Search in sources :

Example 61 with Survey

use of org.openforis.idm.metamodel.Survey in project collect by openforis.

the class GeoFunctions method latLong.

protected static Coordinate latLong(ExpressionContext expressionContext, Coordinate coordinate) {
    if (coordinate == null || !coordinate.isComplete()) {
        return null;
    }
    Survey survey = getSurvey(expressionContext);
    CoordinateOperations coordinateOperations = survey.getContext().getCoordinateOperations();
    if (coordinateOperations == null) {
        return null;
    } else {
        return coordinateOperations.convertToWgs84(coordinate);
    }
}
Also used : Survey(org.openforis.idm.metamodel.Survey) CoordinateOperations(org.openforis.idm.geospatial.CoordinateOperations)

Example 62 with Survey

use of org.openforis.idm.metamodel.Survey in project collect by openforis.

the class IDMFunctions method samplingPointCoordinateLookup.

private static Coordinate samplingPointCoordinateLookup(ExpressionContext context, String... keys) {
    if (validateSamplingPointKeys(keys)) {
        LookupProvider lookupProvider = getLookupProvider(context);
        Survey survey = getSurvey(context);
        Coordinate coordinate = lookupProvider.lookupSamplingPointCoordinate(survey, keys);
        return coordinate;
    } else {
        return null;
    }
}
Also used : Survey(org.openforis.idm.metamodel.Survey) Coordinate(org.openforis.idm.model.Coordinate) LookupProvider(org.openforis.idm.metamodel.validation.LookupProvider)

Example 63 with Survey

use of org.openforis.idm.metamodel.Survey in project collect by openforis.

the class IDMFunctions method lookup.

private static Object lookup(ExpressionContext context, String name, String attribute, String... keys) {
    LookupProvider lookupProvider = getLookupProvider(context);
    Survey survey = getSurvey(context);
    Object result = lookupProvider.lookup(survey, name, attribute, (Object[]) keys);
    if (result == null) {
        return null;
    } else if (LOCATION_ATTRIBUTE.equalsIgnoreCase(attribute)) {
        // convert to Coordinate
        Coordinate coordinate = Coordinate.parseCoordinate(result.toString());
        return coordinate;
    } else {
        return result;
    }
}
Also used : Survey(org.openforis.idm.metamodel.Survey) Coordinate(org.openforis.idm.model.Coordinate) SurveyObject(org.openforis.idm.metamodel.SurveyObject) LookupProvider(org.openforis.idm.metamodel.validation.LookupProvider)

Example 64 with Survey

use of org.openforis.idm.metamodel.Survey in project collect by openforis.

the class UIOptionsBinderTest method createTestSurvey.

private Survey createTestSurvey() {
    Survey survey = context.createSurvey();
    survey.setName("test");
    survey.setUri("http://www.openforis.org/test");
    survey.addLanguage("en");
    return survey;
}
Also used : Survey(org.openforis.idm.metamodel.Survey)

Example 65 with Survey

use of org.openforis.idm.metamodel.Survey in project collect by openforis.

the class AbstractTest method createTestSurvey.

protected static Survey createTestSurvey() throws IdmlParseException {
    InputStream is = AbstractTest.class.getClassLoader().getResourceAsStream("test.idm.xml");
    SurveyContext surveyContext = new TestSurveyContext();
    SurveyIdmlBinder parser = new SurveyIdmlBinder(surveyContext);
    Survey survey = parser.unmarshal(is);
    return survey;
}
Also used : Survey(org.openforis.idm.metamodel.Survey) InputStream(java.io.InputStream) TestSurveyContext(org.openforis.idm.model.TestSurveyContext) SurveyIdmlBinder(org.openforis.idm.metamodel.xml.SurveyIdmlBinder) SurveyContext(org.openforis.idm.metamodel.SurveyContext) TestSurveyContext(org.openforis.idm.model.TestSurveyContext)

Aggregations

Survey (org.openforis.idm.metamodel.Survey)67 Test (org.junit.Test)19 CollectSurvey (org.openforis.collect.model.CollectSurvey)13 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)11 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)10 Schema (org.openforis.idm.metamodel.Schema)10 SurveyContext (org.openforis.idm.metamodel.SurveyContext)8 Entity (org.openforis.idm.model.Entity)4 CollectIntegrationTest (org.openforis.collect.CollectIntegrationTest)3 ParsingError (org.openforis.collect.io.metadata.parsing.ParsingError)3 CodeAttributeDefinition (org.openforis.idm.metamodel.CodeAttributeDefinition)3 LookupProvider (org.openforis.idm.metamodel.validation.LookupProvider)3 TestSurveyContext (org.openforis.idm.model.TestSurveyContext)3 IOException (java.io.IOException)2 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)2 NodeChangeSet (org.openforis.collect.model.NodeChangeSet)2 AttributeDefault (org.openforis.idm.metamodel.AttributeDefault)2 CodeList (org.openforis.idm.metamodel.CodeList)2 CodeListService (org.openforis.idm.metamodel.CodeListService)2 ModelVersion (org.openforis.idm.metamodel.ModelVersion)2