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();
}
}
}
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;
}
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));
}
}
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);
}
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;
}
Aggregations