public static void addPlainAttrsToContext( final Collection<? extends PlainAttr<?>> attrs, final JexlContext jexlContext) { attrs.stream().filter(attr -> attr.getSchema() != null).forEach(attr -> { List<String> attrValues = attr.getValuesAsStrings(); String expressionValue = attrValues.isEmpty() ? StringUtils.EMPTY : attrValues.get(0); LOG.debug("Add attribute {} with value {}", attr.getSchema().getKey(), expressionValue); jexlContext.set(attr.getSchema().getKey(), expressionValue); }); }
protected void fillTO( final AnyTO anyTO, final String realmFullPath, final Collection<? extends AnyTypeClass> auxClasses, final Collection<? extends PlainAttr<?>> plainAttrs, final Map<DerSchema, String> derAttrs, final Map<VirSchema, List<String>> virAttrs, final Collection<? extends ExternalResource> resources, final boolean details) { anyTO.setRealm(realmFullPath); anyTO.getAuxClasses().addAll(auxClasses.stream().map(Entity::getKey).collect(Collectors.toList())); plainAttrs.forEach(plainAttr -> { anyTO.getPlainAttrs().add(new AttrTO.Builder(). schema(plainAttr.getSchema().getKey()). values(plainAttr.getValuesAsStrings()).build()); }); derAttrs.forEach((schema, value) -> { anyTO.getDerAttrs().add(new AttrTO.Builder().schema(schema.getKey()).value(value).build()); }); virAttrs.forEach((schema, values) -> { anyTO.getVirAttrs().add(new AttrTO.Builder().schema(schema.getKey()).values(values).build()); }); anyTO.getResources().addAll(resources.stream().map(Entity::getKey).collect(Collectors.toSet())); }
LOG.debug("{} has already {} set: {}", any, schema.getKey(), attr.getValuesAsStrings());
+ "schema=" + attr.getSchema().getKey() + ", values={}", attr.getValuesAsStrings()); "Invalid values " + attr.getValuesAsStrings())). addPropertyNode(attr.getSchema().getKey()).addConstraintViolation();
if (attr.getValuesAsStrings().isEmpty()) { plainAttrDAO.delete(attr); propByRes.add(ResourceOperation.UPDATE, resource.getKey()); if (item.isConnObjectKey() && !attr.getValuesAsStrings().isEmpty()) { propByRes.addOldConnObjectKey(resource.getKey(), attr.getValuesAsStrings().get(0));
if (attr.getValuesAsStrings().isEmpty()) { attr.setOwner(null); } else {
protected MembershipTO getMembershipTO( final Collection<? extends PlainAttr<?>> plainAttrs, final Map<DerSchema, String> derAttrs, final Map<VirSchema, List<String>> virAttrs, final Membership<? extends Any<?>> membership) { MembershipTO membershipTO = new MembershipTO.Builder(). group(membership.getRightEnd().getKey(), membership.getRightEnd().getName()). build(); plainAttrs.forEach(plainAttr -> { membershipTO.getPlainAttrs().add(new AttrTO.Builder(). schema(plainAttr.getSchema().getKey()). values(plainAttr.getValuesAsStrings()). build()); }); derAttrs.forEach((schema, value) -> { membershipTO.getDerAttrs().add(new AttrTO.Builder(). schema(schema.getKey()). value(value). build()); }); virAttrs.forEach((schema, values) -> { membershipTO.getVirAttrs().add(new AttrTO.Builder(). schema(schema.getKey()). values(values). build()); }); return membershipTO; }