Search in sources :

Example 6 with ReferenceDataSchema

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

Example 7 with ReferenceDataSchema

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

Example 8 with ReferenceDataSchema

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

Example 9 with ReferenceDataSchema

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

Example 10 with ReferenceDataSchema

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

Aggregations

ReferenceDataSchema (org.openforis.idm.metamodel.ReferenceDataSchema)10 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 TaxonomyDefinition (org.openforis.idm.metamodel.ReferenceDataSchema.TaxonomyDefinition)1