use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class YamlSerializer method serializeSources.
private void serializeSources(final Project project) throws WriteException {
for (SourceFileCollection collection : project.getApplication().getSourceFiles()) {
for (final SourceFile file : collection) {
if (!file.isLoaded())
continue;
try {
fileSystem.writeSourceFile(collection.getName(), file.getName(), file.getSource());
file.setLinkedFile(fileSystem.getNameSpaceFile(collection.getName(), file.getName()));
} catch (final IOException e) {
throw new WriteException(file, e);
}
}
}
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class YamlSerializer method serializeToObject.
private Object serializeToObject(final Project project, final boolean serializeReferencedFiles) throws WriteException {
final Map<String, Object> root = map();
final Map<String, Object> content = map();
this.fileSystem = new ProjectFileSystem(project);
if (project.isModuleProject())
content.put(ATTR_MODULE_PROJECT, Boolean.valueOf(true));
serializeDocumentation(project, content);
content.put(ATTR_FEATURES, list(project.getFeatures()));
content.put(ATTR_LOCALIZATIONS, list(project.getApplication().getLocalizations().getNameList()));
serializeBugtrackers(project, content);
content.put(TAG_PROJECT_FILE_STRUCTURE, serialize(project.getProjectFileStructure()));
content.put(TAG_MODULES, serializeModules(project.getModules(), serializeReferencedFiles));
content.put(TAG_APPLICATION, serializeApplication(project.getApplication(), serializeReferencedFiles));
final List<Object> scriptNames = serializeScripts(project.getApplication().getFreemarkerScripts(), serializeReferencedFiles);
if (!scriptNames.isEmpty())
content.put(TAG_SCRIPTS, scriptNames);
final List<Object> macroFilesNames = serializeMacroFiles(project.getApplication().getMacroCollection(), serializeReferencedFiles);
if (!macroFilesNames.isEmpty())
content.put(TAG_MACRO_FILES, macroFilesNames);
serializeProperties(project, content);
if (serializeReferencedFiles) {
serializeDaemons(project.getApplication().getDaemonCollection());
serializeStaticPages(project.getApplication().getStaticPageCollection());
serializeSources(project);
serializeForms(project.getApplication());
serializeLocalizations(project);
serializeSecurity(project.getSecurityCollection());
serializeCustomization(project.getApplication());
serializeMassChanges(project.getApplication().getMassChangeCollection());
if (!project.isModuleProject()) {
serializeConnectionProfiles(project.getConnectionProfiles());
if (project.getConnectionProfileName() != null) {
try {
fileSystem.writeSelectedProfileFile(project.getConnectionProfileName());
} catch (IOException e) {
throw new WriteException(project, e);
}
}
}
}
root.put(project.getName(), content);
return root;
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class ModuleUtilsTest method testMergeAllModulesWithLoadRead.
@Test
public void testMergeAllModulesWithLoadRead() throws Exception {
Path tpmProjectPath = tmp.newFolder().toPath();
Path tpmModulePath = tmp.newFolder().toPath();
Project module = getModule();
Serialization.save(module, tpmModulePath);
Project app = getProject();
Serialization.save(app, tpmProjectPath);
ArrayList<URL> urls = new ArrayList<>();
urls.add(tpmModulePath.resolve("project.yaml").toUri().toURL());
urls.add(tpmProjectPath.resolve("project.yaml").toUri().toURL());
ModuleLoader2.loadAllProjects(urls);
assertNotNull(ModuleLoader2.getModulePath("app").resolve("project.yaml"));
app = ModuleLoader2.getModulesMap().get("app");
ModuleLoader2.mergeModules(app, new NullLogger());
assertEquals(Collections.singleton("mentity"), app.getEntityNames());
assertEquals(EntityType.DICTIONARY, app.getEntity("mentity").getType());
BeModelCollection<Query> queries = app.getEntity("mentity").getQueries();
assertEquals("QUERY1 customized", queries.get("q1").getQuery());
assertEquals("Query1 title", queries.get("q1").getTitleName());
assertEquals("QUERY2", queries.get("q2").getQuery());
assertEquals("Query2 title", queries.get("q2").getTitleName());
assertEquals("QUERY3", queries.get("q3").getQuery());
assertEquals("Query3 title", queries.get("q3").getTitleName());
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class ModuleUtilsTest method getProject.
private Project getProject() throws ProjectSaveException {
Project app = new Project("app");
Module appModule = new Module("module", app.getModules());
DataElementUtils.save(appModule);
Entity appEntity = new Entity("mentity", appModule, EntityType.DICTIONARY);
DataElementUtils.save(appEntity);
Query appQ1 = new Query("q1", appEntity);
appQ1.setQuery("QUERY1 customized");
DataElementUtils.save(appQ1);
Query appQ3 = new Query("q3", appEntity);
appQ3.setQuery("QUERY3");
appQ3.setTitleName("Query3 title");
DataElementUtils.save(appQ3);
return app;
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class ModuleLoader2MergeModulesTest method setRoleGroups.
private void setRoleGroups(Project project, String name) {
BeModelCollection<RoleGroup> groups = project.getRoleGroups();
RoleGroup management = new RoleGroup(name, groups);
management.getRoleSet().addInclusionAll(Collections.singletonList(name));
DataElementUtils.save(management);
project.fireCodeChanged();
}
Aggregations