Reorganizing code

This commit is contained in:
Luca Frosini 2021-03-05 10:46:59 +01:00
parent 5a94aadce5
commit 9770531b33
15 changed files with 155 additions and 59 deletions

View File

@ -111,12 +111,12 @@ public class ContextManagement extends EntityElementManagement<Context, EntityTy
} }
@Override @Override
protected ContextNotFoundException getSpecificElementNotFoundException(NotFoundException e) { protected ContextNotFoundException getSpecificNotFoundException(NotFoundException e) {
return new ContextNotFoundException(e.getMessage(), e.getCause()); return new ContextNotFoundException(e.getMessage(), e.getCause());
} }
@Override @Override
protected ContextAlreadyPresentException getSpecificERAlreadyPresentException(String message) { protected ContextAlreadyPresentException getSpecificAlreadyPresentException(String message) {
return new ContextAlreadyPresentException(message); return new ContextAlreadyPresentException(message);
} }

View File

@ -48,12 +48,12 @@ public class IsParentOfManagement extends RelationElementManagement<ContextManag
} }
@Override @Override
protected IsParentOfNotFoundException getSpecificElementNotFoundException(NotFoundException e) { protected IsParentOfNotFoundException getSpecificNotFoundException(NotFoundException e) {
return new IsParentOfNotFoundException(e.getMessage(), e.getCause()); return new IsParentOfNotFoundException(e.getMessage(), e.getCause());
} }
@Override @Override
protected IsParentOfAlreadyPresentException getSpecificERAlreadyPresentException(String message) { protected IsParentOfAlreadyPresentException getSpecificAlreadyPresentException(String message) {
return new IsParentOfAlreadyPresentException(message); return new IsParentOfAlreadyPresentException(message);
} }

View File

