]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-3441: Added final support in the Services core for tenant specifc document...
authorRichard Millet <richard.millet@berkeley.edu>
Fri, 17 Jun 2011 05:18:21 +0000 (05:18 +0000)
committerRichard Millet <richard.millet@berkeley.edu>
Fri, 17 Jun 2011 05:18:21 +0000 (05:18 +0000)
24 files changed:
services/collectionobject/3rdparty/build.xml
services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/build.xml [new file with mode: 0644]
services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/pom.xml [new file with mode: 0644]
services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/META-INF/MANIFEST.MF [new file with mode: 0644]
services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/core-types-contrib.xml [new file with mode: 0644]
services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/deployment-fragment.xml [new file with mode: 0644]
services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/ecm-types-contrib.xml [new file with mode: 0644]
services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/layouts-contrib.xml [new file with mode: 0644]
services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/life-cycle-contrib.xml [new file with mode: 0644]
services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/schemas/collectionobjects_common.xsd [moved from services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/schemas/collectionobjects_common.xsd with 97% similarity]
services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/build.xml
services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/pom.xml
services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/META-INF/MANIFEST.MF
services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/OSGI-INF/core-types-contrib.xml
services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/OSGI-INF/ecm-types-contrib.xml
services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/OSGI-INF/layouts-contrib.xml
services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/OSGI-INF/life-cycle-contrib.xml
services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/schemas/collectionobjects_naturalhistory.xsd [deleted file]
services/collectionobject/3rdparty/pom.xml
services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java
services/common/src/main/java/org/collectionspace/services/common/context/ServiceContext.java
services/common/src/main/java/org/collectionspace/services/common/query/QueryContext.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java
services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java

index b3c70a12aec08ce2ec2f5e5fcd317e89bdf3ce01..de0e27d3c9a73453f56504a96d1015578c56263a 100644 (file)
@@ -8,6 +8,9 @@
      <!-- enviornment should be declared before reading build.properties -->\r
     <property environment="env" />\r
     <property file="${services.trunk}/build.properties" />\r
+       <property name="nuxeo-platform-collectionobjects_common" value="nuxeo-platform-collectionobjects_common"/>\r
+       <property name="nuxeo-platform-cs-collectionobject" value="nuxeo-platform-cs-collectionobject"/>\r
+       <property name="nuxeo-platform-collectionobject-hearst" value="nuxeo-platform-collectionobject-hearst"/>\r
     <property name="mvn.opts" value="" />\r
     <property name="src" location="src"/>\r
     <property name="build" location="build"/>\r
 \r
     <target name="deploy" depends="install"\r
     description="deploy collectionobject in ${jboss.server.nuxeo}">\r
-        <ant antfile="nuxeo-platform-cs-collectionobject/build.xml" target="deploy" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-collectionobjects_common}/build.xml" target="deploy" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-cs-collectionobject}/build.xml" target="deploy" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-collectionobject-hearst}/build.xml" target="deploy" inheritall="false"/>\r
     </target>\r
 \r
     <target name="undeploy"\r
     description="undeploy collectionobject from ${jboss.server.nuxeo}">\r
-        <ant antfile="nuxeo-platform-cs-collectionobject/build.xml" target="undeploy" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-collectionobjects_common}/build.xml" target="undeploy" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-cs-collectionobject}/build.xml" target="undeploy" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-collectionobject-hearst}/build.xml" target="undeploy" inheritall="false"/>\r
     </target>\r
 \r
     <target name="dist"\r
     description="generate distribution for collectionobject" depends="package">\r
-        <ant antfile="nuxeo-platform-cs-collectionobject/build.xml" target="dist" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-collectionobjects_common}/build.xml" target="dist" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-cs-collectionobject}/build.xml" target="dist" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-collectionobject-hearst}/build.xml" target="dist" inheritall="false"/>\r
     </target>\r
 \r
     <target name="dist_installer"\r
     description="generate distribution for collectionobject" depends="package">\r
-        <ant antfile="nuxeo-platform-cs-collectionobject/build.xml" target="dist_installer" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-collectionobjects_common}/build.xml" target="dist_installer" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-cs-collectionobject}/build.xml" target="dist_installer" inheritall="false"/>\r
+        <ant antfile="${nuxeo-platform-collectionobject-hearst}/build.xml" target="dist_installer" inheritall="false"/>\r
     </target>\r
 \r
 </project>\r
