Search in sources :

Example 11 with IdmGenerateValueDto

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

the class TreeNodeCodeGeneratorTest method testUpperCase.

@Test
public void testUpperCase() {
    IdmTreeTypeDto type = getHelper().createTreeType();
    IdmTreeNodeDto node = new IdmTreeNodeDto();
    node.setTreeType(type.getId());
    node.setName("NODE-" + System.currentTimeMillis());
    node.setTreeType(type.getId());
    IdmGenerateValueDto generator = this.createGenerator(getDtoType(), getGeneratorType(), null, 1, null);
    IdmTreeNodeDto generated = valueGeneratorManager.generate(node);
    assertNotNull(generated.getCode());
    assertEquals(node.getName().toLowerCase(), generated.getCode());
    generatedAttributeService.delete(generator);
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) IdmGenerateValueDto(eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Test(org.junit.Test) AbstractGeneratorTest(eu.bcvsolutions.idm.core.api.generator.AbstractGeneratorTest)

Example 12 with IdmGenerateValueDto

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

the class TreeNodeCodeGeneratorTest method testGreenLine.

@Test
public void testGreenLine() {
    IdmTreeTypeDto type = getHelper().createTreeType();
    IdmTreeNodeDto node = new IdmTreeNodeDto();
    node.setName("node-" + System.currentTimeMillis());
    node.setTreeType(type.getId());
    IdmGenerateValueDto generator = this.createGenerator(getDtoType(), getGeneratorType(), null, 1, null);
    IdmTreeNodeDto generated = valueGeneratorManager.generate(node);
    assertNotNull(generated.getCode());
    assertEquals(node.getName(), generated.getCode());
    generatedAttributeService.delete(generator);
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) IdmGenerateValueDto(eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Test(org.junit.Test) AbstractGeneratorTest(eu.bcvsolutions.idm.core.api.generator.AbstractGeneratorTest)

Example 13 with IdmGenerateValueDto

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

the class IdentityRoleFormDefaultValueGeneratorTest method createGenerator.

/**
 * Method create generator for this test and remove all another generators.
 *
 * @return
 */
private IdmGenerateValueDto createGenerator() {
    IdmGenerateValueDto generateValue = new IdmGenerateValueDto();
    generateValue.setDtoType(getDtoType().getCanonicalName());
    generateValue.setGeneratorType(getGeneratorType());
    generateValue.setSeq((short) 100);
    generateValue.setUnmodifiable(true);
    return generateValueService.save(generateValue);
}
Also used : IdmGenerateValueDto(eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto)

Example 14 with IdmGenerateValueDto

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

the class AbstractGeneratorTest method createGenerator.

/**
 * Create generated attribute
 *
 * @param entityType
 * @param generatorType
 * @param generatorProperties
 * @param seq
 * @param regenerateValue
 * @return
 */
protected IdmGenerateValueDto createGenerator(Class<? extends AbstractDto> dtoType, String generatorType, ConfigurationMap generatorProperties, Integer seq, Boolean regenerateValue) {
    IdmGenerateValueDto dto = new IdmGenerateValueDto();
    dto.setDtoType(dtoType.getCanonicalName());
    dto.setGeneratorType(generatorType);
    dto.setGeneratorProperties(generatorProperties);
    dto.setSeq(seq == null ? 0 : seq.shortValue());
    dto.setRegenerateValue(regenerateValue == null ? true : regenerateValue.booleanValue());
    return generatedAttributeService.save(dto);
}
Also used : IdmGenerateValueDto(eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto)

Example 15 with IdmGenerateValueDto

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

the class IdmGenerateValueRestTest method prepareDto.

@Override
protected IdmGenerateValueDto prepareDto() {
    IdmGenerateValueDto dto = new IdmGenerateValueDto();
    dto.setDtoType(IdmIdentityDto.class.getCanonicalName());
    dto.setGeneratorType(IdentityFormDefaultValueGenerator.class.getCanonicalName());
    dto.setSeq((short) 100);
    return dto;
}
Also used : IdmGenerateValueDto(eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto) IdentityFormDefaultValueGenerator(eu.bcvsolutions.idm.core.generator.identity.IdentityFormDefaultValueGenerator) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)

Aggregations

IdmGenerateValueDto (eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto)20 AbstractGeneratorTest (eu.bcvsolutions.idm.core.api.generator.AbstractGeneratorTest)10 Test (org.junit.Test)10 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)8 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)8 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)6 ValueGeneratorDto (eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto)2 AbstractValueGenerator (eu.bcvsolutions.idm.core.api.generator.AbstractValueGenerator)2 IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)2 IdentityFormDefaultValueGenerator (eu.bcvsolutions.idm.core.generator.identity.IdentityFormDefaultValueGenerator)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 StringUtils (org.apache.commons.lang3.StringUtils)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 Assert (org.springframework.util.Assert)2 ConfigurationMap (eu.bcvsolutions.idm.core.api.domain.ConfigurationMap)1 CoreResultCode (eu.bcvsolutions.idm.core.api.domain.CoreResultCode)1 AbstractDto (eu.bcvsolutions.idm.core.api.dto.AbstractDto)1 IdmConceptRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto)1