use of org.openforis.idm.metamodel.ReferenceDataSchema.SamplingPointDefinition 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.SamplingPointDefinition 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.SamplingPointDefinition 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