diff --git a/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/build.xml b/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/build.xml
new file mode 100644 (file)
index 0000000..1df4e90
--- /dev/null
@@ -0,0 +1,151 @@
+\r
+<project name="nuxeo-platform-collectionobjects_common" default="package" basedir=".">\r
+    <description>\r
+        CollectionobjectsCommon Nuxeo document type\r
+    </description>\r
+    <!-- set global properties for this build -->\r
+    <property name="services.trunk" value="../../../.."/>\r
+    <!-- environment 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
+    <property name="build" location="build"/>\r
+    <property name="dist"  location="dist"/>\r
+    <property name="nuxeo.collectionobject.jar"\r
+        value="org.collectionspace.services.collectionobject.collectionobjects_common.nuxeo-${cspace.release}.jar"/>\r
+    <property name="nuxeo.collectionobject.jars.all"\r
+        value="org.collectionspace.services.collectionobject.collectionobjects_common.nuxeo-*.jar"/>\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
+        <!-- Create the build directory structure used by compile -->\r
+        <mkdir dir="${build}"/>\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 CollectionObjectsCommon doctype in ${jboss.server.nuxeo}">\r
+        <copy file="${basedir}/target/${nuxeo.collectionobject.jar}"\r
+        todir="${jboss.deploy.nuxeo.plugins}"/>\r
+    </target>\r
+\r
+    <target name="undeploy"\r
+        description="Undeploy CollectionObjectsCommon doctype from ${jboss.server.nuxeo}">\r
+        <delete>\r
+            <fileset dir="${jboss.deploy.nuxeo.plugins}">\r
+                <include name="${nuxeo.collectionobject.jars.all}"/>\r
+            </fileset>\r
+            <!-- Legacy deployment location through release 0.6 -->\r
+            <fileset dir="${jboss.deploy.nuxeo.system}">\r
+                <include name="${nuxeo.collectionobject.jars.all}"/>\r
+            </fileset>\r
+        </delete>\r
+    </target>\r
+\r
+    <target name="dist"\r
+       description="generate distribution for collectionobject doctype" depends="package">\r
+        <copy todir="${services.trunk}/${dist.deploy.nuxeo.plugins}">\r
+            <fileset file="${basedir}/target/${nuxeo.collectionobject.jar}"/>\r
+        </copy>\r
+    </target>\r
+\r
+    <target name="dist_installer"\r
+       description="Creates an installer distribution for CollectionObjectsCommon doctype" depends="package">\r
+        <copy todir="${services.trunk}/${dist.installer.services}/collectionobject/nuxeo">\r
+            <fileset file="${basedir}/target/${nuxeo.collectionobject.jar}"/>\r
+        </copy>\r
+    </target>\r
+</project>\r
diff --git a/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/pom.xml b/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/pom.xml
new file mode 100644 (file)
index 0000000..b711ec2
--- /dev/null
@@ -0,0 +1,37 @@
+<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.collectionobject.3rdparty</artifactId>
+        <version>1.8-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.collectionobject.collectionobjects_common.nuxeo</artifactId>
+    <name>org.collectionspace.services.collectionobject.collectionobjects_common.nuxeo</name>
+    <packaging>jar</packaging>
+    <description>
+        CollectionObject Common 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>
diff --git a/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/META-INF/MANIFEST.MF b/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..d1b2134
--- /dev/null
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0 \r
+Bundle-ManifestVersion: 1 \r
+Bundle-Name: org.collectionspace.collectionobject\r
+Bundle-SymbolicName: org.collectionspace.collectionobject;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.webapp.core,\r
+ org.collectionspace.collectionspace_core\r
+Provide-Package: org.collectionspace.collectionobject\r
+Nuxeo-Component: OSGI-INF/core-types-contrib.xml,\r
+ OSGI-INF/life-cycle-contrib.xml,\r
+ OSGI-INF/ecm-types-contrib.xml,\r
+ OSGI-INF/layouts-contrib.xml\r
diff --git a/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/core-types-contrib.xml b/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/core-types-contrib.xml
new file mode 100644 (file)
index 0000000..21ae464
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.collectionobject.coreTypes">
+    <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+        <schema name="collectionobjects_common" prefix="collectionobjects_common" src="schemas/collectionobjects_common.xsd"/>
+    </extension>
+    <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+        <doctype name="CollectionObject" extends="CollectionSpaceDocument">
+            <prefetch>
+                collectionobjects_common:objectNumber
+                collectionobjects_common:objectNameList
+                collectionobjects_common:responsibleDepartments
+                       </prefetch>
+        </doctype>
+    </extension>
+</component>
diff --git a/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/deployment-fragment.xml b/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/deployment-fragment.xml
new file mode 100644 (file)
index 0000000..06404c6
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>\r
+<fragment>\r
+\r
+  <extension target="application#MODULE">\r
+    <module>\r
+      <java>${bundle.fileName}</java>\r
+    </module>\r
+  </extension>\r
+\r
+</fragment>\r
diff --git a/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/ecm-types-contrib.xml b/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/ecm-types-contrib.xml
new file mode 100644 (file)
index 0000000..14b98e4
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.collectionobject.ecm.types">
+  <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+    <type id="CollectionObject" coretype="CollectionObject">
+      <label>org.collectionspace.collectionobject</label>
+      <!--icon>/icons/file.gif</icon-->
+      <default-view>view_documents</default-view>
+
+      <layouts mode="any">
+        <layout>heading</layout>
+        <layout>collectionspace_core</layout>
+        <layout>collectionobjects_common</layout>
+      </layouts>        
+    </type>
+
+    <type id="Folder" coretype="Folder">
+      <subtypes>
+        <type>CollectionObject</type>
+      </subtypes>
+    </type>
+    
+    <type id="Workspace" coretype="Workspace">
+      <subtypes>
+        <type>CollectionObject</type>
+      </subtypes>
+    </type>
+  </extension>
+</component>
diff --git a/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/layouts-contrib.xml b/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/layouts-contrib.xml
new file mode 100644 (file)
index 0000000..c53e7d2
--- /dev/null
@@ -0,0 +1,160 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.collectionobject.layouts.webapp">
+
+  <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+    point="layouts">
+
+    <layout name="collectionobjects_common">
+      <templates>
+        <template mode="any">/layouts/layout_default_template.xhtml</template>
+      </templates>
+      <rows>
+        <row><widget>objectNumber</widget></row>
+        <row><widget>otherNumber</widget></row>
+        <row><widget>otherNumberType</widget></row>
+        <!-- Repeatable fields are commented out for now until we -->
+        <!-- identify how to represent these complex types in layouts. -->
+        <!-- <row><widget>entryMethod</widget></row> -->
+        <!--<row><widget>briefDescription</widget></row>-->
+        <!--<row><widget>comments</widget></row>-->
+        <row><widget>distinguishingFeatures</widget></row>
+        <row><widget>numberOfObjects</widget></row>
+        
+        <row><widget>objectName</widget></row>
+        <row><widget>objectNameCurrency</widget></row>
+        <row><widget>objectNameLevel</widget></row>
+        <row><widget>objectNameNote</widget></row>
+        <row><widget>objectNameSystem</widget></row>
+        <row><widget>objectNameType</widget></row>
+        <row><widget>objectNameLanguage</widget></row>
+        
+        <!--<row><widget>responsibleDepartment</widget></row>-->
+        <row><widget>title</widget></row>
+        <row><widget>objectTitleLanguage</widget></row>
+        <row><widget>titleTranslation</widget></row>
+        <row><widget>titleType</widget></row>
+      </rows>
+
+      <widget name="objectNumber" type="text">
+        <labels>
+          <label mode="any">objectNumber</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="collectionobjects_common">objectNumber</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
+      <widget name="otherNumber" type="text">
+        <labels>
+          <label mode="any">otherNumber</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="collectionobjects_common">otherNumber</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
+      <widget name="otherNumberType" type="text">
+        <labels>
+          <label mode="any">otherNumberType</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="collectionobjects_common">otherNumberType</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+<!--
+      <widget name="briefDescription" type="text">
+        <labels>
+          <label mode="any">briefDescription</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="collectionobjects_common">briefDescription</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+
+     <widget name="comments" type="text">
+        <labels>
+          <label mode="any">comments</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="collectionobjects_common">comments</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+-->
+
+      <widget name="distinguishingFeatures" type="text">
+        <labels>
+          <label mode="any">distinguishingFeatures</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="collectionobjects_common">distinguishingFeatures</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+
+      <widget name="objectName" type="text">
+        <labels>
+          <label mode="any">objectName</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="collectionobjects_common">objectName</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+<!--
+      <widget name="responsibleDepartment" type="text">
+        <labels>
+          <label mode="any">responsibleDepartment</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="collectionobjects_common">responsibleDepartment</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+
+-->
+
+      <widget name="title" type="text">
+        <labels>
+          <label mode="any">title</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="collectionobjects_common">title</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+
+    </layout>
+  </extension>
+</component>
diff --git a/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/life-cycle-contrib.xml b/services/collectionobject/3rdparty/nuxeo-platform-collectionobjects_common/src/main/resources/OSGI-INF/life-cycle-contrib.xml
new file mode 100644 (file)
index 0000000..ca558a2
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.collectionobjects.ecm.platform.LifeCycleManagerExtensions">
+  <extension target="org.nuxeo.ecm.core.lifecycle.LifeCycleService"
+             point="types">
+    <types>
+      <type name="CollectionObject">default</type>
+    </types>
+  </extension>
+</component>
index a8213066f1be5b9a5072eaa3536f1320279878e7..5ea651d086817730179aba3e3d85b8ed18112ed9 100644 (file)
@@ -13,9 +13,9 @@
     <property name="build" location="build"/>\r
     <property name="dist"  location="dist"/>\r
     <property name="nuxeo.collectionobject.jar"\r
