Search in sources :

Example 1 with LookupProvider

use of org.openforis.idm.metamodel.validation.LookupProvider in project collect by openforis.

the class IDMFunctions method samplingPointDataLookup.

private static Object samplingPointDataLookup(ExpressionContext context, String attribute, String... keys) {
    if (validateSamplingPointKeys(keys)) {
        LookupProvider lookupProvider = getLookupProvider(context);
        Survey survey = getSurvey(context);
        Object data = lookupProvider.lookupSamplingPointData(survey, attribute, keys);
        return data;
    } else {
        return null;
    }
}
Also used : Survey(org.openforis.idm.metamodel.Survey) SurveyObject(org.openforis.idm.metamodel.SurveyObject) LookupProvider(org.openforis.idm.metamodel.validation.LookupProvider)

Example 2 with LookupProvider

use of org.openforis.idm.metamodel.validation.LookupProvider in project collect by openforis.

the class CustomFunctions method getLookupProvider.

protected static LookupProvider getLookupProvider(ExpressionContext context) {
    ModelJXPathContext jxPathContext = (ModelJXPathContext) context.getJXPathContext();
    LookupProvider lookupProvider = jxPathContext.getLookupProvider();
    return lookupProvider;
}
Also used : LookupProvider(org.openforis.idm.metamodel.validation.LookupProvider)

Example 3 with LookupProvider

use of org.openforis.idm.metamodel.validation.LookupProvider 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 4 with LookupProvider

use of org.openforis.idm.metamodel.validation.LookupProvider 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)

Aggregations

LookupProvider (org.openforis.idm.metamodel.validation.LookupProvider)4 Survey (org.openforis.idm.metamodel.Survey)3 SurveyObject (org.openforis.idm.metamodel.SurveyObject)2 Coordinate (org.openforis.idm.model.Coordinate)2