Search in sources :

Example 21 with VSystemException

use of io.vertigo.lang.VSystemException in project vertigo by KleeGroup.

the class DtListPatternFilterUtil method createDtListFilterForPattern.

static <D extends DtObject> Predicate<D> createDtListFilterForPattern(final FilterPattern filterPattern, final String[] parsedFilter, final DtDefinition dtDefinition) {
    Assertion.checkNotNull(filterPattern);
    Assertion.checkNotNull(parsedFilter);
    Assertion.checkNotNull(dtDefinition);
    // -----
    // Si on trouve un pattern, on passe sur du code spécifique
    // attention parsedFilter[0] = filtre entier
    final String fieldName = parsedFilter[1];
    final DtField dtField = dtDefinition.getField(fieldName);
    final DataType dataType = dtField.getDomain().getDataType();
    switch(filterPattern) {
        case Range:
            return createDtListRangeFilter(parsedFilter, fieldName, dataType);
        case Term:
            return createDtListTermFilter(parsedFilter, fieldName, dataType);
        default:
            throw new VSystemException("La chaine de filtrage: {0} , ne respecte pas la syntaxe {1}.", parsedFilter[0], filterPattern.getPattern().pattern());
    }
}
Also used : DataType(io.vertigo.dynamo.domain.metamodel.DataType) VSystemException(io.vertigo.lang.VSystemException) DtField(io.vertigo.dynamo.domain.metamodel.DtField)

Example 22 with VSystemException

use of io.vertigo.lang.VSystemException in project vertigo by KleeGroup.

the class ComponentCmdWebServices method getComponentConfig.

@AnonymousAccessAllowed
@GET("/vertigo/components/{componentId}")
public String getComponentConfig(@PathParam("componentId") final String componentId) {
    Assertion.checkArgNotEmpty(componentId);
    // -----
    final JsonArray jsonModuleConfigs = doGetModuleConfigs();
    for (int i = 0; i < jsonModuleConfigs.size(); i++) {
        final JsonObject jsonModuleConfig = (JsonObject) jsonModuleConfigs.get(i);
        final JsonArray jsonComponentConfigs = jsonModuleConfig.get("componentConfigs").getAsJsonArray();
        for (int j = 0; j < jsonComponentConfigs.size(); j++) {
            final JsonObject jsonComponentConfig = (JsonObject) jsonComponentConfigs.get(j);
            if (componentId.equalsIgnoreCase(jsonComponentConfig.get("id").getAsString())) {
                return jsonEngine.toJson(jsonComponentConfig);
            }
        }
    }
    throw new VSystemException("NotFoundException");
}
Also used : JsonArray(com.google.gson.JsonArray) JsonObject(com.google.gson.JsonObject) VSystemException(io.vertigo.lang.VSystemException) GET(io.vertigo.vega.webservice.stereotype.GET) AnonymousAccessAllowed(io.vertigo.vega.webservice.stereotype.AnonymousAccessAllowed)

Aggregations

VSystemException (io.vertigo.lang.VSystemException)22 DatabaseEntry (com.sleepycat.je.DatabaseEntry)3 DatabaseException (com.sleepycat.je.DatabaseException)3 OperationStatus (com.sleepycat.je.OperationStatus)3 Method (java.lang.reflect.Method)3 BulkRequestBuilder (org.elasticsearch.action.bulk.BulkRequestBuilder)3 BulkResponse (org.elasticsearch.action.bulk.BulkResponse)3 JsonArray (com.google.gson.JsonArray)2 JsonObject (com.google.gson.JsonObject)2 DtField (io.vertigo.dynamo.domain.metamodel.DtField)2 URI (io.vertigo.dynamo.domain.model.URI)2 TaskDefinition (io.vertigo.dynamo.task.metamodel.TaskDefinition)2 Task (io.vertigo.dynamo.task.model.Task)2 AnonymousAccessAllowed (io.vertigo.vega.webservice.stereotype.AnonymousAccessAllowed)2 GET (io.vertigo.vega.webservice.stereotype.GET)2 PropertyDescriptor (java.beans.PropertyDescriptor)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 AspectConfig (io.vertigo.app.config.AspectConfig)1 ComponentConfig (io.vertigo.app.config.ComponentConfig)1