use of eu.bcvsolutions.idm.ic.impl.IcAttributeInfoImpl in project CzechIdMng by bcvsolutions.
the class ConnIdIcConvertUtil method convertConnIdAttributeInfo.
public static IcAttributeInfo convertConnIdAttributeInfo(AttributeInfo attribute) {
if (attribute == null) {
return null;
}
IcAttributeInfoImpl icAttribute = new IcAttributeInfoImpl();
if (attribute.getType() != null) {
if (GuardedString.class.isAssignableFrom(attribute.getType())) {
// We do converse between BCV GuardedString and ConnId
// GuardedString
icAttribute.setClassType(eu.bcvsolutions.idm.core.security.api.domain.GuardedString.class.getName());
} else {
icAttribute.setClassType(attribute.getType().getName());
}
}
icAttribute.setCreateable(attribute.isCreateable());
icAttribute.setMultivalued(attribute.isMultiValued());
icAttribute.setName(attribute.getName());
icAttribute.setReadable(attribute.isReadable());
icAttribute.setRequired(attribute.isRequired());
icAttribute.setReturnedByDefault(attribute.isReturnedByDefault());
icAttribute.setUpdateable(attribute.isUpdateable());
return icAttribute;
}
use of eu.bcvsolutions.idm.ic.impl.IcAttributeInfoImpl 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