<artifactId>org.collectionspace.services.movement.service</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.report.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
import org.collectionspace.services.loanout.LoanoutResource;
import org.collectionspace.services.location.LocationAuthorityResource;
import org.collectionspace.services.movement.MovementResource;
+import org.collectionspace.services.report.ReportResource;
import org.collectionspace.services.relation.NewRelationResource;
import org.collectionspace.services.acquisition.AcquisitionResource;
import org.collectionspace.services.dimension.DimensionResource;
singletons.add(new LoanoutResource());
singletons.add(new LocationAuthorityResource());
singletons.add(new MovementResource());
+ singletons.add(new ReportResource());
singletons.add(new AcquisitionResource());
singletons.add(new NewRelationResource());
singletons.add(new VocabularyResource());
<ant antfile="loanout/build.xml" target="deploy" inheritAll="false"/>\r
<ant antfile="location/build.xml" target="deploy" inheritAll="false"/>\r
<ant antfile="movement/build.xml" target="deploy" inheritAll="false"/>\r
+ <ant antfile="report/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="dimension/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="acquisition/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="location/build.xml" target="undeploy" inheritAll="false"/>\r
+ <ant antfile="report/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="movement/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="loanout/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="loanin/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="loanout/build.xml" target="dist" inheritAll="false"/>\r
<ant antfile="location/build.xml" target="dist" inheritAll="false"/>\r
<ant antfile="movement/build.xml" target="dist" inheritAll="false"/>\r
+ <ant antfile="report/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
if (useAuth()) {\r
String user = properties.getProperty(USER_PROPERTY);\r
String password = properties.getProperty(PASSWORD_PROPERTY);\r
- if (logger.isInfoEnabled()) {\r
- logger.info("setupHttpClient() using url=" + url + " user="\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug("setupHttpClient() using url=" + url + " user="\r
+ user + " password=" + password);\r
}\r
\r
new UsernamePasswordCredentials(user, password));\r
// JAXRS client library requires HTTP preemptive authentication\r
httpClient.getParams().setAuthenticationPreemptive(true);\r
- if (logger.isInfoEnabled()) {\r
- logger.info("setupHttpClient: set preemptive authentication");\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug("setupHttpClient: set preemptive authentication");\r
}\r
} else {\r
- if (logger.isInfoEnabled()) {\r
- logger.info("setupHttpClient() : no auth mode!");\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug("setupHttpClient() : no auth mode!");\r
}\r
}\r
}\r
</service:object>
</tenant:serviceBindings>
<!-- end movement service meta-data -->
+ <!-- begin report service meta-data -->
+ <tenant:serviceBindings name="Reports" type="procedure" version="0.1">
+ <!-- other URI paths using which this service could be accessed -->
+ <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
+ /reports/*/output/
+ </service:uriPath>
+ <service:repositoryDomain xmlns:service='http://collectionspace.org/services/common/service'>
+ default-domain
+ </service:repositoryDomain>
+ <service:documentHandler xmlns:service='http://collectionspace.org/services/common/service'>
+ org.collectionspace.services.report.nuxeo.ReportDocumentModelHandler
+ </service:documentHandler>
+ <service:validatorHandler xmlns:service='http://collectionspace.org/services/common/service'>
+ org.collectionspace.services.report.nuxeo.ReportValidatorHandler
+ </service:validatorHandler>
+ <service:object name="Report" version="0.1"
+ xmlns:service='http://collectionspace.org/services/common/service'>
+ <service:part id="0" control_group="Managed"
+ versionable="true" auditable="false"
+ label="reports-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="reports_common" updated="" order="1">
+ <service:content contentType="application/xml">
+ <service:xmlContent
+ namespaceURI="http://collectionspace.org/services/report"
+ schemaLocation="http://collectionspace.org/services/report http://services.collectionspace.org/report/reports_common.xsd">
+ </service:xmlContent>
+ </service:content>
+ </service:part>
+ </service:object>
+ </tenant:serviceBindings>
+ <!-- end report service meta-data -->
<!-- begin vocabulary service meta-data -->
<tenant:serviceBindings name="Vocabularies" version="0.1">
<!-- other URI paths using which this service could be accessed -->
//
// Create the builder and parse the file
//
- result = factory.newDocumentBuilder().parse(payload);
+ DocumentBuilder db = factory.newDocumentBuilder();
+ db.setErrorHandler(null);
+ result = db.parse(payload);
// Write it to the log so we can see what we've created.
if (logger.isDebugEnabled() == true) {
logger.debug(xmlToString(result));
- System.out.println(xmlToString(result)); //FIXME: REM - Need this until we figure out why messages are not showing up in logger.
+ //System.out.println(xmlToString(result)); //FIXME: REM - Need this until we figure out why messages are not showing up in logger.
}
} finally {
if (payload != null) {
<module>loanout</module>
<module>location</module>
<module>movement</module>
+ <module>report</module>
<module>dimension</module>
<module>contact</module>
<module>JaxRsServiceProvider</module>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.report</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Tue Jul 13 14:34:11 PDT 2010\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.source=1.6\r
--- /dev/null
+#Fri Sep 11 17:00:30 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+skipCompilerPlugin=true\r
+version=1\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.report.3rdparty</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Tue Jul 13 14:34:11 PDT 2010\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.source=1.6\r
--- /dev/null
+#Fri Sep 11 17:00:30 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+skipCompilerPlugin=true\r
+version=1\r
--- /dev/null
+\r
+<project name="report.3rdparty" default="package" basedir=".">\r
+ <description>\r
+ report service 3rdparty\r
+ </description>\r
+ <!-- set global properties for this build -->\r
+ <property name="services.trunk" value="../../.."/>\r
+ <!-- enviornment should be declared before reading build.properties -->\r
+ <property environment="env" />\r
+ <property file="${services.trunk}/build.properties" />\r
+ <property name="mvn.opts" value="" />\r
+ <property name="src" location="src"/>\r
+\r
+ <condition property="osfamily-unix">\r
+ <os family="unix" />\r
+ </condition>\r
+ <condition property="osfamily-windows">\r
+ <os family="windows" />\r
+ </condition>\r
+\r
+ <target name="init" >\r
+ <!-- Create the time stamp -->\r
+ <tstamp/>\r
+ </target>\r
+\r
+ <target name="package" depends="package-unix,package-windows"\r
+ description="Package CollectionSpace Services" />\r
+ <target name="package-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="package" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="package-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="package" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="install" depends="install-unix,install-windows"\r
+ description="Install" />\r
+ <target name="install-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="install" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="install-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="install" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ \r
+ <target name="clean" depends="clean-unix,clean-windows"\r
+ description="Delete target directories" >\r
+ <delete dir="${build}"/>\r
+ </target>\r
+ <target name="clean-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="clean" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="clean-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="clean" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />\r
+ <target name="test-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="test" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="test-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="test" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="deploy" depends="install"\r
+ description="deploy report in ${jboss.server.nuxeo}">\r
+ <ant antfile="nuxeo-platform-cs-report/build.xml" target="deploy" inheritall="false"/>\r
+ </target>\r
+\r
+ <target name="undeploy"\r
+ description="undeploy report from ${jboss.server.nuxeo}">\r
+ <ant antfile="nuxeo-platform-cs-report/build.xml" target="undeploy" inheritall="false"/>\r
+ </target>\r
+\r
+ <target name="dist"\r
+ description="generate distribution for report" depends="package">\r
+ <ant antfile="nuxeo-platform-cs-report/build.xml" target="dist" inheritall="false"/>\r
+ </target>\r
+\r
+\r
+</project>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.report.3rdparty.nuxeo</name>\r
+ <comment>Report Nuxeo Document Type</comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Tue Jul 13 14:34:11 PDT 2010\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.source=1.6\r
--- /dev/null
+#Fri Sep 11 17:00:30 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+skipCompilerPlugin=true\r
+version=1\r
--- /dev/null
+
+<project name="nuxeo-platform-cs-report" default="package" basedir=".">
+ <description>
+ report nuxeo document type
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../../../.."/>
+ <!-- environment should be declared before reading build.properties -->
+ <property environment="env" />
+ <property file="${services.trunk}/build.properties" />
+ <property name="mvn.opts" value="" />
+ <property name="src" location="src"/>
+ <property name="nuxeo.report.jar"
+ value="org.collectionspace.services.report.3rdparty.nuxeo-${cspace.release}.jar"/>
+ <property name="nuxeo.report.jars.all"
+ value="org.collectionspace.services.report.3rdparty.nuxeo-*.jar"/>
+
+ <condition property="osfamily-unix">
+ <os family="unix" />
+ </condition>
+ <condition property="osfamily-windows">
+ <os family="windows" />
+ </condition>
+
+ <target name="init" >
+ <!-- Create the time stamp -->
+ <tstamp/>
+ </target>
+
+ <target name="package" depends="package-unix,package-windows"
+ description="Package CollectionSpace Services" />
+ <target name="package-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="package-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="install" depends="install-unix,install-windows"
+ description="Install" />
+ <target name="install-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="install-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="clean" depends="clean-unix,clean-windows"
+ description="Delete target directories" >
+ <delete dir="${build}"/>
+ </target>
+ <target name="clean-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="clean-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />
+ <target name="test-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="test-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn.bat" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="install"
+ description="deploy report doctype in ${jboss.server.nuxeo}">
+ <copy file="${basedir}/target/${nuxeo.report.jar}"
+ todir="${jboss.deploy.nuxeo.plugins}"/>
+ </target>
+
+ <target name="undeploy"
+ description="undeploy report doctype from ${jboss.server.nuxeo}">
+ <delete>
+ <fileset dir="${jboss.deploy.nuxeo.plugins}">
+ <include name="${nuxeo.report.jars.all}"/>
+ </fileset>
+ <!-- Legacy deployment location through release 0.6 -->
+ <fileset dir="${jboss.deploy.nuxeo.system}">
+ <include name="${nuxeo.report.jars.all}"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="dist"
+ description="generate distribution for report doctype" depends="package">
+ <copy todir="${services.trunk}/${dist.deploy.nuxeo.plugins}">
+ <fileset file="${basedir}/target/${nuxeo.report.jar}"/>
+ </copy>
+ </target>
+
+</project>
+
--- /dev/null
+<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.report.3rdparty</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.report.3rdparty.nuxeo</artifactId>
+ <name>services.report.3rdparty.nuxeo</name>
+ <packaging>jar</packaging>
+ <description>
+ Report Nuxeo Document Type
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile> src/main/resources/META-INF/MANIFEST.MF </manifestFile>
+ <manifestEntries>
+ <Bundle-Version>${eclipseVersion}</Bundle-Version>
+ <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+Manifest-Version: 1.0 \r
+Bundle-ManifestVersion: 1 \r
+Bundle-Name: NuxeoCS\r
+Bundle-SymbolicName: org.collectionspace.report;singleton:=true \r
+Bundle-Version: 1.0.0\r
+Bundle-Localization: plugin\r
+Bundle-Vendor: Nuxeo \r
+Require-Bundle: org.nuxeo.runtime, \r
+ org.nuxeo.ecm.core.api, \r
+ org.nuxeo.ecm.core,\r
+ org.nuxeo.ecm.core.api,\r
+ org.nuxeo.ecm.platform.types.api,\r
+ org.nuxeo.ecm.platform.versioning.api,\r
+ org.nuxeo.ecm.platform.ui,\r
+ org.nuxeo.ecm.platform.forms.layout.client,\r
+ org.nuxeo.ecm.platform.publishing.api,\r
+ org.nuxeo.ecm.platform.ws \r
+Provide-Package: org.collectionspace.report\r
+Nuxeo-Component: OSGI-INF/core-types-contrib.xml,\r
+ OSGI-INF/ecm-types-contrib.xml,\r
+ OSGI-INF/layouts-contrib.xml\r
+\r
--- /dev/null
+<?xml version="1.0"?>
+<component name="org.collectionspace.report.coreTypes">
+ <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+ <schema name="reports_common" prefix="reports_common" src="schemas/reports_common.xsd"/>
+ </extension>
+ <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+ <doctype name="Report" extends="Document">
+ <schema name="common"/>
+ <schema name="dublincore"/>
+ <schema name="collectionspace_core"/>
+ <schema name="reports_common"/>
+ </doctype>
+ </extension>
+</component>
--- /dev/null
+<?xml version="1.0"?>
+<fragment>
+
+ <extension target="application#MODULE">
+ <module>
+ <ejb>${bundle.fileName}</ejb>
+ </module>
+
+ <module>
+ <web>
+ <web-uri>nuxeo.war</web-uri>
+ <context-root>/nuxeo</context-root>
+ </web>
+ </module>
+ </extension>
+
+ <!-- uncomment that to enable tomcat based auth
+ <extension target="web#LOGIN-CONFIG">
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <realm-name>nuxeo.ecm</realm-name>
+ <form-login-config>
+ <form-login-page>/login.jsp</form-login-page>
+ <form-error-page>/login.jsp?loginFailed=true</form-error-page>
+ </form-login-config>
+ </login-config>
+ </extension>
+ -->
+
+ <extension target="web#FILTER-MAPPING">
+
+ <!-- Seam Context Filter is declared in org.nuxeo.ecm.platform.ui.web
+ deployment fragment -->
+
+ <filter-mapping>
+ <filter-name>Seam Context Filter</filter-name>
+ <url-pattern>/ws/FileManageWS</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>Seam Context Filter</filter-name>
+ <url-pattern>/DocumentManagerWS</url-pattern>
+ </filter-mapping>
+ </extension>
+
+ <extension target="web#SERVLET">
+ </extension>
+
+ <extension target="web#SERVLET-MAPPING">
+ </extension>
+
+ <extension target="pages#PAGES">
+ <!-- This calls a method which load the Workspace logo -->
+ <page view-id="/showLogo.xhtml" action="#{logoHelper.getLogo}"/>
+
+ <!-- Bind URL to the Document URL resolver-->
+ <page view-id="/getDocument.xhtml"
+ action="#{navigationContext.navigateToURL}">
+ </page>
+
+ <page view-id="/nxliveedit.xhtml" action="#{liveEditHelper.getBootstrap()}"/>
+
+ <!-- Bind URL to the Parallele conversation Document URL resolver-->
+ <page view-id="/parallele.xhtml"
+ action="#{paralleleNavigationHelper.navigateToURL}">
+ </page>
+
+ <!-- Post login and 'home' view handler -->
+ <page view-id="/nxstartup.xhtml"
+ action="#{startupHelper.initDomainAndFindStartupPage('Default domain', 'view')}"/>
+
+ <!-- To redirect to the user dashboard instead, use instead:
+
+ <page view-id="/nxstartup.xhtml"
+ action="#{startupHelper.initDomainAndFindStartupPage('Default domain', 'user_dashboard')}" />
+ -->
+
+ <!-- config for workspace management
+ = give a description for each viewId
+ -->
+
+ <page view-id="/view_domains.xhtml">
+ #{currentServerLocation.name}/#{currentTabAction.label}
+ </page>
+
+ <page view-id="/select_document_type.faces.xhtml">
+ Create new document in #{currentDocument.name}
+ </page>
+
+ <page view-id="/create_document.faces.xhtml">
+ Create new document in #{currentDocument.name}
+ </page>
+
+ <page view-id="/user_dashboard.xhtml">
+ breadcrumb=command.user_dashboard
+ </page>
+
+ <page view-id="/view_users.xhtml">
+ breadcrumb=command.manageMembers
+ </page>
+
+ <page view-id="/view_many_users.xhtml">
+ breadcrumb=command.manageMembers
+ </page>
+
+ <page view-id="/view_vocabularies.xhtml">
+ breadcrumb=title.vocabularies
+ </page>
+
+ <page view-id="/search/search_form.xhtml">
+ breadcrumb=command.advancedSearch
+ </page>
+ </extension>
+
+ <extension target="faces-config#APPLICATION">
+ <locale-config>
+ <default-locale>en</default-locale>
+ <supported-locale>en_GB</supported-locale>
+ <supported-locale>en_US</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <supported-locale>de</supported-locale>
+ <supported-locale>es</supported-locale>
+ <supported-locale>it</supported-locale>
+ <supported-locale>ar</supported-locale>
+ <supported-locale>ru</supported-locale>
+ <supported-locale>ja</supported-locale>
+ <supported-locale>vn</supported-locale>
+ </locale-config>
+
+ <message-bundle>messages</message-bundle>
+ </extension>
+
+ <extension target="components#PAGEFLOW">
+ <value>config/addWorkspace.jpdl.xml</value>
+ </extension>
+
+ <extension target="faces-config#NAVIGATION">
+ <!-- generic pages -->
+ <navigation-case>
+ <from-outcome>generic_error_page</from-outcome>
+ <to-view-id>/generic_error_page.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>generic_message_page</from-outcome>
+ <to-view-id>/generic_message_page.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>home</from-outcome>
+ <to-view-id>/nxstartup.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>user_login</from-outcome>
+ <to-view-id>/login.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>user_logout</from-outcome>
+ <to-view-id>/logout.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_servers</from-outcome>
+ <to-view-id>/view_servers.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- pages for document actions -->
+
+ <navigation-case>
+ <from-outcome>view_domains</from-outcome>
+ <to-view-id>/view_domains.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>select_document_type</from-outcome>
+ <to-view-id>/select_document_type.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_document</from-outcome>
+ <to-view-id>/create_document.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_document</from-outcome>
+ <to-view-id>/edit_document.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_documents</from-outcome>
+ <to-view-id>/view_documents.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_file</from-outcome>
+ <to-view-id>/create_file.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_workspace_wizard</from-outcome>
+ <to-view-id>/createWorkspaceWizard.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>send_email</from-outcome>
+ <to-view-id>/document_email.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use view_documents instead -->
+ <navigation-case>
+ <from-outcome>view_workspaces</from-outcome>
+ <to-view-id>/view_workspaces.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use create_document instead -->
+ <navigation-case>
+ <from-outcome>create_domain</from-outcome>
+ <to-view-id>/create_domain.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use edit_document instead -->
+ <navigation-case>
+ <from-outcome>edit_domain</from-outcome>
+ <to-view-id>/edit_domain.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use create_document instead -->
+ <navigation-case>
+ <from-outcome>create_workspace</from-outcome>
+ <to-view-id>/create_workspace.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use edit_document instead -->
+ <navigation-case>
+ <from-outcome>edit_workspace</from-outcome>
+ <to-view-id>/edit_workspace.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- users ang groups -->
+
+ <navigation-case>
+ <from-outcome>members_management</from-outcome>
+ <to-view-id>/members_management.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_users</from-outcome>
+ <to-view-id>/view_users.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_many_users</from-outcome>
+ <to-view-id>/view_many_users.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_user</from-outcome>
+ <to-view-id>/edit_user.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_user_password</from-outcome>
+ <to-view-id>/edit_user_password.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_user</from-outcome>
+ <to-view-id>/view_user.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_user</from-outcome>
+ <to-view-id>/create_user.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_groups</from-outcome>
+ <to-view-id>/view_groups.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_group</from-outcome>
+ <to-view-id>/view_group.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_group</from-outcome>
+ <to-view-id>/edit_group.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_group</from-outcome>
+ <to-view-id>/create_group.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_vocabularies</from-outcome>
+ <to-view-id>/view_vocabularies.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_vocabulary</from-outcome>
+ <to-view-id>/view_vocabulary.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- search -->
+
+ <navigation-case>
+ <from-outcome>search_form</from-outcome>
+ <to-view-id>/search/search_form.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>search_results_nxql</from-outcome>
+ <to-view-id>/search/search_results_nxql.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>search_results_advanced</from-outcome>
+ <to-view-id>
+ /search/search_results_advanced.xhtml
+ </to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>search_results_simple</from-outcome>
+ <to-view-id>/search/search_results_simple.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- miscellaneaous -->
+
+ <navigation-case>
+ <from-outcome>clipboard</from-outcome>
+ <to-view-id>/incl/clipboard.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>user_dashboard</from-outcome>
+ <to-view-id>/user_dashboard.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>select_workspace_template</from-outcome>
+ <to-view-id>/select_workspace_template.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>pdf_generation_error</from-outcome>
+ <to-view-id>/pdf_generation_error.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>mass_edit</from-outcome>
+ <to-view-id>/massedit_documents.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>mass_edit_confirm</from-outcome>
+ <to-view-id>/massedit_documents_preview.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </extension>
+
+</fragment>
+
--- /dev/null
+<?xml version="1.0"?>
+<component name="org.collectionspace.report.ecm.types">
+ <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+ <type id="Report" coretype="Report">
+ <label>org.collectionspace.report</label>
+ <!--icon>/icons/file.gif</icon-->
+ <default-view>view_documents</default-view>
+
+ <layouts mode="any">
+ <layout>heading</layout>
+ <layout>collectionspace_core</layout>
+ <layout>report</layout>
+ </layouts>
+ </type>
+
+ <type id="Folder" coretype="Folder">
+ <subtypes>
+ <type>Report</type>
+ </subtypes>
+ </type>
+
+ <type id="Workspace" coretype="Workspace">
+ <subtypes>
+ <type>Report</type>
+ </subtypes>
+ </type>
+
+ </extension>
+</component>
--- /dev/null
+<?xml version="1.0"?>
+
+<component name="org.collectionspace.report.layouts.webapp">
+
+ <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+ point="layouts">
+
+ <layout name="report">
+ <templates>
+ <template mode="any">/layouts/layout_default_template.xhtml</template>
+ </templates>
+ <rows>
+ <row><widget>name</widget></row>
+ <row><widget>filename</widget></row>
+ <row><widget>outputMIME</widget></row>
+ </rows>
+
+ <widget name="name" type="text">
+ <labels>
+ <label mode="any">Name</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="reports_common">name</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="filename" type="text">
+ <labels>
+ <label mode="any">filename</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="reports_common">filename</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="outputMIME" type="text">
+ <labels>
+ <label mode="any">outputMIME</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="reports_common">outputMIME</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ </layout>
+ </extension>
+</component>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+\r
+<!--\r
+ Report schema (XSD)\r
+\r
+ Entity : Report\r
+ Part : Common\r
+ Used for: Nuxeo EP core document type\r
+\r
+ $LastChangedRevision: 2498 $\r
+ $LastChangedDate: 2010-06-16 14:47:45 -0700 (Wed, 16 Jun 2010) $\r
+-->\r
+\r
+<xs:schema \r
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
+ xmlns:ns="http://collectionspace.org/report/"\r
+ xmlns="http://collectionspace.org/report/"\r
+ targetNamespace="http://collectionspace.org/report/"\r
+ version="0.1">\r
+ \r
+ <!-- See http://wiki.collectionspace.org/display/collectionspace/Report+Schema -->\r
+\r
+ <xs:element name="name" type="xs:string"/>\r
+ <xs:element name="notes" type="xs:string"/>\r
+ <xs:element name="forDocType" type="xs:string"/>\r
+ <xs:element name="forSingleDoc" type="xs:boolean"/>\r
+ <xs:element name="filename" type="xs:string"/>\r
+ <xs:element name="outputMIME" type="xs:string"/>\r
+\r
+</xs:schema>\r
--- /dev/null
+\r
+<project xmlns="http://maven.apache.org/POM/4.0.0"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+ <parent>\r
+ <artifactId>org.collectionspace.services.report</artifactId>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <version>0.9-SNAPSHOT</version>\r
+ </parent>\r
+ \r
+ <modelVersion>4.0.0</modelVersion>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.report.3rdparty</artifactId>\r
+ <name>services.report.3rdparty</name>\r
+ <packaging>pom</packaging>\r
+ \r
+ <description>\r
+ 3rd party build for report service\r
+ </description>\r
+\r
+ <modules>\r
+ <module>nuxeo-platform-cs-report</module>\r
+ </modules>\r
+</project>\r
--- /dev/null
+\r
+<project name="report" default="package" basedir=".">\r
+ <description>\r
+ report service\r
+ </description>\r
+ <!-- set global properties for this build -->\r
+ <property name="services.trunk" value="../.."/>\r
+ <!-- enviornment should be declared before reading build.properties -->\r
+ <property environment="env" />\r
+ <property file="${services.trunk}/build.properties" />\r
+ <property name="mvn.opts" value="" />\r
+ <property name="src" location="src"/>\r
+\r
+ <condition property="osfamily-unix">\r
+ <os family="unix" />\r
+ </condition>\r
+ <condition property="osfamily-windows">\r
+ <os family="windows" />\r
+ </condition>\r
+\r
+ <target name="package" depends="package-unix,package-windows"\r
+ description="Package CollectionSpace Services" />\r
+ \r
+ <target name="package-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="package" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ \r
+ <target name="package-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="package" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+\r
+ <target name="install" depends="install-unix,install-windows"\r
+ description="Install" />\r
+ <target name="install-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="install" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="install-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="install" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="clean" depends="clean-unix,clean-windows"\r
+ description="Delete target directories" >\r
+ <delete dir="${build}"/>\r
+ </target>\r
+ <target name="clean-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="clean" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="clean-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="clean" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />\r
+ <target name="test-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="test" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="test-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="test" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="deploy" depends="install"\r
+ description="deploy report service">\r
+ <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false"/>\r
+ </target>\r
+\r
+ <target name="undeploy"\r
+ description="undeploy report service">\r
+ <ant antfile="3rdparty/build.xml" target="undeploy" inheritall="false"/>\r
+ </target>\r
+\r
+ <target name="dist" depends="package"\r
+ description="distribute report service">\r
+ <ant antfile="3rdparty/build.xml" target="dist" inheritall="false"/>\r
+ </target>\r
+\r
+</project>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.report.client</name>\r
+ <comment></comment>\r
+ <projects>\r
+ <project>org.collectionspace.services.client</project>\r
+ <project>org.collectionspace.services.common</project>\r
+ <project>org.collectionspace.services.report.jaxb</project>\r
+ <project>org.collectionspace.services.jaxb</project>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Tue Jul 13 14:34:12 PDT 2010\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.source=1.6\r
--- /dev/null
+#Fri Sep 11 17:00:30 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+skipCompilerPlugin=true\r
+version=1\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+ <parent>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.report</artifactId>\r
+ <version>0.9-SNAPSHOT</version>\r
+ </parent>\r
+\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.report.client</artifactId>\r
+ <name>services.report.client</name>\r
+ \r
+ <dependencies>\r
+ <!-- keep slf4j dependencies on the top -->\r
+ <dependency>\r
+ <groupId>org.slf4j</groupId>\r
+ <artifactId>slf4j-api</artifactId>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.slf4j</groupId>\r
+ <artifactId>slf4j-log4j12</artifactId>\r
+ <scope>test</scope>\r
+ </dependency>\r
+<!-- CollectionSpace dependencies -->\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.common</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.report.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.client</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.person.client</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.organization.client</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+<!-- External dependencies --> \r
+ <dependency>\r
+ <groupId>org.testng</groupId>\r
+ <artifactId>testng</artifactId>\r
+ <version>5.6</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-jaxrs</artifactId>\r
+ <!-- filter out unwanted jars -->\r
+ <exclusions>\r
+ <exclusion>\r
+ <groupId>tjws</groupId>\r
+ <artifactId>webserver</artifactId>\r
+ </exclusion>\r
+ </exclusions>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-jaxb-provider</artifactId>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-multipart-provider</artifactId>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-httpclient</groupId>\r
+ <artifactId>commons-httpclient</artifactId>\r
+ <version>3.1</version>\r
+ </dependency>\r
+ </dependencies>\r
+ \r
+ <build>\r
+ <finalName>collectionspace-services-report-client</finalName>\r
+ </build>\r
+</project>\r
+\r
--- /dev/null
+/**
+ * ReportClient.java
+ *
+ * {Purpose of This Class}
+ *
+ * {Other Notes Relating to This Class (Optional)}
+ *
+ * $LastChangedBy: $
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ *
+ * 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 (c) 2009 {Contributing Institution}
+ *
+ * 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
+ */
+package org.collectionspace.services.client;
+
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+//import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.report.ReportsCommonList;
+
+import org.jboss.resteasy.client.ProxyFactory;
+import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+/**
+ * A ReportClient.
+
+ * @version $Revision:$
+ * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684
+ */
+public class ReportClient extends AbstractServiceClientImpl {
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.AbstractServiceClientImpl#getServicePathComponent()
+ */
+ public String getServicePathComponent() {
+ return "reports";
+ }
+ /**
+ *
+ */
+// private static final ReportClient instance = new ReportClient();
+ /**
+ *
+ */
+ private ReportProxy reportProxy;
+
+ /**
+ *
+ * Default constructor for ReportClient class.
+ *
+ */
+ public ReportClient() {
+ ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
+ RegisterBuiltin.register(factory);
+ setProxy();
+ }
+
+ @Override
+ public CollectionSpaceProxy getProxy() {
+ return this.reportProxy;
+ }
+
+ /**
+ * allow to reset proxy as per security needs
+ */
+ public void setProxy() {
+ if (useAuth()) {
+ reportProxy = ProxyFactory.create(ReportProxy.class,
+ getBaseURL(), getHttpClient());
+ } else {
+ reportProxy = ProxyFactory.create(ReportProxy.class,
+ getBaseURL());
+ }
+ }
+
+ /**
+ * FIXME Comment this
+ *
+ * @return
+ */
+// public static ReportClient getInstance() {
+// return instance;
+// }
+
+ /**
+ * @return
+ * @see org.collectionspace.services.client.ReportProxy#getReport()
+ */
+ public ClientResponse<ReportsCommonList> readList() {
+ return reportProxy.readList();
+ }
+
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.services.client.ReportProxy#getAuthorityRefs(java.lang.String)
+ */
+ public ClientResponse<AuthorityRefList> getAuthorityRefs(String csid) {
+ return reportProxy.getAuthorityRefs(csid);
+ }
+
+
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.services.client.ReportProxy#getReport(java.lang.String)
+ */
+ public ClientResponse<MultipartInput> read(String csid) {
+ return reportProxy.read(csid);
+ }
+
+ /**
+ * @param report
+ * @return
+ * @see org.collectionspace.services.client.ReportProxy#createReport(org.collectionspace.hello.Report)
+ */
+ public ClientResponse<Response> create(MultipartOutput multipart) {
+ return reportProxy.create(multipart);
+ }
+
+ /**
+ * @param csid
+ * @param report
+ * @return
+ * @see org.collectionspace.services.client.ReportProxy#updateReport(java.lang.Long, org.collectionspace.hello.Report)
+ */
+ public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
+ return reportProxy.update(csid, multipart);
+
+ }
+
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.services.client.ReportProxy#deleteReport(java.lang.Long)
+ */
+ public ClientResponse<Response> delete(String csid) {
+ return reportProxy.delete(csid);
+ }
+}
--- /dev/null
+/**
+ * ReportProxy.java
+ *
+ * {Purpose of This Class}
+ *
+ * {Other Notes Relating to This Class (Optional)}
+ *
+ * $LastChangedBy: $
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ *
+ * 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 {Contributing Institution}
+ *
+ * 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
+ */
+package org.collectionspace.services.client;
+
+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.core.Response;
+
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.report.ReportsCommonList;
+import org.collectionspace.services.person.PersonsCommonList;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+
+/**
+ * @version $Revision:$
+ * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684
+ */
+@Path("/reports/")
+@Produces({"multipart/mixed"})
+@Consumes({"multipart/mixed"})
+public interface ReportProxy extends CollectionSpaceProxy {
+
+ /**
+ * Read list.
+ *
+ * @return the client response
+ */
+ @GET
+ @Produces({"application/xml"})
+ ClientResponse<ReportsCommonList> readList();
+
+ //(C)reate
+ /**
+ * Creates the.
+ *
+ * @param multipart the multipart
+ * @return the client response
+ */
+ @POST
+ ClientResponse<Response> create(MultipartOutput multipart);
+
+ //(R)ead
+ /**
+ * Read.
+ *
+ * @param csid the csid
+ * @return the client response
+ */
+ @GET
+ @Path("/{csid}")
+ ClientResponse<MultipartInput> read(@PathParam("csid") String csid);
+
+ //(U)pdate
+ /**
+ * Update.
+ *
+ * @param csid the csid
+ * @param multipart the multipart
+ * @return the client response
+ */
+ @PUT
+ @Path("/{csid}")
+ ClientResponse<MultipartInput> update(@PathParam("csid") String csid, MultipartOutput multipart);
+
+ //(D)elete
+ /**
+ * Delete.
+ *
+ * @param csid the csid
+ * @return the client response
+ */
+ @DELETE
+ @Path("/{csid}")
+ ClientResponse<Response> delete(@PathParam("csid") String csid);
+
+ // List Items
+ /**
+ * Gets the authority refs.
+ *
+ * @param csid the csid
+ * @return the authority refs
+ */
+ @GET
+ @Produces({"application/xml"})
+ @Path("/{csid}/authorityrefs/")
+ ClientResponse<AuthorityRefList> getAuthorityRefs(@PathParam("csid") String csid);
+
+}
--- /dev/null
+/**
+ * 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 Regents of the University of California
+ *
+ * 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.client.test;
+
+import java.util.List;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.ReportClient;
+import org.collectionspace.services.report.ReportsCommon;
+import org.collectionspace.services.report.ReportsCommonList;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
+import org.testng.Assert;
+//import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * FIXME: http://issues.collectionspace.org/browse/CSPACE-1685
+ * ReportServiceTest, carries out tests against a
+ * deployed and running Report Service.
+ *
+ * $LastChangedRevision: 2261 $
+ * $LastChangedDate: 2010-05-28 16:52:22 -0700 (Fri, 28 May 2010) $
+ */
+public class ReportServiceTest extends AbstractServiceTestImpl {
+
+ /** The logger. */
+ private final String CLASS_NAME = ReportServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
+ // Instance variables specific to this test.
+ /** The service path component. */
+ final String SERVICE_PATH_COMPONENT = "reports";
+
+ /** The known resource id. */
+ private String knownResourceId = null;
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
+ */
+ @Override
+ protected CollectionSpaceClient getClientInstance() {
+ return new ReportClient();
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
+ */
+ @Override
+ protected AbstractCommonList getAbstractCommonList(
+ ClientResponse<AbstractCommonList> response) {
+ return response.getEntity(ReportsCommonList.class);
+ }
+
+ // ---------------------------------------------------------------
+ // CRUD tests : CREATE tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
+ */
+ @Override
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
+ public void create(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup, such as initializing the type of service request
+ // (e.g. CREATE, DELETE), its valid and expected status codes, and
+ // its associated HTTP method name (e.g. POST, DELETE).
+ setupCreate();
+
+ // Submit the request to the service and store the response.
+ ReportClient client = new ReportClient();
+ String identifier = createIdentifier();
+ MultipartOutput multipart = createReportInstance(identifier);
+ ClientResponse<Response> res = client.create(multipart);
+
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ //
+ // Specifically:
+ // Does it fall within the set of valid status codes?
+ // Does it exactly match the expected status code?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ // Store the ID returned from the first resource created
+ // for additional tests below.
+ if (knownResourceId == null){
+ knownResourceId = extractId(res);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testName + ": knownResourceId=" + knownResourceId);
+ }
+ }
+
+ // Store the IDs from every resource created by tests,
+ // so they can be deleted after tests have been run.
+ allResourceIdsCreated.add(extractId(res));
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
+ */
+ @Override
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"create"})
+ public void createList(String testName) throws Exception {
+ for(int i = 0; i < 3; i++){
+ create(testName);
+ }
+ }
+
+ // Failure outcomes
+ // Placeholders until the three tests below can be uncommented.
+ // See Issue CSPACE-401.
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
+ */
+ @Override
+ public void createWithEmptyEntityBody(String testName) throws Exception {
+ //Should this really be empty?
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
+ */
+ @Override
+ public void createWithMalformedXml(String testName) throws Exception {
+ //Should this really be empty?
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
+ */
+ @Override
+ public void createWithWrongXmlSchema(String testName) throws Exception {
+ //Should this really be empty?
+ }
+
+ // ---------------------------------------------------------------
+ // CRUD tests : READ tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
+ */
+ @Override
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"create"})
+ public void read(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupRead();
+
+ // Submit the request to the service and store the response.
+ ReportClient client = new ReportClient();
+ ClientResponse<MultipartInput> res = client.read(knownResourceId);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ MultipartInput input = (MultipartInput) res.getEntity();
+ ReportsCommon report = (ReportsCommon) extractPart(input,
+ client.getCommonPartName(), ReportsCommon.class);
+ Assert.assertNotNull(report);
+ }
+
+ // Failure outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
+ */
+ @Override
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"read"})
+ public void readNonExistent(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupReadNonExistent();
+
+ // Submit the request to the service and store the response.
+ ReportClient client = new ReportClient();
+ ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+
+ // ---------------------------------------------------------------
+ // CRUD tests : READ_LIST tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
+ */
+ @Override
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"createList", "read"})
+ public void readList(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupReadList();
+
+ // Submit the request to the service and store the response.
+ ReportClient client = new ReportClient();
+ ClientResponse<ReportsCommonList> res = client.readList();
+ ReportsCommonList list = res.getEntity();
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ // Optionally output additional data about list members for debugging.
+ boolean iterateThroughList = false;
+ if(iterateThroughList && logger.isDebugEnabled()){
+ List<ReportsCommonList.ReportListItem> items =
+ list.getReportListItem();
+ int i = 0;
+ for(ReportsCommonList.ReportListItem item : items){
+ logger.debug(testName + ": list-item[" + i + "] csid=" +
+ item.getCsid());
+ logger.debug(testName + ": list-item[" + i + "] name=" +
+ item.getName());
+ logger.debug(testName + ": list-item[" + i + "] outputMIME=" +
+ item.getOutputMIME());
+ logger.debug(testName + ": list-item[" + i + "] URI=" +
+ item.getUri());
+ i++;
+ }
+ }
+
+ }
+
+ // ---------------------------------------------------------------
+ // CRUD tests : UPDATE tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
+ */
+ @Override
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"read"})
+ public void update(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdate();
+
+ // Retrieve the contents of a resource to update.
+ ReportClient client = new ReportClient();
+ ClientResponse<MultipartInput> res =
+ client.read(knownResourceId);
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": read status = " + res.getStatus());
+ }
+ Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+
+ if(logger.isDebugEnabled()){
+ logger.debug("got object to update with ID: " + knownResourceId);
+ }
+ MultipartInput input = (MultipartInput) res.getEntity();
+ ReportsCommon report = (ReportsCommon) extractPart(input,
+ client.getCommonPartName(), ReportsCommon.class);
+ Assert.assertNotNull(report);
+
+ // Update the content of this resource.
+ // Update the content of this resource.
+ report.setName("updated-" + report.getName());
+ report.setOutputMIME("updated-" + report.getOutputMIME());
+ if(logger.isDebugEnabled()){
+ logger.debug("to be updated object");
+ logger.debug(objectAsXmlString(report, ReportsCommon.class));
+ }
+ // Submit the request to the service and store the response.
+ MultipartOutput output = new MultipartOutput();
+ OutputPart commonPart = output.addPart(report, MediaType.APPLICATION_XML_TYPE);
+ commonPart.getHeaders().add("label", client.getCommonPartName());
+
+ res = client.update(knownResourceId, output);
+ int statusCode = res.getStatus();
+ // Check the status code of the response: does it match the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+
+ input = (MultipartInput) res.getEntity();
+ ReportsCommon updatedReport =
+ (ReportsCommon) extractPart(input,
+ client.getCommonPartName(), ReportsCommon.class);
+ Assert.assertNotNull(updatedReport);
+
+ Assert.assertEquals(updatedReport.getName(),
+ report.getName(),
+ "Data in updated object did not match submitted data.");
+
+ }
+
+ // Failure outcomes
+ // Placeholders until the three tests below can be uncommented.
+ // See Issue CSPACE-401.
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
+ */
+ @Override
+ public void updateWithEmptyEntityBody(String testName) throws Exception {
+ //Should this really be empty?
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
+ */
+ @Override
+ public void updateWithMalformedXml(String testName) throws Exception {
+ //Should this really be empty?
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
+ */
+ @Override
+ public void updateWithWrongXmlSchema(String testName) throws Exception {
+ //Should this really be empty?
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
+ */
+ @Override
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"update", "testSubmitRequest"})
+ public void updateNonExistent(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupUpdateNonExistent();
+
+ // Submit the request to the service and store the response.
+ // Note: The ID used in this 'create' call may be arbitrary.
+ // The only relevant ID may be the one used in update(), below.
+ ReportClient client = new ReportClient();
+ MultipartOutput multipart = createReportInstance(NON_EXISTENT_ID);
+ ClientResponse<MultipartInput> res =
+ client.update(NON_EXISTENT_ID, multipart);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+
+ // ---------------------------------------------------------------
+ // CRUD tests : DELETE tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
+ */
+ @Override
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+ public void delete(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupDelete();
+
+ // Submit the request to the service and store the response.
+ ReportClient client = new ReportClient();
+ ClientResponse<Response> res = client.delete(knownResourceId);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+
+ // Failure outcomes
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
+ */
+ @Override
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"delete"})
+ public void deleteNonExistent(String testName) throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(testBanner(testName, CLASS_NAME));
+ }
+ // Perform setup.
+ setupDeleteNonExistent();
+
+ // Submit the request to the service and store the response.
+ ReportClient client = new ReportClient();
+ ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+
+ // ---------------------------------------------------------------
+ // Utility tests : tests of code used in tests above
+ // ---------------------------------------------------------------
+ /**
+ * Tests the code for manually submitting data that is used by several
+ * of the methods above.
+ */
+ @Test(dependsOnMethods = {"create", "read"})
+ public void testSubmitRequest() {
+
+ // Expected status code: 200 OK
+ final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
+
+ // Submit the request to the service and store the response.
+ String method = ServiceRequestType.READ.httpMethodName();
+ String url = getResourceURL(knownResourceId);
+ int statusCode = submitRequest(method, url);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug("testSubmitRequest: url=" + url +
+ " status=" + statusCode);
+ }
+ Assert.assertEquals(statusCode, EXPECTED_STATUS);
+
+ }
+
+ // ---------------------------------------------------------------
+ // Utility methods used by tests above
+ // ---------------------------------------------------------------
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
+ */
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ /**
+ * Creates the report instance.
+ *
+ * @param identifier the identifier
+ * @return the multipart output
+ */
+ private MultipartOutput createReportInstance(String identifier) {
+ return createReportInstance(
+ "name-" + identifier,
+ "persAuthTermCountsTest.jasper",
+ "application/pdf" );
+ }
+
+ /**
+ * Creates the report instance.
+ *
+ * @param name the report name
+ * @param filename the relative path to the report
+ * @param outputMIME the MIME type we will return for this report
+ * @return the multipart output
+ */
+ private MultipartOutput createReportInstance(String name,
+ String filename,
+ String outputMIME) {
+ ReportsCommon report = new ReportsCommon();
+ report.setName(name);
+ report.setFilename(filename);
+ report.setOutputMIME(outputMIME);
+ MultipartOutput multipart = new MultipartOutput();
+ OutputPart commonPart =
+ multipart.addPart(report, MediaType.APPLICATION_XML_TYPE);
+ commonPart.getHeaders().add("label", new ReportClient().getCommonPartName());
+
+ if(logger.isDebugEnabled()){
+ logger.debug("to be created, report common");
+ logger.debug(objectAsXmlString(report, ReportsCommon.class));
+ }
+
+ return multipart;
+ }
+}
--- /dev/null
+log4j.rootLogger=debug, stdout, R\r
+\r
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender\r
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout\r
+\r
+# Pattern to output the caller's file name and line number.\r
+log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n\r
+\r
+log4j.appender.R=org.apache.log4j.RollingFileAppender\r
+log4j.appender.R.File=target/test-client.log\r
+\r
+log4j.appender.R.MaxFileSize=100KB\r
+# Keep one backup file\r
+log4j.appender.R.MaxBackupIndex=1\r
+\r
+log4j.appender.R.layout=org.apache.log4j.PatternLayout\r
+log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n\r
+\r
+#packages\r
+log4j.logger.org.collectionspace=DEBUG\r
+log4j.logger.org.apache=INFO\r
+log4j.logger.httpclient=INFO\r
+log4j.logger.org.jboss.resteasy=INFO\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.report.jaxb</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Wed Feb 10 17:35:05 PST 2010\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.source=1.6\r
--- /dev/null
+#Fri Sep 11 17:00:30 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+skipCompilerPlugin=true\r
+version=1\r
--- /dev/null
+<?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.report</artifactId>
+ <groupId>org.collectionspace.services</groupId>
+ <version>0.9-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.report.jaxb</artifactId>
+ <name>services.report.jaxb</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2-commons</groupId>
+ <artifactId>property-listener-injector</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-report-jaxb</finalName>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
--- /dev/null
+/**\r
+ * \r
+ */\r
+package org.collectionspace.services;\r
+\r
+/**\r
+ * @author pschmitz\r
+ *\r
+ */\r
+public interface ReportJAXBSchema {\r
+ final static String NAME = "name";\r
+ final static String NOTES = "notes";\r
+ final static String FILENAME = "filename";\r
+ final static String FOR_SINGLE_DOC = "forSingleDoc";\r
+ final static String FOR_DOC_TYPE = "forDocType";\r
+ final static String OUTPUT_MIME = "outputMIME";\r
+}\r
+\r
+\r
--- /dev/null
+package org.collectionspace.services;\r
+\r
+public interface ReportListItemJAXBSchema {\r
+ final static String NAME = "name";\r
+ final static String FOR_SINGLE_DOC = "forSingleDoc";\r
+ final static String FOR_DOC_TYPE = "forDocType";\r
+ final static String OUTPUT_MIME ="outputMIME";\r
+ final static String CSID = "csid";\r
+ final static String URI = "url";\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ Report schema (XSD)
+
+ Entity : Report
+ Part : Common
+ Used for: JAXB binding between XML and Java objects
+
+ $LastChangedRevision: 2498 $
+ $LastChangedDate: 2010-06-16 14:47:45 -0700 (Wed, 16 Jun 2010) $
+-->
+
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ jaxb:version="1.0" elementFormDefault="unqualified"
+ xmlns:ns="http://collectionspace.org/services/report"
+ xmlns="http://collectionspace.org/services/report"
+ targetNamespace="http://collectionspace.org/services/report"
+ 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/Report+Schema -->
+
+ <!-- report -->
+ <xs:element name="reports_common">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="csid" type="xs:string" />
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="notes" type="xs:string"/>
+ <xs:element name="forDocType" type="xs:string"/>
+ <xs:element name="forSingleDoc" type="xs:boolean"/>
+ <xs:element name="filename" type="xs:string"/>
+ <xs:element name="outputMIME" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- This is the base class for paginated lists -->
+ <xs:complexType name="abstractCommonList">
+ <xs:annotation>
+ <xs:appinfo>
+ <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:complexType>
+
+ <!-- report records, as in nuxeo repository -->
+ <xs:element name="reports-common-list">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="abstractCommonList">
+ <xs:sequence>
+ <xs:element name="report-list-item" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"
+ minOccurs="1" />
+ <xs:element name="outputMIME" type="xs:string"
+ minOccurs="1" />
+ <xs:element name="forDocType" type="xs:string"
+ minOccurs="1" />
+ <xs:element name="forSingleDoc" type="xs:boolean"
+ minOccurs="1" />
+ <!-- uri to retrive report 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:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!-- A comment. -->\r
+<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">\r
+ <parent>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.main</artifactId>\r
+ <version>0.9-SNAPSHOT</version>\r
+ </parent>\r
+ \r
+ <modelVersion>4.0.0</modelVersion>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.report</artifactId>\r
+ <name>services.report</name>\r
+ <packaging>pom</packaging>\r
+\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>net.sf.jasperreports</groupId>\r
+ <artifactId>jasperreports</artifactId>\r
+ <version>3.7.3</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.codehaus.groovy</groupId>\r
+ <artifactId>groovy-all</artifactId>\r
+ <version>1.5.5</version>\r
+ </dependency>\r
+ </dependencies>\r
+ \r
+\r
+ <modules>\r
+ <module>jaxb</module>\r
+ <module>service</module>\r
+ <module>3rdparty</module>\r
+ <module>client</module>\r
+ </modules>\r
+\r
+</project>\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.report.service</name>\r
+ <comment></comment>\r
+ <projects>\r
+ <project>org.collectionspace.services.common</project>\r
+ <project>org.collectionspace.services.report.jaxb</project>\r
+ <project>org.collectionspace.services.jaxb</project>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Tue Jul 13 14:34:11 PDT 2010\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.source=1.6\r
--- /dev/null
+#Fri Sep 11 17:00:30 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+skipCompilerPlugin=true\r
+version=1\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<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">\r
+\r
+ <parent>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.report</artifactId> \r
+ <version>0.9-SNAPSHOT</version>\r
+ </parent>\r
+ \r
+ <modelVersion>4.0.0</modelVersion>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.report.service</artifactId>\r
+ <name>services.report.service</name>\r
+ <packaging>jar</packaging> \r
+\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.common</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.report.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.collectionobject.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <!-- External dependencies --> \r
+ <dependency>\r
+ <groupId>junit</groupId>\r
+ <artifactId>junit</artifactId>\r
+ <version>4.1</version>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.testng</groupId>\r
+ <artifactId>testng</artifactId>\r
+ <version>5.6</version>\r
+ </dependency>\r
+ \r
+ <!-- javax -->\r
+\r
+ <dependency>\r
+ <groupId>javax.security</groupId>\r
+ <artifactId>jaas</artifactId>\r
+ <version>1.0.01</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+\r
+ <dependency>\r
+ <groupId>dom4j</groupId>\r
+ <artifactId>dom4j</artifactId>\r
+ <version>1.6.1</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ \r
+ <!-- jboss -->\r
+\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-jaxrs</artifactId>\r
+ <exclusions>\r
+ <exclusion>\r
+ <groupId>tjws</groupId>\r
+ <artifactId>webserver</artifactId>\r
+ </exclusion>\r
+ </exclusions>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-jaxb-provider</artifactId>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-multipart-provider</artifactId>\r
+ </dependency>\r
+ \r
+ <!-- nuxeo -->\r
+\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.core</groupId>\r
+ <artifactId>nuxeo-core-api</artifactId>\r
+ <version>1.5.1-SNAPSHOT</version>\r
+ <exclusions>\r
+ <exclusion>\r
+ <artifactId>jboss-remoting</artifactId>\r
+ <groupId>jboss</groupId>\r
+ </exclusion>\r
+ </exclusions>\r
+ </dependency>\r
+\r
+ <dependency>\r
+ <groupId>org.restlet</groupId>\r
+ <artifactId>org.restlet</artifactId>\r
+ <version>1.0.7</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.noelios.restlet</groupId>\r
+ <artifactId>com.noelios.restlet.ext.httpclient</artifactId>\r
+ <version>1.0.7</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.noelios.restlet</groupId>\r
+ <artifactId>com.noelios.restlet</artifactId>\r
+ <version>1.0.7</version>\r
+ </dependency>\r
+ </dependencies>\r
+ \r
+ <build>\r
+ <finalName>collectionspace-services-report</finalName>\r
+ </build>\r
+</project>\r
+\r
--- /dev/null
+<?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
--- /dev/null
+/**
+ * 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.report;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.security.auth.login.LoginException;
+import javax.sql.DataSource;
+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.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
+
+import net.sf.jasperreports.engine.JRException;
+import net.sf.jasperreports.engine.JasperExportManager;
+import net.sf.jasperreports.engine.JasperFillManager;
+import net.sf.jasperreports.engine.JasperPrint;
+
+import org.collectionspace.services.ReportJAXBSchema;
+import org.collectionspace.services.common.AbstractMultiPartCollectionSpaceResourceImpl;
+import org.collectionspace.services.common.ClientType;
+import org.collectionspace.services.common.ServiceMain;
+import org.collectionspace.services.common.config.ConfigReader;
+import org.collectionspace.services.common.context.MultipartServiceContextImpl;
+import org.collectionspace.services.common.context.ServiceBindingUtils;
+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.AuthorityItemJAXBSchema;
+import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
+import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
+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 ReportResource.
+ */
+@Path("/reports")
+@Consumes("multipart/mixed")
+@Produces("multipart/mixed")
+public class ReportResource extends
+ AbstractMultiPartCollectionSpaceResourceImpl {
+
+ /** The Constant serviceName. */
+ private final static String serviceName = "reports";
+
+ private static String repositoryName = "NuxeoDS";
+ private static String reportsFolder = "reports";
+
+ /** The logger. */
+ final Logger logger = LoggerFactory.getLogger(ReportResource.class);
+ //FIXME retrieve client type from configuration
+ /** The Constant CLIENT_TYPE. */
+ final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
+
+ /**
+ * Instantiates a new report resource.
+ */
+ public ReportResource() {
+ // do nothing
+ }
+
+ public static String getRepositoryName() {
+ return repositoryName;
+ }
+
+ public static void setRepositoryName(String repositoryName) {
+ ReportResource.repositoryName = repositoryName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getVersionString()
+ */
+ @Override
+ protected String getVersionString() {
+ /** The last change revision. */
+ final String lastChangeRevision = "$LastChangedRevision: 1982 $";
+ return lastChangeRevision;
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getServiceName()
+ */
+ @Override
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.common.CollectionSpaceResource#getCommonPartClass()
+ */
+ @Override
+ public Class<ReportsCommon> getCommonPartClass() {
+ return ReportsCommon.class;
+ }
+
+ /**
+ * Creates the report.
+ *
+ * @param input the input
+ *
+ * @return the response
+ */
+ @POST
+ public Response createReport(MultipartInput input) {
+ try {
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(input);
+ DocumentHandler handler = createDocumentHandler(ctx);
+ String csid = getRepositoryClient(ctx).create(ctx, handler);
+ UriBuilder path = UriBuilder.fromResource(ReportResource.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 createReport", e);
+ }
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Create failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ }
+
+ /**
+ * Gets the report.
+ *
+ * @param csid the csid
+ *
+ * @return the report
+ */
+ @GET
+ @Path("{csid}")
+ public MultipartOutput getReport(
+ @PathParam("csid") String csid) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getReport with csid=" + csid);
+ }
+ if (csid == null || "".equals(csid)) {
+ logger.error("getReport: missing csid!");
+ Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+ "get failed on Report csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ MultipartOutput result = null;
+ try {
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();
+ 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("getReport", dnfe);
+ }
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Get failed on Report csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getReport", 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 Report CSID:" + csid + ": was not found.").type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return result;
+ }
+
+ /**
+ * Gets the report.
+ *
+ * @param csid the csid
+ *
+ * @return the report
+ */
+ @GET
+ @Path("{csid}/output")
+ @Produces("application/pdf")
+ public Response invokeReport(
+ @PathParam("csid") String csid) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("invokeReport with csid=" + csid);
+ }
+ Response response = null;
+ if (csid == null || "".equals(csid)) {
+ logger.error("invokeReport: missing csid!");
+ response = Response.status(Response.Status.BAD_REQUEST).entity(
+ "invoke failed on Report csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ try {
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();
+ DocumentWrapper<DocumentModel> docWrapper = getRepositoryClient(ctx).getDoc(ctx, csid);
+ DocumentModel docModel = docWrapper.getWrappedObject();
+ String reportFileName = (String)docModel.getPropertyValue(ReportJAXBSchema.FILENAME);
+ String fullPath = ServiceMain.getInstance().getServerRootDir() +
+ File.separator + ConfigReader.CSPACE_DIR_NAME +
+ File.separator + reportsFolder +
+ File.separator + reportFileName;
+ Connection conn = getConnection();
+ HashMap params = new HashMap();
+ FileInputStream fileStream = new FileInputStream(fullPath);
+
+ // fill the report
+ JasperPrint jasperprint = JasperFillManager.fillReport(fileStream, params,conn);
+ // export report to pdf and build a response with the bytes
+ byte[] pdfasbytes = JasperExportManager.exportReportToPdf(jasperprint);
+ response = Response.ok(pdfasbytes, "application/pdf").build();
+ } catch (UnauthorizedException ue) {
+ response = Response.status(
+ Response.Status.UNAUTHORIZED).entity("Invoke failed reason " + ue.getErrorReason()).type("text/plain").build();
+ throw new WebApplicationException(response);
+ } catch (DocumentNotFoundException dnfe) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("invokeReport", dnfe);
+ }
+ response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Invoke failed on Report csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ } catch (SQLException sqle) {
+ // SQLExceptions can be chained. We have at least one exception, so
+ // set up a loop to make sure we let the user know about all of them
+ // if there happens to be more than one.
+ if (logger.isDebugEnabled()) {
+ SQLException tempException = sqle;
+ while (null != tempException) {
+ logger.debug("SQL Exception: " + sqle.getLocalizedMessage());
+
+ // loop to the next exception
+ tempException = tempException.getNextException();
+ }
+ }
+ response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity(
+ "Invoke failed (SQL problem) on Report csid=" + csid).type("text/plain").build();
+ throw new WebApplicationException(response);
+ } catch (JRException jre) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("JR Exception: " + jre.getLocalizedMessage() + " Cause: "+jre.getCause());
+ }
+ response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity(
+ "Invoke failed (Jasper problem) on Report csid=" + csid).type("text/plain").build();
+ throw new WebApplicationException(response);
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("invokeReport", e);
+ }
+ response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Invoke failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ if (response == null) {
+ response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Invoke failed, the requested Report CSID:" + csid + ": was not found.").type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return response;
+ }
+
+ private Connection getConnection() throws LoginException, SQLException {
+ InitialContext ctx = null;
+ Connection conn = null;
+ try {
+ ctx = new InitialContext();
+ DataSource ds = (DataSource) ctx.lookup(repositoryName);
+ if (ds == null) {
+ throw new IllegalArgumentException("datasource not found: " + repositoryName);
+ }
+ conn = ds.getConnection();
+ return conn;
+ } catch (NamingException ex) {
+ LoginException le = new LoginException("Error looking up DataSource from: " + repositoryName);
+ le.initCause(ex);
+ throw le;
+ } finally {
+ if (ctx != null) {
+ try {
+ ctx.close();
+ } catch (Exception e) {
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Gets the report list.
+ *
+ * @param ui the ui
+ * @param keywords the keywords
+ *
+ * @return the report list
+ */
+ @GET
+ @Produces("application/xml")
+ public ReportsCommonList getReportList(@Context UriInfo ui,
+ @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords) {
+ ReportsCommonList result = null;
+ MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+
+ if (keywords != null) {
+ result = searchReports(queryParams, keywords);
+ } else {
+ result = getReportList(queryParams);
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets the report list.
+ *
+ * @return the report list
+ */
+ private ReportsCommonList getReportList(MultivaluedMap<String, String> queryParams) {
+ ReportsCommonList reportObjectList;
+ try {
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
+ DocumentHandler handler = createDocumentHandler(ctx);
+ getRepositoryClient(ctx).getFiltered(ctx, handler);
+ reportObjectList = (ReportsCommonList) 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 getReportList", e);
+ }
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return reportObjectList;
+ }
+
+
+ /**
+ * Gets the report list.
+ *
+ * @param csidList the csid list
+ *
+ * @return the report list
+ public ReportsCommonList getReportList(List<String> csidList) {
+ ReportsCommonList reportObjectList = new ReportsCommonList();
+ try {
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();
+ DocumentHandler handler = createDocumentHandler(ctx);
+ getRepositoryClient(ctx).get(ctx, csidList, handler);
+ reportObjectList = (ReportsCommonList) 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 getReportList", e);
+ }
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return reportObjectList;
+ }
+ */
+
+ /**
+ * Update report.
+ *
+ * @param csid the csid
+ * @param theUpdate the the update
+ *
+ * @return the multipart output
+ */
+ @PUT
+ @Path("{csid}")
+ public MultipartOutput updateReport(
+ @PathParam("csid") String csid,
+ MultipartInput theUpdate) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("updateReport with csid=" + csid);
+ }
+ if (csid == null || "".equals(csid)) {
+ logger.error("updateReport: missing csid!");
+ Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+ "update failed on Report csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ MultipartOutput result = null;
+ try {
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(theUpdate);
+ 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("caugth exception in updateReport", dnfe);
+ }
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Update failed on Report 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 report.
+ *
+ * @param csid the csid
+ *
+ * @return the response
+ */
+ @DELETE
+ @Path("{csid}")
+ public Response deleteReport(@PathParam("csid") String csid) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("deleteReport with csid=" + csid);
+ }
+ if (csid == null || "".equals(csid)) {
+ logger.error("deleteReport: missing csid!");
+ Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+ "delete failed on Report csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ try {
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext();
+ 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 deleteReport", dnfe);
+ }
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Delete failed on Report 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);
+ }
+ }
+
+ /**
+ * Search reports.
+ *
+ * @param keywords the keywords
+ *
+ * @return the reports common list
+ */
+ private ReportsCommonList searchReports(MultivaluedMap<String, String> queryParams,
+ String keywords) {
+ ReportsCommonList reportsObjectList;
+ try {
+ ServiceContext<MultipartInput, MultipartOutput> ctx = createServiceContext(queryParams);
+ 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);
+ reportsObjectList = (ReportsCommonList) 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 Reports", e);
+ }
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return reportsObjectList;
+ }
+}
--- /dev/null
+/**
+ * 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.report.nuxeo;
+
+/**
+ * ReportConstants processes CollectionObject document
+ *
+ */
+public class ReportConstants {
+
+ public final static String NUXEO_DOCTYPE = "Report";
+ public final static String NUXEO_SCHEMA_NAME = "report";
+ public final static String NUXEO_DC_TITLE = "CollectionSpace-Report";
+}
--- /dev/null
+/**
+ * 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.report.nuxeo;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.collectionspace.services.ReportJAXBSchema;
+import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.report.ReportsCommon;
+import org.collectionspace.services.report.ReportsCommonList;
+import org.collectionspace.services.report.ReportsCommonList.ReportListItem;
+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;
+
+/**
+ * ReportDocumentModelHandler
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class ReportDocumentModelHandler
+ extends RemoteDocumentModelHandlerImpl<ReportsCommon, ReportsCommonList> {
+
+ /** The logger. */
+ private final Logger logger = LoggerFactory.getLogger(ReportDocumentModelHandler.class);
+ /**
+ * report is used to stash JAXB object to use when handle is called
+ * for Action.CREATE, Action.UPDATE or Action.GET
+ */
+ private ReportsCommon report;
+ /**
+ * reportList is stashed when handle is called
+ * for ACTION.GET_ALL
+ */
+ private ReportsCommonList reportList;
+
+
+ /**
+ * getCommonPart get associated report
+ * @return
+ */
+ @Override
+ public ReportsCommon getCommonPart() {
+ return report;
+ }
+
+ /**
+ * setCommonPart set associated report
+ * @param report
+ */
+ @Override
+ public void setCommonPart(ReportsCommon report) {
+ this.report = report;
+ }
+
+ /**
+ * getCommonPartList get associated report (for index/GET_ALL)
+ * @return
+ */
+ @Override
+ public ReportsCommonList getCommonPartList() {
+ return reportList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#setCommonPartList(java.lang.Object)
+ */
+ @Override
+ public void setCommonPartList(ReportsCommonList reportList) {
+ this.reportList = reportList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPart(org.collectionspace.services.common.document.DocumentWrapper)
+ */
+ @Override
+ public ReportsCommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
+ throws Exception {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#fillCommonPart(java.lang.Object, org.collectionspace.services.common.document.DocumentWrapper)
+ */
+ @Override
+ public void fillCommonPart(ReportsCommon reportObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
+ */
+ @Override
+ public ReportsCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
+ ReportsCommonList coList = this.extractPagingInfo(new ReportsCommonList(), wrapDoc);
+ List<ReportsCommonList.ReportListItem> list = coList.getReportListItem();
+ Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
+ String label = getServiceContext().getCommonPartLabel();
+ while(iter.hasNext()){
+ DocumentModel docModel = iter.next();
+ ReportListItem ilistItem = new ReportListItem();
+ ilistItem.setName((String) docModel.getProperty(label,
+ ReportJAXBSchema.NAME));
+ ilistItem.setOutputMIME((String) docModel.getProperty(label,
+ ReportJAXBSchema.OUTPUT_MIME));
+ ilistItem.setForSingleDoc((Boolean) docModel.getProperty(label,
+ ReportJAXBSchema.FOR_SINGLE_DOC));
+ ilistItem.setForDocType((String) docModel.getProperty(label,
+ ReportJAXBSchema.FOR_DOC_TYPE));
+ 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 ReportConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+ }
+
+}
+
--- /dev/null
+package org.collectionspace.services.report.nuxeo;\r
+\r
+import org.collectionspace.services.common.context.ServiceContext;\r
+import org.collectionspace.services.common.document.InvalidDocumentException;\r
+import org.collectionspace.services.common.document.ValidatorHandler;\r
+import org.collectionspace.services.common.document.DocumentHandler.Action;\r
+\r
+public class ReportValidatorHandler implements ValidatorHandler {\r
+\r
+ @Override\r
+ public void validate(Action action, ServiceContext ctx)\r
+ throws InvalidDocumentException {\r
+ // TODO Auto-generated method stub\r
+ System.out.println("ReportValidatorHandler executed.");\r
+\r
+ }\r
+\r
+}\r
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
+ <local-tx-datasource>
+ <jndi-name>NuxeoDS</jndi-name>
+ <use-java-context>false</use-java-context>
+ <connection-url>jdbc:mysql://localhost:3306/nuxeo</connection-url>
+ <driver-class>com.mysql.jdbc.Driver</driver-class>
+ <user-name>test</user-name>
+ <password>test</password>
+ <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
+ <!-- should only be used on drivers after 3.22.1 with "ping" support
+ <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
+ -->
+ <!-- sql to call when connection is created
+ <new-connection-sql>some arbitrary sql</new-connection-sql>
+ -->
+ <!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers
+ <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
+ -->
+
+ <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
+ <metadata>
+ <type-mapping>mySQL</type-mapping>
+ </metadata>
+ </local-tx-datasource>
</datasources>