]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-3135: Added three fields in Loan Out records to a repeatable Loaned Object...
authorAron Roberts <aron@socrates.berkeley.edu>
Fri, 12 Nov 2010 22:55:23 +0000 (22:55 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Fri, 12 Nov 2010 22:55:23 +0000 (22:55 +0000)
services/loanout/3rdparty/nuxeo-platform-cs-loanout/src/main/resources/schemas/loansout_common.xsd
services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutServiceTest.java
services/loanout/jaxb/src/main/resources/loansout-common.xsd

index b518cbb7e29e56dd7fa9131979be9b692323cb56..428076085428e60fe46017d3bf08becd0663947f 100644 (file)
     <xs:element name="lendersAuthorizer" type="xs:string"/>\r
     <xs:element name="lendersAuthorizationDate" type="xs:string"/>\r
     <xs:element name="lendersContact" type="xs:string"/>\r
-    \r
-    <!-- The three fields below were added as scalars specifically for release 0.7. -->\r
-    <!-- These fields will be removed, to be replaced by sub-loans, in a future release. -->\r
-    <xs:element name="loanedObjectStatus" type="xs:string"/>\r
-    <xs:element name="loanedObjectStatusDate" type="xs:string"/>\r
-    <xs:element name="loanedObjectStatusNote" type="xs:string"/>\r
+\r
+    <xs:element name="loanedObjectStatusGroupList" type="loanedObjectStatusGroupList"/>\r
     \r
     <xs:element name="loanOutDate" type="xs:string"/>\r
     <xs:element name="loanReturnDate" type="xs:string"/>\r
     <xs:element name="specialConditionsOfLoan" type="xs:string"/>\r
     <xs:element name="loanOutNote" type="xs:string"/>\r
     <xs:element name="loanPurpose" type="xs:string"/>\r
+\r
+    <xs:complexType name="loanedObjectStatusGroupList">\r
+        <xs:sequence>\r
+            <xs:element name="loanedObjectStatusGroup" type="loanedObjectStatusGroup" minOccurs="0" maxOccurs="unbounded"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
+\r
+    <xs:complexType name="loanedObjectStatusGroup">\r
+        <xs:sequence>\r
+            <xs:element name="loanedObjectStatus" type="xs:string"/>\r
+            <xs:element name="loanedObjectStatusDate" type="xs:string"/>\r
+            <xs:element name="loanedObjectStatusNote" type="xs:string"/>\r
+        </xs:sequence>\r
+    </xs:complexType>\r
     \r
 </xs:schema>\r
index 22d0653848dd1ffc71d0912ba8ec9af8829f5898..e1a9d90084be8f6b2bd4556904613da71caf9564 100644 (file)
@@ -29,6 +29,8 @@ import javax.ws.rs.core.Response;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.LoanoutClient;
 import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.loanout.LoanedObjectStatusGroup;
+import org.collectionspace.services.loanout.LoanedObjectStatusGroupList;
 import org.collectionspace.services.loanout.LoansoutCommon;
 import org.collectionspace.services.loanout.LoansoutCommonList;
 
@@ -298,6 +300,15 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         LoansoutCommon loanout = (LoansoutCommon) extractPart(input,
                 client.getCommonPartName(), LoansoutCommon.class);
         Assert.assertNotNull(loanout);
+        Assert.assertNotNull(loanout.getLoanOutNumber());
+        LoanedObjectStatusGroupList statusGroupList = loanout.getLoanedObjectStatusGroupList();
+        Assert.assertNotNull(statusGroupList);
+        List<LoanedObjectStatusGroup> statusGroups = statusGroupList.getLoanedObjectStatusGroup();
+        Assert.assertNotNull(statusGroups);
+        Assert.assertTrue(statusGroups.size() > 0);
+        LoanedObjectStatusGroup statusGroup = statusGroups.get(0);
+        Assert.assertNotNull(statusGroup);
+        Assert.assertNotNull(statusGroup.getLoanedObjectStatus());
     }
 
     // Failure outcomes
@@ -426,6 +437,19 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
             logger.debug("to be updated object");
             logger.debug(objectAsXmlString(loanout, LoansoutCommon.class));
         }
