--- /dev/null
+
+<project name="place.3rdparty" default="package" basedir=".">
+ <description>
+ place service 3rdparty
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../../.."/>
+ <!-- enviornment 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"/>
+
+ <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 place in ${jee.server.nuxeo}">
+ <ant antfile="nuxeo-platform-cs-place/build.xml" target="deploy" inheritall="false"/>
+ </target>
+
+ <target name="undeploy"
+ description="undeploy place from ${jee.server.nuxeo}">
+ <ant antfile="nuxeo-platform-cs-place/build.xml" target="undeploy" inheritall="false"/>
+ </target>
+
+ <target name="dist"
+ description="generate distribution for place" depends="package">
+ <ant antfile="nuxeo-platform-cs-place/build.xml" target="dist" inheritall="false"/>
+ </target>
+
+ <target name="dist_installer"
+ description="generate distribution for collectionobject" depends="package">
+ <ant antfile="nuxeo-platform-cs-place/build.xml" target="dist_installer" inheritall="false"/>
+ </target>
+
+</project>
--- /dev/null
+
+<project name="nuxeo-platform-cs-place" default="package" basedir=".">
+ <description>
+ place 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.place.jar"
+ value="org.collectionspace.services.place.3rdparty.nuxeo-${cspace.release}.jar"/>
+ <property name="nuxeo.place.jars.all"
+ value="org.collectionspace.services.place.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 place doctype in ${jee.server.nuxeo}">
+ <copy file="${basedir}/target/${nuxeo.place.jar}"
+ todir="${jee.deploy.nuxeo.plugins}"/>
+ </target>
+
+ <target name="undeploy"
+ description="undeploy place doctype from ${jee.server.nuxeo}">
+ <delete>
+ <fileset dir="${jee.deploy.nuxeo.plugins}">
+ <include name="${nuxeo.place.jars.all}"/>
+ </fileset>
+ <!-- Legacy deployment location through release 0.6 -->
+ <fileset dir="${jee.deploy.nuxeo.system}">
+ <include name="${nuxeo.place.jars.all}"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="dist"
+ description="generate distribution for place doctype" depends="package">
+ <copy todir="${services.trunk}/${dist.deploy.nuxeo.plugins}">
+ <fileset file="${basedir}/target/${nuxeo.place.jar}"/>
+ </copy>
+ </target>
+
+ <target name="dist_installer"
+ description="Creates an installer distribution for place doctype" depends="package">
+ <copy todir="${services.trunk}/${dist.installer.services}/place/nuxeo">
+ <fileset file="${basedir}/target/${nuxeo.place.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.place.3rdparty</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place.3rdparty.nuxeo</artifactId>
+ <name>services.place.3rdparty.nuxeo</name>
+ <packaging>jar</packaging>
+ <description>
+ Place 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
+Bundle-ManifestVersion: 1
+Bundle-Name: NuxeoCS
+Bundle-SymbolicName: org.collectionspace.place;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Bundle-Vendor: Nuxeo
+Require-Bundle: org.nuxeo.runtime,
+ org.nuxeo.ecm.core.api,
+ org.nuxeo.ecm.core,
+ org.nuxeo.ecm.core.api,
+ org.nuxeo.ecm.platform.types.api,
+ org.nuxeo.ecm.platform.versioning.api,
+ org.nuxeo.ecm.platform.ui,
+ org.nuxeo.ecm.platform.forms.layout.client,
+ org.nuxeo.ecm.platform.ws,
+ org.collectionspace.collectionspace_core
+Provide-Package: org.collectionspace.place
+Nuxeo-Component: OSGI-INF/core-types-contrib.xml,
+ OSGI-INF/life-cycle-contrib.xml,
+ OSGI-INF/ecm-types-contrib.xml,
+ OSGI-INF/layouts-contrib.xml
+
--- /dev/null
+<?xml version="1.0"?>
+<component name="org.collectionspace.place.coreTypes">
+ <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+ <schema name="placeauthorities_common" prefix="placeauthorities_common" src="schemas/placeauthorities_common.xsd"/>
+ </extension>
+ <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+ <schema name="places_common" prefix="places_common" src="schemas/places_common.xsd"/>
+ </extension>
+ <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+ <doctype name="Placeauthority" extends="Document">
+ <schema name="common"/>
+ <schema name="collectionspace_core"/>
+ <schema name="dublincore"/>
+ <schema name="placeauthorities_common"/>
+ </doctype>
+ </extension>
+ <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+ <doctype name="Placeitem" extends="Document">
+ <schema name="common"/>
+ <schema name="collectionspace_core"/>
+ <schema name="dublincore"/>
+ <schema name="places_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_orgauthorities.xhtml">
+ breadcrumb=title.orgauthorities
+ </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_orgauthorities</from-outcome>
+ <to-view-id>/view_orgauthorities.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_orgauthority</from-outcome>
+ <to-view-id>/view_orgauthority.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.place.ecm.types">
+ <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+ <type id="Placeauthority" coretype="Placeauthority">
+ <label>org.collectionspace.placeauthority</label>
+ <!--icon>/icons/file.gif</icon-->
+ <default-view>view_documents</default-view>
+
+ <layouts mode="any">
+ <layout>heading</layout>
+ <layout>csplaceauthority</layout>
+ </layouts>
+ </type>
+
+ <type id="Folder" coretype="Folder">
+ <subtypes>
+ <type>Placeauthority</type>
+ </subtypes>
+ </type>
+
+ <type id="Workspace" coretype="Workspace">
+ <subtypes>
+ <type>Placeauthority</type>
+ </subtypes>
+ </type>
+
+ </extension>
+ <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+ <type id="Placeitem" coretype="Placeitem">
+ <label>org.collectionspace.place</label>
+ <!--icon>/icons/file.gif</icon-->
+ <default-view>view_documents</default-view>
+
+ <layouts mode="any">
+ <layout>heading</layout>
+ <layout>place</layout>
+ </layouts>
+ </type>
+
+ <type id="Folder" coretype="Folder">
+ <subtypes>
+ <type>Place</type>
+ </subtypes>
+ </type>
+
+ <type id="Workspace" coretype="Workspace">
+ <subtypes>
+ <type>Place</type>
+ </subtypes>
+ </type>
+
+ </extension>
+</component>
--- /dev/null
+<?xml version="1.0"?>
+
+<component name="org.collectionspace.place.layouts.webapp">
+
+ <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+ point="layouts">
+
+ <layout name="csplaceauthority">
+ <templates>
+ <template mode="any">/layouts/layout_default_template.xhtml</template>
+ </templates>
+ <rows>
+ <row><widget>displayName</widget></row>
+ <row><widget>shortIdentifier</widget></row>
+ <row><widget>refName</widget></row>
+ <row><widget>vocabType</widget></row>
+ </rows>
+
+ <widget name="displayName" type="text">
+ <labels>
+ <label mode="any">Display Name</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="placeauthorities_common">displayName</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="shortIdentifier" type="text">
+ <labels>
+ <label mode="any">Short Identifier</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="placeauthorities_common">shortIdentifier</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="refName" type="text">
+ <labels>
+ <label mode="any">RefName</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="placeauthorities_common">refName</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="vocabType" type="text">
+ <labels>
+ <label mode="any">Type</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="placeauthorities_common">vocabType</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+ </layout>
+ </extension>
+
+ <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+ point="layouts">
+
+ <layout name="place">
+ <templates>
+ <template mode="any">/layouts/layout_default_template.xhtml</template>
+ </templates>
+ <rows>
+ <row><widget>inAuthority</widget></row>
+ <row><widget>shortIdentifier</widget></row>
+ <row><widget>refName</widget></row>
+ <row><widget>displayName</widget></row>
+ <row><widget>displayNameComputed</widget></row>
+ <row><widget>name</widget></row>
+ <row><widget>conditionNote</widget></row>
+ <row><widget>conditionNoteDate</widget></row>
+ <row><widget>securityNote</widget></row>
+ <row><widget>placeType</widget></row>
+ <row><widget>status</widget></row>
+ </rows>
+
+ <widget name="inAuthority" type="text">
+ <labels>
+ <label mode="any">inAuthority (PlaceAuthority)</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="places_common">inAuthority</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="shortIdentifier" type="text">
+ <labels>
+ <label mode="any">Short Identifier</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="places_common">shortIdentifier</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="refName" type="text">
+ <labels>
+ <label mode="any">refName</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="places_common">refName</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="displayName" type="text">
+ <labels>
+ <label mode="any">displayName</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="placeauthorities_common">displayName</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <!-- This should be some kind of checkbox or something -->
+ <widget name="displayNameComputed" type="text">
+ <labels>
+ <label mode="any">displayNameComputed</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="placeauthorities_common">displayNameComputed</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="name" type="text">
+ <labels>
+ <label mode="any">name</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="places_common">name</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="conditionNote" type="text">
+ <labels>
+ <label mode="any">conditionNote</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="places_common">conditionNote</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="conditionNoteDate" type="text">
+ <labels>
+ <label mode="any">conditionNoteDate</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="places_common">conditionNoteDate</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="securityNote" type="text">
+ <labels>
+ <label mode="any">securityNote</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="places_common">securityNote</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="placeType" type="text">
+ <labels>
+ <label mode="any">placeType</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="places_common">placeType</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ <widget name="status" type="text">
+ <labels>
+ <label mode="any">status</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="places_common">status</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ </layout>
+ </extension>
+</component>
--- /dev/null
+<?xml version="1.0"?>
+<component name="org.collectionspace.ecm.platform.place.LifeCycleManagerExtensions">
+
+ <extension target="org.nuxeo.ecm.core.lifecycle.LifeCycleService"
+ point="types">
+ <types>
+ <type name="Placeauthority">default</type>
+ <type name="Placeitem">default</type>
+ </types>
+ </extension>
+
+</component>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ PlaceAuthority schema (XSD)
+
+ Entity : PlaceAuthority
+ Part : Common
+ Used for: Nuxeo EP core document type
+
+ $LastChangedRevision: 928 $
+ $LastChangedDate: 2009-11-10 12:25:58 -0800 (Tue, 10 Nov 2009) $
+-->
+
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="http://collectionspace.org/services/place"
+ xmlns="http://collectionspace.org/services/place"
+ targetNamespace="http://collectionspace.org/services/place"
+ version="0.1"
+>
+
+<!-- Flattened version of jaxb schema for nuxeo -->
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Place+Service+Home -->
+
+ <!-- PlaceAuthority Information Group -->
+ <xs:element name="displayName" type="xs:string"/>
+ <xs:element name="shortIdentifier" type="xs:string"/>
+ <xs:element name="refName" type="xs:string"/>
+ <xs:element name="vocabType" type="xs:string"/>
+ <xs:element name="source" type="xs:string"/>
+ <xs:element name="description" type="xs:string"/>
+
+</xs:schema>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ Place schema (XSD)
+
+ Entity : Place
+ Part : Common
+ Used for: Nuxeo EP core document type
+
+ $LastChangedRevision: 860 $
+ $LastChangedDate: 2009-10-14 14:48:05 -0700 (Wed, 14 Oct 2009) $
+-->
+
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="http://collectionspace.org/services/place"
+ xmlns="http://collectionspace.org/services/place"
+ targetNamespace="http://collectionspace.org/services/place"
+ version="0.1"
+>
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Place+Service+Home -->
+ <!-- Place Information Group -->
+ <!-- inAuthority is the csid of the owning PlaceAuthority -->
+ <xs:element name="inAuthority" type="xs:string" />
+ <xs:element name="shortIdentifier" type="xs:string"/>
+ <xs:element name="refName" type="xs:string"/>
+ <xs:element name="termStatus" type="xs:string"/>
+ <xs:element name="displayName" type="xs:string"/>
+ <xs:element name="displayNameComputed" type="xs:boolean"/>
+ <xs:element name="shortDisplayName" type="xs:string"/>
+ <xs:element name="shortDisplayNameComputed" type="xs:boolean"/>
+ <xs:element name="placeType" type="xs:string" />
+ <xs:element name="placeRecordAdminStatus" type="xs:string" />
+ <xs:element name="placeIdentifier" type="xs:string" />
+ <xs:element name="placeNameGroupList" type="placeNameGroupList"/>
+ <xs:element name="placeOwnerGroupList" type="placeOwnerGroupList"/>
+ <xs:element name="note" type="xs:string"/>
+ <xs:element name="source" type="xs:string"/>
+ <xs:element name="sourcePage" type="xs:string"/>
+
+ <!-- Locality Information -->
+ <xs:element name="vCoordinates" type="xs:string"/>
+ <xs:element name="vLatitude" type="xs:string"/>
+ <xs:element name="vLongitude" type="xs:string"/>
+ <xs:element name="vCoordSys" type="xs:string"/>
+ <xs:element name="vSpatialReferenceSystem" type="xs:string"/>
+ <xs:element name="vCoordSource" type="xs:string"/>
+ <xs:element name="vCoordSourceRefId" type="xs:string"/>
+ <xs:element name="vUnitofMeasure" type="xs:string"/>
+ <xs:element name="vElevation" type="xs:string"/>
+ <xs:element name="minElevationInMeters" type="xs:decimal"/>
+ <xs:element name="maxElevationInMeters" type="xs:decimal"/>
+ <xs:element name="vDepth" type="xs:string"/>
+ <xs:element name="minDepthInMeters" type="xs:decimal"/>
+ <xs:element name="maxDepthInMeters" type="xs:decimal"/>
+ <xs:element name="vDistanceAboveSurface" type="xs:string"/>
+ <xs:element name="minDistanceAboveSurfaceInMeters" type="xs:decimal"/>
+ <xs:element name="maxDistanceAboveSurfaceInMeters" type="xs:decimal"/>
+
+ <xs:element name="placeGeoRefGroupList" type="placeGeoRefGroupList"/>
+
+
+ <xs:complexType name="placeNameGroupList">
+ <xs:sequence>
+ <xs:element name="placeNameGroup" type="placeNameGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="placeNameGroup">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="nameQualifiedName" type="xs:string"/>
+ <xs:element name="nameLanguage" type="xs:string"/>
+ <xs:element name="nameAbbrev" type="xs:string"/>
+ <xs:element name="nameType" type="xs:string"/>
+ <xs:element name="nameStatus" type="xs:string"/>
+ <xs:element name="nameSource" type="xs:string"/>
+ <xs:element name="nameSourceDetail" type="xs:string"/>
+ <xs:element name="nameSourceRefId" type="xs:string"/>
+ <xs:element name="nameNote" type="xs:string"/>
+ <xs:element name="nameDateGroup" type="structuredDateGroup"/>
+ <xs:element name="nameAdminStatus" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="placeOwnerGroupList">
+ <xs:sequence>
+ <xs:element name="placeOwnerGroup" type="placeOwnerGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="placeOwnerGroup">
+ <xs:sequence>
+ <xs:element name="owner" type="xs:string"/>
+ <xs:element name="ownershipDateGroup" type="structuredDateGroup"/>
+ <xs:element name="ownershipNote" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="placeGeoRefGroupList">
+ <xs:sequence>
+ <xs:element name="placeGeoRefGroup" type="placeGeoRefGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="placeGeoRefGroup">
+ <xs:sequence>
+ <xs:element name="decimalLatitude" type="xs:decimal"/>
+ <xs:element name="decimalLongitude" type="xs:decimal"/>
+ <xs:element name="geodeticDatum" type="xs:string"/>
+ <xs:element name="coordUncertaintyInMeters" type="xs:integer"/>
+ <xs:element name="coordPrecision" type="xs:string"/>
+ <xs:element name="pointRadiusSpatialFit" type="xs:string"/>
+ <xs:element name="footprintWKT" type="xs:string"/>
+ <xs:element name="footprintSRS" type="xs:string"/>
+ <xs:element name="footprintSpatialFit" type="xs:string"/>
+ <xs:element name="geoReferencedBy" type="xs:string"/>
+ <xs:element name="geoRefDateGroup" type="structuredDateGroup"/>
+ <xs:element name="geoRefProtocol" type="xs:string"/>
+ <xs:element name="geoRefSource" type="xs:string"/>
+ <xs:element name="geoRefVerificationStatus" type="xs:string"/>
+ <xs:element name="geoRefRemarks" type="xs:string"/>
+ <xs:element name="geoRefPlaceName" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <!-- IMPORTANT: This structuredDateGroup MUST MATCH EXACTLY structuredDateGroups in other services, for example collectionobject.
+ Use your favorite text editor to REPLICATE IN THOSE OTHER INSTANCES ANY CHANGES MADE HERE. -->
+ <xs:complexType name="structuredDateGroup">
+ <xs:sequence>
+ <xs:element name="dateDisplayDate" type="xs:string"/>
+ <xs:element name="dateAssociation" type="xs:string"/>
+ <xs:element name="dateEarliestSingleYear" type="xs:integer"/>
+ <xs:element name="dateEarliestSingleMonth" type="xs:integer"/>
+ <xs:element name="dateEarliestSingleDay" type="xs:integer"/>
+ <xs:element name="dateEarliestSingleEra" type="xs:string"/>
+ <xs:element name="dateEarliestSingleCertainty" type="xs:string"/>
+ <xs:element name="dateEarliestSingleQualifier" type="xs:string"/>
+ <xs:element name="dateEarliestSingleQualifierValue" type="xs:integer"/>
+ <xs:element name="dateEarliestSingleQualifierUnit" type="xs:string"/>
+ <xs:element name="dateLatestYear" type="xs:integer"/>
+ <xs:element name="dateLatestMonth" type="xs:integer"/>
+ <xs:element name="dateLatestDay" type="xs:integer"/>
+ <xs:element name="dateLatestEra" type="xs:string"/>
+ <xs:element name="dateLatestCertainty" type="xs:string"/>
+ <xs:element name="dateLatestQualifier" type="xs:string"/>
+ <xs:element name="dateLatestQualifierValue" type="xs:integer"/>
+ <xs:element name="dateLatestQualifierUnit" type="xs:string"/>
+ <xs:element name="datePeriod" type="xs:string"/>
+ <xs:element name="dateNote" type="xs:string"/>
+ <xs:element name="dateEarliestScalarValue" type="xs:date"/>
+ <xs:element name="dateLatestScalarValue" type="xs:date"/>
+ <xs:element name="scalarValuesComputed" type="xs:boolean"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
+
--- /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.place</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place.3rdparty</artifactId>
+ <name>services.place.3rdparty</name>
+ <packaging>pom</packaging>
+ <description>
+ 3rd party build for place service
+ </description>
+
+ <modules>
+ <module>nuxeo-platform-cs-place</module>
+ </modules>
+</project>
--- /dev/null
+<project name="place" default="package" basedir=".">
+ <description>
+ Place Authority service
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../.."/>
+ <!-- enviornment 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"/>
+
+ <condition property="osfamily-unix">
+ <os family="unix" />
+ </condition>
+ <condition property="osfamily-windows">
+ <os family="windows" />
+ </condition>
+
+ <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 place service">
+ <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false"/>
+ </target>
+
+ <target name="undeploy"
+ description="undeploy place service">
+ <ant antfile="3rdparty/build.xml" target="undeploy" inheritall="false"/>
+ </target>
+
+ <target name="dist" depends="package"
+ description="distribute place service">
+ <ant antfile="3rdparty/build.xml" target="dist" inheritall="false"/>
+ </target>
+
+ <target name="dist_installer" depends="package"
+ description="distribute place service">
+ <!-- copy install scripts, etc. -->
+ <copy todir="${services.trunk}/${dist.installer.services}/place">
+ <fileset dir="${basedir}/installer/"/>
+ </copy>
+ <ant antfile="3rdparty/build.xml" target="dist_installer" inheritall="false"/>
+ </target>
+
+</project>
--- /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>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place.client</artifactId>
+ <name>services.place.client</name>
+
+ <dependencies>
+ <!-- keep slf4j dependencies on the top -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.common</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- External dependencies -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <!-- filter out unwanted jars -->
+ <exclusions>
+ <exclusion>
+ <groupId>tjws</groupId>
+ <artifactId>webserver</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-multipart-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-place-client</finalName>
+ <plugins>
+ </plugins>
+ </build>
+</project>
+
--- /dev/null
+/**
+ * PlaceAuthorityClient.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 org.collectionspace.services.place.PlacesCommon;
+/**
+ * The Class PlaceAuthorityClient.
+ */
+public class PlaceAuthorityClient extends AuthorityClientImpl<PlacesCommon, PlaceAuthorityProxy> {
+ public static final String SERVICE_NAME = "placeauthorities";
+ public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
+ public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
+ public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
+ //
+ // Subitem constants
+ //
+ public static final String SERVICE_ITEM_NAME = "places";
+ public static final String SERVICE_ITEM_PAYLOAD_NAME = SERVICE_ITEM_NAME;
+ //
+ // Payload Part/Schema part names
+ //
+ public static final String SERVICE_COMMON_PART_NAME = SERVICE_NAME +
+ PART_LABEL_SEPARATOR + PART_COMMON_LABEL;
+ public static final String SERVICE_ITEM_COMMON_PART_NAME = SERVICE_ITEM_NAME +
+ PART_LABEL_SEPARATOR + PART_COMMON_LABEL;
+
+ @Override
+ public String getServiceName() {
+ return SERVICE_NAME;
+ }
+
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ @Override
+ public String getItemCommonPartName() {
+ return getCommonPartName(SERVICE_ITEM_NAME);
+ }
+
+ @Override
+ public Class<PlaceAuthorityProxy> getProxyClass() {
+ return PlaceAuthorityProxy.class;
+ }
+
+ @Override
+ public String getInAuthority(PlacesCommon item) {
+ return item.getInAuthority();
+ }
+
+ @Override
+ public void setInAuthority(PlacesCommon item, String inAuthorityCsid) {
+ item.setInAuthority(inAuthorityCsid);
+ }
+}
--- /dev/null
+package org.collectionspace.services.client;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+
+import org.apache.commons.io.FileUtils;
+import org.collectionspace.services.PlaceJAXBSchema;
+import org.collectionspace.services.client.test.ServiceRequestType;
+import org.collectionspace.services.place.PlaceauthoritiesCommon;
+import org.collectionspace.services.place.PlaceNameGroup;
+import org.collectionspace.services.place.PlaceNameGroupList;
+import org.collectionspace.services.place.PlacesCommon;
+import org.dom4j.DocumentException;
+import org.jboss.resteasy.client.ClientResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PlaceAuthorityClientUtils {
+ private static final Logger logger =
+ LoggerFactory.getLogger(PlaceAuthorityClientUtils.class);
+
+ /**
+ * Creates a new Place Authority
+ * @param displayName The displayName used in UI, etc.
+ * @param refName The proper refName for this authority
+ * @param headerLabel The common part label
+ * @return The PoxPayloadOut payload for the create call
+ */
+ public static PoxPayloadOut createPlaceAuthorityInstance(
+ String displayName, String shortIdentifier, String headerLabel ) {
+ PlaceauthoritiesCommon placeAuthority = new PlaceauthoritiesCommon();
+ placeAuthority.setDisplayName(displayName);
+ placeAuthority.setShortIdentifier(shortIdentifier);
+ String refName = createPlaceAuthRefName(shortIdentifier, displayName);
+ placeAuthority.setRefName(refName);
+ placeAuthority.setVocabType("PlaceAuthority"); //FIXME: REM - Should this really be hard-coded?
+ PoxPayloadOut multipart = new PoxPayloadOut(PlaceAuthorityClient.SERVICE_PAYLOAD_NAME);
+ PayloadOutputPart commonPart = multipart.addPart(placeAuthority, MediaType.APPLICATION_XML_TYPE);
+ commonPart.setLabel(headerLabel);
+
+ if(logger.isDebugEnabled()){
+ logger.debug("to be created, placeAuthority common ",
+ placeAuthority, PlaceauthoritiesCommon.class);
+ }
+
+ return multipart;
+ }
+
+ /**
+ * @param placeRefName The proper refName for this authority
+ * @param placeInfo the properties for the new Place. Can pass in one condition
+ * note and date string.
+ * @param headerLabel The common part label
+ * @return The PoxPayloadOut payload for the create call
+ */
+ public static PoxPayloadOut createPlaceInstance(
+ String placeAuthRefName, Map<String, String> placeInfo,
+ String headerLabel){
+ PlacesCommon place = new PlacesCommon();
+ String shortId = placeInfo.get(PlaceJAXBSchema.SHORT_IDENTIFIER);
+ String displayName = placeInfo.get(PlaceJAXBSchema.DISPLAY_NAME);
+ place.setShortIdentifier(shortId);
+ String placeRefName = createPlaceRefName(placeAuthRefName, shortId, displayName);
+ place.setRefName(placeRefName);
+ String value = null;
+ value = placeInfo.get(PlaceJAXBSchema.DISPLAY_NAME_COMPUTED);
+ boolean displayNameComputed = (value==null) || value.equalsIgnoreCase("true");
+ place.setDisplayNameComputed(displayNameComputed);
+ if((value = (String)placeInfo.get(PlaceJAXBSchema.DISPLAY_NAME))!=null)
+ place.setDisplayName(value);
+ value = placeInfo.get(PlaceJAXBSchema.DISPLAY_NAME_COMPUTED);
+ displayNameComputed = (value==null) || value.equalsIgnoreCase("true");
+ place.setDisplayNameComputed(displayNameComputed);
+ /* TODO - think about how much to support. This approach to the client
+ * does not scale! We should really favor the document/payload approach. */
+ if((value = (String)placeInfo.get(PlaceJAXBSchema.NAME))!=null) {
+ PlaceNameGroupList placeNameGroupList = new PlaceNameGroupList();
+ List<PlaceNameGroup> placeNameGroups = placeNameGroupList.getPlaceNameGroup();
+ PlaceNameGroup placeNameGroup = new PlaceNameGroup();
+ placeNameGroup.setName(value);
+ placeNameGroups.add(placeNameGroup);
+ place.setPlaceNameGroupList(placeNameGroupList);
+ }
+
+
+ if((value = (String)placeInfo.get(PlaceJAXBSchema.TERM_STATUS))!=null)
+ place.setTermStatus(value);
+
+ PoxPayloadOut multipart = new PoxPayloadOut(PlaceAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+ PayloadOutputPart commonPart = multipart.addPart(place,
+ MediaType.APPLICATION_XML_TYPE);
+ commonPart.setLabel(headerLabel);
+
+ if(logger.isDebugEnabled()){
+ logger.debug("to be created, place common ", place, PlacesCommon.class);
+ }
+
+ return multipart;
+ }
+
+ /**
+ * @param vcsid CSID of the authority to create a new placplace
+ * @param placeAuthorityRefName The refName for the authority
+ * @param placeMap the properties for the new Place
+ * @param client the service client
+ * @return the CSID of the new item
+ */
+ public static String createItemInAuthority(String vcsid,
+ String placeAuthorityRefName, Map<String,String> placeMap,
+ PlaceAuthorityClient client ) {
+ // Expected status code: 201 Created
+ int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();
+ // Type of service request being tested
+ ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE;
+
+ String displayName = placeMap.get(PlaceJAXBSchema.DISPLAY_NAME);
+ String displayNameComputedStr = placeMap.get(PlaceJAXBSchema.DISPLAY_NAME_COMPUTED);
+ boolean displayNameComputed = (displayNameComputedStr==null) || displayNameComputedStr.equalsIgnoreCase("true");
+ if( displayName == null ) {
+ if(!displayNameComputed) {
+ throw new RuntimeException(
+ "CreateItem: Must supply a displayName if displayNameComputed is set to false.");
+ }
+ /* Could try to pull name out of first placeNameGroup
+ displayName =
+ prepareDefaultDisplayName(
+ placeMap.get(PlaceJAXBSchema.NAME));
+ */
+ }
+
+ if(logger.isDebugEnabled()){
+ logger.debug("Import: Create Item: \""+displayName
+ +"\" in placeAuthority: \"" + placeAuthorityRefName +"\"");
+ }
+ PoxPayloadOut multipart =
+ createPlaceInstance( placeAuthorityRefName,
+ placeMap, client.getItemCommonPartName() );
+ String newID = null;
+ ClientResponse<Response> res = client.createItem(vcsid, multipart);
+ try {
+ int statusCode = res.getStatus();
+
+ if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {
+ throw new RuntimeException("Could not create Item: \""
+ +placeMap.get(PlaceJAXBSchema.SHORT_IDENTIFIER)
+ +"\" in placeAuthority: \"" + placeAuthorityRefName
+ +"\" "+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ }
+ if(statusCode != EXPECTED_STATUS_CODE) {
+ throw new RuntimeException("Unexpected Status when creating Item: \""
+ +placeMap.get(PlaceJAXBSchema.SHORT_IDENTIFIER)
+ +"\" in placeAuthority: \"" + placeAuthorityRefName +"\", Status:"+ statusCode);
+ }
+ newID = extractId(res);
+ } finally {
+ res.releaseConnection();
+ }
+
+ return newID;
+ }
+
+ public static PoxPayloadOut createPlaceInstance(
+ String commonPartXML, String headerLabel) throws DocumentException {
+ PoxPayloadOut multipart = new PoxPayloadOut(PlaceAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+ PayloadOutputPart commonPart = multipart.addPart(commonPartXML,
+ MediaType.APPLICATION_XML_TYPE);
+ commonPart.setLabel(headerLabel);
+
+ if(logger.isDebugEnabled()){
+ logger.debug("to be created, place common ", commonPartXML);
+ }
+
+ return multipart;
+ }
+
+ public static String createItemInAuthority(String vcsid,
+ String commonPartXML,
+ PlaceAuthorityClient client ) throws DocumentException {
+ // Expected status code: 201 Created
+ int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();
+ // Type of service request being tested
+ ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE;
+
+ PoxPayloadOut multipart =
+ createPlaceInstance(commonPartXML, client.getItemCommonPartName());
+ String newID = null;
+ ClientResponse<Response> res = client.createItem(vcsid, multipart);
+ try {
+ int statusCode = res.getStatus();
+
+ if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {
+ throw new RuntimeException("Could not create Item: \""+commonPartXML
+ +"\" in placeAuthority: \"" + vcsid
+ +"\" "+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ }
+ if(statusCode != EXPECTED_STATUS_CODE) {
+ throw new RuntimeException("Unexpected Status when creating Item: \""+commonPartXML
+ +"\" in placeAuthority: \"" + vcsid +"\", Status:"+ statusCode);
+ }
+ newID = extractId(res);
+ } finally {
+ res.releaseConnection();
+ }
+
+ return newID;
+ }
+
+ /**
+ * Creates the from xml file.
+ *
+ * @param fileName the file name
+ * @return new CSID as string
+ * @throws Exception the exception
+ */
+ private String createItemInAuthorityFromXmlFile(String vcsid, String commonPartFileName,
+ PlaceAuthorityClient client) throws Exception {
+ byte[] b = FileUtils.readFileToByteArray(new File(commonPartFileName));
+ String commonPartXML = new String(b);
+ return createItemInAuthority(vcsid, commonPartXML, client );
+ }
+
+ /**
+ * Creates the placeAuthority ref name.
+ *
+ * @param shortId the placeAuthority shortIdentifier
+ * @param displaySuffix displayName to be appended, if non-null
+ * @return the string
+ */
+ public static String createPlaceAuthRefName(String shortId, String displaySuffix) {
+ String refName = "urn:cspace:org.collectionspace.demo:placeauthority:name("
+ +shortId+")";
+ if(displaySuffix!=null&&!displaySuffix.isEmpty())
+ refName += "'"+displaySuffix+"'";
+ return refName;
+ }
+
+ /**
+ * Creates the place ref name.
+ *
+ * @param placeAuthRefName the placeAuthority ref name
+ * @param shortId the place shortIdentifier
+ * @param displaySuffix displayName to be appended, if non-null
+ * @return the string
+ */
+ public static String createPlaceRefName(
+ String placeAuthRefName, String shortId, String displaySuffix) {
+ String refName = placeAuthRefName+":place:name("+shortId+")";
+ if(displaySuffix!=null&&!displaySuffix.isEmpty())
+ refName += "'"+displaySuffix+"'";
+ return refName;
+ }
+
+ public static String extractId(ClientResponse<Response> res) {
+ MultivaluedMap<String, Object> mvm = res.getMetadata();
+ String uri = (String) ((ArrayList<Object>) mvm.get("Location")).get(0);
+ if(logger.isDebugEnabled()){
+ logger.debug("extractId:uri=" + uri);
+ }
+ String[] segments = uri.split("/");
+ String id = segments[segments.length - 1];
+ if(logger.isDebugEnabled()){
+ logger.debug("id=" + id);
+ }
+ return id;
+ }
+
+ /**
+ * Returns an error message indicating that the status code returned by a
+ * specific call to a service does not fall within a set of valid status
+ * codes for that service.
+ *
+ * @param serviceRequestType A type of service request (e.g. CREATE, DELETE).
+ *
+ * @param statusCode The invalid status code that was returned in the response,
+ * from submitting that type of request to the service.
+ *
+ * @return An error message.
+ */
+ public static String invalidStatusCodeMessage(ServiceRequestType requestType, int statusCode) {
+ return "Status code '" + statusCode + "' in response is NOT within the expected set: " +
+ requestType.validStatusCodesAsString();
+ }
+
+
+
+ /**
+ * Produces a default displayName from one or more supplied field(s).
+ * @see PlaceAuthorityDocumentModelHandler.prepareDefaultDisplayName() which
+ * duplicates this logic, until we define a service-general utils package
+ * that is neither client nor service specific.
+ * @param name
+ * @return a display name
+ */
+ public static String prepareDefaultDisplayName(
+ String name ) {
+ StringBuilder newStr = new StringBuilder();
+ newStr.append(name);
+ return newStr.toString();
+ }
+
+
+
+}
--- /dev/null
+package org.collectionspace.services.client;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+/**
+ * @version $Revision:$
+ */
+@Path(PlaceAuthorityClient.SERVICE_PATH + "/")
+@Produces("application/xml")
+@Consumes("application/xml")
+public interface PlaceAuthorityProxy extends AuthorityProxy {
+}
--- /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 (c)) 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.collectionspace.services.PlaceJAXBSchema;
+import org.collectionspace.services.client.AbstractCommonListUtils;
+import org.collectionspace.services.client.AuthorityClient;
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.PayloadOutputPart;
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.client.PlaceAuthorityClient;
+import org.collectionspace.services.client.PlaceAuthorityClientUtils;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.place.PlaceauthoritiesCommon;
+import org.collectionspace.services.place.PlacesCommon;
+import org.collectionspace.services.place.PlaceNameGroup;
+import org.collectionspace.services.place.PlaceNameGroupList;
+
+import org.jboss.resteasy.client.ClientResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+/**
+ * PlaceAuthorityServiceTest, carries out tests against a
+ * deployed and running PlaceAuthority Service.
+ *
+ * $LastChangedRevision: 753 $
+ * $LastChangedDate: 2009-09-23 11:03:36 -0700 (Wed, 23 Sep 2009) $
+ */
+public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<PlaceauthoritiesCommon, PlacesCommon> {
+
+ /** The logger. */
+ private final String CLASS_NAME = PlaceAuthorityServiceTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(PlaceAuthorityServiceTest.class);
+ private final String REFNAME = "refName";
+ private final static String EMPTY_REFNAME = "";
+ private final String DISPLAYNAME = "displayName";
+
+ @Override
+ public String getServicePathComponent() {
+ return PlaceAuthorityClient.SERVICE_PATH_COMPONENT;
+ }
+
+ @Override
+ protected String getServiceName() {
+ return PlaceAuthorityClient.SERVICE_NAME;
+ }
+
+ public String getItemServicePathComponent() {
+ return AuthorityClient.ITEMS;
+ }
+
+ // Instance variables specific to this test.
+
+// /** The SERVICE path component. */
+// final String SERVICE_PATH_COMPONENT = "placeauthorities";
+//
+// /** The ITEM service path component. */
+// final String ITEM_SERVICE_PATH_COMPONENT = "items";
+//
+
+ final String TEST_DNAME = "San Jose, CA";
+ final String TEST_NAME = "San Jose";
+ final String TEST_SHORTID = "sanjose";
+ // TODO Make place type be a controlled vocab term.
+ final String TEST_PLACE_TYPE = "City";
+ // TODO Make status type be a controlled vocab term.
+ final String TEST_STATUS = "Approved";
+ final String TEST_NOTE = "My hometown";
+ final String TEST_SOURCE = "Peralta's Places of California";
+ final String TEST_SOURCE_PAGE = "p.21";
+ final String TEST_DISPLAY_DATE = "This year";
+ final String TEST_EARLIEST_SINGLE_YEAR = "2012";
+
+ /** The known resource id. */
+ private String knownResourceShortIdentifer = null;
+ private String knownResourceRefName = null;
+
+ private String knownPlaceTypeRefName = null;
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
+ */
+ @Override
+ protected CollectionSpaceClient getClientInstance() {
+ return new PlaceAuthorityClient();
+ }
+
+ /**
+ * Creates the item in authority.
+ *
+ * @param vcsid the vcsid
+ * @param authRefName the auth ref name
+ * @return the string
+ */
+ private String createItemInAuthority(String vcsid, String authRefName) {
+ final String testName = "createItemInAuthority("+vcsid+","+authRefName+")";
+
+ // Submit the request to the service and store the response.
+ PlaceAuthorityClient client = new PlaceAuthorityClient();
+ Map<String, String> sanjoseMap = new HashMap<String,String>();
+ // TODO Make place type and status be controlled vocabs.
+ sanjoseMap.put(PlaceJAXBSchema.DISPLAY_NAME, TEST_DNAME);
+ sanjoseMap.put(PlaceJAXBSchema.SHORT_IDENTIFIER, TEST_SHORTID);
+ sanjoseMap.put(PlaceJAXBSchema.NAME, TEST_NAME);
+ sanjoseMap.put(PlaceJAXBSchema.NOTE, TEST_NOTE);
+ sanjoseMap.put(PlaceJAXBSchema.SOURCE, TEST_SOURCE);
+ sanjoseMap.put(PlaceJAXBSchema.SOURCE_PAGE, TEST_SOURCE_PAGE);
+ sanjoseMap.put(PlaceJAXBSchema.PLACE_TYPE, TEST_PLACE_TYPE);
+ sanjoseMap.put(PlaceJAXBSchema.TERM_STATUS, TEST_STATUS);
+
+ String newID = PlaceAuthorityClientUtils.createItemInAuthority(vcsid,
+ authRefName, sanjoseMap, client );
+
+ // Store the ID returned from the first item resource created
+ // for additional tests below.
+ if (knownItemResourceId == null){
+ setKnownItemResource(newID, TEST_SHORTID);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testName + ": knownItemResourceId=" + newID);
+ }
+ }
+
+ // Store the IDs from any item resources created
+ // by tests, along with the IDs of their parents, so these items
+ // can be deleted after all tests have been run.
+ allResourceItemIdsCreated.put(newID, vcsid);
+
+ return newID;
+ }
+
+ /**
+ * Verify item display name.
+ *
+ * @param testName the test name
+ * @throws Exception the exception
+ */
+ @Test(dataProvider="testName",
+ dependsOnMethods = {"readItem", "updateItem"})
+ public void verifyItemDisplayName(String testName) throws Exception {
+ // Perform setup.
+ setupRead();
+ //
+ // First, read our known item resource
+ //
+ PlaceAuthorityClient client = new PlaceAuthorityClient();
+ ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+ PlacesCommon place = null;
+ try {
+ assertStatusCode(res, testName);
+ // Check whether place has expected displayName.
+ PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+ place = (PlacesCommon) extractPart(input,
+ client.getItemCommonPartName(), PlacesCommon.class);
+ Assert.assertNotNull(place);
+ } finally {
+ if (res != null) {
+ res.releaseConnection();
+ }
+ }
+ //
+ // Now prepare an updated payload.
+ //
+ String displayName = place.getDisplayName();
+ // Make sure displayName matches computed form
+ String expectedDisplayName =
+ PlaceAuthorityClientUtils.prepareDefaultDisplayName(TEST_NAME);
+ Assert.assertNotNull(displayName, expectedDisplayName);
+
+ // Update the shortName and verify the computed name is updated.
+ place.setCsid(null);
+ place.setDisplayNameComputed(true);
+
+ // Verify the contents of this resource
+ PlaceNameGroupList placeNameGroupList = place.getPlaceNameGroupList();
+ Assert.assertNotNull(placeNameGroupList);
+ List<PlaceNameGroup> placeNameGroups = placeNameGroupList.getPlaceNameGroup();
+ Assert.assertNotNull(placeNameGroups);
+ Assert.assertTrue(placeNameGroups.size() > 0);
+ String name = placeNameGroups.get(0).getName();
+ Assert.assertNotNull(name);
+
+ // Update the contents of this resource.
+ final String PLACE_NAME_ADDITION = "verify-item-place-name-updated";
+ placeNameGroups.get(0).setName(PLACE_NAME_ADDITION + TEST_NAME);
+ place.setPlaceNameGroupList(placeNameGroupList);
+ if (logger.isDebugEnabled()) {
+ logger.debug("to be updated Place");
+ logger.debug(objectAsXmlString(place,
+ PlacesCommon.class));
+ }
+ expectedDisplayName =
+ PlaceAuthorityClientUtils.prepareDefaultDisplayName(PLACE_NAME_ADDITION + TEST_NAME);
+
+ // Submit the updated resource to the service and store the response.
+ PoxPayloadOut output = new PoxPayloadOut(PlaceAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+ PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), place);
+
+ setupUpdate();
+ res = client.updateItem(knownResourceId, knownItemResourceId, output);
+ PlacesCommon updatedPlace = null;
+ try {
+ assertStatusCode(res, testName);
+ // Retrieve the updated resource and verify that its contents exist.
+ PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+ updatedPlace = (PlacesCommon) extractPart(input,
+ client.getItemCommonPartName(), PlacesCommon.class);
+ Assert.assertNotNull(updatedPlace);
+ } finally {
+ if (res != null) {
+ res.releaseConnection();
+ }
+ }
+
+ // Verify that the updated resource computes the right displayName.
+ Assert.assertEquals(updatedPlace.getDisplayName(), expectedDisplayName,
+ "Updated DisplayName in Place not reflected in computed DisplayName.");
+ //
+ // Now Update the displayName, not computed and verify the computed name is overriden.
+ //
+ place.setDisplayNameComputed(false);
+ expectedDisplayName = "TestName";
+ place.setDisplayName(expectedDisplayName);
+
+ // Submit the updated resource to the service and store the response.
+ output = new PoxPayloadOut(PlaceAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+ commonPart = output.addPart(client.getItemCommonPartName(), place);
+ setupUpdate();
+ res = client.updateItem(knownResourceId, knownItemResourceId, output);
+ try {
+ assertStatusCode(res, testName);
+ // Retrieve the updated resource and verify that its contents exist.
+ PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+ updatedPlace = (PlacesCommon) extractPart(input,
+ client.getItemCommonPartName(), PlacesCommon.class);
+ Assert.assertNotNull(updatedPlace);
+ } finally {
+ if (res != null) {
+ res.releaseConnection();
+ }
+ }
+
+ // Verify that the updated resource received the correct data.
+ Assert.assertEquals(updatedPlace.isDisplayNameComputed(), false,
+ "Updated displayNameComputed in Place did not match submitted data.");
+ // Verify that the updated resource computes the right displayName.
+ Assert.assertEquals(updatedPlace.getDisplayName(),
+ expectedDisplayName,
+ "Updated DisplayName (not computed) in Place not stored.");
+ }
+
+ /**
+ * Verify illegal item display name.
+ *
+ * @param testName the test name
+ * @throws Exception the exception
+ */
+ @Test(dataProvider="testName",
+ dependsOnMethods = {"verifyItemDisplayName"})
+ public void verifyIllegalItemDisplayName(String testName) throws Exception {
+ // Perform setup for read.
+ setupRead();
+
+ // Submit the request to the service and store the response.
+ PlaceAuthorityClient client = new PlaceAuthorityClient();
+ ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+ PlacesCommon place= null;
+ try {
+ assertStatusCode(res, testName);
+ PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+ place = (PlacesCommon) extractPart(input,
+ client.getItemCommonPartName(), PlacesCommon.class);
+ Assert.assertNotNull(place);
+ } finally {
+ if (res != null) {
+ res.releaseConnection();
+ }
+ }
+
+ // Try to Update with computed false and no displayName
+ place.setDisplayNameComputed(false);
+ place.setDisplayName(null);
+
+ // Submit the updated resource to the service and store the response.
+ PoxPayloadOut output = new PoxPayloadOut(PlaceAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+ PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), place);
+ setupUpdateWithInvalidBody(); // we expected a failure here.
+ res = client.updateItem(knownResourceId, knownItemResourceId, output);
+ try {
+ assertStatusCode(res, testName);
+ } finally {
+ if (res != null) {
+ res.releaseConnection();
+ }
+ }
+ }
+
+ /**
+ * Read item list.
+ */
+ @Test(dataProvider = "testName", groups = {"readList"},
+ dependsOnMethods = {"readList"})
+ public void readItemList(String testName) {
+ readItemList(knownAuthorityWithItems, null);
+ }
+
+ /**
+ * Read item list by authority name.
+ */
+ @Test(dataProvider = "testName", groups = {"readList"},
+ dependsOnMethods = {"readItemList"})
+ public void readItemListByAuthorityName(String testName) {
+ readItemList(null, READITEMS_SHORT_IDENTIFIER);
+ }
+
+ /**
+ * Read item list.
+ *
+ * @param vcsid
+ * the vcsid
+ * @param name
+ * the name
+ */
+ private void readItemList(String vcsid, String shortId) {
+ String testName = "readItemList";
+
+ // Perform setup.
+ setupReadList();
+
+ // Submit the request to the service and store the response.
+ PlaceAuthorityClient client = new PlaceAuthorityClient();
+ ClientResponse<AbstractCommonList> res = null;
+ if (vcsid != null) {
+ res = client.readItemList(vcsid, null, null);
+ } else if (shortId != null) {
+ res = client.readItemListForNamedAuthority(shortId, null, null);
+ } else {
+ Assert.fail("readItemList passed null csid and name!");
+ }
+
+ AbstractCommonList list = null;
+ try {
+ assertStatusCode(res, testName);
+ list = res.getEntity();
+ } finally {
+ if (res != null) {
+ res.releaseConnection();
+ }
+ }
+
+ List<AbstractCommonList.ListItem> items = list.getListItem();
+ int nItemsReturned = items.size();
+ // There will be 'nItemsToCreateInList'
+ // items created by the createItemList test,
+ // all associated with the same parent resource.
+ int nExpectedItems = nItemsToCreateInList;
+ if (logger.isDebugEnabled()) {
+ logger.debug(testName + ": Expected " + nExpectedItems
+ + " items; got: " + nItemsReturned);
+ }
+ Assert.assertEquals(nItemsReturned, nExpectedItems);
+
+ for (AbstractCommonList.ListItem item : items) {
+ String value = AbstractCommonListUtils.ListItemGetElementValue(
+ item, REFNAME);
+ Assert.assertTrue((null != value), "Item refName is null!");
+ value = AbstractCommonListUtils.ListItemGetElementValue(item,
+ DISPLAYNAME);
+ Assert.assertTrue((null != value), "Item displayName is null!");
+ }
+ if (logger.isTraceEnabled()) {
+ AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger,
+ testName);
+ }
+ }
+
+ @Override
+ public void delete(String testName) throws Exception {
+ // Do nothing. See localDelete(). This ensure proper test order.
+ }
+
+ @Test(dataProvider = "testName", dependsOnMethods = {"localDeleteItem"})
+ public void localDelete(String testName) throws Exception {
+ super.delete(testName);
+ }
+
+ @Override
+ public void deleteItem(String testName) throws Exception {
+ // Do nothing. We need to wait until after the test "localDelete" gets run. When it does,
+ // its dependencies will get run first and then we can call the base class' delete method.
+ }
+
+ @Test(dataProvider = "testName", groups = {"delete"},
+ dependsOnMethods = {"verifyIllegalItemDisplayName"})
+ public void localDeleteItem(String testName) throws Exception {
+ super.deleteItem(testName);
+ }
+
+ // ---------------------------------------------------------------
+ // Cleanup of resources created during testing
+ // ---------------------------------------------------------------
+
+ /**
+ * Deletes all resources created by tests, after all tests have been run.
+ *
+ * This cleanup method will always be run, even if one or more tests fail.
+ * For this reason, it attempts to remove all resources created
+ * at any point during testing, even if some of those resources
+ * may be expected to be deleted by certain tests.
+ */
+
+ @AfterClass(alwaysRun=true)
+ public void cleanUp() {
+ String noTest = System.getProperty("noTestCleanup");
+ if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Skipping Cleanup phase ...");
+ }
+ return;
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("Cleaning up temporary resources created for testing ...");
+ }
+ String parentResourceId;
+ String itemResourceId;
+ // Clean up contact resources.
+ PlaceAuthorityClient client = new PlaceAuthorityClient();
+ parentResourceId = knownResourceId;
+ // Clean up item resources.
+ for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
+ itemResourceId = entry.getKey();
+ parentResourceId = entry.getValue();
+ // Note: Any non-success responses from the delete operation
+ // below are ignored and not reported.
+ client.deleteItem(parentResourceId, itemResourceId).releaseConnection();
+ }
+ // Clean up parent resources.
+ for (String resourceId : allResourceIdsCreated) {
+ // Note: Any non-success responses from the delete operation
+ // below are ignored and not reported.
+ client.delete(resourceId).releaseConnection();
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // Utility methods used by tests above
+ // ---------------------------------------------------------------
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
+ */
+
+ /**
+ * Returns the root URL for the item service.
+ *
+ * This URL consists of a base URL for all services, followed by
+ * a path component for the owning parent, followed by the
+ * path component for the items.
+ *
+ * @param parentResourceIdentifier An identifier (such as a UUID) for the
+ * parent authority resource of the relevant item resource.
+ *
+ * @return The root URL for the item service.
+ */
+ protected String getItemServiceRootURL(String parentResourceIdentifier) {
+ return getResourceURL(parentResourceIdentifier) + "/" + getItemServicePathComponent();
+ }
+
+ /**
+ * Returns the URL of a specific item resource managed by a service, and
+ * designated by an identifier (such as a universally unique ID, or UUID).
+ *
+ * @param parentResourceIdentifier An identifier (such as a UUID) for the
+ * parent authority resource of the relevant item resource.
+ *
+ * @param itemResourceIdentifier An identifier (such as a UUID) for an
+ * item resource.
+ *
+ * @return The URL of a specific item resource managed by a service.
+ */
+ protected String getItemResourceURL(String parentResourceIdentifier, String itemResourceIdentifier) {
+ return getItemServiceRootURL(parentResourceIdentifier) + "/" + itemResourceIdentifier;
+ }
+
+ @Override
+ public void authorityTests(String testName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ //
+ // Place specific overrides
+ //
+
+ @Override
+ protected PoxPayloadOut createInstance(String commonPartName,
+ String identifier) {
+ // Submit the request to the service and store the response.
+ String shortId = identifier;
+ String displayName = "displayName-" + shortId;
+ // String baseRefName = PlaceAuthorityClientUtils.createPlaceAuthRefName(shortId, null);
+ PoxPayloadOut result =
+ PlaceAuthorityClientUtils.createPlaceAuthorityInstance(
+ displayName, shortId, commonPartName);
+ return result;
+ }
+
+ @Override
+ protected PoxPayloadOut createNonExistenceInstance(String commonPartName, String identifier) {
+ String displayName = "displayName-NON_EXISTENT_ID";
+ PoxPayloadOut result = PlaceAuthorityClientUtils.createPlaceAuthorityInstance(
+ displayName, "nonEx", commonPartName);
+ return result;
+ }
+
+ @Override
+ protected PlaceauthoritiesCommon updateInstance(PlaceauthoritiesCommon placeauthoritiesCommon) {
+ PlaceauthoritiesCommon result = new PlaceauthoritiesCommon();
+
+ result.setDisplayName("updated-" + placeauthoritiesCommon.getDisplayName());
+ result.setVocabType("updated-" + placeauthoritiesCommon.getVocabType());
+
+ return result;
+ }
+
+ @Override
+ protected void compareUpdatedInstances(PlaceauthoritiesCommon original,
+ PlaceauthoritiesCommon updated) throws Exception {
+ Assert.assertEquals(updated.getDisplayName(),
+ original.getDisplayName(),
+ "Display name in updated object did not match submitted data.");
+ }
+
+ protected void compareReadInstances(PlaceauthoritiesCommon original,
+ PlaceauthoritiesCommon fromRead) throws Exception {
+ Assert.assertNotNull(fromRead.getDisplayName());
+ Assert.assertNotNull(fromRead.getShortIdentifier());
+ Assert.assertNotNull(fromRead.getRefName());
+ }
+
+ //
+ // Authority item specific overrides
+ //
+
+ @Override
+ protected String createItemInAuthority(String authorityId) {
+ return createItemInAuthority(authorityId, null /*refname*/);
+ }
+
+ @Override
+ protected PlacesCommon updateItemInstance(PlacesCommon placesCommon) {
+
+ // Get the Name field from the resource passed in
+ PlaceNameGroupList placeNameGroupList = placesCommon.getPlaceNameGroupList();
+ Assert.assertNotNull(placeNameGroupList);
+ List<PlaceNameGroup> placeNameGroups = placeNameGroupList.getPlaceNameGroup();
+ Assert.assertNotNull(placeNameGroups);
+ Assert.assertTrue(placeNameGroups.size() > 0);
+ String originalName = placeNameGroups.get(0).getName();
+ Assert.assertNotNull(originalName);
+
+ // Update the contents of the new resource based on original value
+ PlaceNameGroupList updatedPlaceNameGroupList = new PlaceNameGroupList();
+ List<PlaceNameGroup> updatedPlaceNameGroups = updatedPlaceNameGroupList.getPlaceNameGroup();
+ PlaceNameGroup updatedPlaceNameGroup = new PlaceNameGroup();
+ updatedPlaceNameGroup.setName("updated-" + originalName);
+ updatedPlaceNameGroups.add(updatedPlaceNameGroup);
+ PlacesCommon result = new PlacesCommon();
+ result.setPlaceNameGroupList(updatedPlaceNameGroupList);
+
+ result.setDisplayName("updated-" + placesCommon.getDisplayName());
+
+ return result;
+ }
+
+ @Override
+ protected void compareUpdatedItemInstances(PlacesCommon original,
+ PlacesCommon updated) throws Exception {
+
+ // Get the Name fields each resource passed in
+ PlaceNameGroupList placeNameGroupList = original.getPlaceNameGroupList();
+ Assert.assertNotNull(placeNameGroupList);
+ List<PlaceNameGroup> placeNameGroups = placeNameGroupList.getPlaceNameGroup();
+ Assert.assertNotNull(placeNameGroups);
+ Assert.assertTrue(placeNameGroups.size() > 0);
+ String originalName = placeNameGroups.get(0).getName();
+ Assert.assertNotNull(originalName);
+
+ PlaceNameGroupList updatedPlaceNameGroupList = updated.getPlaceNameGroupList();
+ Assert.assertNotNull(updatedPlaceNameGroupList);
+ List<PlaceNameGroup> updatedPlaceNameGroups = updatedPlaceNameGroupList.getPlaceNameGroup();
+ Assert.assertNotNull(updatedPlaceNameGroups);
+ Assert.assertTrue(updatedPlaceNameGroups.size() > 0);
+ String updatedName = updatedPlaceNameGroups.get(0).getName();
+ Assert.assertNotNull(updatedName);
+
+
+
+
+ Assert.assertEquals(updatedName, originalName,
+ "Data in updated Place did not match submitted data.");
+ }
+
+ @Override
+ protected void verifyReadItemInstance(PlacesCommon item)
+ throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ protected PoxPayloadOut createNonExistenceItemInstance(
+ String commonPartName, String identifier) {
+ Map<String, String> nonexMap = new HashMap<String,String>();
+ nonexMap.put(PlaceJAXBSchema.NAME, TEST_NAME);
+ nonexMap.put(PlaceJAXBSchema.SHORT_IDENTIFIER, "nonEx");
+ nonexMap.put(PlaceJAXBSchema.PLACE_TYPE, TEST_PLACE_TYPE);
+ nonexMap.put(PlaceJAXBSchema.TERM_STATUS, TEST_STATUS);
+ // PoxPayloadOut multipart =
+ // PlaceAuthorityClientUtils.createPlaceInstance(
+ // PlaceAuthorityClientUtils.createPlaceRefName(knownResourceRefName, "nonEx", "Non Existent"),
+ // nonexMap, client.getItemCommonPartName() );
+ final String EMPTY_REFNAME = "";
+ PoxPayloadOut result =
+ PlaceAuthorityClientUtils.createPlaceInstance(EMPTY_REFNAME,
+ nonexMap, commonPartName);
+ return result;
+ }
+}
--- /dev/null
+log4j.rootLogger=debug, stdout, R
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+
+# Pattern to output the caller's file name and line number.
+log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n
+
+log4j.appender.R=org.apache.log4j.RollingFileAppender
+log4j.appender.R.File=target/test-client.log
+
+log4j.appender.R.MaxFileSize=100KB
+# Keep one backup file
+log4j.appender.R.MaxBackupIndex=1
+
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
+log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n
+
+#packages
+log4j.logger.org.collectionspace=DEBUG
+log4j.logger.org.apache=INFO
+log4j.logger.httpclient=INFO
+log4j.logger.org.jboss.resteasy=INFO
--- /dev/null
+
+<project name="place" default="package" basedir=".">
+ <description>
+ place service
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../.."/>
+ <property file="${services.trunk}/build.properties" />
+ <property name="mvn.opts" value="" />
+ <property name="src" location="src"/>
+
+ <condition property="osfamily-unix">
+ <os family="unix" />
+ </condition>
+ <condition property="osfamily-windows">
+ <os family="windows" />
+ </condition>
+
+ <target name="install" description="">
+ <exec executable="echo">
+ <arg value="Installer: Executing place Service's 'install' target." />
+ </exec>
+ <!-- Copy the Nuxeo DocType jar files to the Nuxeo app server domain -->
+ <copy todir="${jee.deploy.nuxeo.plugins}">
+ <fileset file="nuxeo/*.jar"/>
+ </copy>
+ </target>
+
+ <target name="config" description="" depends="install">
+ <exec executable="echo">
+ <arg value="Installer: Executing Place Service's 'config' target." />
+ </exec>
+ </target>
+
+ <target name="predeploy" description="" depends="config">
+ <exec executable="echo">
+ <arg value="Installer: Executing Place Service's 'predeploy' target." />
+ </exec>
+ </target>
+
+ <target name="deploy" description="">
+ <exec executable="echo">
+ <arg value="Installer: Executing Place Service's 'deploy' target." />
+ </exec>
+ </target>
+
+ <target name="postdeploy">
+ <exec executable="echo">
+ <arg value="Installer: Executing installer's 'postdeploy' target for the Place Service." />
+ </exec>
+ <exec executable="echo">
+ <arg value="Importing necessary placeauthorities." />
+ </exec>
+ <java jar="./postdeploy/collectionspace-services-place-importer-jar-with-dependencies.jar"
+ fork="true"
+ failonerror="true">
+ </java>
+ </target>
+
+
+</project>
--- /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>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place.jaxb</artifactId>
+ <name>services.place.jaxb</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <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>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-place-jaxb</finalName>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
--- /dev/null
+/**
+ *
+ */
+package org.collectionspace.services;
+import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
+
+/**
+ * @author pschmitz
+ *
+ */
+public interface PlaceJAXBSchema extends AuthorityItemJAXBSchema {
+ final static String PLACES_COMMON = "places_common";
+ final static String DISPLAY_NAME = "displayName";
+ final static String DISPLAY_NAME_COMPUTED = "displayNameComputed";
+ final static String SHORT_DISPLAY_NAME = "shortDisplayName";
+ final static String SHORT_DISPLAY_NAME_COMPUTED = "shortDisplayNameComputed";
+ final static String PLACE_NAME_GROUP_LIST = "placeNameGroupList";
+ final static String NAME = "name";
+ final static String NOTE = "note";
+ final static String SOURCE = "source";
+ final static String SOURCE_PAGE = "sourcePage";
+ final static String PLACE_TYPE = "placeType";
+}
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<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/place"
+ xmlns="http://collectionspace.org/services/place"
+ targetNamespace="http://collectionspace.org/services/place"
+ version="0.1"
+ >
+
+
+ <!-- avoid XmlRootElement nightnmare, see http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html-->
+ <!-- See http://wiki.collectionspace.org/display/collectionspace/Place+Service+Home -->
+
+ <!-- Place -->
+ <xs:element name="places_common">
+ <xs:complexType>
+ <xs:sequence>
+ <!-- Common identifier -->
+ <xs:element name="csid" type="xs:string" />
+
+ <!-- Place Information Group -->
+ <!-- inAuthority is the csid of the owning PlaceAuthority -->
+ <xs:element name="inAuthority" type="xs:string" />
+ <xs:element name="shortIdentifier" type="xs:string"/>
+ <xs:element name="refName" type="xs:string"/>
+ <xs:element name="termStatus" type="xs:string"/>
+ <xs:element name="displayName" type="xs:string"/>
+ <xs:element name="displayNameComputed" type="xs:boolean"/>
+ <xs:element name="shortDisplayName" type="xs:string"/>
+ <xs:element name="shortDisplayNameComputed" type="xs:boolean"/>
+ <xs:element name="placeType" type="xs:string" />
+ <xs:element name="placeRecordAdminStatus" type="xs:string" />
+ <xs:element name="placeIdentifier" type="xs:string" />
+ <xs:element name="placeNameGroupList" type="placeNameGroupList"/>
+ <xs:element name="placeOwnerGroupList" type="placeOwnerGroupList"/>
+ <xs:element name="note" type="xs:string"/>
+ <xs:element name="source" type="xs:string"/>
+ <xs:element name="sourcePage" type="xs:string"/>
+
+ <!-- Locality Information -->
+ <xs:element name="vCoordinates" type="xs:string"/>
+ <xs:element name="vLatitude" type="xs:string"/>
+ <xs:element name="vLongitude" type="xs:string"/>
+ <xs:element name="vCoordSys" type="xs:string"/>
+ <xs:element name="vSpatialReferenceSystem" type="xs:string"/>
+ <xs:element name="vCoordSource" type="xs:string"/>
+ <xs:element name="vCoordSourceRefId" type="xs:string"/>
+ <xs:element name="vUnitofMeasure" type="xs:string"/>
+ <xs:element name="vElevation" type="xs:string"/>
+ <xs:element name="minElevationInMeters" type="xs:decimal"/>
+ <xs:element name="maxElevationInMeters" type="xs:decimal"/>
+ <xs:element name="vDepth" type="xs:string"/>
+ <xs:element name="minDepthInMeters" type="xs:decimal"/>
+ <xs:element name="maxDepthInMeters" type="xs:decimal"/>
+ <xs:element name="vDistanceAboveSurface" type="xs:string"/>
+ <xs:element name="minDistanceAboveSurfaceInMeters" type="xs:decimal"/>
+ <xs:element name="maxDistanceAboveSurfaceInMeters" type="xs:decimal"/>
+
+ <xs:element name="placeGeoRefGroupList" type="placeGeoRefGroupList"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="placeNameGroupList">
+ <xs:sequence>
+ <xs:element name="placeNameGroup" type="placeNameGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="placeNameGroup">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="nameQualifiedName" type="xs:string"/>
+ <xs:element name="nameLanguage" type="xs:string"/>
+ <xs:element name="nameAbbrev" type="xs:string"/>
+ <xs:element name="nameType" type="xs:string"/>
+ <xs:element name="nameStatus" type="xs:string"/>
+ <xs:element name="nameSource" type="xs:string"/>
+ <xs:element name="nameSourceDetail" type="xs:string"/>
+ <xs:element name="nameSourceRefId" type="xs:string"/>
+ <xs:element name="nameNote" type="xs:string"/>
+ <xs:element name="nameDateGroup" type="structuredDateGroup"/>
+ <xs:element name="nameAdminStatus" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="placeOwnerGroupList">
+ <xs:sequence>
+ <xs:element name="placeOwnerGroup" type="placeOwnerGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="placeOwnerGroup">
+ <xs:sequence>
+ <xs:element name="owner" type="xs:string"/>
+ <xs:element name="ownershipDateGroup" type="structuredDateGroup"/>
+ <xs:element name="ownershipNote" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="placeGeoRefGroupList">
+ <xs:sequence>
+ <xs:element name="placeGeoRefGroup" type="placeGeoRefGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="placeGeoRefGroup">
+ <xs:sequence>
+ <xs:element name="decimalLatitude" type="xs:decimal"/>
+ <xs:element name="decimalLongitude" type="xs:decimal"/>
+ <xs:element name="geodeticDatum" type="xs:string"/>
+ <xs:element name="coordUncertaintyInMeters" type="xs:integer"/>
+ <xs:element name="coordPrecision" type="xs:string"/>
+ <xs:element name="pointRadiusSpatialFit" type="xs:string"/>
+ <xs:element name="footprintWKT" type="xs:string"/>
+ <xs:element name="footprintSRS" type="xs:string"/>
+ <xs:element name="footprintSpatialFit" type="xs:string"/>
+ <xs:element name="geoReferencedBy" type="xs:string"/>
+ <xs:element name="geoRefDateGroup" type="structuredDateGroup"/>
+ <xs:element name="geoRefProtocol" type="xs:string"/>
+ <xs:element name="geoRefSource" type="xs:string"/>
+ <xs:element name="geoRefVerificationStatus" type="xs:string"/>
+ <xs:element name="geoRefRemarks" type="xs:string"/>
+ <xs:element name="geoRefPlaceName" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <!-- IMPORTANT: This structuredDateGroup MUST MATCH EXACTLY structuredDateGroups in other services, for example collectionobject.
+ Use your favorite text editor to REPLICATE IN THOSE OTHER INSTANCES ANY CHANGES MADE HERE. -->
+ <xs:complexType name="structuredDateGroup">
+ <xs:sequence>
+ <xs:element name="dateDisplayDate" type="xs:string"/>
+ <xs:element name="dateAssociation" type="xs:string"/>
+ <xs:element name="dateEarliestSingleYear" type="xs:integer"/>
+ <xs:element name="dateEarliestSingleMonth" type="xs:integer"/>
+ <xs:element name="dateEarliestSingleDay" type="xs:integer"/>
+ <xs:element name="dateEarliestSingleEra" type="xs:string"/>
+ <xs:element name="dateEarliestSingleCertainty" type="xs:string"/>
+ <xs:element name="dateEarliestSingleQualifier" type="xs:string"/>
+ <xs:element name="dateEarliestSingleQualifierValue" type="xs:integer"/>
+ <xs:element name="dateEarliestSingleQualifierUnit" type="xs:string"/>
+ <xs:element name="dateLatestYear" type="xs:integer"/>
+ <xs:element name="dateLatestMonth" type="xs:integer"/>
+ <xs:element name="dateLatestDay" type="xs:integer"/>
+ <xs:element name="dateLatestEra" type="xs:string"/>
+ <xs:element name="dateLatestCertainty" type="xs:string"/>
+ <xs:element name="dateLatestQualifier" type="xs:string"/>
+ <xs:element name="dateLatestQualifierValue" type="xs:integer"/>
+ <xs:element name="dateLatestQualifierUnit" type="xs:string"/>
+ <xs:element name="datePeriod" type="xs:string"/>
+ <xs:element name="dateNote" type="xs:string"/>
+ <xs:element name="dateEarliestScalarValue" type="xs:date"/>
+ <xs:element name="dateLatestScalarValue" type="xs:date"/>
+ <xs:element name="scalarValuesComputed" type="xs:boolean"/>
+ </xs:sequence>
+ </xs:complexType>
+
+</xs:schema>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ PlaceAuthority schema (XSD)
+
+ Entity : PlaceAuthority
+ Part : Common
+ Used for: JAXB binding between XML and Java objects
+
+ $LastChangedRevision: 1055 $
+ $LastChangedDate: 2009-12-09 12:25:15 -0800 (Wed, 09 Dec 2009) $
+-->
+
+<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/place"
+ xmlns="http://collectionspace.org/services/place"
+ targetNamespace="http://collectionspace.org/services/place"
+ 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/Place+Service+Home -->
+
+ <!-- PlaceAuthority -->
+ <xs:element name="placeauthorities_common">
+ <xs:complexType>
+ <xs:sequence>
+ <!-- Common identifier -->
+ <xs:element name="csid" type="xs:string" />
+
+ <!-- PlaceAuthority Information Group -->
+ <xs:element name="displayName" type="xs:string"/>
+ <xs:element name="shortIdentifier" type="xs:string"/>
+ <xs:element name="refName" type="xs:string"/>
+ <xs:element name="vocabType" type="xs:string"/>
+ <xs:element name="source" type="xs:string"/>
+ <xs:element name="description" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
+
--- /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>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.main</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place</artifactId>
+ <name>services.place</name>
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <!-- <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.service</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>-->
+ </dependencies>
+
+ <modules>
+ <module>jaxb</module>
+ <module>service</module>
+ <module>3rdparty</module>
+ <module>client</module>
+ </modules>
+
+ <profiles>
+ <profile>
+ <id>samples</id>
+ <modules>
+ <!-- <module>sample</module> -->
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
+
--- /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>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place.service</artifactId>
+ <name>services.place.service</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+<!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.place.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.service</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- External dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.6</version>
+ </dependency>
+
+ <!-- apache -->
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <!-- javax -->
+
+
+ <dependency>
+ <groupId>javax.security</groupId>
+ <artifactId>jaas</artifactId>
+ <version>1.0.01</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- jboss -->
+
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>tjws</groupId>
+ <artifactId>webserver</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-multipart-provider</artifactId>
+ </dependency>
+
+ <!-- nuxeo -->
+
+ <dependency>
+ <groupId>org.nuxeo.ecm.core</groupId>
+ <artifactId>nuxeo-core-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-remoting</artifactId>
+ <groupId>jboss</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.restlet</groupId>
+ <artifactId>org.restlet</artifactId>
+ <version>1.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.noelios.restlet</groupId>
+ <artifactId>com.noelios.restlet.ext.httpclient</artifactId>
+ <version>1.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.noelios.restlet</groupId>
+ <artifactId>com.noelios.restlet</artifactId>
+ <version>1.0.7</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-place</finalName>
+ <plugins>
+ </plugins>
+ </build>
+</project>
+
--- /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.place;
+
+import org.collectionspace.services.client.PlaceAuthorityClient;
+import org.collectionspace.services.common.vocabulary.AuthorityResource;
+import org.collectionspace.services.place.nuxeo.PlaceDocumentModelHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+@Path(PlaceAuthorityClient.SERVICE_PATH)
+@Consumes("application/xml")
+@Produces("application/xml")
+public class PlaceAuthorityResource
+ extends AuthorityResource<PlaceauthoritiesCommon,
+ PlaceDocumentModelHandler> {
+
+ private final static String placeAuthorityServiceName = "placeauthorities";
+ private final static String PLACEAUTHORITIES_COMMON = "placeauthorities_common";
+
+ private final static String placeServiceName = "places";
+ private final static String PLACES_COMMON = "places_common";
+
+ final Logger logger = LoggerFactory.getLogger(PlaceAuthorityResource.class);
+
+ public PlaceAuthorityResource() {
+ super(PlaceauthoritiesCommon.class, PlaceAuthorityResource.class,
+ PLACEAUTHORITIES_COMMON, PLACES_COMMON);
+ }
+
+ @Override
+ public String getServiceName() {
+ return placeAuthorityServiceName;
+ }
+
+ public String getItemServiceName() {
+ return placeServiceName;
+ }
+
+ @Override
+ public Class<PlaceauthoritiesCommon> getCommonPartClass() {
+ return PlaceauthoritiesCommon.class;
+ }
+}
--- /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.place.nuxeo;
+
+/**
+ * PlaceAuthorityConstants processes CollectionObject document
+ *
+ */
+public class PlaceAuthorityConstants {
+
+ public final static String NUXEO_DOCTYPE = "PlaceAuthority";
+ public final static String NUXEO_SCHEMA_NAME = "placeauthority";
+ public final static String NUXEO_DC_TITLE = "CollectionSpace-PlaceAuthority";
+}
--- /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.place.nuxeo;
+
+import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler;
+import org.collectionspace.services.place.PlaceauthoritiesCommon;
+
+/**
+ * PlaceAuthorityDocumentModelHandler
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class PlaceAuthorityDocumentModelHandler
+ extends AuthorityDocumentModelHandler<PlaceauthoritiesCommon> {
+
+ /**
+ * Common part schema label
+ */
+ private static final String COMMON_PART_LABEL = "placeauthorities_common";
+
+ public PlaceAuthorityDocumentModelHandler() {
+ super(COMMON_PART_LABEL);
+ }
+
+ /**
+ * getQProperty converts the given property to qualified schema property
+ * @param prop
+ * @return
+ */
+ @Override
+ public String getQProperty(String prop) {
+ return PlaceAuthorityConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+ }
+}
+
--- /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.place.nuxeo;
+
+/**
+ * PlaceConstants processes CollectionObject document
+ *
+ */
+public class PlaceConstants {
+
+ public final static String NUXEO_DOCTYPE = "Place";
+ public final static String NUXEO_SCHEMA_NAME = "place";
+ public final static String NUXEO_DC_TITLE = "CollectionSpace-Place";
+}
--- /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.place.nuxeo;
+
+import org.collectionspace.services.PlaceJAXBSchema;
+import org.collectionspace.services.client.PlaceAuthorityClient;
+import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler;
+import org.collectionspace.services.place.PlacesCommon;
+import org.nuxeo.ecm.core.api.DocumentModel;
+
+/**
+ * PlaceDocumentModelHandler
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+/**
+ * @author pschmitz
+ *
+ */
+public class PlaceDocumentModelHandler
+ extends AuthorityItemDocumentModelHandler<PlacesCommon> {
+
+ /**
+ * Common part schema label
+ */
+ private static final String COMMON_PART_LABEL = "places_common";
+
+ public PlaceDocumentModelHandler() {
+ super(COMMON_PART_LABEL);
+ }
+
+ @Override
+ public String getAuthorityServicePath(){
+ return PlaceAuthorityClient.SERVICE_PATH_COMPONENT; // CSPACE-3932
+ }
+
+ /**
+ * Handle display name.
+ *
+ * @param docModel the doc model
+ * @throws Exception the exception
+ */
+ @Override
+ protected void handleComputedDisplayNames(DocumentModel docModel) throws Exception {
+ String commonPartLabel = getServiceContext().getCommonPartLabel("places");
+ Boolean displayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
+ PlaceJAXBSchema.DISPLAY_NAME_COMPUTED);
+ Boolean shortDisplayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
+ PlaceJAXBSchema.SHORT_DISPLAY_NAME_COMPUTED);
+ if(displayNameComputed==null)
+ displayNameComputed = true;
+ if(shortDisplayNameComputed==null)
+ shortDisplayNameComputed = true;
+ if (displayNameComputed || shortDisplayNameComputed) {
+ // Obtain the primary place name from the list of place names, for computing the display name.
+ String xpathToName = PlaceJAXBSchema.PLACE_NAME_GROUP_LIST
+ + "/[0]/" + PlaceJAXBSchema.NAME;
+ String name = getXPathStringValue(docModel, COMMON_PART_LABEL, xpathToName);
+ String displayName = prepareDefaultDisplayName(name);
+ if (displayNameComputed) {
+ docModel.setProperty(commonPartLabel, PlaceJAXBSchema.DISPLAY_NAME,
+ displayName);
+ }
+ if (shortDisplayNameComputed) {
+ docModel.setProperty(commonPartLabel, PlaceJAXBSchema.SHORT_DISPLAY_NAME,
+ displayName);
+ }
+ }
+ }
+
+ /**
+ * Produces a default displayName from one or more supplied fields.
+ * @see PlaceAuthorityClientUtils.prepareDefaultDisplayName() which
+ * duplicates this logic, until we define a service-general utils package
+ * that is neither client nor service specific.
+ * @param name
+ * @return the default display name
+ * @throws Exception
+ */
+ private static String prepareDefaultDisplayName(
+ String name ) throws Exception {
+ StringBuilder newStr = new StringBuilder();
+ newStr.append(name);
+ return newStr.toString();
+ }
+
+ /**
+ * getQProperty converts the given property to qualified schema property
+ * @param prop
+ * @return
+ */
+ @Override
+ public String getQProperty(String prop) {
+ return PlaceConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+ }
+}
+
--- /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.
+ *//**
+ * 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.
+ */
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.collectionspace.services.place.nuxeo;
+
+import java.util.regex.Pattern;
+
+import org.collectionspace.services.place.PlacesCommon;
+import org.collectionspace.services.common.context.MultipartServiceContext;
+import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.DocumentHandler.Action;
+import org.collectionspace.services.common.document.InvalidDocumentException;
+import org.collectionspace.services.common.document.ValidatorHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author
+ */
+public class PlaceValidatorHandler implements ValidatorHandler {
+
+ final Logger logger = LoggerFactory.getLogger(PlaceValidatorHandler.class);
+ private static final Pattern shortIdBadPattern = Pattern.compile("[\\W]"); //.matcher(input).matches()
+
+ @Override
+ public void validate(Action action, ServiceContext ctx)
+ throws InvalidDocumentException {
+ if(logger.isDebugEnabled()) {
+ logger.debug("validate() action=" + action.name());
+ }
+ try {
+ MultipartServiceContext mctx = (MultipartServiceContext) ctx;
+ PlacesCommon place = (PlacesCommon) mctx.getInputPart(mctx.getCommonPartLabel(),
+ PlacesCommon.class);
+ String msg = "";
+ boolean invalid = false;
+
+ // Validation occurring on both creates and updates
+ String displayName = place.getDisplayName();
+ if (!place.isDisplayNameComputed() && ((displayName == null) || displayName.trim().isEmpty())) {
+ invalid = true;
+ msg += "displayName must be non-null and non-blank if displayNameComputed is false";
+ }
+
+ // Validation specific to creates or updates
+ if (action.equals(Action.CREATE)) {
+ String shortId = place.getShortIdentifier();
+ // Per CSPACE-2215, shortIdentifier values that are null (missing)
+ // oe the empty string are now legally accepted in create payloads.
+ // In either of those cases, a short identifier will be synthesized from
+ // a display name or supplied in another manner.
+ if ((shortId != null) && (shortIdBadPattern.matcher(shortId).find())) {
+ invalid = true;
+ msg += "shortIdentifier must only contain standard word characters";
+ }
+ } else if (action.equals(Action.UPDATE)) {
+ }
+
+ if (invalid) {
+ logger.error(msg);
+ throw new InvalidDocumentException(msg);
+ }
+ } catch (InvalidDocumentException ide) {
+ throw ide;
+ } catch (Exception e) {
+ throw new InvalidDocumentException(e);
+ }
+ }
+}