Search in sources :

Example 1 with IcAttributeInfoImpl

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;
}
Also used : IcAttributeInfoImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeInfoImpl) GuardedString(org.identityconnectors.common.security.GuardedString)

Example 2 with IcAttributeInfoImpl

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;
}
Also used : IcObjectClassInfoImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassInfoImpl) VsAccount(eu.bcvsolutions.idm.vs.entity.VsAccount) IcAttributeInfo(eu.bcvsolutions.idm.ic.api.IcAttributeInfo) IcSchemaImpl(eu.bcvsolutions.idm.ic.impl.IcSchemaImpl) IcObjectClassInfo(eu.bcvsolutions.idm.ic.api.IcObjectClassInfo) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IcAttributeInfoImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeInfoImpl)

Aggregations

IcAttributeInfoImpl (eu.bcvsolutions.idm.ic.impl.IcAttributeInfoImpl)2 IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)1 IcAttributeInfo (eu.bcvsolutions.idm.ic.api.IcAttributeInfo)1 IcObjectClassInfo (eu.bcvsolutions.idm.ic.api.IcObjectClassInfo)1 IcObjectClassInfoImpl (eu.bcvsolutions.idm.ic.impl.IcObjectClassInfoImpl)1 IcSchemaImpl (eu.bcvsolutions.idm.ic.impl.IcSchemaImpl)1 VsAccount (eu.bcvsolutions.idm.vs.entity.VsAccount)1 GuardedString (org.identityconnectors.common.security.GuardedString)1