protected PlainSchema getPlainSchema(final String schemaName) { PlainSchema schema = null; if (StringUtils.isNotBlank(schemaName)) { schema = plainSchemaDAO.find(schemaName); // safely ignore invalid schemas from AttrTO if (schema == null) { LOG.debug("Ignoring invalid schema {}", schemaName); } else if (schema.isReadonly()) { schema = null; LOG.debug("Ignoring readonly schema {}", schemaName); } } return schema; }
private void checkMandatory( final PlainSchema schema, final PlainAttr<?> attr, final Any<?> any, final SyncopeClientException reqValMissing) { if (attr == null && !schema.isReadonly() && JexlUtils.evaluateMandatoryCondition(schema.getMandatoryCondition(), any)) { LOG.error("Mandatory schema " + schema.getKey() + " not provided with values"); reqValMissing.getElements().add(schema.getKey()); } }
JexlUtils.addPlainAttrsToContext(confDAO.get().getPlainAttrs(), jexlContext); if (!schema.isReadonly() && Boolean.parseBoolean(JexlUtils.evaluate(schema.getMandatoryCondition(), jexlContext))) {
@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; }