Search in sources :

Example 6 with IdmFormAttributeDto

use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.

the class GenerateSchemaWithEavTest method testFormAttributeType.

@Test
public void testFormAttributeType() {
    IdmFormDefinitionDto definition = formService.getDefinition(IdmIdentity.class);
    IdmFormAttributeFilter filter = new IdmFormAttributeFilter();
    filter.setDefinitionId(definition.getId());
    // 
    SysSystemDto systemDto = this.initData();
    filter.setText("in resource " + systemDto.getName());
    // 
    long totalFormAttributesSecond = formAttributeService.find(filter, null).getTotalElements();
    // 
    // 9 new eav attribute
    assertEquals(9, totalFormAttributesSecond);
    // 
    for (IdmFormAttributeDto attribute : formAttributeService.find(filter, null)) {
        if (attribute.getCode().toLowerCase().equals("boolean_value")) {
            assertEquals(PersistentType.BOOLEAN, attribute.getPersistentType());
        } else if (attribute.getCode().toLowerCase().equals("byte_value")) {
            assertEquals(PersistentType.BYTEARRAY, attribute.getPersistentType());
        } else if (attribute.getCode().toLowerCase().equals("date_value")) {
            // TODO: date value is saved as text
            assertEquals(PersistentType.TEXT, attribute.getPersistentType());
        } else if (attribute.getCode().toLowerCase().equals("double_value")) {
            assertEquals(PersistentType.DOUBLE, attribute.getPersistentType());
        } else if (attribute.getCode().toLowerCase().equals("int_value")) {
            assertEquals(PersistentType.INT, attribute.getPersistentType());
        } else if (attribute.getCode().toLowerCase().equals("long_value")) {
            assertEquals(PersistentType.LONG, attribute.getPersistentType());
        } else if (attribute.getCode().toLowerCase().equals("short_text_value")) {
            // TODO: now is short text saved as TEXT
            assertEquals(PersistentType.TEXT, attribute.getPersistentType());
        } else if (attribute.getCode().toLowerCase().equals("string_value")) {
            assertEquals(PersistentType.TEXT, attribute.getPersistentType());
        } else if (attribute.getCode().toLowerCase().equals("uuid_value")) {
            assertEquals(PersistentType.BYTEARRAY, attribute.getPersistentType());
        } else {
            fail();
        }
    }
}
Also used : IdmFormAttributeFilter(eu.bcvsolutions.idm.core.eav.api.dto.filter.IdmFormAttributeFilter) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 7 with IdmFormAttributeDto

use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemAttributeMappingService method convertMappingAttribute.

/**
 * Convert schema attribute handling to Form attribute
 *
 * @param entity
 * @return
 */
private IdmFormAttributeDto convertMappingAttribute(AttributeMapping entity) {
    SysSchemaAttributeDto schemaAttribute = getSchemaAttribute(entity);
    IdmFormAttributeDto attributeDefinition = new IdmFormAttributeDto();
    attributeDefinition.setSeq((short) 0);
    attributeDefinition.setCode(entity.getIdmPropertyName());
    attributeDefinition.setName(entity.getName());
    attributeDefinition.setPersistentType(formPropertyManager.getPersistentType(schemaAttribute.getClassType()));
    attributeDefinition.setRequired(schemaAttribute.isRequired());
    attributeDefinition.setMultiple(schemaAttribute.isMultivalued());
    attributeDefinition.setReadonly(!schemaAttribute.isUpdateable());
    attributeDefinition.setConfidential(entity.isConfidentialAttribute());
    // attribute can be deleted
    attributeDefinition.setUnmodifiable(false);
    // 
    SysSystemDto system = getSystemFromSchemaAttribute(schemaAttribute);
    // 
    attributeDefinition.setDescription(MessageFormat.format("Genereted by schema attribute {0} in resource {1}. Created by SYSTEM.", schemaAttribute.getName(), system.getName()));
    return attributeDefinition;
}
Also used : IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 8 with IdmFormAttributeDto

use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemAttributeMappingService method createExtendedAttributeDefinition.

/**
 * Check on exists EAV definition for given attribute. If the definition not exist, then we try create it.
 * @param entity
 * @param ownerType
 */
@Override
@Transactional
public void createExtendedAttributeDefinition(AttributeMapping entity, Class<? extends Identifiable> ownerType) {
    IdmFormAttributeDto attribute = formService.getAttribute(ownerType, entity.getIdmPropertyName());
    if (attribute == null) {
        log.info(MessageFormat.format("IdmFormAttribute for identity and property {0} not found. We will create definition now.", entity.getIdmPropertyName()));
        formService.saveAttribute(ownerType, convertMappingAttribute(entity));
    }
}
Also used : IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Transactional(org.springframework.transaction.annotation.Transactional)

Example 9 with IdmFormAttributeDto

use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.

the class DefaultTestHelper method createEavAttribute.

@Override
public IdmFormAttributeDto createEavAttribute(String code, Class<? extends Identifiable> clazz, PersistentType type) {
    IdmFormAttributeDto eavAttribute = new IdmFormAttributeDto();
    eavAttribute.setCode(code);
    IdmFormDefinitionDto main = formDefinitionService.findOneByMain(clazz.getName());
    eavAttribute.setFormDefinition(main.getId());
    eavAttribute.setName(code);
    eavAttribute.setConfidential(false);
    eavAttribute.setRequired(false);
    eavAttribute.setReadonly(false);
    eavAttribute.setPersistentType(type);
    return formAttributeService.save(eavAttribute);
}
Also used : IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto)

Example 10 with IdmFormAttributeDto

use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.

the class IdentityReportExecutor method getDisabledAttribute.

/**
 * Filter attribute - identity activity
 *
 * @return
 */
protected static IdmFormAttributeDto getDisabledAttribute() {
    IdmFormAttributeDto disabled = new IdmFormAttributeDto(IdmIdentityFilter.PARAMETER_DISABLED, "Disabled identities", PersistentType.BOOLEAN);
    // we want select box instead simple checkbox (null value is needed)
    disabled.setFaceType(BaseFaceType.BOOLEAN_SELECT);
    disabled.setPlaceholder("All identities or select ...");
    disabled.setDefaultValue("false");
    return disabled;
}
Also used : IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)

Aggregations

IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)67 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)40 Test (org.junit.Test)40 IdmFormDefinitionDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto)32 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)22 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)18 IdmAutomaticRoleAttributeDto (eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto)15 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)15 Transactional (org.springframework.transaction.annotation.Transactional)12 IdmFormValueDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto)11 FormableEntity (eu.bcvsolutions.idm.core.eav.api.entity.FormableEntity)10 ArrayList (java.util.ArrayList)9 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)8 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)7 IdmIdentity (eu.bcvsolutions.idm.core.model.entity.IdmIdentity)7 UUID (java.util.UUID)7 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)6 Serializable (java.io.Serializable)5 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)4 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)4