]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-1286: Initial, somewhat minimal version of Loans In service. (The service...
authorAron Roberts <aron@socrates.berkeley.edu>
Thu, 25 Mar 2010 04:20:55 +0000 (04:20 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Thu, 25 Mar 2010 04:20:55 +0000 (04:20 +0000)
17 files changed:
services/JaxRsServiceProvider/pom.xml
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
services/build.xml
services/common/src/main/config/services/tenant-bindings.xml
services/loanin/jaxb/pom.xml [new file with mode: 0644]
services/loanin/jaxb/src/main/java/org/collectionspace/services/LoaninJAXBSchema.java [new file with mode: 0644]
services/loanin/jaxb/src/main/java/org/collectionspace/services/LoaninListItemJAXBSchema.java [new file with mode: 0644]
services/loanin/jaxb/src/main/resources/loansin-common.xsd [new file with mode: 0644]
services/loanin/service/pom.xml [new file with mode: 0644]
services/loanin/service/profiles.xml [new file with mode: 0644]
services/loanin/service/src/main/java/org/collectionspace/services/loanin/LoaninResource.java [new file with mode: 0644]
services/loanin/service/src/main/java/org/collectionspace/services/loanin/nuxeo/LoaninConstants.java [new file with mode: 0644]
services/loanin/service/src/main/java/org/collectionspace/services/loanin/nuxeo/LoaninDocumentModelHandler.java [new file with mode: 0644]
services/loanin/service/src/main/java/org/collectionspace/services/loanin/nuxeo/LoaninValidatorHandler.java [new file with mode: 0644]
services/loanin/service/src/test/java/org/collectionspace/services/test/LoaninServiceTest.java [new file with mode: 0644]
services/loanin/service/src/test/resources/log4j.xml [new file with mode: 0644]
services/pom.xml

index 0225c15cb0a59648023fe7b805d9c384f54884f8..39dafa866ce0ec3f45a0231dc26be2d321ad2748 100644 (file)
             <artifactId>org.collectionspace.services.intake.service</artifactId>\r
             <version>${project.version}</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.loanin.service</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.dimension.service</artifactId>\r
index ba0591be5e065b476632d42109d0ea94b51487bd..60cdd95c38317cbb865d0e9c6f841798988244a1 100644 (file)
@@ -27,6 +27,7 @@ import org.collectionspace.services.account.AccountResource;
 import org.collectionspace.services.collectionobject.CollectionObjectResource;
 import org.collectionspace.services.id.IDResource;
 import org.collectionspace.services.intake.IntakeResource;
+import org.collectionspace.services.loanin.LoaninResource;
 import org.collectionspace.services.relation.NewRelationResource;
 import org.collectionspace.services.acquisition.AcquisitionResource;
 import org.collectionspace.services.dimension.DimensionResource;
@@ -63,6 +64,7 @@ public class CollectionSpaceJaxRsApplication extends Application {
         singletons.add(new CollectionObjectResource());
         singletons.add(new IDResource());
         singletons.add(new IntakeResource());
+        singletons.add(new LoaninResource());
         singletons.add(new AcquisitionResource());
         singletons.add(new NewRelationResource());
         singletons.add(new VocabularyResource());
index 4b2377044cbf122de88048f12e8a8af064d40096..a2c56c4afdf746d40c4636169bad21644e6a1388 100644 (file)
         <ant antfile="id/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="collectionobject/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="intake/build.xml" target="deploy" inheritAll="false"/>\r
+        <ant antfile="loanin/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="vocabulary/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="organization/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="person/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="contact/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="dimension/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="acquisition/build.xml" target="undeploy" inheritAll="false"/>\r
+        <ant antfile="loanin/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="intake/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="collectionobject/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="id/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="id/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="collectionobject/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="intake/build.xml" target="dist" inheritAll="false"/>\r
+        <ant antfile="loanin/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="vocabulary/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="organization/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="person/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="authentication/build.xml" target="dist_installer" inheritAll="false"/>\r
         <ant antfile="relation/build.xml" target="dist_installer" inheritAll="false"/>\r
         <ant antfile="intake/build.xml" target="dist_installer" inheritAll="false"/>\r
+        <ant antfile="loanin/build.xml" target="dist_installer" inheritAll="false"/>\r
         <ant antfile="acquisition/build.xml" target="dist_installer" inheritAll="false"/>\r
         <ant antfile="JaxRsServiceProvider/build.xml" target="dist_installer" inheritAll="false"/>\r
 -->        \r
index 294577b9b4b4bb2df9a8ae78e631c6f43fe413c9..3a3f6bb0d19d17937d4537a53581b7e98cb3ab9b 100644 (file)
             </service:object>
         </tenant:serviceBindings>
         <!-- end intake service meta-data -->
+        <!-- begin loanin service meta-data -->
+        <tenant:serviceBindings name="Loansin" type="procedure" version="0.1">
+            <service:repositoryClient xmlns:service='http://collectionspace.org/services/common/service'>
+                nuxeo-java
+            </service:repositoryClient>
+            <service:documentHandler xmlns:service='http://collectionspace.org/services/common/service'>
+                org.collectionspace.services.loanin.nuxeo.LoaninDocumentModelHandler
+            </service:documentHandler>
+            <service:validatorHandler xmlns:service='http://collectionspace.org/services/common/service'>
+                org.collectionspace.services.loanin.nuxeo.LoaninValidatorHandler
+            </service:validatorHandler>
+            <service:object name="Loanin" version="0.1"
+                            xmlns:service='http://collectionspace.org/services/common/service'>
+                <service:part id="0" control_group="Managed"
+                              versionable="true" auditable="false"
+                              label="loansin-system" updated="" order="0">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent
+                            namespaceURI="http://collectionspace.org/services/common/system"
+                            schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd">
+                        </service:xmlContent>
+                    </service:content>
+                </service:part>
+                <service:part id="1" control_group="Managed"
+                              versionable="true" auditable="false"
+                              label="loansin_common" updated="" order="1">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent
+                            namespaceURI="http://collectionspace.org/services/loanin"
+                            schemaLocation="http://collectionspace.org/services/loanin http://services.collectionspace.org/intake/loansin_common.xsd">
+                        </service:xmlContent>
+                    </service:content>
+                </service:part>
+            </service:object>
+        </tenant:serviceBindings>
+        <!-- end loanin service meta-data -->
         <!-- begin vocabulary service meta-data -->
         <tenant:serviceBindings name="Vocabularies" version="0.1">
             <service:repositoryClient xmlns:service='http://collectionspace.org/services/common/service'>
diff --git a/services/loanin/jaxb/pom.xml b/services/loanin/jaxb/pom.xml
new file mode 100644 (file)
index 0000000..5f7a2c5
--- /dev/null
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>org.collectionspace.services.loanin</artifactId>
+        <groupId>org.collectionspace.services</groupId>
+        <version>0.6-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.loanin.jaxb</artifactId>
+    <name>services.loanin.jaxb</name>
+    
+    <dependencies>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jvnet.jaxb2-commons</groupId>
+            <artifactId>property-listener-injector</artifactId>
+            <version>1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jvnet.jaxb2_commons</groupId>
+            <artifactId>runtime</artifactId>
+            <version>0.4.1.4</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <finalName>collectionspace-services-loanin-jaxb</finalName>
+        <defaultGoal>install</defaultGoal>
+        <plugins>
+            <plugin>
+                <groupId>org.jvnet.jaxb2.maven2</groupId>
+                <artifactId>maven-jaxb2-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <dependencies>
+               <!-- javax.activation.DataSource provider is required by spec -->
+                    <dependency>
+                        <groupId>javax.activation</groupId>
+                        <artifactId>activation</artifactId>
+                        <version>1.1</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>com.sun.xml.bind</groupId>
+                        <artifactId>jaxb-impl</artifactId>
+                        <version>2.1.9</version>
+                     </dependency>
+                </dependencies>
+                <configuration>
+                    <args>
+                        <arg>-XtoString</arg>
+                        <arg>-Xinject-listener-code</arg>
+
+                     <!-- <arg>-Xcollection-setter-injector</arg>
+                                <arg>-Xfluent-api</arg> -->
+                    </args>
+                    <plugins>
+                        <plugin>
+                            <groupId>
+                           org.jvnet.jaxb2_commons
+                            </groupId>
+                            <artifactId>basic</artifactId>
+                            <version>0.4.1</version>
+                        </plugin>
+                        <plugin>
+                            <groupId>
+                           org.jvnet.jaxb2-commons
+                            </groupId>
+                            <artifactId>
+                           property-listener-injector
+                            </artifactId>
+                            <version>1.0</version>
+                        </plugin>
+
+                    </plugins>
+                    <!--generatePackage>
+                     org.collectionspace.hello
+                    </generatePackage-->
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.0.2</version>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
+
diff --git a/services/loanin/jaxb/src/main/java/org/collectionspace/services/LoaninJAXBSchema.java b/services/loanin/jaxb/src/main/java/org/collectionspace/services/LoaninJAXBSchema.java
new file mode 100644 (file)
index 0000000..be1ddd9
--- /dev/null
@@ -0,0 +1,11 @@
+/**
+ * 
+ */
+package org.collectionspace.services;
+
+public interface LoaninJAXBSchema {
+       final static String LOAN_IN_NUMBER = "loanInNumber";
+        final static String LOAN_RETURN_DATE = "loanReturnDate";
+}
+
+
diff --git a/services/loanin/jaxb/src/main/java/org/collectionspace/services/LoaninListItemJAXBSchema.java b/services/loanin/jaxb/src/main/java/org/collectionspace/services/LoaninListItemJAXBSchema.java
new file mode 100644 (file)
index 0000000..3428560
--- /dev/null
@@ -0,0 +1,8 @@
+package org.collectionspace.services;
+
+public interface LoaninListItemJAXBSchema {
+       final static String LOAN_IN_NUMBER = "loaninNumber";
+        final static String LOAN_RETURN_DATE = "loanReturnDate";
+       final static String CSID = "csid";
+       final static String URI = "url";
+}
diff --git a/services/loanin/jaxb/src/main/resources/loansin-common.xsd b/services/loanin/jaxb/src/main/resources/loansin-common.xsd
new file mode 100644 (file)
index 0000000..d4af271
--- /dev/null
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    Loan In schema (XSD)
+    
+    Entity  : Loanin 
+    Part    : Common
+    Used for: JAXB binding between XML and Java objects
+
+    $LastChangedRevision$
+    $LastChangedDate$
+-->
+
+<xs:schema 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:ns="http://collectionspace.org/services/loanin"
+  xmlns="http://collectionspace.org/services/loanin"
+  targetNamespace="http://collectionspace.org/services/loanin"
+  version="0.1"
+>
+
+<!--
+    Avoid XmlRootElement nightmare:
+    See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
+-->
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Loans+In+Schema -->    
+    
+    <!-- loanin -->
+    <xs:element name="loansin_common">
+        <xs:complexType>
+            <xs:sequence>                
+                <!--  Loan In Information Group -->
+                <xs:element name="loanInNumber" type="xs:string"/>
+                <xs:element name="lenders" type="lenderList"/>
+                <xs:element name="lendersAuthorizer" type="xs:string"/>
+                <xs:element name="lendersAuthorizationDate" type="xs:string"/>
+                <xs:element name="lendersContact" type="xs:string"/>
+                <xs:element name="loanInContact" type="xs:string"/>
+                <xs:element name="loanInConditions" type="xs:string"/>
+                <xs:element name="loanInDate" type="xs:string"/>
+                <xs:element name="loanReturnDate" type="xs:string"/>
+                <xs:element name="loanRenewalApplicationDate" type="xs:string"/>
+                <xs:element name="loanInNote" type="xs:string"/>
+                <xs:element name="loanPurpose" type="xs:string"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:complexType name="lenderList">
+        <xs:sequence>
+            <xs:element name="lender" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <!-- loansin records, as in nuxeo repository -->
+    <xs:element name="loansin-common-list">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="loanin-list-item" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="loanInNumber" type="xs:string"
+                                minOccurs="1" />
+                            <xs:element name="loanReturnDate" type="xs:string"
+                                minOccurs="1" />
+                            <!-- uri to retrive details -->
+                            <xs:element name="uri" type="xs:anyURI"
+                                minOccurs="1" />
+                            <xs:element name="csid" type="xs:string"
+                                minOccurs="1" />
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
+
diff --git a/services/loanin/service/pom.xml b/services/loanin/service/pom.xml
new file mode 100644 (file)
index 0000000..8cfe40b
--- /dev/null
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.loanin</artifactId>        
+        <version>0.6-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.loanin.service</artifactId>
+    <name>services.loanin.service</name>
+    <packaging>jar</packaging>       
+
+    <dependencies>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.loanin.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.collectionobject.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- External dependencies -->        
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>5.6</version>
+        </dependency>
+        
+      <!-- javax -->
+
+        <dependency>
+            <groupId>javax.security</groupId>
+            <artifactId>jaas</artifactId>
+            <version>1.0.01</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>1.6.1</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <!-- jboss -->
+
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxrs</artifactId>
+            <version>1.0.2.GA</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>tjws</groupId>
+                    <artifactId>webserver</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxb-provider</artifactId>
+            <version>1.0.2.GA</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-multipart-provider</artifactId>
+            <version>1.0.2.GA</version>
+        </dependency>
+        
+        <!-- nuxeo -->
+
+        <dependency>
+            <groupId>org.nuxeo.ecm.core</groupId>
+            <artifactId>nuxeo-core-api</artifactId>
+            <version>1.5.1-SNAPSHOT</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>jboss-remoting</artifactId>
+                    <groupId>jboss</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.restlet</groupId>
+            <artifactId>org.restlet</artifactId>
+            <version>1.0.7</version>
+        </dependency>
+        <dependency>
+            <groupId>com.noelios.restlet</groupId>
+            <artifactId>com.noelios.restlet.ext.httpclient</artifactId>
+            <version>1.0.7</version>
+        </dependency>
+        <dependency>
+            <groupId>com.noelios.restlet</groupId>
+            <artifactId>com.noelios.restlet</artifactId>
+            <version>1.0.7</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <finalName>collectionspace-services-loanin</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>jboss-maven-plugin</artifactId>
+                <configuration>
+                    <jbossHome>${jboss.dir}</jbossHome>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                    <showDeprecation>true</showDeprecation>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
+
diff --git a/services/loanin/service/profiles.xml b/services/loanin/service/profiles.xml
new file mode 100644 (file)
index 0000000..347b9df
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profilesXml xmlns="http://maven.apache.org/PROFILES/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/PROFILES/1.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
+</profilesXml>
\ No newline at end of file
diff --git a/services/loanin/service/src/main/java/org/collectionspace/services/loanin/LoaninResource.java b/services/loanin/service/src/main/java/org/collectionspace/services/loanin/LoaninResource.java
new file mode 100644 (file)
index 0000000..38264d5
--- /dev/null
@@ -0,0 +1,480 @@
+/**
+ *  This document is a part of the source code and related artifacts
+ *  for CollectionSpace, an open source collections management system
+ *  for museums and related institutions:
+
+ *  http://www.collectionspace.org
+ *  http://wiki.collectionspace.org
+
+ *  Copyright 2009 University of California at Berkeley
+
+ *  Licensed under the Educational Community License (ECL), Version 2.0.
+ *  You may not use this file except in compliance with this License.
+
+ *  You may obtain a copy of the ECL 2.0 License at
+
+ *  https://source.collectionspace.org/collection-space/LICENSE.txt
+
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.collectionspace.services.loanin;
+
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
+
+import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl;
+import org.collectionspace.services.common.ClientType;
+import org.collectionspace.services.common.ServiceMain;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.common.context.MultipartServiceContext;
+import org.collectionspace.services.common.context.MultipartServiceContextFactory;
+import org.collectionspace.services.common.context.MultipartServiceContextImpl;
+import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.DocumentFilter;
+import org.collectionspace.services.common.document.DocumentHandler;
+import org.collectionspace.services.common.document.DocumentNotFoundException;
+import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.query.IQueryManager;
+import org.collectionspace.services.common.query.QueryManager;
+import org.collectionspace.services.common.security.UnauthorizedException;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
+import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.util.HttpResponseCodes;
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The Class LoaninResource.
+ */
+@Path("/loansin")
+@Consumes("multipart/mixed")
+@Produces("multipart/mixed")
+public class LoaninResource extends AbstractCollectionSpaceResourceImpl {
+
+    /** The Constant serviceName. */
+    private final static String serviceName = "loansin";
+    
+    /** The logger. */
+    final Logger logger = LoggerFactory.getLogger(LoaninResource.class);
+    //FIXME retrieve client type from configuration
+    /** The Constant CLIENT_TYPE. */
+    final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
+
+    /**
+     * Instantiates a new loanin resource.
+     */
+    public LoaninResource() {
+        // do nothing
+    }
+
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getVersionString()
+     */
+    @Override
+    protected String getVersionString() {
+       /** The last change revision. */
+       final String lastChangeRevision = "$LastChangedRevision: 1627 $";
+       return lastChangeRevision;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getServiceName()
+     */
+    @Override
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#createDocumentHandler(org.collectionspace.services.common.context.ServiceContext)
+     */
+    @Override
+    public DocumentHandler createDocumentHandler(ServiceContext ctx) throws Exception {
+        DocumentHandler docHandler = ctx.getDocumentHandler();
+        if (ctx.getInput() != null) {
+            Object obj = ((MultipartServiceContext) ctx).getInputPart(ctx.getCommonPartLabel(), LoansinCommon.class);
+            if (obj != null) {
+                docHandler.setCommonPart((LoansinCommon) obj);
+            }
+        }
+        return docHandler;
+    }
+
+    /**
+     * Creates the loanin.
+     * 
+     * @param input the input
+     * 
+     * @return the response
+     */
+    @POST
+    public Response createLoanin(MultipartInput input) {
+        try {
+            ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(input, getServiceName());
+            DocumentHandler handler = createDocumentHandler(ctx);
+            String csid = getRepositoryClient(ctx).create(ctx, handler);
+            //loaninObject.setCsid(csid);
+            UriBuilder path = UriBuilder.fromResource(LoaninResource.class);
+            path.path("" + csid);
+            Response response = Response.created(path.build()).build();
+            return response;
+        } catch (UnauthorizedException ue) {
+            Response response = Response.status(
+                    Response.Status.UNAUTHORIZED).entity("Create failed reason " + ue.getErrorReason()).type("text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Caught exception in createLoanin", e);
+            }
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Create failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+    }
+
+    /**
+     * Gets the loanin.
+     * 
+     * @param csid the csid
+     * 
+     * @return the loanin
+     */
+    @GET
+    @Path("{csid}")
+    public MultipartOutput getLoanin(
+            @PathParam("csid") String csid) {
+        if (logger.isDebugEnabled()) {
+            logger.debug("getLoanin with csid=" + csid);
+        }
+        if (csid == null || "".equals(csid)) {
+            logger.error("getLoanin: missing csid!");
+            Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+                    "get failed on Loanin csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        MultipartOutput result = null;
+        try {
+            ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
+            DocumentHandler handler = createDocumentHandler(ctx);
+            getRepositoryClient(ctx).get(ctx, csid, handler);
+            result = (MultipartOutput) ctx.getOutput();
+        } catch (UnauthorizedException ue) {
+            Response response = Response.status(
+                    Response.Status.UNAUTHORIZED).entity("Get failed reason " + ue.getErrorReason()).type("text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (DocumentNotFoundException dnfe) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("getLoanin", dnfe);
+            }
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Get failed on Loanin csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("getLoanin", e);
+            }
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Get failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        if (result == null) {
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Get failed, the requested Loanin CSID:" + csid + ": was not found.").type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        return result;
+    }
+
+    /**
+     * Gets the loanin list.
+     * 
+     * @param ui the ui
+     * @param keywords the keywords
+     * 
+     * @return the loanin list
+     */
+    @GET
+    @Produces("application/xml")
+    public LoansinCommonList getLoaninList(@Context UriInfo ui,
+               @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords) {
+       LoansinCommonList result = null;
+       
+       if (keywords != null) {
+               result = searchLoansin(keywords);
+       } else {
+               result = getLoaninList();
+       }
+       return result;
+    }
+    
+    /**
+     * Gets the loanin list.
+     * 
+     * @return the loanin list
+     */
+    private LoansinCommonList getLoaninList() {
+        LoansinCommonList loaninObjectList;
+        try {
+            ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
+            DocumentHandler handler = createDocumentHandler(ctx);
+            getRepositoryClient(ctx).getAll(ctx, handler);
+            loaninObjectList = (LoansinCommonList) handler.getCommonPartList();
+        } catch (UnauthorizedException ue) {
+            Response response = Response.status(
+                    Response.Status.UNAUTHORIZED).entity("Index failed reason " + ue.getErrorReason()).type("text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Caught exception in getLoaninList", e);
+            }
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        return loaninObjectList;
+    }
+
+    /**
+     * Gets the authority refs.
+     * 
+     * @param csid the csid
+     * @param ui the ui
+     * 
+     * @return the authority refs
+     */
+    @GET
+    @Path("{csid}/authorityrefs")
+    @Produces("application/xml")
+    public AuthorityRefList getAuthorityRefs(
+               @PathParam("csid") String csid, 
+               @Context UriInfo ui) {
+       AuthorityRefList authRefList = null;
+        try {
+            ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
+            DocumentWrapper<DocumentModel> docWrapper = 
+               getRepositoryClient(ctx).getDoc(ctx, csid);
+            RemoteDocumentModelHandlerImpl handler 
+               = (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
+            List<String> authRefFields = ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues(RefNameServiceUtils.AUTH_REF_PROP);
+            authRefList = handler.getAuthorityRefs(docWrapper, authRefFields);
+        } catch (UnauthorizedException ue) {
+            Response response = Response.status(
+                    Response.Status.UNAUTHORIZED).entity("Index failed reason " + ue.getErrorReason()).type("text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Caught exception in getAuthorityRefs", e);
+            }
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        return authRefList;
+    }
+
+    /**
+     * Gets the loanin list.
+     * 
+     * @param csidList the csid list
+     * 
+     * @return the loanin list
+     */
+    public LoansinCommonList getLoaninList(List<String> csidList) {
+        LoansinCommonList loaninObjectList = new LoansinCommonList();
+        try {
+            ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
+            DocumentHandler handler = createDocumentHandler(ctx);
+            getRepositoryClient(ctx).get(ctx, csidList, handler);
+            loaninObjectList = (LoansinCommonList) handler.getCommonPartList();
+        } catch (UnauthorizedException ue) {
+            Response response = Response.status(
+                    Response.Status.UNAUTHORIZED).entity("Index failed reason " + ue.getErrorReason()).type("text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Caught exception in getLoaninList", e);
+            }
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        return loaninObjectList;
+    }
+    
+    /**
+     * Update loanin.
+     * 
+     * @param csid the csid
+     * @param theUpdate the the update
+     * 
+     * @return the multipart output
+     */
+    @PUT
+    @Path("{csid}")
+    public MultipartOutput updateLoanin(
+            @PathParam("csid") String csid,
+            MultipartInput theUpdate) {
+        if (logger.isDebugEnabled()) {
+            logger.debug("updateLoanin with csid=" + csid);
+        }
+        if (csid == null || "".equals(csid)) {
+            logger.error("updateLoanin: missing csid!");
+            Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+                    "update failed on Loanin csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        MultipartOutput result = null;
+        try {
+            ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(theUpdate, getServiceName());
+            DocumentHandler handler = createDocumentHandler(ctx);
+            getRepositoryClient(ctx).update(ctx, csid, handler);
+            result = (MultipartOutput) ctx.getOutput();
+        } catch (UnauthorizedException ue) {
+            Response response = Response.status(
+                    Response.Status.UNAUTHORIZED).entity("Update failed reason " + ue.getErrorReason()).type("text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (DocumentNotFoundException dnfe) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("caught exception in updateLoanin", dnfe);
+            }
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Update failed on Loanin csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (Exception e) {
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Update failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        return result;
+    }
+
+    /**
+     * Delete loanin.
+     * 
+     * @param csid the csid
+     * 
+     * @return the response
+     */
+    @DELETE
+    @Path("{csid}")
+    public Response deleteLoanin(@PathParam("csid") String csid) {
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("deleteLoanin with csid=" + csid);
+        }
+        if (csid == null || "".equals(csid)) {
+            logger.error("deleteLoanin: missing csid!");
+            Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+                    "delete failed on Loanin csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        try {
+            ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
+            getRepositoryClient(ctx).delete(ctx, csid);
+            return Response.status(HttpResponseCodes.SC_OK).build();
+        } catch (UnauthorizedException ue) {
+            Response response = Response.status(
+                    Response.Status.UNAUTHORIZED).entity("Delete failed reason " + ue.getErrorReason()).type("text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (DocumentNotFoundException dnfe) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("caught exception in deleteLoanin", dnfe);
+            }
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Delete failed on Loanin csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (Exception e) {
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Delete failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+    }
+    
+    /**
+     * Keywords search loansin.
+     * 
+     * @param ui the ui
+     * @param keywords the keywords
+     * 
+     * @return the loansin common list
+     */
+    @GET
+    @Path("/search")    
+    @Produces("application/xml")
+    public LoansinCommonList keywordsSearchLoansin(@Context UriInfo ui,
+               @QueryParam (IQueryManager.SEARCH_TYPE_KEYWORDS) String keywords) {
+       return searchLoansin(keywords);
+    }
+       
+    /**
+     * Search loansin.
+     * 
+     * @param keywords the keywords
+     * 
+     * @return the loansin common list
+     */
+    private LoansinCommonList searchLoansin(String keywords) {
+       LoansinCommonList loansinObjectList;
+        try {
+            ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
+            DocumentHandler handler = createDocumentHandler(ctx);
+
+            // perform a keyword search
+            if (keywords != null && !keywords.isEmpty()) {
+               String whereClause = QueryManager.createWhereClauseFromKeywords(keywords);
+                   DocumentFilter documentFilter = handler.getDocumentFilter();
+                   documentFilter.setWhereClause(whereClause);
+                   if (logger.isDebugEnabled()) {
+                       logger.debug("The WHERE clause is: " + documentFilter.getWhereClause());
+                   }
+                   getRepositoryClient(ctx).getFiltered(ctx, handler);
+            } else {
+               getRepositoryClient(ctx).getAll(ctx, handler);
+            }            
+            loansinObjectList = (LoansinCommonList) handler.getCommonPartList();
+            
+        } catch (UnauthorizedException ue) {
+            Response response = Response.status(
+                    Response.Status.UNAUTHORIZED).entity("Index failed reason " + ue.getErrorReason()).type("text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Caught exception in search for Loansin", e);
+            }
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        return loansinObjectList;
+    }    
+    
+}
diff --git a/services/loanin/service/src/main/java/org/collectionspace/services/loanin/nuxeo/LoaninConstants.java b/services/loanin/service/src/main/java/org/collectionspace/services/loanin/nuxeo/LoaninConstants.java
new file mode 100644 (file)
index 0000000..113c458
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ *  This document is a part of the source code and related artifacts
+ *  for CollectionSpace, an open source collections management system
+ *  for museums and related institutions:
+
+ *  http://www.collectionspace.org
+ *  http://wiki.collectionspace.org
+
+ *  Copyright 2009 University of California at Berkeley
+
+ *  Licensed under the Educational Community License (ECL), Version 2.0.
+ *  You may not use this file except in compliance with this License.
+
+ *  You may obtain a copy of the ECL 2.0 License at
+
+ *  https://source.collectionspace.org/collection-space/LICENSE.txt
+
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.collectionspace.services.loanin.nuxeo;
+
+/**
+ * LoaninConstants specifies constants for the Loans In service
+ *
+ */
+public class LoaninConstants {
+
+    public final static String NUXEO_DOCTYPE = "Loanin";
+    public final static String NUXEO_SCHEMA_NAME = "loanin";
+    public final static String NUXEO_DC_TITLE = "CollectionSpace-Loanin";
+}
diff --git a/services/loanin/service/src/main/java/org/collectionspace/services/loanin/nuxeo/LoaninDocumentModelHandler.java b/services/loanin/service/src/main/java/org/collectionspace/services/loanin/nuxeo/LoaninDocumentModelHandler.java
new file mode 100644 (file)
index 0000000..0aebab8
--- /dev/null
@@ -0,0 +1,143 @@
+/**
+ *  This document is a part of the source code and related artifacts
+ *  for CollectionSpace, an open source collections management system
+ *  for museums and related institutions:
+
+ *  http://www.collectionspace.org
+ *  http://wiki.collectionspace.org
+
+ *  Copyright 2009 University of California at Berkeley
+
+ *  Licensed under the Educational Community License (ECL), Version 2.0.
+ *  You may not use this file except in compliance with this License.
+
+ *  You may obtain a copy of the ECL 2.0 License at
+
+ *  https://source.collectionspace.org/collection-space/LICENSE.txt
+
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.collectionspace.services.loanin.nuxeo;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.collectionspace.services.LoaninJAXBSchema;
+import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.loanin.LoansinCommon;
+import org.collectionspace.services.loanin.LoansinCommonList;
+import org.collectionspace.services.loanin.LoansinCommonList.LoaninListItem;
+import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.core.api.DocumentModelList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * LoaninDocumentModelHandler
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class LoaninDocumentModelHandler
+        extends RemoteDocumentModelHandlerImpl<LoansinCommon, LoansinCommonList> {
+
+    private final Logger logger = LoggerFactory.getLogger(LoaninDocumentModelHandler.class);
+    /**
+     * loanin is used to stash JAXB object to use when handle is called
+     * for Action.CREATE, Action.UPDATE or Action.GET
+     */
+    private LoansinCommon loanin;
+    /**
+     * loaninList is stashed when handle is called
+     * for ACTION.GET_ALL
+     */
+    private LoansinCommonList loaninList;
+
+
+    /**
+     * getCommonPart get associated loanin
+     * @return
+     */
+    @Override
+    public LoansinCommon getCommonPart() {
+        return loanin;
+    }
+
+    /**
+     * setCommonPart set associated loanin
+     * @param loanin
+     */
+    @Override
+    public void setCommonPart(LoansinCommon loanin) {
+        this.loanin = loanin;
+    }
+
+    /**
+     * getCommonPartList get associated loanin (for index/GET_ALL)
+     * @return
+     */
+    @Override
+    public LoansinCommonList getCommonPartList() {
+        return loaninList;
+    }
+
+    @Override
+    public void setCommonPartList(LoansinCommonList loaninList) {
+        this.loaninList = loaninList;
+    }
+
+    @Override
+    public LoansinCommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
+            throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void fillCommonPart(LoansinCommon loaninObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public LoansinCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
+        DocumentModelList docList = wrapDoc.getWrappedObject();
+
+        LoansinCommonList coList = new LoansinCommonList();
+        List<LoansinCommonList.LoaninListItem> list = coList.getLoaninListItem();
+
+        //FIXME: iterating over a long list of documents is not a long term
+        //strategy...need to change to more efficient iterating in future
+        Iterator<DocumentModel> iter = docList.iterator();
+        while(iter.hasNext()){
+            DocumentModel docModel = iter.next();
+            LoaninListItem ilistItem = new LoaninListItem();
+            ilistItem.setLoanInNumber((String) docModel.getProperty(getServiceContext().getCommonPartLabel(),
+                    LoaninJAXBSchema.LOAN_IN_NUMBER));
+            ilistItem.setLoanReturnDate((String) docModel.getProperty(getServiceContext().getCommonPartLabel(),
+                    LoaninJAXBSchema.LOAN_RETURN_DATE));
+            String id = NuxeoUtils.extractId(docModel.getPathAsString());
+            ilistItem.setUri(getServiceContextPath() + id);
+            ilistItem.setCsid(id);
+            list.add(ilistItem);
+        }
+
+        return coList;
+    }
+
+    /**
+     * getQProperty converts the given property to qualified schema property
+     * @param prop
+     * @return
+     */
+    @Override
+    public String getQProperty(String prop) {
+        return LoaninConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+    }
+}
+
diff --git a/services/loanin/service/src/main/java/org/collectionspace/services/loanin/nuxeo/LoaninValidatorHandler.java b/services/loanin/service/src/main/java/org/collectionspace/services/loanin/nuxeo/LoaninValidatorHandler.java
new file mode 100644 (file)
index 0000000..b45fd51
--- /dev/null
@@ -0,0 +1,18 @@
+package org.collectionspace.services.loanin.nuxeo;
+
+import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.InvalidDocumentException;
+import org.collectionspace.services.common.document.ValidatorHandler;
+import org.collectionspace.services.common.document.DocumentHandler.Action;
+
+public class LoaninValidatorHandler implements ValidatorHandler {
+
+       @Override
+       public void validate(Action action, ServiceContext ctx)
+                       throws InvalidDocumentException {
+               // TODO Auto-generated method stub
+               System.out.println("LoaninValidatorHandler executed.");
+
+       }
+
+}
diff --git a/services/loanin/service/src/test/java/org/collectionspace/services/test/LoaninServiceTest.java b/services/loanin/service/src/test/java/org/collectionspace/services/test/LoaninServiceTest.java
new file mode 100644 (file)
index 0000000..adcf38f
--- /dev/null
@@ -0,0 +1,13 @@
+package org.collectionspace.services.test;
+
+//import org.collectionspace.services.loanin.Loanin;
+//import org.collectionspace.services.loanin.LoaninList;
+
+/**
+ * Placeholder for server-side testing of Loan In service code.
+ * 
+ * @version $Revision:$
+ */
+public class LoaninServiceTest {
+       //empty
+}
diff --git a/services/loanin/service/src/test/resources/log4j.xml b/services/loanin/service/src/test/resources/log4j.xml
new file mode 100644 (file)
index 0000000..52121cb
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.TTCCLayout">
+                       <param name="DateFormat" value="ISO8601" />
+               </layout>
+       </appender>
+
+
+       <appender name="unit-tests"
+               class="org.apache.log4j.RollingFileAppender">
+               <param name="File" value="./target/unit-tests.log" />
+               <param name="MaxFileSize" value="10240KB" />
+               <param name="MaxBackupIndex" value="6" />
+               <layout class="org.apache.log4j.TTCCLayout">
+                       <param name="DateFormat" value="ISO8601" />
+               </layout>
+       </appender>
+
+       <logger name="org.apache.commons.httpclient" additivity="false">
+               <level value="warn" />
+               <appender-ref ref="console" />
+               <appender-ref ref="unit-tests" />
+       </logger>
+
+       <logger name="httpclient.wire" additivity="false">
+               <level value="info" />
+               <appender-ref ref="console" />
+               <appender-ref ref="unit-tests" />
+       </logger>
+
+       <root>
+               <priority value="debug" />
+               <appender-ref ref="console" />
+               <appender-ref ref="unit-tests" />
+       </root>
+
+</log4j:configuration>
+
+
+
+
index cefff9c0f92eff24190818343ac63cc8d46980a6..97f1028753a5b95f8f0c3d1b6163fed8bfee31f9 100644 (file)
@@ -28,6 +28,7 @@
         <module>id</module>
         <module>collectionobject</module>
         <module>intake</module>
+        <module>loanin</module>
         <module>dimension</module>
         <module>contact</module>
         <module>JaxRsServiceProvider</module>
             </dependency>
         </dependencies>
     </dependencyManagement>
-</project>
\ No newline at end of file
+</project>