use of com.developmentontheedge.be5.metadata.serialization.ProjectFileSystem in project be5 by DevelopmentOnTheEdge.
the class WatchDir method registerAll.
private void registerAll(final ProjectFileSystem fs) throws IOException {
Path start = fs.getRoot();
NavigableMap<Path, Boolean> map = fs.getPaths();
// register directory and sub-directories
Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
Path parent = StreamEx.iterate(dir, Path::getParent).takeWhile(Objects::nonNull).findFirst(map::containsKey).orElse(null);
boolean hasChildren = StreamEx.ofKeys(map).anyMatch(path -> path.startsWith(dir));
if (parent == null || !map.get(parent) && !parent.equals(dir))
return hasChildren ? FileVisitResult.CONTINUE : FileVisitResult.SKIP_SUBTREE;
register(dir);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
lastModifiedByPath.put(file, file.toFile().lastModified());
return FileVisitResult.CONTINUE;
}
});
}
use of com.developmentontheedge.be5.metadata.serialization.ProjectFileSystem in project be5 by DevelopmentOnTheEdge.
the class YamlSerializer method serialize.
public void serialize(final JavaScriptForms forms) throws WriteException {
this.fileSystem = new ProjectFileSystem(forms.getProject());
new FormsSerializer().serialize(forms);
}
use of com.developmentontheedge.be5.metadata.serialization.ProjectFileSystem in project be5 by DevelopmentOnTheEdge.
the class YamlSerializer method serialize.
public void serialize(final BeConnectionProfiles connectionProfiles) throws WriteException {
this.fileSystem = new ProjectFileSystem(connectionProfiles.getProject());
new ConnectionProfilesSerializer().serialize(connectionProfiles.getType(), connectionProfiles);
}
use of com.developmentontheedge.be5.metadata.serialization.ProjectFileSystem 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.serialization.ProjectFileSystem 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;
}
Aggregations