use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class Serialization method reloadSecurity.
public static SecurityCollection reloadSecurity(final Path file, final Project project) throws ReadException {
checkProject(project);
turnOffAutomaticSerialization();
try {
return new YamlDeserializer(new LoadContext()).reloadSecurityCollection(file, project);
} finally {
turnOnAutomaticSerialization();
}
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class Serialization method save.
/**
* @param project
* @param root
* @param format
* @throws ProjectSaveException
*/
public static void save(final Project project, final Path root) throws ProjectSaveException {
Objects.requireNonNull(project);
Objects.requireNonNull(root);
try {
new YamlSerializer().serializeProjectTo(project, root);
} catch (final WriteException e) {
throw new ProjectSaveException(root, e);
}
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class YamlDeserializer method readConnectionProfile.
/**
* Parses a connection profile. Doesn't save it to connection profiles collection.
*
* @param serializedProfileBody just a map of properties
* @throws ReadException
*/
private static BeConnectionProfile readConnectionProfile(final LoadContext loadContext, final String profileName, final Map<String, Object> serializedProfileBody, final Project project) throws ReadException {
final YamlDeserializer yamlDeserializer = new YamlDeserializer(loadContext);
final ConnectionProfilesDeserializer connectionProfilesDeserializer = yamlDeserializer.new ConnectionProfilesDeserializer(project.getConnectionProfiles().getLocalProfiles());
final BeConnectionProfile connectionProfile = connectionProfilesDeserializer.deserializeConnectionProfile(profileName, serializedProfileBody);
return connectionProfile;
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class YamlDeserializer method readCustomizations.
/**
* Used with customizations (module), entity, query, operation and static page.
*/
@SuppressWarnings("unchecked")
private void readCustomizations(final Map<String, Object> serialized, final BeVectorCollection<?> target, boolean replace) {
if (project == null)
throw new IllegalStateException();
final Map<String, Object> serializedCustomizations = (Map<String, Object>) serialized.get("customizations");
if (serializedCustomizations == null || serializedCustomizations.isEmpty())
return;
final BeVectorCollection<PageCustomization> customizations = replace ? new PageCustomizations(target) : target.getOrCreateCollection(PageCustomization.CUSTOMIZATIONS_COLLECTION, PageCustomization.class);
try {
for (final String name : serializedCustomizations.keySet()) {
final Map<String, Object> content = (Map<String, Object>) serializedCustomizations.get(name);
final List<String> splitted = StreamEx.split(name, "\\.").toList();
final String type;
final String domain;
if (splitted.size() == 1) {
type = "";
domain = splitted.get(0);
} else {
type = splitted.get(splitted.size() - 1);
splitted.remove(splitted.size() - 1);
domain = String.join(".", splitted);
}
final PageCustomization customization = new PageCustomization(type, domain, customizations);
customization.setCode((String) content.get(TAG_CODE));
customization.setOriginModuleName(project.getProjectOrigin());
DataElementUtils.saveQuiet(customization);
}
} catch (Exception e) {
loadContext.addWarning(new ReadException(e, target, project.getLocation()));
}
if (replace)
DataElementUtils.save(customizations);
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class ModuleLoader2 method loadModules.
public static List<Project> loadModules(Project application, ProcessController logger, LoadContext loadContext) throws ProjectLoadException {
List<Project> result = new ArrayList<>();
for (Module module : application.getModules()) {
if (containsModule(module.getName())) {
Project moduleProject = modulesMap.get(module.getName());
result.add(moduleProject);
} else {
throw new RuntimeException("Module project not found " + module.getName());
}
}
// todo ????? topological sort?
result.sort((o1, o2) -> {
if (o1.getModules().contains(o2.getName()))
return 1;
if (o2.getModules().contains(o1.getName()))
return -1;
return 0;
});
return result;
}
Aggregations