use of org.openforis.idm.metamodel.ReferenceDataSchema in project collect by openforis.
the class SpeciesImportProcess method initializeTaxonomyDefinition.
private TaxonomyDefinition initializeTaxonomyDefinition() {
List<String> infoColumnNames = reader.getInfoColumnNames();
TaxonomyDefinition taxonomyDefinition = new TaxonomyDefinition(taxonomyName);
taxonomyDefinition.setAttributes(ReferenceDataDefinition.Attribute.fromNames(infoColumnNames));
ReferenceDataSchema referenceDataSchema = survey.getReferenceDataSchema();
referenceDataSchema.addTaxonomyDefinition(taxonomyDefinition);
return taxonomyDefinition;
}
use of org.openforis.idm.metamodel.ReferenceDataSchema in project collect by openforis.
the class ReferenceDataSchemaXS method marshalInstances.
@Override
protected void marshalInstances(Survey survey) throws IOException {
ReferenceDataSchema schema = survey.getReferenceDataSchema();
marshal(schema);
}
use of org.openforis.idm.metamodel.ReferenceDataSchema in project collect by openforis.
the class SamplingDesignImportTask method persistSamplingDesign.
protected void persistSamplingDesign() throws SurveyImportException {
List<String> infoColumnNames = reader.getInfoColumnNames();
List<ReferenceDataDefinition.Attribute> attributes = ReferenceDataDefinition.Attribute.fromNames(infoColumnNames);
SamplingPointDefinition samplingPoint;
if (attributes.isEmpty()) {
samplingPoint = null;
} else {
samplingPoint = new SamplingPointDefinition();
samplingPoint.setAttributes(attributes);
}
ReferenceDataSchema referenceDataSchema = survey.getReferenceDataSchema();
if (referenceDataSchema == null) {
referenceDataSchema = new ReferenceDataSchema();
survey.setReferenceDataSchema(referenceDataSchema);
}
referenceDataSchema.setSamplingPointDefinition(samplingPoint);
List<SamplingDesignItem> items = createItemsFromLines();
samplingDesignManager.insert(survey, items, overwriteAll);
}
use of org.openforis.idm.metamodel.ReferenceDataSchema in project collect by openforis.
the class ExpressionValidatorTest method samplingPointDataAttribute.
private void samplingPointDataAttribute(Survey survey, String name) {
ReferenceDataSchema referenceDataSchema = survey.getReferenceDataSchema();
if (referenceDataSchema == null) {
referenceDataSchema = new ReferenceDataSchema();
survey.setReferenceDataSchema(referenceDataSchema);
}
SamplingPointDefinition samplingPointDefinition = referenceDataSchema.getSamplingPointDefinition();
samplingPointDefinition.addAttribute(name);
}
use of org.openforis.idm.metamodel.ReferenceDataSchema in project collect by openforis.
the class SamplingDesignExportProcess method getInfoAttributes.
private List<ReferenceDataDefinition.Attribute> getInfoAttributes(CollectSurvey survey) {
ReferenceDataSchema referenceDataSchema = survey.getReferenceDataSchema();
SamplingPointDefinition samplingPoint = referenceDataSchema == null ? null : referenceDataSchema.getSamplingPointDefinition();
if (samplingPoint == null) {
return Collections.emptyList();
} else {
List<ReferenceDataDefinition.Attribute> infoAttributes = samplingPoint.getAttributes(false);
return infoAttributes;
}
}
Aggregations