Search in sources :

Example 6 with SamplingPointDefinition

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);
}
Also used : SamplingPointDefinition(org.openforis.idm.metamodel.ReferenceDataSchema.SamplingPointDefinition) ReferenceDataSchema(org.openforis.idm.metamodel.ReferenceDataSchema) SamplingDesignItem(org.openforis.collect.model.SamplingDesignItem)

Example 7 with SamplingPointDefinition

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);
}
Also used : ReferenceDataSchema(org.openforis.idm.metamodel.ReferenceDataSchema) SamplingPointDefinition(org.openforis.idm.metamodel.ReferenceDataSchema.SamplingPointDefinition)

Example 8 with SamplingPointDefinition

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;
    }
}
Also used : ReferenceDataSchema(org.openforis.idm.metamodel.ReferenceDataSchema) SamplingPointDefinition(org.openforis.idm.metamodel.ReferenceDataSchema.SamplingPointDefinition)

Aggregations

ReferenceDataSchema (org.openforis.idm.metamodel.ReferenceDataSchema)8 SamplingPointDefinition (org.openforis.idm.metamodel.ReferenceDataSchema.SamplingPointDefinition)8 SamplingDesignItem (org.openforis.collect.model.SamplingDesignItem)2 ReferenceDataDefinition (org.openforis.idm.metamodel.ReferenceDataSchema.ReferenceDataDefinition)2 ArrayList (java.util.ArrayList)1 ExternalizedProperty (org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)1 CollectSurvey (org.openforis.collect.model.CollectSurvey)1