]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-3739 Updated schema, query paramters, POST behavior, and chaining of ServiceCo...
authorLaramie Crocker <laramie@berkeley.edu>
Thu, 21 Apr 2011 08:48:01 +0000 (08:48 +0000)
committerLaramie Crocker <laramie@berkeley.edu>
Thu, 21 Apr 2011 08:48:01 +0000 (08:48 +0000)
services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplay.java
services/IntegrationTests/src/main/java/org/collectionspace/services/IntegrationTests/xmlreplay/XmlReplayEval.java
services/IntegrationTests/src/test/resources/test-data/xmlreplay/dev-master.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/person.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_w_relations_POST.xml [new file with mode: 0755]
services/authority/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
services/common-api/src/main/java/org/collectionspace/services/common/api/CommonAPI.java
services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java
services/jaxb/src/main/resources/relations_common.xsd
services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationValidatorHandler.java

index 89807bf87489e3add4655fc22ec15cc880429915..ae1a9178e52dcbb1949e0cf1e5a76e22fe2f5e17 100755 (executable)
@@ -562,7 +562,7 @@ public class XmlReplay {
 \r
         for (Node testgroup : testgroupNodes) {\r
 \r
-            JexlContext jc = new MapContext();  //Get a new JexlContext for each test group.\r
+            XmlReplayEval.MapContextWKeys jc = new XmlReplayEval.MapContextWKeys();//MapContext();  //Get a new JexlContext for each test group.\r
             evalStruct.jc = jc;\r
 \r
             autoDeletePOSTS = testgroup.valueOf("@autoDeletePOSTS");\r
index a9ece6858e781c5d965af1599c47f31dc1c1cba6..2662413b2fb089d6ac00c5053138f90e02aa4009 100755 (executable)
@@ -25,8 +25,12 @@ package org.collectionspace.services.IntegrationTests.xmlreplay;
 import org.apache.commons.jexl2.Expression;\r
 import org.apache.commons.jexl2.JexlContext;\r
 import org.apache.commons.jexl2.JexlEngine;\r
+import org.apache.commons.jexl2.MapContext;\r
 \r
+import java.util.HashMap;\r
+import java.util.List;\r
 import java.util.Map;\r
+import java.util.Set;\r
 \r
 /**\r
  * User: laramie\r
@@ -113,8 +117,8 @@ public class XmlReplayEval {
             Object resultObj = expr.evaluate(jc);\r
             String resultStr;\r
             if (null == resultObj){\r
-                resultStr = "ERROR";\r
-                System.out.println("Jexl context: "+jc.toString());\r
+                //debug: System.out.println("null found while evaluationg variable: '"+var+"' Jexl context: "+dumpContext(jc));\r
+                resultStr = "${"+var+"}";\r
             } else {\r
                 resultStr = resultObj.toString();\r
 \r
@@ -124,4 +128,23 @@ public class XmlReplayEval {
         return result.toString();\r
     }\r
 \r
+    protected static String dumpContext(JexlContext jc){\r
+        String result = "";\r
+        if (jc instanceof MapContextWKeys){\r
+            Set keys = ((MapContextWKeys)jc).getKeys();\r
+            result = keys.toString();\r
+        }  else {\r
+            result = jc.toString();\r
+        }\r
+        return result;\r
+    }\r
+\r
+    public static class MapContextWKeys extends MapContext implements JexlContext {\r
+        private Map<String,Object> map = new HashMap();\r
+        public Set getKeys(){\r
+            return this.map.keySet();\r
+        }\r
+    }\r
+\r
+\r
 }\r
index 6e6303ccfe4872f544aa2fe0963d3defd25f0f03..dfd9c1c4b7826a6bad56846d29f4eb2ccbc0db18 100644 (file)
     <run controlFile="person/person.xml" testGroup="updatePerson" />\r
     <run controlFile="person/person.xml" testGroup="updatePerson" />\r
     <run controlFile="relation/relation.xml" testGroup="makeRelations" />\r
-     <run controlFile="person/person.xml" testGroup="updatePerson" />\r
+\r
+    <run controlFile="person/person.xml" testGroup="updatePerson" autoDeletePOSTS="true"  />\r
+    <run controlFile="person/person.xml" testGroup="updatePerson" autoDeletePOSTS="true"  />\r
+   <run controlFile="relation/relation.xml" testGroup="makeRelations" />\r
+     \r
+   <run controlFile="person/person.xml" testGroup="postPerson" />\r
     -->\r
+    <!-- TODO: make this an override: autoDeletePOSTS="true"-->\r
    \r
     \r
 </xmlReplayMaster>\r
index e911c554b6866c329dc08b1d99b5ef595fbdb9d7..e26e11267e8d857b69bac0216bfea152c1430b3c 100755 (executable)
         \r
         <test ID="GETPersonPUT_1p2c">\r
             <method>GET</method>\r
-            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}</uri>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}?showRelations=true</uri>\r
         </test>\r
         \r
            <test ID="PersonPUT_1p">\r
         \r
         <test ID="GETPersonPUT_1p">\r
             <method>GET</method>\r
-            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}</uri>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}?showRelations=true</uri>\r
         </test>\r
         \r
       \r
         \r
         <test ID="GETPersonPUT_1p1c">\r
             <method>GET</method>\r
-            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}</uri>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}?showRelations=true</uri>\r
         </test>\r
       \r
            <test ID="PersonPUT_2c">\r
         \r
         <test ID="GETPersonPUT_2c">\r
             <method>GET</method>\r
-            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}</uri>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}?showRelations=true</uri>\r
         </test>\r
        </testGroup>\r
+       \r
+       !-- ========================= POST a person ===================================================== -->\r
+       \r
+       <testGroup ID="postPerson" autoDeletePOSTS="true">\r
+           <test ID="PersonAuth1" auth="admin@collectionspace.org">\r
+            <method>POST</method>\r
+            <uri>/cspace-services/personauthorities/</uri>\r
+            <filename>person/personauthorities_common.xml</filename>\r
+            <vars>\r
+               <var ID="authShortIdentifier">CSPACE3739PersonAuthority</var>\r
+            </vars>\r
+        </test>\r
+        \r
+        <test ID="PersonParent">\r
+            <method>POST</method>\r
+            <uri>/cspace-services/personauthorities/urn:cspace:name(CSPACE3739PersonAuthority)/items/</uri>\r
+            <filename>person/persons_common.xml</filename>\r
+            <vars>\r
+               <var ID="inAuthority">${PersonAuth1.CSID}</var>\r
+               <var ID="authShortIdentifier">CSPACE3739PersonAuthority</var>\r
+               <var ID="shortIdentifier">johnWayneActorParent</var>\r
+            </vars>\r
+        </test>\r
+        \r
+        <test ID="PersonChild">\r
+            <method>POST</method>\r
+            <uri>/cspace-services/personauthorities/urn:cspace:name(CSPACE3739PersonAuthority)/items/</uri>\r
+            <filename>person/persons_common.xml</filename>\r
+            <vars>\r
+               <var ID="inAuthority">${PersonAuth1.CSID}</var>\r
+               <var ID="authShortIdentifier">CSPACE3739PersonAuthority</var>\r
+               <var ID="shortIdentifier">johnWayneActorChild</var>\r
+            </vars>\r
+        </test>\r
+        \r
+        <test ID="PersonChild2">\r
+            <method>POST</method>\r
+            <uri>/cspace-services/personauthorities/urn:cspace:name(CSPACE3739PersonAuthority)/items/</uri>\r
+            <filename>person/persons_common.xml</filename>\r
+            <vars>\r
+               <var ID="inAuthority">${PersonAuth1.CSID}</var>\r
+               <var ID="authShortIdentifier">CSPACE3739PersonAuthority</var>\r
+               <var ID="shortIdentifier">johnWayneActorChild2</var>\r
+            </vars>\r
+        </test>\r
+        \r
+        <test ID="Person1">\r
+            <method>POST</method>\r
+            <uri>/cspace-services/personauthorities/urn:cspace:name(CSPACE3739PersonAuthority)/items/</uri>\r
+            <filename>person/persons_common_w_relations_POST.xml</filename>\r
+            <vars>\r
+               <var ID="inAuthority">${PersonAuth1.CSID}</var>\r
+               <var ID="authShortIdentifier">CSPACE3739PersonAuthority</var>\r
+               <var ID="shortIdentifier">johnWayneActor</var>\r
+               <var ID="CSID">${itemCSID}</var>\r
+               <var ID="parentCSID">${PersonParent.CSID}</var>\r
+               <var ID="childCSID">${PersonChild.CSID}</var>\r
+               <var ID="child2CSID">${PersonChild2.CSID}</var>\r
+            </vars>\r
+        </test>\r
+        \r
+           <test ID="GETpostPerson">\r
+            <method>GET</method>\r
+            <uri>/cspace-services/personauthorities/${PersonAuth1.CSID}/items/${Person1.CSID}?showRelations=true</uri>\r
+        </test>\r
+        \r
+       </testGroup>\r
 </xmlReplay>\r
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_w_relations_POST.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/person/persons_common_w_relations_POST.xml
new file mode 100755 (executable)
index 0000000..7d75d8b
--- /dev/null
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<document name="persons">\r
+  <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:ns3="http://collectionspace.org/services/jaxb">\r
+    <inAuthority>${inAuthority}</inAuthority>\r
+    <shortIdentifier>${shortIdentifier}</shortIdentifier>\r
+    <refName>urn:cspace:org.collectionspace.demo:personauthority:name(${authShortIdentifier}):person:name(${shortIdentifier})'John Wayne'</refName>\r
+    <displayName>John Wayne</displayName>\r
+    <displayNameComputed>false</displayNameComputed>\r
+    <shortDisplayName>JohnWayne</shortDisplayName>\r
+    <shortDisplayNameComputed>false</shortDisplayNameComputed>\r
+    <foreName>John</foreName>\r
+    <surName>Wayne</surName>\r
+    <birthDate>May 26, 1907</birthDate>\r
+    <deathDate>June 11, 1979</deathDate>\r
+    <birthPlace>Winterset, Iowa</birthPlace>\r
+    <groups>\r
+      <group>Irish</group>\r
+      <group>Scottish</group>\r
+    </groups>\r
+    <gender>male</gender>\r
+    <bioNote>born Marion Robert Morrison and betterknown by his stage name John Wayne, was an American film actor, director and producer. He epitomized rugged masculinity and has become an enduring American icon. He is famous for his distinctive\r
+    voice, walk and height. He was also known for his conservative political views and his support in the 1950s for anti-communist positions.</bioNote>\r
+  </ns2:persons_common>\r
+  \r
+  <ns3:relations-common-list xmlns:ns3="http://collectionspace.org/services/relation" xmlns:ns2="http://collectionspace.org/services/jaxb">\r
+    <pageNum>0</pageNum>\r
+    <pageSize>40</pageSize>\r
+    <itemsInPage>1</itemsInPage>\r
+    <totalItems>1</totalItems>\r
+    <fieldsReturned>subjectCsid|relationshipType|predicateDisplayName|objectCsid|uri|csid|subject|object</fieldsReturned>\r
+    <relation-list-item>\r
+               <predicate>hasBroader</predicate>\r
+               <subject>\r
+                 <csid>${itemCSID}</csid>\r
+                 <documentType>Person</documentType>\r
+                 <name>John Wayne, Me</name>\r
+               </subject>\r
+               <object>\r
+                 <csid>${parentCSID}</csid>\r
+                 <documentType>Person</documentType>\r
+                 <name>John Wayne 2, the evil twin, Parent</name>\r
+               </object>\r
+       </relation-list-item>\r
+       <relation-list-item>\r
+               <predicate>hasBroader</predicate>\r
+               <subject>\r
+                 <csid>${childCSID}</csid>\r
+                 <documentType>Person</documentType>\r
+                 <name>John Wayne 2, the evil twin, child</name>\r
+               </subject>\r
+               <object>\r
+                 <csid>${itemCSID}</csid>\r
+                 <documentType>Person</documentType>\r
+                 <name>John Wayne</name>\r
+               </object>\r
+       </relation-list-item>\r
+       <relation-list-item>\r
+               <predicate>hasBroader</predicate>\r
+               <subject>\r
+                 <csid>${child2CSID}</csid>\r
+                 <documentType>Person</documentType>\r
+                 <name>John Wayne 2, the evil twin, child</name>\r
+               </subject>\r
+               <object>\r
+                 <csid>${itemCSID}</csid>\r
+                 <documentType>Person</documentType>\r
+                 <name>John Wayne</name>\r
+               </object>\r
+       </relation-list-item>\r
+  </ns3:relations-common-list>\r
+</document>\r
+\r
+\r
index eb5a0511c3a40bde042a140ca5c2159190b41c81..6ca1012de64a49cac4d602d40f5411b2ef685bfa 100644 (file)
@@ -36,6 +36,7 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.RelationClient;
 //import org.collectionspace.services.common.authority.AuthorityItemRelations;
+import org.collectionspace.services.common.api.CommonAPI;
 import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.context.MultipartServiceContext;
 import org.collectionspace.services.common.context.ServiceContext;
@@ -54,6 +55,7 @@ import org.nuxeo.ecm.core.api.DocumentModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.management.relation.Relation;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriInfo;
 
@@ -198,16 +200,32 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon, AICommonList>
             throws Exception {
         MultipartServiceContext ctx = (MultipartServiceContext) getServiceContext();
         super.extractAllParts(wrapDoc);
-
-        String thisCSID = NuxeoUtils.getCsid(wrapDoc.getWrappedObject());
-
-        //TODO: add broader, etc. here.
-        String predicate = RelationshipType.HAS_BROADER.value();
-        RelationsCommonList relationsCommonList = getRelations(thisCSID, null, predicate);
-        if (relationsCommonList.getTotalItems() == 0){
-            relationsCommonList = getRelations(null, thisCSID, predicate);   //for development... try switching subject and object.  This is not correct, though.
+         String showRelations = ctx.getQueryParams().getFirst(CommonAPI.showRelations_QP);
+         if (!Tools.isTrue(showRelations)){
+             return;
+         }
+         String thisCSID = NuxeoUtils.getCsid(wrapDoc.getWrappedObject());
+
+         String predicate = RelationshipType.HAS_BROADER.value();
+         RelationsCommonList parentListOuter = getRelations(thisCSID, null, predicate);
+         List<RelationsCommonList.RelationListItem> parentList = parentListOuter.getRelationListItem();
+
+         RelationsCommonList childrenListOuter = getRelations(null, thisCSID, predicate);
+         List<RelationsCommonList.RelationListItem> childrenList = childrenListOuter.getRelationListItem();
+
+         //Assume that there are more children than parents.  Will be true for parent/child, but maybe not for other relations.
+         //Now add all parents to our childrenList, to be able to return just one list of consolidated results.
+         //Not optimal, but that's the current design spec.
+        long added = 0;
+        for (RelationsCommonList.RelationListItem parent : parentList) {
+             childrenList.add(parent);
+             added++;
         }
-        PayloadOutputPart relationsPart = new PayloadOutputPart(RelationClient.SERVICE_COMMON_LIST_NAME, relationsCommonList);
+        long childrenSize = childrenList.size();
+        childrenListOuter.setTotalItems(childrenSize);
+        childrenListOuter.setItemsInPage(childrenListOuter.getItemsInPage()+added);
+
+        PayloadOutputPart relationsPart = new PayloadOutputPart(RelationClient.SERVICE_COMMON_LIST_NAME, childrenListOuter);
         ctx.addOutputPart(relationsPart);
     }
 
@@ -252,14 +270,16 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon, AICommonList>
     public RelationsCommonList updateRelations(String itemCSID, PoxPayloadIn input) throws Exception {
         PayloadInputPart part = input.getPart(RelationClient.SERVICE_COMMON_LIST_NAME);        //input.getPart("relations_common");
         if (part == null) {
-            System.out.println("Nothing to do in updateRelations: " + input);
+            //System.out.println("Nothing to do in updateRelations: " + input);
             return null;
         }
         RelationsCommonList relationsCommonListBody = (RelationsCommonList) part.getBody();
 
         ServiceContext ctx = getServiceContext();
-        MultivaluedMap queryParams = ctx.getQueryParams();
-       String predicate = RelationshipType.HAS_BROADER.value();
+        UriInfo uriInfo = ctx.getUriInfo();
+        MultivaluedMap queryParams = uriInfo.getQueryParameters();
+
+        String predicate = RelationshipType.HAS_BROADER.value();
         queryParams.putSingle(IRelationsManager.PREDICATE_QP, predicate);
         queryParams.putSingle(IRelationsManager.SUBJECT_QP, null);
         queryParams.putSingle(IRelationsManager.SUBJECT_TYPE_QP, null);
@@ -297,7 +317,15 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon, AICommonList>
         List<RelationsCommonList.RelationListItem> parentList = parentListOuter.getRelationListItem();
 
         for (RelationsCommonList.RelationListItem inboundItem : inboundList) {
-            if (inboundItem.getObjectCsid().equals(itemCSID) && inboundItem.getPredicate().equals(HAS_BROADER)){
+            if (inboundItem.getObject().getCsid().equalsIgnoreCase(CommonAPI.AuthorityItemCSID_REPLACE)){
+                inboundItem.setObjectCsid(itemCSID);
+                inboundItem.getObject().setCsid(itemCSID);
+            }
+            if (inboundItem.getSubject().getCsid().equalsIgnoreCase(CommonAPI.AuthorityItemCSID_REPLACE)){
+                inboundItem.setSubjectCsid(itemCSID);
+                inboundItem.getSubject().setCsid(itemCSID);
+            }
+            if (inboundItem.getObject().getCsid().equals(itemCSID) && inboundItem.getPredicate().equals(HAS_BROADER)) {
                 //then this is an item that says we have a child.
                 RelationsCommonList.RelationListItem childItem = findInList(childList, inboundItem);
                 if (childItem != null){
@@ -305,7 +333,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon, AICommonList>
                 } else {
                     actionList.add(inboundItem);   //doesn't exist as a child, but is a child.  Add to additions list
                 }
-            } else if  (inboundItem.getSubjectCsid().equals(itemCSID) && inboundItem.getPredicate().equals(HAS_BROADER)) {
+            } else if  (inboundItem.getSubject().getCsid().equals(itemCSID) && inboundItem.getPredicate().equals(HAS_BROADER)) {
                 //then this is an item that says we have a parent
                 RelationsCommonList.RelationListItem parentItem = findInList(parentList, inboundItem);
                 if (parentItem != null){
@@ -314,12 +342,12 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon, AICommonList>
                     actionList.add(inboundItem);   //doesn't exist as a parent, but is a parent. Add to additions list
                 }
             }  else {
+
                 System.out.println("\r\n\r\n================\r\n    Element didn't match parent or child, but may have partial fields that match. inboundItem: "+inboundItem);
                 //not dealing with: hasNarrower or any other predicate.
-
             }
         }
-        deleteRelations(parentList, ctx);
+        deleteRelations(parentList, ctx);               //todo: there are items appearing on both lists....april 20.
         deleteRelations(childList, ctx);
         createRelations(actionList, ctx);
 
@@ -328,19 +356,27 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon, AICommonList>
 
     private void createRelations(List<RelationsCommonList.RelationListItem> inboundList, ServiceContext ctx){
          for (RelationsCommonList.RelationListItem item : inboundList) {
-            RelationsCommon rc = new RelationsCommon();
-            //rc.setCsid(item.getCsid());
-            rc.setDocumentId1(item.getSubjectCsid());
-            rc.setDocumentId2(item.getObjectCsid());
-            rc.setRelationshipType(item.getPredicate());
-            //todo: is an enum:  rc.setPredicate(item.getPredicate());
-            rc.setDocumentType1(item.getSubject().getDocumentType());
-            rc.setDocumentType2(item.getObject().getDocumentType());
+             RelationsCommon rc = new RelationsCommon();
+             //rc.setCsid(item.getCsid());
+             String itemCsid =  item.getSubject().getCsid();
+             rc.setDocumentId1(itemCsid);
+             rc.setSubjectCsid(itemCsid);
+
+             String objCsid = item.getObject().getCsid();
+             rc.setDocumentId2(objCsid);
+             rc.setObjectCsid(objCsid);
+
+             rc.setRelationshipType(item.getPredicate());
+             //RelationshipType  foo = (RelationshipType.valueOf(item.getPredicate())) ;
+             //rc.setPredicate(foo);
+
+             rc.setDocumentType1(item.getSubject().getDocumentType());
+             rc.setDocumentType2(item.getObject().getDocumentType());
 
             PoxPayloadOut payloadOut = new PoxPayloadOut(RelationClient.SERVICE_PAYLOAD_NAME);
             PayloadOutputPart outputPart = new PayloadOutputPart(RelationClient.SERVICE_COMMONPART_NAME, rc);
             payloadOut.addPart(outputPart);
-            System.out.println("\r\n==== TO CREATE: "+rc.getDocumentId1()+"==>"+rc.getPredicate()+"==>"+rc.getDocumentId2());
+            //System.out.println("\r\n==== TO CREATE: "+rc.getDocumentId1()+"==>"+rc.getPredicate()+"==>"+rc.getDocumentId2());
             RelationResource relationResource = new RelationResource();
             Object res = relationResource.create(ctx.getUriInfo(), payloadOut.toXML());    //NOTE ui recycled from above to pass in unknown query params.
         }
@@ -349,7 +385,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon, AICommonList>
           try {
               for (RelationsCommonList.RelationListItem inboundItem : list) {
                   RelationResource relationResource = new RelationResource();
-                  System.out.println("\r\n==== TO DELETE: "+inboundItem.getCsid());
+                  //System.out.println("\r\n==== TO DELETE: "+inboundItem.getCsid());
                   Object res = relationResource.delete(inboundItem.getCsid());
               }
           } catch (Throwable t){
@@ -382,12 +418,17 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon, AICommonList>
         if (item==null || item2==null){
             return false;
         }
-        return     (item.getSubjectCsid().equals(item2.getSubjectCsid()))
-                && (item.getObjectCsid().equals(item2.getObjectCsid()))
+        RelationsDocListItem subj1 = item.getSubject();
+        RelationsDocListItem subj2 = item2.getSubject();
+        RelationsDocListItem obj1 = item.getObject();
+        RelationsDocListItem obj2 = item2.getObject();
+
+        return     (subj1.getCsid().equals(subj2.getCsid()))
+                && (obj1.getCsid().equals(obj1.getCsid()))
                 && ( (item.getPredicate().equals(item2.getPredicate()))
                 && (item.getRelationshipType().equals(item2.getRelationshipType()))   )
-                && (item.getObject().getDocumentType().equals(item2.getObject().getDocumentType()))
-                && (item.getSubject().getDocumentType().equals(item2.getSubject().getDocumentType())) ;
+                && (obj1.getDocumentType().equals(obj2.getDocumentType()))
+                && (subj1.getDocumentType().equals(subj2.getDocumentType())) ;
     }
 
      private void removeFromList(List<RelationsCommonList.RelationListItem> list, RelationsCommonList.RelationListItem item){
index c4cba8ac41369c0528c742a5d933f6c7367c6243..d08232e0b5882c590d2356cd9d3bff6d517cdc6a 100755 (executable)
@@ -10,5 +10,7 @@ public class CommonAPI {
     public static String getVersionString(){\r
         return COMMON_API;\r
     }\r
+    public static String AuthorityItemCSID_REPLACE="${itemCSID}";\r
+    public static String showRelations_QP = "showRelations";\r
 }\r
 \r
index 891fac1c74891b46cd18809725ae22287966b868..2f3798e3f2a870aab159d789eafdddbd34ef52b4 100644 (file)
@@ -593,6 +593,12 @@ public abstract class AbstractServiceContextImpl<IT, OT>
      */
     @Override
     public MultivaluedMap<String, String> getQueryParams() {
+
+         if (queryParams == null){
+              if (this.uriInfo != null){
+                queryParams = this.uriInfo.getQueryParameters();
+            }
+         }
          if (queryParams == null){
              queryParams = new org.jboss.resteasy.specimpl.MultivaluedMapImpl<String,String>();
         }
index 2f03cf8e13e38bde919fe7253c39092d8a2e9bed..32e60ad90f6f3d38000ed47cc8df099ab9f128fa 100644 (file)
             <xs:element name="number" type="xs:string" minOccurs="1"/>\r
             <xs:element name="documentType" type="xs:string" minOccurs="1"/>\r
             <xs:element name="documentTypeFromModel" type="xs:string" minOccurs="1"/>\r
+            <!-- order is for potential use by app/gui.  services won't do anything with it.-->\r
+            <xs:element name="order" type="xs:string" minOccurs="0"/>\r
+            <!-- key is for things like -which predicate type search did this list come from-->\r
+            <xs:element name="key" type="xs:string" minOccurs="0"/>\r
+            <!-- error is filled in and present only when sercices has crawled this record, and found that the related item was not in DB.-->\r
             <xs:element name="error" type="xs:string" minOccurs="0"/>\r
         </xs:sequence>\r
     </xs:complexType>\r
@@ -90,7 +95,6 @@
                         <xs:element name="relation-list-item" maxOccurs="unbounded">\r
                             <xs:complexType>\r
                                 <xs:sequence>\r
-                                    <!-- uri to retrieve collection object details -->\r
                                     <xs:element name="uri" type="xs:anyURI" minOccurs="1"/>\r
                                     <xs:element name="csid" type="xs:string" minOccurs="1"/>\r
                                     <xs:element name="subjectCsid" type="xs:string" minOccurs="1"/>\r
index c59509d1fb26c77428e4c795f861a68bfc06ba54..e1bc98dad60c220a61e1b6ab76f8ca5bcc16bb28 100644 (file)
@@ -50,8 +50,7 @@ public class RelationValidatorHandler extends ValidatorHandlerImpl<PoxPayloadIn,
                //\r
                // Assert that the Subject ID and Predicate ID are not the same\r
                //\r
-               assert(relationsCommon.getDocumentId1().equalsIgnoreCase(relationsCommon.getDocumentId2()) == false) :\r
-                       SUBJECT_EQUALS_PREDICATE_ERROR;\r
+               assert(relationsCommon.getDocumentId1().equalsIgnoreCase(relationsCommon.getDocumentId2()) == false) :  SUBJECT_EQUALS_PREDICATE_ERROR;\r
        } catch (AssertionError e) {\r
                if (logger.isErrorEnabled() == true) {\r
                        logger.error(e.getMessage(), e);\r