-        value="org.collectionspace.services.collectionobject.3rdparty.nuxeo-${cspace.release}.jar"/>\r
+        value="org.collectionspace.services.collectionobject.CollectionObjectTenant1.nuxeo-${cspace.release}.jar"/>\r
     <property name="nuxeo.collectionobject.jars.all"\r
-        value="org.collectionspace.services.collectionobject.3rdparty.nuxeo-*.jar"/>\r
+        value="org.collectionspace.services.collectionobject.CollectionObjectTenant1.nuxeo-*.jar"/>\r
 \r
     <condition property="osfamily-unix">\r
         <os family="unix" />\r
index 55321ff677a3fcf7f6776cdb419fa79be336b41c..183a03700dcc92068a6f47394bc113f514dcaece 100644 (file)
@@ -9,11 +9,11 @@
     
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.collectionspace.services</groupId>
-    <artifactId>org.collectionspace.services.collectionobject.3rdparty.nuxeo</artifactId>
-    <name>services.collectionobject.3rdparty.nuxeo</name>
+    <artifactId>org.collectionspace.services.collectionobject.CollectionObjectTenant1.nuxeo</artifactId>
+    <name>services.collectionobject.CollectionObjectTenant1.nuxeo</name>
     <packaging>jar</packaging>
     <description>
-        CollectionObject Nuxeo document type
+        CollectionObject Nuxeo document type for Tenant ID = "1"
     </description>
 
     <build>
@@ -22,9 +22,6 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-jar-plugin</artifactId>
                 <configuration>
-<!--                     <includes>
-                               <include>mydog.xml</include>
-                               </includes> -->
                     <archive>
                         <manifestFile> src/main/resources/META-INF/MANIFEST.MF </manifestFile>
                         <manifestEntries>
index 1a49e9936b82c9ecbb0f0a62a2b0e1490d83909c..97efbb62f854d41ea27e458c4f2f0510765e6600 100644 (file)
@@ -1,7 +1,7 @@
 Manifest-Version: 1.0 \r
 Bundle-ManifestVersion: 1 \r
-Bundle-Name: NuxeoCS\r
-Bundle-SymbolicName: org.collectionspace.collectionobject;singleton:=true \r
+Bundle-Name: org.collectionspace.collectionobjecttenant1\r
+Bundle-SymbolicName: org.collectionspace.collectionobjecttenant1;singleton:=true \r
 Bundle-Version: 1.0.0\r
 Bundle-Localization: plugin\r
 Bundle-Vendor: Nuxeo \r
@@ -9,8 +9,9 @@ Require-Bundle: org.nuxeo.runtime,
  org.nuxeo.ecm.core.api,\r
  org.nuxeo.ecm.core,\r
  org.nuxeo.ecm.webapp.core,\r
- org.collectionspace.collectionspace_core\r
-Provide-Package: org.collectionspace.collectionobject\r
+ org.collectionspace.collectionspace_core,\r
+ org.collectionspace.collectionobject\r
+Provide-Package: org.collectionspace.collectionobjecttenant1\r
 Nuxeo-Component: OSGI-INF/core-types-contrib.xml,\r
  OSGI-INF/life-cycle-contrib.xml,\r
  OSGI-INF/ecm-types-contrib.xml,\r