+        LoanedObjectStatusGroupList statusGroupList = loanout.getLoanedObjectStatusGroupList();
+        Assert.assertNotNull(statusGroupList);
+        List<LoanedObjectStatusGroup> statusGroups = statusGroupList.getLoanedObjectStatusGroup();
+        Assert.assertNotNull(statusGroups);
+        Assert.assertTrue(statusGroups.size() > 0);
+        LoanedObjectStatusGroup statusGroup = statusGroups.get(0);
+        Assert.assertNotNull(statusGroup);
+        String loanedObjectStatus = statusGroup.getLoanedObjectStatus();
+        Assert.assertNotNull(loanedObjectStatus);
+        String updatedLoanedObjectStatus = "updated-" + loanedObjectStatus;
+        statusGroups.get(0).setLoanedObjectStatus(updatedLoanedObjectStatus);
+        loanout.setLoanedObjectStatusGroupList(statusGroupList);
+
         // Submit the request to the service and store the response.
         MultipartOutput output = new MultipartOutput();
         OutputPart commonPart = output.addPart(loanout, MediaType.APPLICATION_XML_TYPE);
@@ -452,6 +476,16 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
                 loanout.getLoanReturnDate(),
                 "Data in updated object did not match submitted data.");
 
+        statusGroupList = updatedLoanout.getLoanedObjectStatusGroupList();
+        Assert.assertNotNull(statusGroupList);
+        statusGroups = statusGroupList.getLoanedObjectStatusGroup();
+        Assert.assertNotNull(statusGroups);
+        Assert.assertTrue(statusGroups.size() > 0);
+        Assert.assertNotNull(statusGroups.get(0));
+        Assert.assertEquals(updatedLoanedObjectStatus,
+                statusGroups.get(0).getLoanedObjectStatus(),
+                "Data in updated object did not match submitted data.");
+
     }
 
     // Failure outcomes
@@ -734,6 +768,13 @@ public class LoanoutServiceTest extends AbstractServiceTestImpl {
         loanout.setBorrowersContact(
             "urn:cspace:org.collectionspace.demo:personauthority:name(TestPersonAuth):person:name(Chris Contact)'Chris Contact'");
         loanout.setLoanPurpose("Allow people in cold climes to share the magic of Surfboards of the 1960s.");
+        LoanedObjectStatusGroupList statusGroupList = new LoanedObjectStatusGroupList();
+        List<LoanedObjectStatusGroup> statusGroups = statusGroupList.getLoanedObjectStatusGroup();
+        LoanedObjectStatusGroup statusGroup = new LoanedObjectStatusGroup();
+        statusGroup.setLoanedObjectStatus("returned");
+        statusGroup.setLoanedObjectStatusNote("Left under the front mat.");
+        statusGroups.add(statusGroup);
+        loanout.setLoanedObjectStatusGroupList(statusGroupList);
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart =
             multipart.addPart(loanout, MediaType.APPLICATION_XML_TYPE);
index df1b4a6549e7310a41fe1e8aeaaa46e7219facc3..16147eaa749a30bfcb734358385a292bfc534e4a 100644 (file)
                 <xs:element name="lendersAuthorizationDate" type="xs:string"/>
                 <xs:element name="lendersContact" type="xs:string"/>
                 
-                <!-- The three fields below were added as scalars specifically for release 0.7. -->
-                <!-- These fields will be removed, to be replaced by sub-loans, in a future release. -->
-                <xs:element name="loanedObjectStatus" type="xs:string"/>
-                <xs:element name="loanedObjectStatusDate" type="xs:string"/>
-                <xs:element name="loanedObjectStatusNote" type="xs:string"/>
-                
+                <xs:element name="loanedObjectStatusGroupList" type="loanedObjectStatusGroupList"/>
+
                 <xs:element name="loanOutDate" type="xs:string"/>
                 <xs:element name="loanReturnDate" type="xs:string"/>
                 <xs:element name="loanRenewalApplicationDate" type="xs:string"/>
              </xs:sequence>
         </xs:complexType>
     </xs:element>
+
+    <xs:complexType name="loanedObjectStatusGroupList">
+        <xs:sequence>
+            <xs:element name="loanedObjectStatusGroup" type="loanedObjectStatusGroup" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="loanedObjectStatusGroup">
+        <xs:sequence>
+            <xs:element name="loanedObjectStatus" type="xs:string"/>
+            <xs:element name="loanedObjectStatusDate" type="xs:string"/>
+            <xs:element name="loanedObjectStatusNote" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
  
     <!-- This is the base class for paginated lists -->
     <xs:complexType name="abstractCommonList">