use of com.evolveum.icf.dummy.resource.SchemaViolationException in project midpoint by Evolveum.
the class DummyConnector method convertToPriv.
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 IllegalArgumentException("Password specified for a privilege");
} else if (attr.is(OperationalAttributeInfos.ENABLE.getName())) {
throw new IllegalArgumentException("Unsupported ENABLE attribute in privilege");
} else {
String name = attr.getName();
try {
newPriv.replaceAttributeValues(name, attr.getValue());
} catch (SchemaViolationException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
}
return newPriv;
}
use of com.evolveum.icf.dummy.resource.SchemaViolationException in project midpoint by Evolveum.
the class DummyConnector method schema.
/**
* {@inheritDoc}
*/
public Schema schema() {
log.info("schema::begin");
if (!configuration.getSupportSchema()) {
log.info("schema::unsupported operation");
throw new UnsupportedOperationException();
}
SchemaBuilder builder = new SchemaBuilder(DummyConnector.class);
try {
builder.defineObjectClass(createAccountObjectClass(configuration.getSupportActivation()));
builder.defineObjectClass(createGroupObjectClass(configuration.getSupportActivation()));
builder.defineObjectClass(createPrivilegeObjectClass());
builder.defineObjectClass(createOrgObjectClass());
for (ObjectClassInfo auxObjectClass : createAuxiliaryObjectClasses()) {
builder.defineObjectClass(auxObjectClass);
}
} catch (SchemaViolationException e) {
throw new InvalidAttributeValueException(e.getMessage(), e);
} catch (ConflictException e) {
throw new AlreadyExistsException(e);
}
if (configuration.isSupportReturnDefaultAttributes()) {
builder.defineOperationOption(OperationOptionInfoBuilder.buildReturnDefaultAttributes(), SearchOp.class, SyncOp.class);
}
log.info("schema::end");
return builder.build();
}
Aggregations