index ae91a1580b4835f0f9094ee6bbd13bc8d738f34b..8dbaede9c007acca5abccf64089a45fa5484bb92 100644 (file)
@@ -1,20 +1,11 @@
 <?xml version="1.0"?>
-<component name="org.collectionspace.collectionobject.coreTypes">
-    <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
-        <schema name="collectionobjects_common" prefix="collectionobjects_common" src="schemas/collectionobjects_common.xsd"/>
-        <schema name="collectionobjects_naturalhistory" prefix="collectionobjects_naturalhistory" src="schemas/collectionobjects_naturalhistory.xsd"/>
-    </extension>
+<component name="org.collectionspace.CollectionObjectTenant1.coreTypes">
     <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
-        <doctype name="CollectionObject" extends="CollectionSpaceDocument">
+        <doctype name="CollectionObjectTenant1" extends="CollectionObject">
             <schema name="common"/>
             <schema name="dublincore"/>
             <schema name="collectionspace_core"/>
             <schema name="collectionobjects_common"/>
-            <schema name="collectionobjects_naturalhistory"/>
-            <prefetch>
-            collectionobjects_common:objectNumber
-            collectionobjects_common:objectNameList
-            collectionobjects_common:responsibleDepartments</prefetch>
         </doctype>
     </extension>
 </component>
index 1627222b9260ed09deb84c5da0eba79c3531909f..cc831e163e3f257ea89e355ab803c6309eb0df3a 100644 (file)
@@ -1,27 +1,28 @@
 <?xml version="1.0"?>
-<component name="org.collectionspace.collectionobject.ecm.types">
+<component name="org.collectionspace.CollectionObjectTenant1.ecm.types">
   <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
-    <type id="CollectionObject" coretype="CollectionObject">
-      <label>org.collectionspace.collectionobject</label>
+  
+    <type id="CollectionObjectTenant1" coretype="CollectionObjectTenant1">
+      <label>org.collectionspace.CollectionObjectTenant1</label>
       <!--icon>/icons/file.gif</icon-->
       <default-view>view_documents</default-view>
 
       <layouts mode="any">
         <layout>heading</layout>
         <layout>collectionspace_core</layout>
-        <layout>collectionobject</layout>
+        <layout>CollectionObjectTenant1</layout>
       </layouts>        
     </type>
 
     <type id="Folder" coretype="Folder">
       <subtypes>
-        <type>CollectionObject</type>
+        <type>"CollectionObjectTenant1"</type>
       </subtypes>
     </type>
     
     <type id="Workspace" coretype="Workspace">
       <subtypes>
-        <type>CollectionObject</type>
+        <type>"CollectionObjectTenant1"</type>
       </subtypes>
     </type>
   </extension>
index 0267b47a53dc4407a1826521beabd04259b0bf2d..64369fd09969429f2fa0942d037a9ef2dc63dca6 100644 (file)
 <?xml version="1.0"?>
 
-<component name="org.collectionspace.collectionobject.layouts.webapp">
+<component name="org.collectionspace.CollectionObjectTenant1.layouts.webapp">
 
   <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
     point="layouts">
 
-    <layout name="collectionobject">
+    <layout name="CollectionObjectTenant1">
+       <!--
       <templates>
         <template mode="any">/layouts/layout_default_template.xhtml</template>
       </templates>
       <rows>
-        <row><widget>objectNumber</widget></row>
-        <row><widget>otherNumber</widget></row>
-        <row><widget>otherNumberType</widget></row>
-        <!-- Repeatable fields are commented out for now until we -->
-        <!-- identify how to represent these complex types in layouts. -->
-        <!-- <row><widget>entryMethod</widget></row> -->
-        <!--<row><widget>briefDescription</widget></row>-->
-        <!--<row><widget>comments</widget></row>-->
-        <row><widget>distinguishingFeatures</widget></row>
-        <row><widget>numberOfObjects</widget></row>
-        
-        <row><widget>objectName</widget></row>
-        <row><widget>objectNameCurrency</widget></row>
-        <row><widget>objectNameLevel</widget></row>
-        <row><widget>objectNameNote</widget></row>
-        <row><widget>objectNameSystem</widget></row>
-        <row><widget>objectNameType</widget></row>
-        <row><widget>objectNameLanguage</widget></row>
-        
-        <!--<row><widget>responsibleDepartment</widget></row>-->
-        <row><widget>title</widget></row>
-        <row><widget>objectTitleLanguage</widget></row>
-        <row><widget>titleTranslation</widget></row>
-        <row><widget>titleType</widget></row>
+        <row><widget>exampleField</widget></row>
       </rows>
 
-      <widget name="objectNumber" type="text">
+      <widget name="exampleField" type="text">
         <labels>
-          <label mode="any">objectNumber</label>
+          <label mode="any">exampleField</label>
         </labels>
         <translated>true</translated>
         <fields>
-          <field schema="collectionobjects_common">objectNumber</field>
+          <field schema="collectionobjects_naturalhistory">exampleField</field>
         </fields>
         <properties widgetMode="edit">
           <property name="styleClass">dataInputText</property>
         </properties>
       </widget>
