mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-18 05:57:17 +00:00
Fetch templates for collate and oss. (#17254)
* fetch template for oss and collate. * migrations.
This commit is contained in:
parent
407a4496e6
commit
0ca3d7afb8
@ -220,3 +220,8 @@ SET json = JSON_SET(
|
||||
)
|
||||
WHERE JSON_CONTAINS_PATH(json, 'one', '$.owner')
|
||||
AND JSON_TYPE(JSON_EXTRACT(json, '$.owner')) <> 'ARRAY';
|
||||
|
||||
-- set templates to fetch emailTemplates
|
||||
UPDATE openmetadata_settings
|
||||
SET json = JSON_SET(json, '$.templates', 'openmetadata')
|
||||
WHERE configType = 'emailConfiguration';
|
@ -201,3 +201,8 @@ SET json = jsonb_set(
|
||||
WHERE jsonb_path_exists(json, '$.owner')
|
||||
AND jsonb_path_query_first(json, '$.owner ? (@ != null)') IS NOT null
|
||||
AND jsonb_typeof(json->'owner') <> 'array';
|
||||
|
||||
-- set templates to fetch emailTemplates
|
||||
UPDATE openmetadata_settings
|
||||
SET json = jsonb_set(json, '{templates}', '"openmetadata"')
|
||||
WHERE configType = 'emailConfiguration';
|
@ -372,6 +372,7 @@ email:
|
||||
username: ${SMTP_SERVER_USERNAME:-""}
|
||||
password: ${SMTP_SERVER_PWD:-""}
|
||||
transportationStrategy: ${SMTP_SERVER_STRATEGY:-"SMTP_TLS"}
|
||||
templates: ${TEMPLATES:-"openmetadata"}
|
||||
|
||||
limits:
|
||||
enable: ${LIMITS_ENABLED:-false}
|
||||
|
@ -115,10 +115,12 @@ import org.openmetadata.schema.api.VoteRequest;
|
||||
import org.openmetadata.schema.api.VoteRequest.VoteType;
|
||||
import org.openmetadata.schema.api.feed.ResolveTask;
|
||||
import org.openmetadata.schema.api.teams.CreateTeam;
|
||||
import org.openmetadata.schema.email.SmtpSettings;
|
||||
import org.openmetadata.schema.entity.data.Table;
|
||||
import org.openmetadata.schema.entity.feed.Suggestion;
|
||||
import org.openmetadata.schema.entity.teams.Team;
|
||||
import org.openmetadata.schema.entity.teams.User;
|
||||
import org.openmetadata.schema.settings.SettingsType;
|
||||
import org.openmetadata.schema.system.EntityError;
|
||||
import org.openmetadata.schema.type.ApiStatus;
|
||||
import org.openmetadata.schema.type.ChangeDescription;
|
||||
@ -153,6 +155,7 @@ import org.openmetadata.service.jdbi3.CollectionDAO.EntityVersionPair;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO.ExtensionRecord;
|
||||
import org.openmetadata.service.jdbi3.FeedRepository.TaskWorkflow;
|
||||
import org.openmetadata.service.jdbi3.FeedRepository.ThreadContext;
|
||||
import org.openmetadata.service.resources.settings.SettingsCache;
|
||||
import org.openmetadata.service.resources.tags.TagLabelUtil;
|
||||
import org.openmetadata.service.search.SearchClient;
|
||||
import org.openmetadata.service.search.SearchListFilter;
|
||||
@ -440,6 +443,31 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
||||
}
|
||||
|
||||
public final List<T> getEntitiesFromSeedData() throws IOException {
|
||||
List<T> entitiesFromSeedData = new ArrayList<>();
|
||||
|
||||
if (entityType.equals(Entity.DOCUMENT)) {
|
||||
SmtpSettings emailConfig =
|
||||
SettingsCache.getSetting(SettingsType.EMAIL_CONFIGURATION, SmtpSettings.class);
|
||||
|
||||
switch (emailConfig.getTemplates()) {
|
||||
case COLLATE -> {
|
||||
entitiesFromSeedData.addAll(
|
||||
getEntitiesFromSeedData(
|
||||
String.format(".*json/data/%s/emailTemplates/collate/.*\\.json$", entityType)));
|
||||
}
|
||||
default -> {
|
||||
entitiesFromSeedData.addAll(
|
||||
getEntitiesFromSeedData(
|
||||
String.format(
|
||||
".*json/data/%s/emailTemplates/openmetadata/.*\\.json$", entityType)));
|
||||
}
|
||||
}
|
||||
|
||||
entitiesFromSeedData.addAll(
|
||||
getEntitiesFromSeedData(String.format(".*json/data/%s/docs/.*\\.json$", entityType)));
|
||||
return entitiesFromSeedData;
|
||||
}
|
||||
|
||||
return getEntitiesFromSeedData(String.format(".*json/data/%s/.*\\.json$", entityType));
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,11 @@
|
||||
},
|
||||
"templatePath": {
|
||||
"type": "string"
|
||||
},
|
||||
"templates": {
|
||||
"type": "string",
|
||||
"enum": ["openmetadata", "collate"],
|
||||
"default": "openmetadata"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user