Fixing code

This commit is contained in:
Luca Frosini 2021-02-19 19:38:10 +01:00
parent 44631557da
commit d98303c28d
1 changed files with 17 additions and 8 deletions

View File

@ -74,7 +74,7 @@ public class ERManagementUtility {
* Without following the propagation constraint no instances are enforced to be added
* to the context. The sanity check ensure that the graph is consistent otherwise a
* an exception is raised.
* So no need to collect affected isntance and expected instance can be returned.
* So no need to collect affected instances and expected instance can be returned.
*/
return expectedInstances;
} catch(ResourceRegistryException e) {
@ -113,8 +113,7 @@ public class ERManagementUtility {
SecurityContext targetSecurityContext = ContextUtility.getInstance().getSecurityContextByUUID(contextUUID);
Map<UUID,JsonNode> affectedInstances = new HashMap<>();
Map<UUID, ElementManagement<?>> instancesManagement = new HashMap<>();
for(UUID uuid : expectedInstances.keySet()) {
String type = expectedInstances.get(uuid).get(Element.CLASS_PROPERTY).asText();
ElementManagement<?> elementManagement = ElementManagementUtility.getERManagement(type);
@ -123,10 +122,14 @@ public class ERManagementUtility {
elementManagement.setUUID(uuid);
((ERManagement) elementManagement).setHonourPropagationConstraintsInContextSharing(false);
((ERManagement) elementManagement).setDryRunContextSharing(dryRun);
affectedInstances.putAll(((ERManagement) elementManagement).internalRemoveFromContext(targetSecurityContext));
((ERManagement) elementManagement).sanityCheck();
((ERManagement) elementManagement).internalRemoveFromContext(targetSecurityContext);
instancesManagement.put(uuid, elementManagement);
}
for(UUID uuid : expectedInstances.keySet()) {
ElementManagement<?> elementManagement = instancesManagement.get(uuid);
// TODO
elementManagement.sanityCheck();
}
/*
@ -139,7 +142,13 @@ public class ERManagementUtility {
staticLogger.info("{} successfully removed from Context with UUID {} not following Propagation Constraints", instances, contextUUID);
return affectedInstances;
/*
* Without following the propagation constraint no instances are enforced to be added
* to the context. The sanity check ensure that the graph is consistent otherwise a
* an exception is raised.
* So no need to collect affected instances and expected instance can be returned.
*/
return expectedInstances;
} catch(ResourceRegistryException e) {
staticLogger.error("Unable to remove {} from Context with UUID {} not following Propagation Constraints - Reason is {}", instances, contextUUID, e.getMessage());
if(oDatabaseDocument != null) {