Search in sources :

Example 1 with IcSchemaImpl

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;
}
Also used : IcSchemaImpl(eu.bcvsolutions.idm.ic.impl.IcSchemaImpl) ObjectClassInfo(org.identityconnectors.framework.common.objects.ObjectClassInfo) IcObjectClassInfo(eu.bcvsolutions.idm.ic.api.IcObjectClassInfo) IcObjectClassInfo(eu.bcvsolutions.idm.ic.api.IcObjectClassInfo) ArrayList(java.util.ArrayList) GuardedString(org.identityconnectors.common.security.GuardedString)

Example 2 with IcSchemaImpl

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;
}
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

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