use of eu.bcvsolutions.idm.core.api.dto.OperationResultDto in project CzechIdMng by bcvsolutions.
the class OperationResult method toDto.
public OperationResultDto toDto() {
OperationResultDto dto = new OperationResultDto();
dto.setCause(cause);
dto.setCode(code);
dto.setModel(model);
dto.setState(state);
return dto;
}
use of eu.bcvsolutions.idm.core.api.dto.OperationResultDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmAutomaticRoleRequestService method cancel.
@Override
@Transactional
public void cancel(IdmAutomaticRoleRequestDto dto) {
cancelWF(dto);
dto.setState(RequestState.CANCELED);
dto.setResult(new OperationResultDto(OperationState.CANCELED));
this.save(dto);
}
use of eu.bcvsolutions.idm.core.api.dto.OperationResultDto in project CzechIdMng by bcvsolutions.
the class IdmEntityEventFilterIntegrationTest method testFindByOwnerType.
@Test
@Transactional
public void testFindByOwnerType() {
UUID ownerOneId = UUID.randomUUID();
IdmEntityEventDto entityEventOne = new IdmEntityEventDto();
entityEventOne.setOwnerType("mockTypeOne");
entityEventOne.setEventType("mockEvent");
entityEventOne.setOwnerId(ownerOneId);
entityEventOne.setInstanceId("mockInstance");
entityEventOne.setResult(new OperationResultDto(OperationState.BLOCKED));
entityEventOne.setPriority(PriorityType.NORMAL);
entityEventOne = service.save(entityEventOne);
//
UUID ownerTwoId = UUID.randomUUID();
IdmEntityEventDto entityEventTwo = new IdmEntityEventDto();
entityEventTwo.setOwnerType("mockTypeTwo");
entityEventTwo.setEventType("mockEvent");
entityEventTwo.setOwnerId(ownerTwoId);
entityEventTwo.setInstanceId("mockInstance");
entityEventTwo.setResult(new OperationResultDto(OperationState.BLOCKED));
entityEventTwo.setPriority(PriorityType.NORMAL);
entityEventTwo = service.save(entityEventTwo);
//
IdmEntityEventFilter filter = new IdmEntityEventFilter();
filter.setOwnerType("mockTypeOne");
//
List<IdmEntityEventDto> events = service.find(filter, null).getContent();
Assert.assertEquals(1, events.size());
Assert.assertEquals(entityEventOne.getId(), events.get(0).getId());
}
use of eu.bcvsolutions.idm.core.api.dto.OperationResultDto in project CzechIdMng by bcvsolutions.
the class IdmEntityEventFilterIntegrationTest method testFindByCreated.
@Test
@Transactional
public void testFindByCreated() {
UUID ownerOneId = UUID.randomUUID();
IdmEntityEventDto entityEventOne = new IdmEntityEventDto();
entityEventOne.setOwnerType("mockType");
entityEventOne.setEventType("mockEvent");
entityEventOne.setOwnerId(ownerOneId);
entityEventOne.setInstanceId("mockInstance");
entityEventOne.setResult(new OperationResultDto(OperationState.BLOCKED));
entityEventOne.setPriority(PriorityType.NORMAL);
entityEventOne = service.save(entityEventOne);
//
helper.waitForResult(null, null, 1);
//
UUID ownerTwoId = UUID.randomUUID();
IdmEntityEventDto entityEventTwo = new IdmEntityEventDto();
entityEventTwo.setOwnerType("mockType");
entityEventTwo.setEventType("mockEvent");
entityEventTwo.setOwnerId(ownerTwoId);
entityEventTwo.setInstanceId("mockInstance");
entityEventTwo.setResult(new OperationResultDto(OperationState.BLOCKED));
entityEventTwo.setPriority(PriorityType.NORMAL);
entityEventTwo = service.save(entityEventTwo);
//
IdmEntityEventFilter filter = new IdmEntityEventFilter();
filter.setCreatedFrom(entityEventTwo.getCreated());
filter.setOwnerType("mockType");
List<IdmEntityEventDto> events = service.find(filter, null).getContent();
Assert.assertEquals(1, events.size());
Assert.assertEquals(entityEventTwo.getId(), events.get(0).getId());
//
filter.setCreatedFrom(null);
filter.setCreatedTill(entityEventTwo.getCreated());
events = service.find(filter, null).getContent();
Assert.assertEquals(2, events.size());
//
filter.setCreatedTill(entityEventOne.getCreated());
events = service.find(filter, null).getContent();
Assert.assertEquals(1, events.size());
Assert.assertEquals(entityEventOne.getId(), events.get(0).getId());
}
use of eu.bcvsolutions.idm.core.api.dto.OperationResultDto in project CzechIdMng by bcvsolutions.
the class IdmEntityEventFilterIntegrationTest method testFindByPriority.
@Test
@Transactional
public void testFindByPriority() {
UUID ownerOneId = UUID.randomUUID();
IdmEntityEventDto entityEventOne = new IdmEntityEventDto();
entityEventOne.setOwnerType("mockType");
entityEventOne.setEventType("mockEvent");
entityEventOne.setOwnerId(ownerOneId);
entityEventOne.setInstanceId("mockInstance");
entityEventOne.setResult(new OperationResultDto(OperationState.BLOCKED));
entityEventOne.setPriority(PriorityType.NORMAL);
entityEventOne = service.save(entityEventOne);
//
UUID ownerTwoId = UUID.randomUUID();
IdmEntityEventDto entityEventTwo = new IdmEntityEventDto();
entityEventTwo.setOwnerType("mockType");
entityEventTwo.setEventType("mockEvent");
entityEventTwo.setOwnerId(ownerTwoId);
entityEventTwo.setInstanceId("mockInstance");
entityEventTwo.setResult(new OperationResultDto(OperationState.BLOCKED));
entityEventTwo.setPriority(PriorityType.HIGH);
entityEventTwo = service.save(entityEventTwo);
//
IdmEntityEventFilter filter = new IdmEntityEventFilter();
filter.setOwnerType("mockType");
filter.setPriority(PriorityType.NORMAL);
//
List<IdmEntityEventDto> events = service.find(filter, null).getContent();
Assert.assertEquals(1, events.size());
Assert.assertEquals(entityEventOne.getId(), events.get(0).getId());
//
filter.setPriority(PriorityType.HIGH);
events = service.find(filter, null).getContent();
Assert.assertEquals(1, events.size());
Assert.assertEquals(entityEventTwo.getId(), events.get(0).getId());
}
Aggregations