@ -94,14 +94,14 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
protected boolean reload; protected boolean reload;
/** /**
* An operation can affects multiple instances (e.g. addToContext) * An operation can affects multiple instances (e.g. create, update)
* We need to know if the instance is the entry point of the operation * We need to know if the instance is the entry point of the operation
* or if it is just a subordinated operation. * or if it is just a subordinated operation.
* This is required for example in addTocontext to trigger sanity check * This is required for example in addTocontext to trigger sanity check
* in the Resource when the action is performed directly on the Facet, * in the Resource when the action is performed directly on the Facet,
* or the Resource sanity check is not required to be triggered * or the Resource sanity check is not required to be triggered
* because the entry point of the action already take care * because the entry point of the action already take care
* of triggering this action (e.g. the addToContext was invoked on the Resource and * of triggering this action (e.g. the update was invoked on the Resource and
* each describing Facets must not trigger multiple time the sanityCheck). * each describing Facets must not trigger multiple time the sanityCheck).
*/ */
protected boolean entryPoint; protected boolean entryPoint;
@ -463,9 +463,9 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
this.typeName = oClass.getName(); this.typeName = oClass.getName();
} }
protected abstract NotFoundException getSpecificElementNotFoundException(NotFoundException e); protected abstract NotFoundException getSpecificNotFoundException(NotFoundException e);
protected abstract AlreadyPresentException getSpecificERAlreadyPresentException(String message); protected abstract AlreadyPresentException getSpecificAlreadyPresentException(String message);
public El getElement() throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException { public El getElement() throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
if(element == null) { if(element == null) {
@ -495,7 +495,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
return Utility.getElementByUUID(oDatabaseDocument, typeName == null ? accessType.getName() : typeName, uuid, return Utility.getElementByUUID(oDatabaseDocument, typeName == null ? accessType.getName() : typeName, uuid,
elementClass); elementClass);
} catch(NotFoundException e) { } catch(NotFoundException e) {
throw getSpecificElementNotFoundException(e); throw getSpecificNotFoundException(e);
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
@ -508,7 +508,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
return Utility.getElementByUUIDAsAdmin(typeName == null ? accessType.getName() : typeName, uuid, return Utility.getElementByUUIDAsAdmin(typeName == null ? accessType.getName() : typeName, uuid,
elementClass); elementClass);
} catch(NotFoundException e) { } catch(NotFoundException e) {
throw getSpecificElementNotFoundException(e); throw getSpecificNotFoundException(e);
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
@ -1115,15 +1115,6 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
return superClasses; return superClasses;
} }
*/ */
/*
public boolean isAvailableOnContext(SecurityContext securityContext) {
try {
return securityContext.isElementInContext(element);
} catch (ResourceRegistryException e) {
return false;
}
}
*/
protected String getNotNullErrorMessage(String fieldName) { protected String getNotNullErrorMessage(String fieldName) {
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();

View File

@ -104,8 +104,7 @@ public class ElementManagementUtility {
} }
} }
@SuppressWarnings("rawtypes") public static ElementManagement<?, ?> getERManagementFromUUID(SecurityContext workingContext, ODatabaseDocument orientGraph,
public static ElementManagement getERManagementFromUUID(SecurityContext workingContext, ODatabaseDocument orientGraph,
UUID uuid) throws ResourceRegistryException { UUID uuid) throws ResourceRegistryException {
OElement element; OElement element;
try { try {
@ -117,8 +116,7 @@ public class ElementManagementUtility {
} }
} }
@SuppressWarnings({"rawtypes", "unchecked"}) public static EntityManagement<?, ?> getEntityManagement(SecurityContext workingContext, ODatabaseDocument oDatabaseDocument,
public static EntityManagement getEntityManagement(SecurityContext workingContext, ODatabaseDocument oDatabaseDocument,
OVertex vertex) throws ResourceRegistryException { OVertex vertex) throws ResourceRegistryException {
if(oDatabaseDocument == null) { if(oDatabaseDocument == null) {
@ -141,7 +139,7 @@ public class ElementManagementUtility {
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
EntityManagement entityManagement = null; EntityManagement<?, ?> entityManagement = null;
if(oClass.isSubClassOf(Resource.NAME)) { if(oClass.isSubClassOf(Resource.NAME)) {
entityManagement = new ResourceManagement(); entityManagement = new ResourceManagement();
} else if(oClass.isSubClassOf(Facet.NAME)) { } else if(oClass.isSubClassOf(Facet.NAME)) {
@ -157,8 +155,7 @@ public class ElementManagementUtility {
return entityManagement; return entityManagement;
} }
@SuppressWarnings({"unchecked", "rawtypes"}) public static RelationManagement<?,?> getRelationManagement(SecurityContext workingContext, ODatabaseDocument oDatabaseDocument,
public static RelationManagement getRelationManagement(SecurityContext workingContext, ODatabaseDocument oDatabaseDocument,
OEdge edge) throws ResourceRegistryException { OEdge edge) throws ResourceRegistryException {
if(oDatabaseDocument == null) { if(oDatabaseDocument == null) {
@ -173,7 +170,7 @@ public class ElementManagementUtility {
OClass oClass = ElementManagementUtility.getOClass(edge); OClass oClass = ElementManagementUtility.getOClass(edge);
RelationManagement relationManagement = null; RelationManagement<?,?> relationManagement = null;
if(oClass.isSubClassOf(ConsistsOf.NAME)) { if(oClass.isSubClassOf(ConsistsOf.NAME)) {
relationManagement = new ConsistsOfManagement(); relationManagement = new ConsistsOfManagement();
} else if(oClass.isSubClassOf(IsRelatedTo.NAME)) { } else if(oClass.isSubClassOf(IsRelatedTo.NAME)) {

View File

@ -133,7 +133,7 @@ public abstract class EntityElementManagement<E extends EntityElement, ET extend
OVertex v = getElement(); OVertex v = getElement();
if(v != null) { if(v != null) {
String error = String.format("A %s with UUID %s already exist", typeName, uuid.toString()); String error = String.format("A %s with UUID %s already exist", typeName, uuid.toString());
throw getSpecificERAlreadyPresentException(error); throw getSpecificAlreadyPresentException(error);
} }
} }

View File

@ -21,14 +21,32 @@ public interface ERManagement {
public void setHonourPropagationConstraintsInContextSharing(boolean honourPropagationConstraintsInContextSharing); public void setHonourPropagationConstraintsInContextSharing(boolean honourPropagationConstraintsInContextSharing);
public Map<UUID,JsonNode> getAffectedInstances();
public void setAffectedInstances(Map<UUID,JsonNode> affectedInstances);
/**
* Set source security context to evaluate addToContext
* @param sourceSecurityContext the source security context
*/
public void setSourceSecurityContext(SecurityContext sourceSecurityContext);
public SecurityContext getSourceSecurityContext();
public Map<UUID, JsonNode> internalAddToContext() public Map<UUID, JsonNode> internalAddToContext()
throws ContextException, ResourceRegistryException; throws ContextException, ResourceRegistryException;
public Map<UUID, JsonNode> addToContext(UUID contextUUID) public Map<UUID, JsonNode> addToContext(UUID contextUUID)
throws SchemaViolationException, NotFoundException, ContextException, ResourceRegistryException; throws SchemaViolationException, NotFoundException, ContextException, ResourceRegistryException;
/**
* Set target security context of addToContext/removeFromContext
* @param targetSecurityContext
*/
public void setTargetSecurityContext(SecurityContext targetSecurityContext); public void setTargetSecurityContext(SecurityContext targetSecurityContext);
public SecurityContext getTargetSecurityContext();
public Map<UUID, JsonNode> internalRemoveFromContext() public Map<UUID, JsonNode> internalRemoveFromContext()
throws ContextException, ResourceRegistryException; throws ContextException, ResourceRegistryException;
@ -37,6 +55,6 @@ public interface ERManagement {
// public void sanityCheck() throws SchemaViolationException, ResourceRegistryException; // public void sanityCheck() throws SchemaViolationException, ResourceRegistryException;
public AvailableInAnotherContextException getSpecificERAvailableInAnotherContextException(String message); public AvailableInAnotherContextException getSpecificAvailableInAnotherContextException(String message);
} }

View File

@ -59,6 +59,11 @@ import com.orientechnologies.orient.core.sql.executor.OResultSet;
*/ */
public abstract class EntityManagement<E extends Entity, ET extends EntityType> extends EntityElementManagement<E, ET> implements ERManagement { public abstract class EntityManagement<E extends Entity, ET extends EntityType> extends EntityElementManagement<E, ET> implements ERManagement {
/**
* The source context of an addToContex
*/
protected SecurityContext sourceSecurityContext;
/** /**
* The target context of an addToContex/RemoveFromContext * The target context of an addToContex/RemoveFromContext
*/ */
@ -111,11 +116,41 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
*/ */
protected boolean honourPropagationConstraintsInContextSharing; protected boolean honourPropagationConstraintsInContextSharing;
/**
* Instances affected by addToContext/removeFromContext
*/
protected Map<UUID,JsonNode> affectedInstances;
@Override
public Map<UUID,JsonNode> getAffectedInstances() {
return affectedInstances;
}
@Override
public void setAffectedInstances(Map<UUID,JsonNode> affectedInstances) {
this.affectedInstances = affectedInstances;
}
@Override
public void setSourceSecurityContext(SecurityContext sourceSecurityContext) {
this.sourceSecurityContext = sourceSecurityContext;
}
@Override
public SecurityContext getSourceSecurityContext() {
return sourceSecurityContext;
}
@Override @Override
public void setTargetSecurityContext(SecurityContext targetSecurityContext) { public void setTargetSecurityContext(SecurityContext targetSecurityContext) {
this.targetSecurityContext = targetSecurityContext; this.targetSecurityContext = targetSecurityContext;
} }
@Override
public SecurityContext getTargetSecurityContext() {
return sourceSecurityContext;
}
public boolean isDryRunContextSharing() { public boolean isDryRunContextSharing() {
return dryRunContextSharing; return dryRunContextSharing;
} }
@ -136,8 +171,17 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
* Provide a cache edge-internal-id -> RelationManagement * Provide a cache edge-internal-id -> RelationManagement
* this avoid to recreate the relationManagement of already visited edges * this avoid to recreate the relationManagement of already visited edges
*/ */
@SuppressWarnings("rawtypes") protected Map<String,RelationManagement<?, ?>> relationManagements;
protected Map<String,RelationManagement> relationManagements;
/*
public boolean isAvailableOnContext(SecurityContext securityContext) {
try {
return securityContext.isElementInContext(element);
} catch (ResourceRegistryException e) {
return false;
}
}
*/
protected EntityManagement(AccessType accessType) { protected EntityManagement(AccessType accessType) {
super(accessType); super(accessType);
@ -171,7 +215,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
} catch(NotFoundException e) { } catch(NotFoundException e) {
try { try {
retrieveElementFromAnyContext(); retrieveElementFromAnyContext();
throw getSpecificERAvailableInAnotherContextException(typeName == null ? accessType.getName() throw getSpecificAvailableInAnotherContextException(typeName == null ? accessType.getName()
: typeName + " with UUID " + uuid + " is available in another " : typeName + " with UUID " + uuid + " is available in another "
+ Context.class.getSimpleName()); + Context.class.getSimpleName());
} catch(AvailableInAnotherContextException e1) { } catch(AvailableInAnotherContextException e1) {
@ -258,7 +302,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
OVertex v = getElement(); OVertex v = getElement();
if(v != null) { if(v != null) {
String error = String.format("A %s with UUID %s already exist", typeName, uuid.toString()); String error = String.format("A %s with UUID %s already exist", typeName, uuid.toString());
throw getSpecificERAlreadyPresentException(error); throw getSpecificAlreadyPresentException(error);
} }
} }
@ -267,7 +311,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
OElement el = ElementManagementUtility.getAnyElementByUUID(uuid); OElement el = ElementManagementUtility.getAnyElementByUUID(uuid);
String error = String.format("UUID %s is already used by another %s. This is not allowed.", String error = String.format("UUID %s is already used by another %s. This is not allowed.",
uuid.toString(), (el instanceof OVertex) ? Entity.NAME : Relation.NAME); uuid.toString(), (el instanceof OVertex) ? Entity.NAME : Relation.NAME);
throw getSpecificERAvailableInAnotherContextException(error); throw getSpecificAvailableInAnotherContextException(error);
} catch(NotFoundException e1) { } catch(NotFoundException e1) {
// OK the UUID is not already used. // OK the UUID is not already used.
@ -357,6 +401,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
oDatabaseDocument.begin(); oDatabaseDocument.begin();
setAsEntryPoint(); setAsEntryPoint();
sourceSecurityContext = ContextUtility.getCurrentSecurityContext();
targetSecurityContext = ContextUtility.getInstance().getSecurityContextByUUID(contextUUID); targetSecurityContext = ContextUtility.getInstance().getSecurityContextByUUID(contextUUID);
Map<UUID,JsonNode> affectedInstances = internalAddToContext(); Map<UUID,JsonNode> affectedInstances = internalAddToContext();
@ -543,7 +588,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
OElement element = ElementManagementUtility.getAnyElementByUUID(oDatabaseDocument, referenceUUID); OElement element = ElementManagementUtility.getAnyElementByUUID(oDatabaseDocument, referenceUUID);
if(element instanceof OVertex) { if(element instanceof OVertex) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
EntityManagement<Entity, EntityType> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(), EntityManagement<Entity, EntityType> entityManagement = (EntityManagement<Entity, EntityType>) ElementManagementUtility.getEntityManagement(getWorkingContext(),
oDatabaseDocument, (OVertex) element); oDatabaseDocument, (OVertex) element);
String elementType = entityManagement.getTypeName(); String elementType = entityManagement.getTypeName();

View File

@ -34,17 +34,17 @@ public class FacetManagement extends EntityManagement<Facet, FacetType> {
} }
@Override @Override
protected FacetNotFoundException getSpecificElementNotFoundException(NotFoundException e) { protected FacetNotFoundException getSpecificNotFoundException(NotFoundException e) {
return new FacetNotFoundException(e.getMessage(), e.getCause()); return new FacetNotFoundException(e.getMessage(), e.getCause());
} }
@Override @Override
public FacetAvailableInAnotherContextException getSpecificERAvailableInAnotherContextException(String message) { public FacetAvailableInAnotherContextException getSpecificAvailableInAnotherContextException(String message) {
return new FacetAvailableInAnotherContextException(message); return new FacetAvailableInAnotherContextException(message);
} }
@Override @Override
protected FacetAlreadyPresentException getSpecificERAlreadyPresentException(String message) { protected FacetAlreadyPresentException getSpecificAlreadyPresentException(String message) {
return new FacetAlreadyPresentException(message); return new FacetAlreadyPresentException(message);
} }

View File

@ -51,18 +51,18 @@ public class ResourceManagement extends EntityManagement<Resource, ResourceType>
} }
@Override @Override
protected ResourceNotFoundException getSpecificElementNotFoundException(NotFoundException e) { protected ResourceNotFoundException getSpecificNotFoundException(NotFoundException e) {
return new ResourceNotFoundException(e.getMessage(), e.getCause()); return new ResourceNotFoundException(e.getMessage(), e.getCause());
} }
@Override @Override
public ResourceAvailableInAnotherContextException getSpecificERAvailableInAnotherContextException( public ResourceAvailableInAnotherContextException getSpecificAvailableInAnotherContextException(
String message) { String message) {
return new ResourceAvailableInAnotherContextException(message); return new ResourceAvailableInAnotherContextException(message);
} }
@Override @Override
protected ResourceAlreadyPresentException getSpecificERAlreadyPresentException(String message) { protected ResourceAlreadyPresentException getSpecificAlreadyPresentException(String message) {
return new ResourceAlreadyPresentException(message); return new ResourceAlreadyPresentException(message);
} }

View File

@ -44,18 +44,18 @@ public class ConsistsOfManagement extends RelationManagement<FacetManagement, Fa
} }
@Override @Override
protected ConsistsOfNotFoundException getSpecificElementNotFoundException(NotFoundException e) { protected ConsistsOfNotFoundException getSpecificNotFoundException(NotFoundException e) {
return new ConsistsOfNotFoundException(e.getMessage(), e.getCause()); return new ConsistsOfNotFoundException(e.getMessage(), e.getCause());
} }
@Override @Override
public ConsistsOfAvailableInAnotherContextException getSpecificERAvailableInAnotherContextException( public ConsistsOfAvailableInAnotherContextException getSpecificAvailableInAnotherContextException(
String message) { String message) {
return new ConsistsOfAvailableInAnotherContextException(message); return new ConsistsOfAvailableInAnotherContextException(message);
} }
@Override @Override
protected ConsistsOfAlreadyPresentException getSpecificERAlreadyPresentException(String message) { protected ConsistsOfAlreadyPresentException getSpecificAlreadyPresentException(String message) {
return new ConsistsOfAlreadyPresentException(message); return new ConsistsOfAlreadyPresentException(message);
} }

View File

@ -33,18 +33,18 @@ public class IsRelatedToManagement extends RelationManagement<ResourceManagement
} }
@Override @Override
protected IsRelatedToNotFoundException getSpecificElementNotFoundException(NotFoundException e) { protected IsRelatedToNotFoundException getSpecificNotFoundException(NotFoundException e) {
return new IsRelatedToNotFoundException(e.getMessage(), e.getCause()); return new IsRelatedToNotFoundException(e.getMessage(), e.getCause());
} }
@Override @Override
public IsRelatedToAvailableInAnotherContextException getSpecificERAvailableInAnotherContextException( public IsRelatedToAvailableInAnotherContextException getSpecificAvailableInAnotherContextException(
String message) { String message) {
return new IsRelatedToAvailableInAnotherContextException(message); return new IsRelatedToAvailableInAnotherContextException(message);
} }
@Override @Override
protected IsRelatedToAlreadyPresentException getSpecificERAlreadyPresentException(String message) { protected IsRelatedToAlreadyPresentException getSpecificAlreadyPresentException(String message) {
return new IsRelatedToAlreadyPresentException(message); return new IsRelatedToAlreadyPresentException(message);
} }

View File

@ -58,6 +58,11 @@ import com.orientechnologies.orient.core.record.impl.ODocument;
public abstract class RelationManagement<T extends EntityManagement<? extends Entity, TET>, TET extends EntityType> public abstract class RelationManagement<T extends EntityManagement<? extends Entity, TET>, TET extends EntityType>
extends RelationElementManagement<ResourceManagement, T, ResourceType, TET> implements ERManagement { extends RelationElementManagement<ResourceManagement, T, ResourceType, TET> implements ERManagement {
/**
* The source context of an addToContex
*/
protected SecurityContext sourceSecurityContext;
/** /**
* The target context of an addToContex/RemoveFromContext * The target context of an addToContex/RemoveFromContext
*/ */
@ -110,11 +115,41 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
*/ */
protected boolean honourPropagationConstraintsInContextSharing; protected boolean honourPropagationConstraintsInContextSharing;
/**
* Instances affected by addToContext/removeFromContext
*/
protected Map<UUID,JsonNode> affectedInstances;
@Override
public Map<UUID,JsonNode> getAffectedInstances() {
return affectedInstances;
}
@Override
public void setAffectedInstances(Map<UUID,JsonNode> affectedInstances) {
this.affectedInstances = affectedInstances;
}
@Override
public void setSourceSecurityContext(SecurityContext sourceSecurityContext) {
this.sourceSecurityContext = sourceSecurityContext;
}
@Override
public SecurityContext getSourceSecurityContext() {
return sourceSecurityContext;
}
@Override @Override
public void setTargetSecurityContext(SecurityContext targetSecurityContext) { public void setTargetSecurityContext(SecurityContext targetSecurityContext) {
this.targetSecurityContext = targetSecurityContext; this.targetSecurityContext = targetSecurityContext;
} }
@Override
public SecurityContext getTargetSecurityContext() {
return sourceSecurityContext;
}
public boolean isDryRunContextSharing() { public boolean isDryRunContextSharing() {
return dryRunContextSharing; return dryRunContextSharing;
} }
@ -133,6 +168,16 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
public final PropagationConstraint defaultPropagationConstraint; public final PropagationConstraint defaultPropagationConstraint;
/*
public boolean isAvailableOnContext(SecurityContext securityContext) {
try {
return securityContext.isElementInContext(element);
} catch (ResourceRegistryException e) {
return false;
}
}
*/
protected RelationManagement(AccessType accessType, Class<? extends Entity> targetEntityClass, PropagationConstraint defaultPropagationConstraint) { protected RelationManagement(AccessType accessType, Class<? extends Entity> targetEntityClass, PropagationConstraint defaultPropagationConstraint) {
super(accessType, Resource.class, targetEntityClass); super(accessType, Resource.class, targetEntityClass);
this.defaultPropagationConstraint = defaultPropagationConstraint; this.defaultPropagationConstraint = defaultPropagationConstraint;
@ -159,7 +204,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
} catch(NotFoundException e) { } catch(NotFoundException e) {
try { try {
retrieveElementFromAnyContext(); retrieveElementFromAnyContext();
throw getSpecificERAvailableInAnotherContextException(typeName == null ? accessType.getName() throw getSpecificAvailableInAnotherContextException(typeName == null ? accessType.getName()
: typeName + " with UUID " + uuid + " is available in another " : typeName + " with UUID " + uuid + " is available in another "
+ Context.class.getSimpleName()); + Context.class.getSimpleName());
} catch(AvailableInAnotherContextException e1) { } catch(AvailableInAnotherContextException e1) {
@ -797,7 +842,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
continue; continue;
} }
RelationManagement<T, TET> relationManagement = ElementManagementUtility.getRelationManagement(getWorkingContext(), RelationManagement<T, TET> relationManagement = (RelationManagement<T, TET>) ElementManagementUtility.getRelationManagement(getWorkingContext(),
oDatabaseDocument, edge); oDatabaseDocument, edge);
visitedSourceResources = relationManagement.fullSerialize(visitedSourceResources); visitedSourceResources = relationManagement.fullSerialize(visitedSourceResources);
} }

View File

@ -144,7 +144,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
return element; return element;
} catch (NotFoundException e) { } catch (NotFoundException e) {
throw getSpecificElementNotFoundException(e); throw getSpecificNotFoundException(e);
} catch (ResourceRegistryException e) { } catch (ResourceRegistryException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
@ -182,12 +182,12 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
} }
@Override @Override
protected NotFoundException getSpecificElementNotFoundException(NotFoundException e) { protected NotFoundException getSpecificNotFoundException(NotFoundException e) {
return new SchemaNotFoundException(e.getMessage(), e.getCause()); return new SchemaNotFoundException(e.getMessage(), e.getCause());
} }
@Override @Override
protected AlreadyPresentException getSpecificERAlreadyPresentException(String message) { protected AlreadyPresentException getSpecificAlreadyPresentException(String message) {
return new SchemaAlreadyPresentException(message); return new SchemaAlreadyPresentException(message);
} }

View File

@ -151,7 +151,7 @@ public class PropertyTypeDefinitionManagement extends ElementManagement<OElement
return element; return element;
} catch(NotFoundException e) { } catch(NotFoundException e) {
throw getSpecificElementNotFoundException(e); throw getSpecificNotFoundException(e);
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
@ -183,12 +183,12 @@ public class PropertyTypeDefinitionManagement extends ElementManagement<OElement
} }
@Override @Override
protected NotFoundException getSpecificElementNotFoundException(NotFoundException e) { protected NotFoundException getSpecificNotFoundException(NotFoundException e) {
return new SchemaNotFoundException(e.getMessage(), e.getCause()); return new SchemaNotFoundException(e.getMessage(), e.getCause());
} }
@Override @Override
protected AlreadyPresentException getSpecificERAlreadyPresentException(String message) { protected AlreadyPresentException getSpecificAlreadyPresentException(String message) {
return new SchemaAlreadyPresentException(message); return new SchemaAlreadyPresentException(message);
} }

View File

@ -180,7 +180,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
return element; return element;
} catch (NotFoundException e) { } catch (NotFoundException e) {
throw getSpecificElementNotFoundException(e); throw getSpecificNotFoundException(e);
} catch (ResourceRegistryException e) { } catch (ResourceRegistryException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
@ -194,12 +194,12 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
} }
@Override @Override
protected NotFoundException getSpecificElementNotFoundException(NotFoundException e) { protected NotFoundException getSpecificNotFoundException(NotFoundException e) {
return new SchemaNotFoundException(e.getMessage(), e.getCause()); return new SchemaNotFoundException(e.getMessage(), e.getCause());
} }
@Override @Override
protected AlreadyPresentException getSpecificERAlreadyPresentException(String message) { protected AlreadyPresentException getSpecificAlreadyPresentException(String message) {
return new SchemaAlreadyPresentException(message); return new SchemaAlreadyPresentException(message);
} }