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);
}
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());
}
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());
}
Aggregations