use of org.openforis.idm.metamodel.FileAttributeDefinition in project collect by openforis.
the class RecordFileBackupTask method calculateRecordFileEntryName.
public static String calculateRecordFileEntryName(FileAttribute fileAttribute) {
FileAttributeDefinition fileAttributeDefinition = fileAttribute.getDefinition();
String repositoryRelativePath = RecordFileManager.getRepositoryRelativePath(fileAttributeDefinition, ZIP_FOLDER_SEPARATOR, false);
String filename = fileAttribute.getFilename();
return StringUtils.join(Arrays.asList(UPLOADED_FILES_FOLDER, repositoryRelativePath, filename), ZIP_FOLDER_SEPARATOR);
}
use of org.openforis.idm.metamodel.FileAttributeDefinition in project collect by openforis.
the class FileAttributeDefinitionPR method onStartDefinition.
@Override
protected void onStartDefinition() throws XmlParseException, XmlPullParserException, IOException {
super.onStartDefinition();
String extensions = getAttribute(EXTENSIONS, false);
Integer maxSize = getIntegerAttribute(MAX_SIZE, false);
FileAttributeDefinition defn = (FileAttributeDefinition) getDefinition();
defn.setMaxSize(maxSize);
if (extensions != null) {
String[] exts = extensions.split(" ");
for (String ext : exts) {
defn.addExtension(ext);
}
}
}
use of org.openforis.idm.metamodel.FileAttributeDefinition in project collect by openforis.
the class RecordFileManager method getRepositoryFileAbsolutePath.
public String getRepositoryFileAbsolutePath(FileAttribute fileAttribute) {
FileAttributeDefinition defn = fileAttribute.getDefinition();
String filename = fileAttribute.getFilename();
if (StringUtils.isNotBlank(filename)) {
String path = getRepositoryFileAbsolutePath(defn, filename);
return path;
} else {
return null;
}
}
use of org.openforis.idm.metamodel.FileAttributeDefinition in project collect by openforis.
the class RecordFileManager method getRepositoryFile.
public java.io.File getRepositoryFile(FileAttribute fileAttribute) {
FileAttributeDefinition defn = fileAttribute.getDefinition();
String filename = fileAttribute.getFilename();
if (StringUtils.isNotBlank(filename)) {
java.io.File file = getRepositoryFile(defn, filename);
return file;
} else {
return null;
}
}
use of org.openforis.idm.metamodel.FileAttributeDefinition in project collect by openforis.
the class NodeDefinitionProxy method fromList.
static List<NodeDefinitionProxy> fromList(EntityDefinitionProxy parent, List<? extends NodeDefinition> list) {
List<NodeDefinitionProxy> proxies = new ArrayList<NodeDefinitionProxy>();
if (list != null) {
for (NodeDefinition n : list) {
NodeDefinitionProxy p = null;
CollectSurvey survey = (CollectSurvey) n.getSurvey();
UIOptions uiOptions = survey.getUIOptions();
boolean hidden = uiOptions.isHidden(n);
if (!hidden) {
if (n instanceof AttributeDefinition) {
if (n instanceof BooleanAttributeDefinition) {
p = new BooleanAttributeDefinitionProxy(parent, (BooleanAttributeDefinition) n);
} else if (n instanceof CodeAttributeDefinition) {
p = new CodeAttributeDefinitionProxy(parent, (CodeAttributeDefinition) n);
} else if (n instanceof CoordinateAttributeDefinition) {
p = new CoordinateAttributeDefinitionProxy(parent, (CoordinateAttributeDefinition) n);
} else if (n instanceof DateAttributeDefinition) {
p = new DateAttributeDefinitionProxy(parent, (DateAttributeDefinition) n);
} else if (n instanceof FileAttributeDefinition) {
p = new FileAttributeDefinitionProxy(parent, (FileAttributeDefinition) n);
} else if (n instanceof NumberAttributeDefinition) {
p = new NumberAttributeDefinitionProxy(parent, (NumberAttributeDefinition) n);
} else if (n instanceof RangeAttributeDefinition) {
p = new RangeAttributeDefinitionProxy(parent, (RangeAttributeDefinition) n);
} else if (n instanceof TaxonAttributeDefinition) {
p = new TaxonAttributeDefinitionProxy(parent, (TaxonAttributeDefinition) n);
} else if (n instanceof TextAttributeDefinition) {
p = new TextAttributeDefinitionProxy(parent, (TextAttributeDefinition) n);
} else if (n instanceof TimeAttributeDefinition) {
p = new TimeAttributeDefinitionProxy(parent, (TimeAttributeDefinition) n);
} else {
throw new RuntimeException("AttributeDefinition not supported: " + n.getClass().getSimpleName());
}
} else if (n instanceof EntityDefinition) {
p = new EntityDefinitionProxy(parent, (EntityDefinition) n);
}
if (p != null) {
proxies.add(p);
}
}
}
}
return proxies;
}
Aggregations