Search in sources :

Example 1 with OperationResultDto

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;
}
Also used : OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto)

Example 2 with OperationResultDto

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);
}
Also used : OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with OperationResultDto

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());
}
Also used : OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) UUID(java.util.UUID) IdmEntityEventFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter) IdmEntityEventDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with OperationResultDto

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());
}
Also used : OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) UUID(java.util.UUID) IdmEntityEventFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter) IdmEntityEventDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with OperationResultDto

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());
}
Also used : OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) UUID(java.util.UUID) IdmEntityEventFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter) IdmEntityEventDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

OperationResultDto (eu.bcvsolutions.idm.core.api.dto.OperationResultDto)17 IdmEntityEventDto (eu.bcvsolutions.idm.core.api.dto.IdmEntityEventDto)13 Transactional (org.springframework.transaction.annotation.Transactional)12 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)11 Test (org.junit.Test)11 IdmEntityEventFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityEventFilter)8 UUID (java.util.UUID)8 IdmEntityStateDto (eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto)3 ArrayList (java.util.ArrayList)3 PageRequest (org.springframework.data.domain.PageRequest)3 Lists (com.google.common.collect.Lists)2 OperationState (eu.bcvsolutions.idm.core.api.domain.OperationState)2 PriorityType (eu.bcvsolutions.idm.core.api.domain.PriorityType)2 Objects (com.google.common.base.Objects)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 CoreModuleDescriptor (eu.bcvsolutions.idm.core.CoreModuleDescriptor)1 EventConfiguration (eu.bcvsolutions.idm.core.api.config.domain.EventConfiguration)1 Auditable (eu.bcvsolutions.idm.core.api.domain.Auditable)1 ConfigurationMap (eu.bcvsolutions.idm.core.api.domain.ConfigurationMap)1 CoreResultCode (eu.bcvsolutions.idm.core.api.domain.CoreResultCode)1