Search in sources :

Example 11 with IdmCodeListDto

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

the class DefaultCodeListManagerIntegrationTest method testReferentialIntegrity.

@Test
public void testReferentialIntegrity() {
    IdmCodeListDto codeList = manager.create(getHelper().createName());
    IdmCodeListItemDto item = manager.createItem(codeList, getHelper().createName(), getHelper().createName());
    // 
    Assert.assertNotNull(manager.get(codeList));
    Assert.assertNotNull(manager.getItem(codeList, item.getCode()));
    Assert.assertNotNull(formService.getDefinition(codeList.getFormDefinition().getId()));
    // 
    manager.delete(codeList);
    // 
    Assert.assertNull(manager.get(codeList));
    Assert.assertNull(manager.getItem(codeList, item.getCode()));
    Assert.assertNull(formService.getDefinition(codeList.getFormDefinition().getId()));
}
Also used : IdmCodeListDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListDto) IdmCodeListItemDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListItemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 12 with IdmCodeListDto

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

the class DefaultCodeListManagerIntegrationTest method testChangeFormDefintion.

@Test(expected = ResultCodeException.class)
public void testChangeFormDefintion() {
    IdmCodeListDto codeList = manager.create(getHelper().createName());
    codeList.setFormDefinition(formService.createDefinition(IdmCodeListItemDto.class, getHelper().createName(), null));
    // 
    manager.save(codeList);
}
Also used : IdmCodeListDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListDto) IdmCodeListItemDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListItemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 13 with IdmCodeListDto

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

the class InitCodeListProcessor method process.

@Override
public EventResult<ModuleDescriptorDto> process(EntityEvent<ModuleDescriptorDto> event) {
    // prepare system code lists
    if (codeListManager.get(BaseCodeList.ENVIRONMENT) == null) {
        IdmCodeListDto environment = codeListManager.create(BaseCodeList.ENVIRONMENT);
        codeListManager.createItem(environment, "development", "environment.development.title");
        codeListManager.createItem(environment, "test", "environment.test.title");
        codeListManager.createItem(environment, "production", "environment.production.title");
    }
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : IdmCodeListDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListDto) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult)

Example 14 with IdmCodeListDto

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

the class CodeListDeleteProcessor method process.

@Override
public EventResult<IdmCodeListDto> process(EntityEvent<IdmCodeListDto> event) {
    IdmCodeListDto codeList = event.getContent();
    // 
    service.deleteInternal(codeList);
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : IdmCodeListDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListDto) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult)

Example 15 with IdmCodeListDto

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

the class DefaultCodeListManager method getItems.

@Override
public List<IdmCodeListItemDto> getItems(Serializable codeListIdentifier, Pageable pageable, BasePermission... permission) {
    Assert.notNull(codeListIdentifier, "CodeList identifier is required.");
    IdmCodeListDto codeList = get(codeListIdentifier);
    Assert.notNull(codeList, "CodeList is required.");
    // 
    IdmCodeListItemFilter filter = new IdmCodeListItemFilter();
    filter.setCodeListId(codeList.getId());
    // 
    return codeListItemService.find(filter, pageable, permission).getContent();
}
Also used : IdmCodeListDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListDto) IdmCodeListItemFilter(eu.bcvsolutions.idm.core.eav.api.dto.filter.IdmCodeListItemFilter)

Aggregations

IdmCodeListDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListDto)20 IdmCodeListItemDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListItemDto)9 Test (org.junit.Test)8 Transactional (org.springframework.transaction.annotation.Transactional)7 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)5 List (java.util.List)4 Assert (org.junit.Assert)4 Autowired (org.springframework.beans.factory.annotation.Autowired)4 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)3 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)3 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)3 CodeListManager (eu.bcvsolutions.idm.core.eav.api.service.CodeListManager)3 CoreGroupPermission (eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission)3 IdmBasePermission (eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission)3 AbstractEvaluatorIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractEvaluatorIntegrationTest)3 Set (java.util.Set)3 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)2 IdmFormDefinitionDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto)2 FormService (eu.bcvsolutions.idm.core.eav.api.service.FormService)2 IdmCodeListItemService (eu.bcvsolutions.idm.core.eav.api.service.IdmCodeListItemService)2