-      
-      <widget name="otherNumber" type="text">
-        <labels>
-          <label mode="any">otherNumber</label>
-        </labels>
-        <translated>true</translated>
-        <fields>
-          <field schema="collectionobjects_common">otherNumber</field>
-        </fields>
-        <properties widgetMode="edit">
-          <property name="styleClass">dataInputText</property>
-        </properties>
-      </widget>
-      
-      <widget name="otherNumberType" type="text">
-        <labels>
-          <label mode="any">otherNumberType</label>
-        </labels>
-        <translated>true</translated>
-        <fields>
-          <field schema="collectionobjects_common">otherNumberType</field>
-        </fields>
-        <properties widgetMode="edit">
-          <property name="styleClass">dataInputText</property>
-        </properties>
-      </widget>
-<!--
-      <widget name="briefDescription" type="text">
-        <labels>
-          <label mode="any">briefDescription</label>
-        </labels>
-        <translated>true</translated>
-        <fields>
-          <field schema="collectionobjects_common">briefDescription</field>
-        </fields>
-        <properties widgetMode="edit">
-          <property name="styleClass">dataInputText</property>
-        </properties>
-      </widget>
-
-     <widget name="comments" type="text">
-        <labels>
-          <label mode="any">comments</label>
-        </labels>
-        <translated>true</translated>
-        <fields>
-          <field schema="collectionobjects_common">comments</field>
-        </fields>
-        <properties widgetMode="edit">
-          <property name="styleClass">dataInputText</property>
-        </properties>
-      </widget>
--->
-
-      <widget name="distinguishingFeatures" type="text">
-        <labels>
-          <label mode="any">distinguishingFeatures</label>
-        </labels>
-        <translated>true</translated>
-        <fields>
-          <field schema="collectionobjects_common">distinguishingFeatures</field>
-        </fields>
-        <properties widgetMode="edit">
-          <property name="styleClass">dataInputText</property>
-        </properties>
-      </widget>
-
-      <widget name="objectName" type="text">
-        <labels>
-          <label mode="any">objectName</label>
-        </labels>
-        <translated>true</translated>
-        <fields>
-          <field schema="collectionobjects_common">objectName</field>
-        </fields>
-        <properties widgetMode="edit">
-          <property name="styleClass">dataInputText</property>
-        </properties>
-      </widget>
-<!--
-      <widget name="responsibleDepartment" type="text">
-        <labels>
-          <label mode="any">responsibleDepartment</label>
-        </labels>
-        <translated>true</translated>
-        <fields>
-          <field schema="collectionobjects_common">responsibleDepartment</field>
-        </fields>
-        <properties widgetMode="edit">
-          <property name="styleClass">dataInputText</property>
-        </properties>
-      </widget>
-
--->
-
-      <widget name="title" type="text">
-        <labels>
-          <label mode="any">title</label>
-        </labels>
-        <translated>true</translated>
-        <fields>
-          <field schema="collectionobjects_common">title</field>
-        </fields>
-        <properties widgetMode="edit">
-          <property name="styleClass">dataInputText</property>
-        </properties>
-      </widget>
-
+      -->
     </layout>
   </extension>
 </component>
index 4fa5e8832ca5155f5c21042e5808228d54029e98..3b710368ffef46beecdbb717775468c318c79bd0 100644 (file)
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
-<component name="org.collectionspace.ecm.platform.collectionobject.LifeCycleManagerExtensions">
+<component name="org.collectionspace.CollectionObjectTenant1.ecm.platform.LifeCycleManagerExtensions">
 
   <extension target="org.nuxeo.ecm.core.lifecycle.LifeCycleService"
              point="types">
     <types>
-      <type name="CollectionObject">default</type>
+      <type name="CollectionObjectTenant1">default</type>
     </types>
   </extension>
 
