use of eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListItemDto in project CzechIdMng by bcvsolutions.
the class CodeListItemSaveProcessor method process.
@Override
public EventResult<IdmCodeListItemDto> process(EntityEvent<IdmCodeListItemDto> event) {
IdmCodeListItemDto item = event.getContent();
item = service.saveInternal(item);
event.setContent(item);
//
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListItemDto in project CzechIdMng by bcvsolutions.
the class DefaultCodeListManager method deleteItem.
@Override
@Transactional
public void deleteItem(Serializable codeListIdentifier, String itemCode, BasePermission... permission) {
IdmCodeListItemDto item = getItem(codeListIdentifier, itemCode);
//
codeListItemService.delete(item, permission);
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListItemDto in project CzechIdMng by bcvsolutions.
the class DefaultCodeListManagerIntegrationTest method testCodeListItemCRUD.
@Test
public void testCodeListItemCRUD() {
String code = getHelper().createName();
IdmCodeListDto codeList = manager.create(code);
//
String itemCode = getHelper().createName();
String itemName = getHelper().createName();
IdmCodeListItemDto item = manager.createItem(codeList, itemCode, itemName);
//
Assert.assertEquals(itemCode, item.getCode());
Assert.assertEquals(itemName, item.getName());
//
String itemCodeUpdate = getHelper().createName();
String itemNameUpdate = getHelper().createName();
item.setCode(itemCodeUpdate);
item.setName(itemNameUpdate);
item = manager.saveItem(item);
//
Assert.assertEquals(itemCodeUpdate, item.getCode());
Assert.assertEquals(itemNameUpdate, item.getName());
//
Assert.assertNotNull(manager.getItem(codeList, itemCodeUpdate));
Assert.assertEquals(item.getId(), manager.getItem(codeList, itemCodeUpdate).getId());
//
List<IdmCodeListItemDto> items = manager.getItems(codeList, null);
Assert.assertEquals(1, items.size());
Assert.assertTrue(items.stream().anyMatch(i -> i.getCode().equals(itemCodeUpdate)));
//
manager.deleteItem(codeList, itemCodeUpdate);
//
Assert.assertNull(manager.getItem(codeList, itemCodeUpdate));
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmCodeListItemDto in project CzechIdMng by bcvsolutions.
the class IdmCodeListItemControllerRestTest method prepareDto.
@Override
protected IdmCodeListItemDto prepareDto() {
IdmCodeListDto codeList = new IdmCodeListDto();
codeList.setName(getHelper().createName());
codeList.setCode(getHelper().createName());
codeList = getHelper().getService(IdmCodeListService.class).save(codeList);
//
IdmCodeListItemDto dto = new IdmCodeListItemDto();
dto.setName(getHelper().createName());
dto.setCode(getHelper().createName());
dto.setCodeList(codeList.getId());
//
return dto;
}
Aggregations