use of org.openforis.collect.metamodel.CollectAnnotations in project collect by openforis.
the class CollectSurvey method getExtendedDataFields.
/**
* Goes though the attributes on the survey finding those that are marked as coming "From CSV" meaning that the popup-up will not show the attributes and they will be kept as hidden inputs
* @param survey
* @return The list of attributes that are marked as coming "From CSV" or that are key attributes
*/
public List<AttributeDefinition> getExtendedDataFields() {
final CollectAnnotations annotations = getAnnotations();
final List<AttributeDefinition> fromCsvAttributes = new ArrayList<AttributeDefinition>();
getSchema().traverse(new NodeDefinitionVisitor() {
public void visit(NodeDefinition def) {
if (def instanceof AttributeDefinition) {
AttributeDefinition attrDef = (AttributeDefinition) def;
if (annotations.isFromCollectEarthCSV(attrDef) && !attrDef.isKey()) {
fromCsvAttributes.add(attrDef);
}
}
}
});
return fromCsvAttributes;
}
use of org.openforis.collect.metamodel.CollectAnnotations in project collect by openforis.
the class CoordinateAttributeDefinitionFormObject method saveTo.
@Override
public void saveTo(T dest, String languageCode) {
super.saveTo(dest, languageCode);
saveFieldOrderValue(dest);
dest.setFieldLabel(CoordinateAttributeDefinition.X_FIELD_NAME, languageCode, xFieldLabel);
dest.setFieldLabel(CoordinateAttributeDefinition.Y_FIELD_NAME, languageCode, yFieldLabel);
dest.setFieldLabel(CoordinateAttributeDefinition.SRS_FIELD_NAME, languageCode, srsFieldLabel);
CollectAnnotations annotations = ((CollectSurvey) dest.getSurvey()).getAnnotations();
annotations.setAllowOnlyDeviceCoordinate(dest, allowOnlyDeviceCoordinate);
annotations.setShowSrsField(dest, showSrsField);
}
use of org.openforis.collect.metamodel.CollectAnnotations in project collect by openforis.
the class CoordinateAttributeDefinitionFormObject method loadFrom.
@Override
public void loadFrom(T source, String languageCode) {
super.loadFrom(source, languageCode);
loadFieldsOrderValue(source);
xFieldLabel = source.getFieldLabel(CoordinateAttributeDefinition.X_FIELD_NAME, languageCode);
yFieldLabel = source.getFieldLabel(CoordinateAttributeDefinition.Y_FIELD_NAME, languageCode);
srsFieldLabel = source.getFieldLabel(CoordinateAttributeDefinition.SRS_FIELD_NAME, languageCode);
CollectAnnotations annotations = ((CollectSurvey) source.getSurvey()).getAnnotations();
allowOnlyDeviceCoordinate = annotations.isAllowOnlyDeviceCoordinate(source);
showSrsField = annotations.isShowSrsField(source);
}
use of org.openforis.collect.metamodel.CollectAnnotations in project collect by openforis.
the class FileAttributeDefinitionFormObject method saveTo.
@Override
public void saveTo(T dest, String languageCode) {
super.saveTo(dest, languageCode);
dest.setMaxSize(convertToBytes(maxSize));
dest.removeAllExtensions();
CollectAnnotations annotations = ((CollectSurvey) dest.getSurvey()).getAnnotations();
annotations.setFileType(dest, FileType.valueOf(fileType));
}
use of org.openforis.collect.metamodel.CollectAnnotations in project collect by openforis.
the class AttributeDefinitionFormObject method loadFrom.
@Override
public void loadFrom(T source, String languageCode) {
super.loadFrom(source, languageCode);
key = source.isKey();
attributeDefaults = new ArrayList<AttributeDefault>(source.getAttributeDefaults());
CollectSurvey survey = (CollectSurvey) source.getSurvey();
CollectAnnotations annotations = survey.getAnnotations();
phaseToApplyDefaultValue = annotations.getPhaseToApplyDefaultValue(source).name();
editable = annotations.isEditable(source);
measurement = annotations.isMeasurementAttribute(source);
showInMapBalloon = annotations.isShowInMapBalloon(source);
checks = new ArrayList<Check<?>>(source.getChecks());
UIOptions uiOptions = getUIOptions(source);
visibleFields = uiOptions.getVisibleFields(source);
if (source.getReferencedAttribute() != null) {
referencedAttributePath = source.getReferencedAttribute().getPath();
}
}
Aggregations