diff --git a/services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/schemas/collectionobjects_naturalhistory.xsd b/services/collectionobject/3rdparty/nuxeo-platform-cs-collectionobject/src/main/resources/schemas/collectionobjects_naturalhistory.xsd
deleted file mode 100644 (file)
index 606f5eb..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
-\r
-<!--\r
-  CollectionObject schema (XSD)\r
-  \r
-  Entity  : CollectionObject\r
-  Part    : Domain - Natural History (example)\r
-  Used for: Nuxeo EP core document type\r
-  \r
-  $LastChangedRevision$\r
-  $LastChangedDate$\r
--->\r
-\r
-<xs:schema \r
-  xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
-  xmlns:ns="http://collectionspace.org/services/collectionobject/domain/naturalhistory"\r
-  xmlns="http://collectionspace.org/services/collectionobject/domain/naturalhistory"\r
-  targetNamespace="http://collectionspace.org/services/collectionobject/domain/naturalhistory"\r
-  version="0.1">\r
-\r
-  <!-- used for testing\r
-  <xs:element name="nh-string" type="xs:string" />\r
-  <xs:element name="nh-int" type="xs:int"/>\r
-  <xs:element name="nh-long" type="xs:long"/>\r
-  <xs:element name="nh-date" type="xs:dateTime"/>\r
-  <xs:element name="nh-note" type="xs:string"/>\r
-  -->\r
-\r
-  <!--  These items are being moved to common\r
-  <xs:element name="fieldCollector" type="xs:string"/>\r
-  <xs:element name="fieldCollectionDate" type="xs:string"/>\r
-  <xs:element name="fieldLocPlace" type="xs:string"/>\r
-  <xs:element name="catalogDate" type="xs:string"/>\r
-  -->\r
-\r
-  <xs:element name="labelHeader" type="xs:string"/>\r
-  <xs:element name="labelFooter" type="xs:string"/>\r
-\r
-  <xs:element name="fieldLocVerbatim" type="xs:string"/>\r
-  <xs:element name="fieldCollectionDateEarliest" type="xs:string"/>\r
-  <xs:element name="fieldCollectionDateLatest" type="xs:string"/>\r
-  <xs:element name="fieldLocLatDecimal" type="xs:string"/>\r
-  <xs:element name="fieldLocLongDecimal" type="xs:string"/>\r
-  <xs:element name="fieldLocElevation" type="xs:string"/>\r
-\r
-  <!-- These will become contolled lists -->\r
-  <xs:element name="fieldLocGeodeticDatum" type="xs:string"/>\r
-  <xs:element name="fieldLocCoordinateSystem" type="xs:string"/>\r
-  <xs:element name="fieldLocCounty" type="xs:string"/>\r
-  <xs:element name="fieldLocState" type="xs:string"/>\r
-  <xs:element name="fieldLocCountry" type="xs:string"/>\r
-  <xs:element name="fieldLocHigherGeography" type="xs:string"/>\r
-\r
-  <xs:element name="taxonomicIdentGroupList" type="taxonomicIdentGroupList"/>\r
-  <xs:element name="typeSpecimenGroupList" type="typeSpecimenGroupList"/>\r
-  <xs:element name="fieldCollElevationGroupList" type="fieldCollElevationGroupList"/>\r
-  <xs:element name="fieldCollDepthGroupList" type="fieldCollDepthGroupList"/>\r
-  <xs:element name="associatedTaxaGroupList" type="associatedTaxaGroupList"/>\r
-\r
-       <xs:complexType name="taxonomicIdentGroupList">\r
-                       <xs:sequence>\r
-                                       <xs:element name="taxonomicIdentGroup" type="taxonomicIdentGroup" minOccurs="0"\r
-                                                       maxOccurs="unbounded"/>\r
-                       </xs:sequence>\r
-       </xs:complexType>\r
-       <xs:complexType name="taxonomicIdentGroup">\r
-                       <xs:sequence>\r
-                                       <xs:element name="taxon" type="xs:string"/>\r
-                                       <xs:element name="qualifier" type="xs:string"/>\r
-                                       <xs:element name="identBy" type="xs:string"/>\r
-                                       <xs:element name="identDate" type="xs:string"/>\r
-                                       <xs:element name="institution" type="xs:string"/>\r
-                                       <xs:element name="identKind" type="xs:string"/>\r
-                                       <xs:element name="reference" type="xs:string"/>\r
-                                       <xs:element name="refPage" type="xs:string"/>\r
-                                       <xs:element name="notes" type="xs:string"/>\r
-                        </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="typeSpecimenGroupList">\r
-                       <xs:sequence>\r
-                                       <xs:element name="typeSpecimenGroup" type="typeSpecimenGroup" minOccurs="0"\r
-                                                       maxOccurs="unbounded"/>\r
-                       </xs:sequence>\r
-       </xs:complexType>\r
-       <xs:complexType name="typeSpecimenGroup">\r
-                       <xs:sequence>\r
-                                       <xs:element name="kindOfType" type="xs:string"/>\r
-                                       <xs:element name="reference" type="xs:string"/>\r
-                                       <xs:element name="refPage" type="xs:string"/>\r
-                                       <xs:element name="institution" type="xs:string"/>\r
-                                       <xs:element name="institutionType" type="xs:string"/>\r
-                                       <xs:element name="notes" type="xs:string"/>\r
-                        </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="fieldCollElevationGroupList">\r
-                       <xs:sequence>\r
-                                       <xs:element name="fieldCollElevationGroup" type="fieldCollElevationGroup" minOccurs="0"\r
-                                                       maxOccurs="unbounded"/>\r
-                       </xs:sequence>\r
-       </xs:complexType>\r
-       <xs:complexType name="fieldCollElevationGroup">\r
-                       <xs:sequence>\r
-                                       <xs:element name="minElevation" type="xs:integer"/>\r
-                                       <xs:element name="maxElevation" type="xs:integer"/>\r
-                                       <xs:element name="units" type="xs:string"/>\r
-                                       <xs:element name="qualifier" type="xs:string"/>\r
-                                       <xs:element name="notes" type="xs:string"/>\r
-                        </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="fieldCollDepthGroupList">\r
-                       <xs:sequence>\r
-                                       <xs:element name="fieldCollDepthGroup" type="fieldCollDepthGroup" minOccurs="0"\r
-                                                       maxOccurs="unbounded"/>\r
-                       </xs:sequence>\r
-       </xs:complexType>\r
-       <xs:complexType name="fieldCollDepthGroup">\r
-                       <xs:sequence>\r
-                                       <xs:element name="minDepth" type="xs:integer"/>\r
-                                       <xs:element name="maxDepth" type="xs:integer"/>\r
-                                       <xs:element name="units" type="xs:string"/>\r
-                                       <xs:element name="qualifier" type="xs:string"/>\r
-                                       <xs:element name="notes" type="xs:string"/>\r
-                        </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="associatedTaxaGroupList">\r
-                       <xs:sequence>\r
-                                       <xs:element name="associatedTaxaGroup" type="associatedTaxaGroup" minOccurs="0"\r
-                                                       maxOccurs="unbounded"/>\r
-                       </xs:sequence>\r
-       </xs:complexType>\r
-       <xs:complexType name="associatedTaxaGroup">\r
-                       <xs:sequence>\r
-                                       <xs:element name="taxon" type="xs:string"/>\r
-                                       <xs:element name="commonName" type="xs:integer"/>\r
-                                       <xs:element name="interaction" type="xs:integer"/>\r
-                        </xs:sequence>\r
-       </xs:complexType>\r
-\r
-</xs:schema>\r
index 4c2f2e227338c63cddd4d6fd1e02ab2369a2073f..ef1a30ac6bda106aadda67e8143adcbb395d5526 100644 (file)
@@ -18,7 +18,9 @@
     </description>\r
 \r
     <modules>\r
-        <module>nuxeo-platform-cs-collectionobject</module>\r
+       <module>nuxeo-platform-collectionobjects_common</module>\r
+               <module>nuxeo-platform-cs-collectionobject</module>\r
+        <module>nuxeo-platform-collectionobject-hearst</module>\r
     </modules>\r
 \r
 </project>\r
