Search in sources :

Example 1 with SecurityDimensionType

use of io.vertigo.account.authorization.metamodel.SecurityDimensionType in project vertigo by KleeGroup.

the class SecuredEntityDeserializer method deserializeSecurityDimensions.

private static SecurityDimension deserializeSecurityDimensions(final DtDefinition entityDefinition, final JsonObject advancedDimension, final JsonDeserializationContext context) {
    final String name = advancedDimension.get("name").getAsString();
    final SecurityDimensionType type = SecurityDimensionType.valueOf(advancedDimension.get("type").getAsString());
    final List<String> fieldNames = deserializeList(advancedDimension.get("fields"), String.class, context);
    final List<DtField> fields = fieldNames.stream().map(fieldName -> deserializeDtField(entityDefinition, fieldName)).collect(Collectors.toList());
    final List<String> values = deserializeList(advancedDimension.get("values"), String.class, context);
    return new SecurityDimension(name, type, fields, values);
}
Also used : JsonObject(com.google.gson.JsonObject) RuleMultiExpression(io.vertigo.account.authorization.metamodel.rulemodel.RuleMultiExpression) DtField(io.vertigo.dynamo.domain.metamodel.DtField) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) JsonDeserializationContext(com.google.gson.JsonDeserializationContext) JsonElement(com.google.gson.JsonElement) Home(io.vertigo.app.Home) WrappedException(io.vertigo.lang.WrappedException) Map(java.util.Map) Assertion(io.vertigo.lang.Assertion) SecuredEntity(io.vertigo.account.authorization.metamodel.SecuredEntity) SecurityDimensionType(io.vertigo.account.authorization.metamodel.SecurityDimensionType) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) Set(java.util.Set) DslParserUtil(io.vertigo.account.impl.authorization.dsl.rules.DslParserUtil) Collectors(java.util.stream.Collectors) Definition(io.vertigo.core.definition.Definition) List(java.util.List) DefinitionUtil(io.vertigo.core.definition.DefinitionUtil) Type(java.lang.reflect.Type) StringUtil(io.vertigo.util.StringUtil) JsonDeserializer(com.google.gson.JsonDeserializer) Optional(java.util.Optional) Authorization(io.vertigo.account.authorization.metamodel.Authorization) PegNoMatchFoundException(io.vertigo.commons.peg.PegNoMatchFoundException) Collections(java.util.Collections) SecurityDimension(io.vertigo.account.authorization.metamodel.SecurityDimension) SecurityDimension(io.vertigo.account.authorization.metamodel.SecurityDimension) SecurityDimensionType(io.vertigo.account.authorization.metamodel.SecurityDimensionType) DtField(io.vertigo.dynamo.domain.metamodel.DtField)

Aggregations

JsonDeserializationContext (com.google.gson.JsonDeserializationContext)1 JsonDeserializer (com.google.gson.JsonDeserializer)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 Authorization (io.vertigo.account.authorization.metamodel.Authorization)1 SecuredEntity (io.vertigo.account.authorization.metamodel.SecuredEntity)1 SecurityDimension (io.vertigo.account.authorization.metamodel.SecurityDimension)1 SecurityDimensionType (io.vertigo.account.authorization.metamodel.SecurityDimensionType)1 RuleMultiExpression (io.vertigo.account.authorization.metamodel.rulemodel.RuleMultiExpression)1 DslParserUtil (io.vertigo.account.impl.authorization.dsl.rules.DslParserUtil)1 Home (io.vertigo.app.Home)1 PegNoMatchFoundException (io.vertigo.commons.peg.PegNoMatchFoundException)1 Definition (io.vertigo.core.definition.Definition)1 DefinitionUtil (io.vertigo.core.definition.DefinitionUtil)1 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)1 DtField (io.vertigo.dynamo.domain.metamodel.DtField)1 Assertion (io.vertigo.lang.Assertion)1 WrappedException (io.vertigo.lang.WrappedException)1 StringUtil (io.vertigo.util.StringUtil)1 Type (java.lang.reflect.Type)1