private <T> void checkIfExist(Collection<T> valuesToDelete, Set<Object> currentValues) throws SchemaViolationException{ for (T valueToDelete : valuesToDelete) { boolean found = false; for (Object currentValue : currentValues) { if (resource.isCaseIgnoreValues() && currentValue instanceof String && valueToDelete instanceof String) { if (StringUtils.equalsIgnoreCase((String)currentValue, (String)valueToDelete)) { found = true; break; } } else { if (currentValue.equals(valueToDelete)) { found = true; break; } } } if (!found){ throw new SchemaViolationException("no such member: " + valueToDelete + " in " + currentValues); } } }
throw new InvalidAttributeValueException(e.getMessage(), e); } catch (InterruptedException e) { throw new OperationTimeoutException(e.getMessage(), e);
private DummyOrg convertToOrg(Set<Attribute> createAttributes) throws ConnectException, FileNotFoundException, ConflictException { String icfName = Utils.getMandatoryStringAttribute(createAttributes,Name.NAME); if (configuration.getUpCaseName()) { icfName = StringUtils.upperCase(icfName); } final DummyOrg newOrg = new DummyOrg(icfName); for (Attribute attr : createAttributes) { if (attr.is(Uid.NAME)) { throw new IllegalArgumentException("UID explicitly specified in the org attributes"); } else if (attr.is(Name.NAME)) { // Skip, already processed } else if (attr.is(OperationalAttributeInfos.PASSWORD.getName())) { throw new IllegalArgumentException("Password specified for a org"); } else if (attr.is(OperationalAttributeInfos.ENABLE.getName())) { throw new IllegalArgumentException("Unsupported ENABLE attribute in org"); } else { String name = attr.getName(); try { newOrg.replaceAttributeValues(name,attr.getValue()); } catch (SchemaViolationException e) { throw new IllegalArgumentException(e.getMessage(),e); } catch (InterruptedException e) { throw new OperationTimeoutException(e.getMessage(),e); } } } return newOrg; }
void breakIt(BreakMode breakMode, String operation) throws ConnectException, FileNotFoundException, SchemaViolationException, ConflictException { if (breakMode == BreakMode.NONE) { return; } else if (breakMode == BreakMode.NETWORK) { throw new ConnectException("Network error (simulated error)"); } else if (breakMode == BreakMode.IO) { throw new FileNotFoundException("IO error (simulated error)"); } else if (breakMode == BreakMode.SCHEMA) { throw new SchemaViolationException("Schema violation (simulated error)"); } else if (breakMode == BreakMode.CONFLICT) { throw new ConflictException("Conflict (simulated error)"); } else if (breakMode == BreakMode.GENERIC) { // The connector will react with generic exception throw new IllegalArgumentException("Generic error (simulated error)"); } else if (breakMode == BreakMode.RUNTIME) { // The connector will just pass this up throw new IllegalStateException("Generic error (simulated error)"); } else if (breakMode == BreakMode.UNSUPPORTED) { throw new UnsupportedOperationException("Not supported (simulated error)"); } else if (breakMode == BreakMode.ASSERTION_ERROR) { throw new AssertionError("Assertion error"); } else { // This is a real error. Use this strange thing to make sure it passes up throw new RuntimeException("Unknown "+operation+" break mode "+getBreakMode); } }
} catch (SchemaViolationException e) { log.info("delete::exception "+e); throw new InvalidAttributeValueException(e.getMessage(), e); } catch (ConflictException e) { log.info("delete::exception "+e);
throw new FileNotFoundException("IO error (simulated error)"); } else if (modifyBreakMode == BreakMode.SCHEMA) { throw new SchemaViolationException("Schema violation (simulated error)"); } else if (modifyBreakMode == BreakMode.CONFLICT) { throw new ConflictException("Conflict (simulated error)");
private DummyPrivilege convertToPriv(Set<Attribute> createAttributes) throws ConnectException, FileNotFoundException, ConflictException { String icfName = Utils.getMandatoryStringAttribute(createAttributes,Name.NAME); if (configuration.getUpCaseName()) { icfName = StringUtils.upperCase(icfName); } final DummyPrivilege newPriv = new DummyPrivilege(icfName); for (Attribute attr : createAttributes) { if (attr.is(Uid.NAME)) { throw new IllegalArgumentException("UID explicitly specified in the group attributes"); } else if (attr.is(Name.NAME)) { // Skip, already processed } else if (attr.is(OperationalAttributeInfos.PASSWORD.getName())) { throw new InvalidAttributeValueException("Password specified for a privilege"); } else if (attr.is(OperationalAttributeInfos.ENABLE.getName())) { throw new InvalidAttributeValueException("Unsupported ENABLE attribute in privilege"); } else { String name = attr.getName(); try { newPriv.replaceAttributeValues(name,attr.getValue()); } catch (SchemaViolationException e) { throw new InvalidAttributeValueException(e.getMessage(),e); } catch (InterruptedException e) { throw new OperationTimeoutException(e.getMessage(),e); } } } return newPriv; }
protected void checkSchema(String attrName, Collection<Object> values, String operationName) throws SchemaViolationException { if (resource == null || !resource.isEnforceSchema()) { return; } DummyObjectClass accountObjectClass; try { accountObjectClass = getObjectClass(); } catch (Exception e) { // No not enforce schema if the schema is broken (simulated) return; } if (accountObjectClass == null) { // Nothing to check return; } DummyAttributeDefinition attributeDefinition = getAttributeDefinition(attrName); if (attributeDefinition == null) { throw new SchemaViolationException("Attribute "+attrName+" is not defined in resource schema"); } if (attributeDefinition.isRequired() && (values == null || values.isEmpty())) { throw new SchemaViolationException(operationName + " of required attribute "+attrName+" results in no values"); } if (!attributeDefinition.isMulti() && values != null && values.size() > 1) { throw new SchemaViolationException(operationName + " of single-valued attribute "+attrName+" results in "+values.size()+" values"); } }
throw new InvalidAttributeValueException(e.getMessage(), e); throw new InvalidAttributeValueException(e.getMessage(),e); throw new InvalidAttributeValueException(e.getMessage(),e); throw new InvalidAttributeValueException(e.getMessage(),e); } catch (SchemaViolationException e) { log.info("removeAttributeValues::exception "+e); throw new InvalidAttributeValueException(e.getMessage(), e); } catch (ConflictException e) { log.info("removeAttributeValues::exception "+e);
throw new InvalidAttributeValueException(e.getMessage(), e); throw new InvalidAttributeValueException(e.getMessage(), e); throw new InvalidAttributeValueException(e.getMessage(),e); throw new InvalidAttributeValueException(e.getMessage(), e); } catch (SchemaViolationException e) { log.info("addAttributeValues::exception "+e); throw new InvalidAttributeValueException(e.getMessage(), e); } catch (ConflictException e) { log.info("addAttributeValues::exception "+e);
throw new InvalidAttributeValueException(e.getMessage(), e); } catch (ConflictException e) { throw new AlreadyExistsException(e);
throw new org.identityconnectors.framework.common.exceptions.AlreadyExistsException(e.getMessage(), e); } catch (SchemaViolationException e) { throw new org.identityconnectors.framework.common.exceptions.InvalidAttributeValueException("Schema exception: " + e.getMessage(), e); throw new InvalidAttributeValueException(e.getMessage(),e); group.replaceAttributeValues(name, values); } catch (SchemaViolationException e) { throw new InvalidAttributeValueException(e.getMessage(),e); priv.replaceAttributeValues(name, attr.getValue()); } catch (SchemaViolationException e) { throw new InvalidAttributeValueException(e.getMessage(),e); org.replaceAttributeValues(name, attr.getValue()); } catch (SchemaViolationException e) { throw new InvalidAttributeValueException(e.getMessage(),e); } catch (SchemaViolationException e) { log.info("update::exception "+e); throw new InvalidAttributeValueException(e.getMessage(), e); } catch (ConflictException e) { log.info("update::exception "+e);
} catch (SchemaViolationException e) { log.info("sync::exception "+e); throw new InvalidAttributeValueException(e.getMessage(), e); } catch (ConflictException e) { log.info("sync::exception "+e);
newGroup.replaceAttributeValues(name,attr.getValue()); } catch (SchemaViolationException e) { throw new InvalidAttributeValueException(e.getMessage(),e);
throw new org.identityconnectors.framework.common.exceptions.AlreadyExistsException(e.getMessage(), e); } catch (SchemaViolationException e) { throw new org.identityconnectors.framework.common.exceptions.InvalidAttributeValueException("Schema exception: " + e.getMessage(), e); } catch (SchemaViolationException e) { log.info("update::exception "+e); throw new InvalidAttributeValueException(e.getMessage(), e); } catch (ConflictException e) { log.info("update::exception "+e);
} catch (SchemaViolationException e) { log.info("executeQuery::exception "+e); throw new InvalidAttributeValueException(e.getMessage(), e); } catch (ConflictException e) { log.info("executeQuery::exception "+e);
throw new InvalidAttributeValueException(e.getMessage(),e);