RM-1813 (Not possible to create from-parent-to-child reference via add reference dialog)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@93176 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2015-01-08 17:19:33 +00:00
parent a423bafd58
commit 6452e0a0e8
3 changed files with 11 additions and 2 deletions

View File

@@ -47,6 +47,7 @@ public abstract class AbstractRmWebScript extends DeclarativeWebScript
protected static final String STORE_ID = "store_id";
protected static final String ID = "id";
protected static final String SUCCESS = "success";
protected static final String INVERT = "__invert";
/** Disposition service */
private DispositionService dispositionService;

View File

@@ -126,7 +126,15 @@ public class CustomRefPost extends AbstractRmWebScript
NodeRef target = getTargetNode(json);
NodeRef source = parseRequestForNodeRef(req);
getRelationshipService().addRelationship(uniqueName, source, target);
if (uniqueName.endsWith(INVERT))
{
String uniqueNameStem = uniqueName.split(INVERT)[0];
getRelationshipService().addRelationship(uniqueNameStem, target, source);
}
else
{
getRelationshipService().addRelationship(uniqueName, source, target);
}
}
/**

View File

@@ -104,7 +104,7 @@ public class RelationshipLabelsGet extends AbstractRmWebScript
if (RelationshipType.PARENTCHILD.equals(type))
{
relationshipLabels.add(new RelationshipLabel(sourceText, uniqueName));
relationshipLabels.add(new RelationshipLabel(sourceText, uniqueName + INVERT));
relationshipLabels.add(new RelationshipLabel(targetText, uniqueName));
}
else if (RelationshipType.BIDIRECTIONAL.equals(type))