use of eu.bcvsolutions.idm.ic.impl.IcSchemaImpl in project CzechIdMng by bcvsolutions.
the class ConnIdIcConvertUtil method convertConnIdSchema.
public static IcSchema convertConnIdSchema(Schema schema) {
if (schema == null) {
return null;
}
IcSchemaImpl icSchema = new IcSchemaImpl();
List<IcObjectClassInfo> objectClasses = icSchema.getDeclaredObjectClasses();
for (ObjectClassInfo classInfo : schema.getObjectClassInfo()) {
objectClasses.add(ConnIdIcConvertUtil.convertConnIdObjectClassInfo(classInfo));
}
if (schema.getSupportedObjectClassesByOperation() != null) {
for (Class<? extends APIOperation> operation : schema.getSupportedObjectClassesByOperation().keySet()) {
List<String> objectClassesForOperation = new ArrayList<>();
Set<ObjectClassInfo> objectClasesConnid = schema.getSupportedObjectClassesByOperation().get(operation);
for (ObjectClassInfo oci : objectClasesConnid) {
objectClassesForOperation.add(oci.getType());
}
icSchema.getSupportedObjectClassesByOperation().put(operation.getSimpleName(), objectClassesForOperation);
}
}
return icSchema;
}
use of eu.bcvsolutions.idm.ic.impl.IcSchemaImpl in project CzechIdMng by bcvsolutions.
the class BasicVirtualConnector method generateSchema.
/**
* Generate schema from connector configuration and form definition
*
* @return
*/
private IcSchemaImpl generateSchema() {
IcSchemaImpl schema = new IcSchemaImpl();
List<IcObjectClassInfo> objectClasses = schema.getDeclaredObjectClasses();
IcObjectClassInfoImpl objectClass = new IcObjectClassInfoImpl();
objectClass.setType(IcObjectClassInfo.ACCOUNT);
List<IcAttributeInfo> attributes = objectClass.getAttributeInfos();
// Create UID schema attribute
IcAttributeInfoImpl attributeUid = new IcAttributeInfoImpl();
attributeUid.setClassType(String.class.getName());
attributeUid.setCreateable(true);
attributeUid.setMultivalued(false);
attributeUid.setName(IcAttributeInfo.NAME);
attributeUid.setNativeName(VsAccount_.uid.getName());
attributeUid.setReadable(true);
attributeUid.setRequired(true);
attributeUid.setReturnedByDefault(true);
attributeUid.setUpdateable(true);
attributes.add(attributeUid);
// Create ENABLE schema attribute
if (this.virtualConfiguration.isDisableSupported()) {
IcAttributeInfoImpl attributeDisabled = new IcAttributeInfoImpl();
attributeDisabled.setClassType(Boolean.class.getName());
attributeDisabled.setCreateable(true);
attributeDisabled.setMultivalued(false);
attributeDisabled.setName(IcAttributeInfo.ENABLE);
attributeDisabled.setNativeName(VsAccount_.enable.getName());
attributeDisabled.setReadable(true);
attributeDisabled.setRequired(false);
attributeDisabled.setReturnedByDefault(true);
attributeDisabled.setUpdateable(true);
attributes.add(attributeDisabled);
}
// Attributes from definition and configuration
Arrays.asList(virtualConfiguration.getAttributes()).forEach(virtualAttirbute -> {
IdmFormAttributeDto formAttribute = formAttributeService.findAttribute(VsAccount.class.getName(), formDefinition.getCode(), virtualAttirbute);
if (formAttribute == null) {
return;
}
IcAttributeInfoImpl attribute = new IcAttributeInfoImpl();
String classType = this.convertToSchemaClassType(formAttribute.getPersistentType());
attribute.setClassType(classType);
attribute.setCreateable(!formAttribute.isReadonly());
attribute.setMultivalued(formAttribute.isMultiple());
attribute.setName(virtualAttirbute);
attribute.setNativeName(virtualAttirbute);
attribute.setReadable(true);
attribute.setRequired(formAttribute.isRequired());
attribute.setReturnedByDefault(true);
attribute.setUpdateable(!formAttribute.isReadonly());
attributes.add(attribute);
});
objectClasses.add(objectClass);
return schema;
}
Aggregations