private void fillAttr( final List<String> values, final AnyUtils anyUtils, final PlainSchema schema, final PlainAttr<?> attr, final SyncopeClientException invalidValues) { // if schema is multivalue, all values are considered for addition; // otherwise only the fist one - if provided - is considered List<String> valuesProvided = schema.isMultivalue() ? values : (values.isEmpty() ? Collections.<String>emptyList() : Collections.singletonList(values.get(0))); valuesProvided.forEach(value -> { if (StringUtils.isBlank(value)) { LOG.debug("Null value for {}, ignoring", schema.getKey()); } else { try { attr.add(value, anyUtils); } catch (InvalidPlainAttrValueException e) { String valueToPrint = value.length() > 40 ? value.substring(0, 20) + "..." : value; LOG.warn("Invalid value for attribute " + schema.getKey() + ": " + valueToPrint, e); invalidValues.getElements().add(schema.getKey() + ": " + valueToPrint + " - " + e.getMessage()); } } }); }
if (not && !(cond instanceof AnyCond) && checked.getLeft().isMultivalue()) { query.append(svs.field().name).append(" WHERE "); } else {
if (not && schema.isMultivalue() && !(cond instanceof AnyCond) && cond.getType() != AttributeCond.Type.ISNULL && cond.getType() != AttributeCond.Type.ISNOTNULL) {
List<String> valuesProvided = schema.isMultivalue() ? values : (values.isEmpty()
isValid = !attr.getValues().isEmpty() && attr.getUniqueValue() == null; if (!attr.getSchema().isMultivalue()) { isValid &= attr.getValues().size() == 1;
addPropertyNode("secretKey").addPropertyNode("cipherAlgorithm").addConstraintViolation(); } else { isValid = !schema.isMultivalue() || !schema.isUniqueConstraint(); if (!isValid) { context.disableDefaultConstraintViolation();
@Override public PlainSchemaTO getPlainSchemaTO(final String key) { PlainSchema schema = plainSchemaDAO.find(key); if (schema == null) { throw new NotFoundException("Schema '" + key + "'"); } PlainSchemaTO schemaTO = new PlainSchemaTO(); schemaTO.setKey(schema.getKey()); schemaTO.setType(schema.getType()); schemaTO.setCipherAlgorithm(schema.getCipherAlgorithm()); schemaTO.setConversionPattern(schema.getConversionPattern()); schemaTO.setEnumerationKeys(schema.getEnumerationKeys()); schemaTO.setEnumerationValues(schema.getEnumerationValues()); schemaTO.setMandatoryCondition(schema.getMandatoryCondition()); schemaTO.setMimeType(schema.getMimeType()); schemaTO.setMultivalue(schema.isMultivalue()); schemaTO.setReadonly(schema.isReadonly()); schemaTO.setSecretKey(schema.getSecretKey()); schemaTO.setUniqueConstraint(schema.isUniqueConstraint()); labels(schema, schemaTO); schemaTO.setAnyTypeClass(schema.getAnyTypeClass() == null ? null : schema.getAnyTypeClass().getKey()); if (schema.getValidator() != null) { schemaTO.setValidator(schema.getValidator().getKey()); } return schemaTO; }