index 2dc344b092cbb36f79f1b17922f3fb62f37ec3a3..3a611d7dd040311789b189c6b7b0fc74ef195854 100644 (file)
@@ -336,6 +336,21 @@ public abstract class AbstractServiceContextImpl<IT, OT>
         // object.
         return (overrideDocumentType != null) ? overrideDocumentType : serviceBinding.getObject().getName();
     }
+    
+    @Override
+    public String getTenantQualifiedDoctype(String docType) {
+        // If they have not overridden the setting, use the type of the service
+        // object.
+        String result = docType + ServiceContext.TENANT_SUFFIX + this.getTenantId();
+        
+        return result;
+    }
+    
+    @Override
+    public String getTenantQualifiedDoctype() {
+        String docType = (overrideDocumentType != null) ? overrideDocumentType : serviceBinding.getObject().getName();
+       return getTenantQualifiedDoctype(docType);
+    }
 
     /* (non-Javadoc)
      * @see org.collectionspace.services.common.context.ServiceContext#setDocumentType(java.lang.String)
index cd0fb5b31253ae59555c004ce811a97f2d41e3a5..ccfdb588c464c4ae7415a49e4ee3ab10487215cb 100644 (file)
@@ -32,6 +32,7 @@ import javax.ws.rs.core.UriInfo;
 import org.collectionspace.services.common.ClientType;
 import org.collectionspace.services.common.document.DocumentHandler;
 import org.collectionspace.services.common.document.ValidatorHandler;
+import org.collectionspace.services.common.query.QueryContext;
 import org.collectionspace.services.common.security.SecurityContext;
 import org.collectionspace.services.common.security.UnauthorizedException;
 import org.collectionspace.services.common.service.ObjectPartType;
@@ -51,6 +52,8 @@ public interface ServiceContext<IT, OT> {
     public static final String PART_LABEL_SEPARATOR = "_";
     /** The Constant PART_COMMON_LABEL. */
     public static final String PART_COMMON_LABEL = "common";
+    /** Used to qualify document types **/
+       public static final String TENANT_SUFFIX = "Tenant";    
 
     /**
      * getSecurityContext is contains security info. for the service layer
@@ -92,6 +95,18 @@ public interface ServiceContext<IT, OT> {
      * @return service name
      */
     public String getDocumentType();
+    
+    /**
+     * Returns a tenant qualified document type.
+     * 
+     */
+    public String getTenantQualifiedDoctype();
+    
+    /**
+     * Returns a tenant qualified document type.
+     * 
+     */
+    public String getTenantQualifiedDoctype(String docType);
 
     /**
      * setDocumentType sets the name of the Document Type for this service
index 1ba06a4f1cede8820ac70e20bfc35ae6367ca515..f23e1786b3f357ed8b374c040d8339a252608796 100644 (file)
@@ -31,9 +31,7 @@ public class QueryContext {
     String tenantId;\r
 \r
     static public final String getTenantQualifiedDoctype(QueryContext queryContext, String docType) {\r
-//     return queryContext.getTenantId() + "_" + docType;\r
-       return docType; //FIXME: Need to use the line above to get a qualified doctype name \r
-\r
+       return docType + ServiceContext.TENANT_SUFFIX + queryContext.getTenantId();\r
     }\r
     \r
     /**\r
index 20bcf75e204916b90d194a42468be5756ff1186a..3eadf6ed7a737632ece05f464fe92887abf8392c 100644 (file)
@@ -19,6 +19,7 @@ package org.collectionspace.services.nuxeo.client.java;
 
 import java.util.Hashtable;
 import java.util.List;
+import java.util.Set;
 import java.util.UUID;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -58,6 +59,8 @@ import org.nuxeo.ecm.core.api.IdRef;
 import org.nuxeo.ecm.core.api.PathRef;
 import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
 import org.nuxeo.ecm.core.client.NuxeoClient;
+import org.nuxeo.ecm.core.schema.SchemaManager;
+import org.nuxeo.runtime.api.Framework;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -123,10 +126,12 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
             DocumentHandler handler) throws BadRequestException,
             DocumentException {
 
-        if (ctx.getDocumentType() == null) {
+       String docType = NuxeoUtils.getTenantQualifiedDocType(ctx); //ctx.getDocumentType();
+        if (docType == null) {
             throw new IllegalArgumentException(
                     "RepositoryJavaClient.create: docType is missing");
         }
+       
         if (handler == null) {
             throw new IllegalArgumentException(
                     "RepositoryJavaClient.create: handler is missing");
@@ -147,8 +152,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
             //give our own ID so PathRef could be constructed later on
             String id = IdUtils.generateId(UUID.randomUUID().toString());
             // create document model
-            DocumentModel doc = repoSession.createDocumentModel(wspacePath, id,
-                    ctx.getDocumentType());
+            DocumentModel doc = repoSession.createDocumentModel(wspacePath, id, docType);
             ((DocumentModelHandler) handler).setRepositorySession(repoSession);
             DocumentWrapper<DocumentModel> wrapDoc = new DocumentWrapperImpl<DocumentModel>(doc);
             handler.handle(Action.CREATE, wrapDoc);
@@ -248,7 +252,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
 
             DocumentModelList docList = null;
             // force limit to 1, and ignore totalSize
-            String query = NuxeoUtils.buildNXQLQuery(queryContext);
+            String query = NuxeoUtils.buildNXQLQuery(ctx, queryContext);
             docList = repoSession.query(query, null, 1, 0, false);
             if (docList.size() != 1) {
                 throw new DocumentNotFoundException("No document found matching filter params.");
@@ -343,7 +347,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
             repoSession = getRepositorySession();
             DocumentModelList docList = null;
             // force limit to 1, and ignore totalSize
-            String query = NuxeoUtils.buildNXQLQuery(queryContext);
+            String query = NuxeoUtils.buildNXQLQuery(ctx, queryContext);
             docList = repoSession.query(query,
                     null, //Filter
                     1, //limit
@@ -610,7 +614,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
             handler.prepare(Action.GET_ALL);
             repoSession = getRepositorySession();
             DocumentModelList docList = null;
-            String query = NuxeoUtils.buildNXQLQuery(queryContext);
+            String query = NuxeoUtils.buildNXQLQuery(ctx, queryContext);
 
             if (logger.isDebugEnabled()) {
                 logger.debug("Executing NXQL query: " + query.toString());
index 03bc26d63bcea1d211c78c8073c9f77ec700e8ba..0a02150757679302c40a8a4a436038b870c6b765 100644 (file)
@@ -25,6 +25,7 @@ import java.io.File;
 import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -34,6 +35,7 @@ import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.document.DocumentWrapperImpl;
@@ -62,9 +64,11 @@ import org.nuxeo.ecm.core.io.impl.DocumentPipeImpl;
 import org.nuxeo.ecm.core.io.impl.plugins.SingleDocumentReader;
 import org.nuxeo.ecm.core.io.impl.plugins.XMLDocumentWriter;
 
+import org.nuxeo.ecm.core.schema.SchemaManager;
 import org.nuxeo.ecm.core.search.api.client.querymodel.descriptor.QueryModelDescriptor;
 import org.nuxeo.ecm.core.storage.sql.jdbc.ResultSetQueryResult;
 import org.nuxeo.ecm.core.query.sql.NXQL;
+import org.nuxeo.runtime.api.Framework;
 
 
 import org.slf4j.Logger;
@@ -349,9 +353,9 @@ public class NuxeoUtils {
      * @return an NXQL query
      * @throws Exception if supplied values in the query are invalid.
      */
