use of com.developmentontheedge.be5.metadata.exception.WriteException in project be5 by DevelopmentOnTheEdge.
the class YamlSerializer method serialize.
public void serialize(final StaticPages pages) throws WriteException {
this.fileSystem = new ProjectFileSystem(pages.getProject());
new StaticPagesSerializer().serialize(pages);
}
use of com.developmentontheedge.be5.metadata.exception.WriteException in project be5 by DevelopmentOnTheEdge.
the class YamlSerializer method serializeModules.
private Object serializeModules(final BeModelCollection<Module> modules, boolean serializeReferencedFiles) throws WriteException {
final List<Object> serializedModules = list();
for (final Module module : modules) {
final Map<String, Object> serializedModule = map();
final Map<String, Object> serializedModuleContent = map();
final List<Object> serializedEntities = list();
final Iterable<Entity> entities = module.getEntities();
for (final Entity entity : entities) if (entity.isCustomized()) {
if (serializeReferencedFiles)
new EntitySerializer().serialize(entity);
serializedEntities.add(entity.getName());
}
serializedModuleContent.put(TAG_ENTITIES, serializedEntities);
final List<Object> serializedExtras = list();
for (String extra : module.getExtras()) {
serializedExtras.add(extra);
}
if (!serializedExtras.isEmpty()) {
serializedModuleContent.put(TAG_EXTRAS, serializedExtras);
}
serializedModule.put(module.getName(), serializedModuleContent);
serializedModules.add(serializedModule);
}
return serializedModules;
}
use of com.developmentontheedge.be5.metadata.exception.WriteException 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.exception.WriteException in project be5 by DevelopmentOnTheEdge.
the class YamlSerializer method serialize.
public void serialize(final LanguageLocalizations languageLocalizations) throws WriteException {
this.fileSystem = new ProjectFileSystem(languageLocalizations.getProject());
new LocalizationSerializer().serialize(languageLocalizations);
}
Aggregations