use of org.structr.web.entity.MinifiedCssFile in project structr by structr.
the class DeployCommand method exportFileConfiguration.
private void exportFileConfiguration(final AbstractFile abstractFile, final Map<String, Object> config) {
if (abstractFile.isVisibleToPublicUsers()) {
putIf(config, "visibleToPublicUsers", true);
}
if (abstractFile.isVisibleToAuthenticatedUsers()) {
putIf(config, "visibleToAuthenticatedUsers", true);
}
if (abstractFile instanceof File) {
final File file = (File) abstractFile;
if (file.isTemplate()) {
putIf(config, "isTemplate", true);
}
}
putIf(config, "type", abstractFile.getProperty(File.type));
putIf(config, "contentType", abstractFile.getProperty(StructrApp.key(File.class, "contentType")));
putIf(config, "cacheForSeconds", abstractFile.getProperty(StructrApp.key(File.class, "cacheForSeconds")));
putIf(config, "useAsJavascriptLibrary", abstractFile.getProperty(StructrApp.key(File.class, "useAsJavascriptLibrary")));
putIf(config, "includeInFrontendExport", abstractFile.getProperty(StructrApp.key(File.class, "includeInFrontendExport")));
putIf(config, "basicAuthRealm", abstractFile.getProperty(StructrApp.key(File.class, "basicAuthRealm")));
putIf(config, "enableBasicAuth", abstractFile.getProperty(StructrApp.key(File.class, "enableBasicAuth")));
if (abstractFile instanceof Image) {
final Image image = (Image) abstractFile;
putIf(config, "isThumbnail", image.isThumbnail());
putIf(config, "isImage", image.isImage());
putIf(config, "width", image.getWidth());
putIf(config, "height", image.getHeight());
}
if (abstractFile instanceof AbstractMinifiedFile) {
if (abstractFile instanceof MinifiedCssFile) {
final MinifiedCssFile mcf = (MinifiedCssFile) abstractFile;
putIf(config, "lineBreak", mcf.getLineBreak());
}
if (abstractFile instanceof MinifiedJavaScriptFile) {
final MinifiedJavaScriptFile mjf = (MinifiedJavaScriptFile) abstractFile;
putIf(config, "optimizationLevel", mjf.getOptimizationLevel());
}
final Class<Relation> relType = StructrApp.getConfiguration().getRelationshipEntityClass("AbstractMinifiedFileMINIFICATIONFile");
final PropertyKey<Integer> positionKey = StructrApp.key(relType, "position");
final Map<Integer, String> minifcationSources = new TreeMap<>();
for (Relation minificationSourceRel : AbstractMinifiedFile.getSortedRelationships((AbstractMinifiedFile) abstractFile)) {
final File file = (File) minificationSourceRel.getTargetNode();
minifcationSources.put(minificationSourceRel.getProperty(positionKey), file.getPath());
}
putIf(config, "minificationSources", minifcationSources);
}
// export all dynamic properties
for (final PropertyKey key : StructrApp.getConfiguration().getPropertySet(abstractFile.getClass(), PropertyView.All)) {
// only export dynamic (=> additional) keys
if (!key.isPartOfBuiltInSchema()) {
putIf(config, key.jsonName(), abstractFile.getProperty(key));
}
}
exportOwnershipAndSecurity(abstractFile, config);
}
Aggregations