-    static public final String buildNXQLQuery(QueryContext queryContext) throws Exception {
+    static public final String buildNXQLQuery(ServiceContext ctx, QueryContext queryContext) throws Exception {
         StringBuilder query = new StringBuilder("SELECT * FROM ");
-        query.append(queryContext.getTenantQualifiedDoctype()); // Nuxeo doctype must be tenant qualified.
+        query.append(NuxeoUtils.getTenantQualifiedDocType(queryContext)); // Nuxeo doctype must be tenant qualified.
         appendNXQLWhere(query, queryContext);
         appendNXQLOrderBy(query, queryContext);
         return query.toString();
@@ -364,7 +368,7 @@ public class NuxeoUtils {
      * @param queryContext the query context
      * @return an NXQL query
      */
-    static public final String buildNXQLQuery(List<String> docTypes, QueryContext queryContext) {
+    static public final String buildNXQLQuery(List<String> docTypes, QueryContext queryContext) throws Exception {
         StringBuilder query = new StringBuilder("SELECT * FROM "); 
         boolean fFirst = true;
         for (String docType : docTypes) {
@@ -373,7 +377,7 @@ public class NuxeoUtils {
             } else {
                 query.append(",");
             }
-            String tqDocType = QueryContext.getTenantQualifiedDoctype(queryContext, docType);
+            String tqDocType = getTenantQualifiedDocType(queryContext, docType);
             query.append(tqDocType); // Nuxeo doctype must be tenant qualified.
         }
         appendNXQLWhere(query, queryContext);
@@ -396,7 +400,7 @@ public class NuxeoUtils {
         //
         // Since we're doing a query, we get back a list so we need to make sure there is only
         // a single result since CSID values are supposed to be unique.
-        String query = buildNXQLQuery(queryContext);
+        String query = buildNXQLQuery(ctx, queryContext);
         docModelList = repoSession.query(query);
         long resultSize = docModelList.totalSize();
         if (resultSize == 1) {
@@ -511,4 +515,60 @@ public class NuxeoUtils {
                        
                return result;
     }
+    
+    public static String getTenantQualifiedDocType(ServiceContext ctx, String docType) throws Exception {
+       String result = docType;
+       
+               String tenantQualifiedDocType = ctx.getTenantQualifiedDoctype(docType);
+               if (docTypeExists(tenantQualifiedDocType) == true) {
+                       result = tenantQualifiedDocType;
+               }
+               
+       return result;
+    }
+
+    public static String getTenantQualifiedDocType(ServiceContext ctx) {
+       String result = null;
+       try {
+               String docType = ctx.getDocumentType();
+               result = getTenantQualifiedDocType(ctx, docType);
+       } catch (Exception e) {
+               logger.error("Could not get tentant qualified doctype.", e);
+       }
+       return result;
+    }
+    
+    public static String getTenantQualifiedDocType(QueryContext queryCtx, String docType) throws Exception {
+       String result = docType;
+       
+       String tenantQualifiedDocType = queryCtx.getTenantQualifiedDoctype();
+               if (docTypeExists(tenantQualifiedDocType) == true) {
+                       result = tenantQualifiedDocType;
+               }
+               
+       return result;
+    }
+    
+    public static String getTenantQualifiedDocType(QueryContext queryCtx) throws Exception {           
+       return getTenantQualifiedDocType(queryCtx, queryCtx.getDocType());
+    }
+    
+    static private boolean docTypeExists(String docType) throws Exception {
+       boolean result = false;
+       
+        SchemaManager schemaManager = null;
+       try {
+                       schemaManager = Framework.getService(org.nuxeo.ecm.core.schema.SchemaManager.class);
+               } catch (Exception e1) {
+                       // TODO Auto-generated catch block
+                       logger.error("Could not get Nuxeo SchemaManager instance.", e1);
+                       throw e1;
+               }
+               Set<String> docTypes = schemaManager.getDocumentTypeNamesExtending(docType);
+               if (docTypes != null && docTypes.contains(docType)) {
+                       result = true;
+               }
+               
+       return result;
+    }
 }