Search in sources :

Example 11 with SysAttributeDifferenceDto

use of eu.bcvsolutions.idm.acc.dto.SysAttributeDifferenceDto in project CzechIdMng by bcvsolutions.

the class SysProvisioningOperationController method getDifferenceObject.

@ResponseBody
@RequestMapping(value = "/{backendId}/difference-object", method = RequestMethod.GET)
@PreAuthorize("hasAuthority('" + AccGroupPermission.PROVISIONING_OPERATION_READ + "')")
@ApiOperation(value = "Detail of the provisioning changes", nickname = "getProvisioningDetail", tags = { SysProvisioningOperationController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = AccGroupPermission.PROVISIONING_OPERATION_READ, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = AccGroupPermission.PROVISIONING_OPERATION_READ, description = "") }) })
public ResponseEntity<?> getDifferenceObject(@ApiParam(value = "Provisioning detail uuid identifier.", required = true) @PathVariable @NotNull String backendId) {
    SysProvisioningOperationDto archive = getDto(backendId);
    if (archive == null) {
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    ProvisioningContext context = archive.getProvisioningContext();
    if (context == null) {
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    List<SysAttributeDifferenceDto> result = provisioningArchiveService.evaluateProvisioningDifferences(context.getSystemConnectorObject(), context.getConnectorObject());
    return new ResponseEntity<>(result, HttpStatus.OK);
}
Also used : ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) ResponseEntity(org.springframework.http.ResponseEntity) SysAttributeDifferenceDto(eu.bcvsolutions.idm.acc.dto.SysAttributeDifferenceDto) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with SysAttributeDifferenceDto

use of eu.bcvsolutions.idm.acc.dto.SysAttributeDifferenceDto in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningArchiveServiceIntegrationTest method differenceObjectUpdateSingleTest.

@Test
public void differenceObjectUpdateSingleTest() {
    String attrName = getHelper().createName();
    IcAttributeImpl icAttributeOne = new IcAttributeImpl(attrName, "TEST1");
    IcConnectorObject connObjectOld = new IcConnectorObjectImpl(getHelper().createName(), new IcObjectClassImpl("__mock__"), ImmutableList.of(icAttributeOne));
    IcAttributeImpl icAttributeTwo = new IcAttributeImpl(attrName, "TEST2");
    IcConnectorObject connObjectNew = new IcConnectorObjectImpl(getHelper().createName(), new IcObjectClassImpl("__mock__"), ImmutableList.of(icAttributeTwo));
    List<SysAttributeDifferenceDto> diffs = service.evaluateProvisioningDifferences(connObjectOld, connObjectNew);
    Assert.assertEquals(1, diffs.size());
    Assert.assertFalse(diffs.get(0).isMultivalue());
    Assert.assertEquals(SysValueChangeType.UPDATED, diffs.get(0).getValue().getChange());
    Assert.assertEquals("TEST1", diffs.get(0).getValue().getOldValue());
    Assert.assertEquals("TEST2", diffs.get(0).getValue().getValue());
}
Also used : IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) SysAttributeDifferenceDto(eu.bcvsolutions.idm.acc.dto.SysAttributeDifferenceDto) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 13 with SysAttributeDifferenceDto

use of eu.bcvsolutions.idm.acc.dto.SysAttributeDifferenceDto in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningArchiveServiceIntegrationTest method differenceObjectAddSingleTest.

@Test
public void differenceObjectAddSingleTest() {
    String attrName = getHelper().createName();
    IcAttributeImpl icAttributeOne = new IcAttributeImpl(attrName, "TEST1");
    IcConnectorObject connObjectNew = new IcConnectorObjectImpl(getHelper().createName(), new IcObjectClassImpl("__mock__"), ImmutableList.of(icAttributeOne));
    IcConnectorObject connObjectOld = new IcConnectorObjectImpl(getHelper().createName(), new IcObjectClassImpl("__mock__"), ImmutableList.of());
    List<SysAttributeDifferenceDto> diffs = service.evaluateProvisioningDifferences(connObjectOld, connObjectNew);
    Assert.assertEquals(1, diffs.size());
    Assert.assertFalse(diffs.get(0).isMultivalue());
    Assert.assertEquals(SysValueChangeType.ADDED, diffs.get(0).getValue().getChange());
    Assert.assertEquals(null, diffs.get(0).getValue().getOldValue());
    Assert.assertEquals("TEST1", diffs.get(0).getValue().getValue());
}
Also used : IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) SysAttributeDifferenceDto(eu.bcvsolutions.idm.acc.dto.SysAttributeDifferenceDto) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

SysAttributeDifferenceDto (eu.bcvsolutions.idm.acc.dto.SysAttributeDifferenceDto)13 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)6 IcConnectorObjectImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl)5 ProvisioningContext (eu.bcvsolutions.idm.acc.domain.ProvisioningContext)4 SysAttributeDifferenceValueDto (eu.bcvsolutions.idm.acc.dto.SysAttributeDifferenceValueDto)4 IcObjectClassImpl (eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl)4 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 SysValueChangeType (eu.bcvsolutions.idm.acc.domain.SysValueChangeType)3 List (java.util.List)3 UUID (java.util.UUID)3 ImmutableList (com.google.common.collect.ImmutableList)2 Lists (com.google.common.collect.Lists)2 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)2 SysProvisioningArchiveDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto)2 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)2 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)2 SysProvisioningArchiveService (eu.bcvsolutions.idm.acc.service.api.SysProvisioningArchiveService)2 SysSystemService (eu.bcvsolutions.idm.acc.service.api.SysSystemService)2