From 43ab26fcce7bf54a72ce256195cdcdda31ded6e9 Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Tue, 18 Sep 2012 15:37:00 -0700 Subject: [PATCH] CSPACE-5440,CSPACE-5509: Fully integrate relationshipMetaType field into the services, including reading and that field's value from, and emitting that value in, lists of relations records. --- .../collectionobject-hierarchy-csid.xml | 24 +++++++++++++++++-- ...nobject-create-with-parent-child-csids.xml | 1 + ...nobject-update-with-parent-child-csids.xml | 3 ++- .../res/relationship-metatype.res.xml | 20 ++++++++++++++++ .../common/relation/RelationJAXBSchema.java | 2 ++ .../java/RemoteDocumentModelHandlerImpl.java | 1 + .../src/main/resources/relations_common.xsd | 1 + .../resources/schemas/relations_common.xsd | 1 + .../nuxeo/RelationDocumentModelHandler.java | 4 +++- 9 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/res/relationship-metatype.res.xml diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-csid.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-csid.xml index bd3868c8a..b9c62eff2 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-csid.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/collectionobject-hierarchy-csid.xml @@ -94,7 +94,7 @@ CSPACE-5518-WhiteRook ${CreateBagOfWhiteChessPieces.CSID} - + 201 @@ -200,6 +200,7 @@ CSPACE-5518-BagOfBlackChessPieces ${CreateChessSetBox.CSID} ${CreateBlackQueen.CSID} + Item in a set @@ -228,6 +229,7 @@ ${CreateBagOfBlackChessPieces.CSID} ${CreateBlackRookFragment1.CSID} ${CreateBlackRookFragment2.CSID} + set 200 @@ -431,7 +433,25 @@ /document/*[local-name()='relations-common-list'] - + + + + + + + GET + /cspace-services/relations?sbj=${CreateBlackQueen.CSID}&obj=${CreateBagOfBlackChessPieces.CSID} + 200 + + + collectionobject/hierarchy/res/relationship-metatype.res.xml + + ${CreateBagOfBlackChessPieces.relationshipMetaType} + ${CreateBagOfBlackChessPieces.CSID} + ${CreateBlackQueen.CSID} + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/3-collectionobject-create-with-parent-child-csids.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/3-collectionobject-create-with-parent-child-csids.xml index 26fe85060..9d5c7fda4 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/3-collectionobject-create-with-parent-child-csids.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/3-collectionobject-create-with-parent-child-csids.xml @@ -52,6 +52,7 @@ ${itemCSID} CollectionObject + ${relationshipMetaType} diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/4-collectionobject-update-with-parent-child-csids.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/4-collectionobject-update-with-parent-child-csids.xml index b8c2620e2..231361814 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/4-collectionobject-update-with-parent-child-csids.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/4-collectionobject-update-with-parent-child-csids.xml @@ -27,7 +27,8 @@ ${parentCSID} CollectionObject - + ${relationshipMetaType} + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/res/relationship-metatype.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/res/relationship-metatype.res.xml new file mode 100644 index 000000000..004b47967 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy/res/relationship-metatype.res.xml @@ -0,0 +1,20 @@ + + + 0 + 1 + 1 + + + ${relationshipMetaType} + hasBroader + + ${childCSID} + CollectionObject + + + ${parentCSID} + CollectionObject + + + + diff --git a/services/common/src/main/java/org/collectionspace/services/common/relation/RelationJAXBSchema.java b/services/common/src/main/java/org/collectionspace/services/common/relation/RelationJAXBSchema.java index c28d367c5..713c546d2 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/relation/RelationJAXBSchema.java +++ b/services/common/src/main/java/org/collectionspace/services/common/relation/RelationJAXBSchema.java @@ -44,6 +44,8 @@ public interface RelationJAXBSchema { /** The Constant RELATIONSHIP_TYPE_DISPLAYNAME. */ final static String RELATIONSHIP_TYPE_DISPLAYNAME = "predicateDisplayName"; + + final static String RELATIONSHIP_META_TYPE = "relationshipMetaType"; final static String SUBJECT_URI = "subjectUri"; final static String SUBJECT_CSID = "subjectCsid"; diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java index f598d597d..075c24c8a 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java @@ -1047,6 +1047,7 @@ public abstract class RemoteDocumentModelHandlerImpl rc.setObjectRefName(itemObject.getRefName()); rc.setRelationshipType(item.getPredicate()); + rc.setRelationshipMetaType(item.getRelationshipMetaType()); //RelationshipType foo = (RelationshipType.valueOf(item.getPredicate())) ; //rc.setPredicate(foo); //this must be one of the type found in the enum in services/jaxb/src/main/resources/relations_common.xsd diff --git a/services/jaxb/src/main/resources/relations_common.xsd b/services/jaxb/src/main/resources/relations_common.xsd index af01c9a15..e17ac254c 100644 --- a/services/jaxb/src/main/resources/relations_common.xsd +++ b/services/jaxb/src/main/resources/relations_common.xsd @@ -103,6 +103,7 @@ + diff --git a/services/relation/3rdparty/nuxeo-platform-cs-relation/src/main/resources/schemas/relations_common.xsd b/services/relation/3rdparty/nuxeo-platform-cs-relation/src/main/resources/schemas/relations_common.xsd index 3872f7268..640e785c9 100644 --- a/services/relation/3rdparty/nuxeo-platform-cs-relation/src/main/resources/schemas/relations_common.xsd +++ b/services/relation/3rdparty/nuxeo-platform-cs-relation/src/main/resources/schemas/relations_common.xsd @@ -62,6 +62,7 @@ + diff --git a/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java b/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java index dc5f1ad3e..2b5e22c14 100644 --- a/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java +++ b/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java @@ -227,7 +227,7 @@ public class RelationDocumentModelHandler @Override public RelationsCommonList extractCommonPartList(DocumentWrapper wrapDoc) throws Exception { RelationsCommonList relList = this.extractPagingInfo(new RelationsCommonList(), wrapDoc); - relList.setFieldsReturned("subjectCsid|relationshipType|predicateDisplayName|objectCsid|uri|csid|subject|object"); + relList.setFieldsReturned("subjectCsid|relationshipType|predicateDisplayName|relationshipMetaType|objectCsid|uri|csid|subject|object"); ServiceContext ctx = getServiceContext(); String serviceContextPath = getServiceContextPath(); @@ -273,6 +273,8 @@ public class RelationDocumentModelHandler relationListItem.setPredicateDisplayName((String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.RELATIONSHIP_TYPE_DISPLAYNAME)); + relationListItem.setRelationshipMetaType((String) docModel.getProperty(ctx.getCommonPartLabel(), + RelationJAXBSchema.RELATIONSHIP_META_TYPE)); relationListItem.setObjectCsid((String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.OBJECT_CSID)); -- 2.47.3