From 89827c6fc2001e7039a08d640edab07fb70ff367 Mon Sep 17 00:00:00 2001 From: Patrick Schmitz Date: Tue, 5 Jan 2010 19:47:02 +0000 Subject: [PATCH] CSPACE-149. Added Organization services to system and build scripts. Fixed a few typos that broke 1 test. Organization service is working. --- services/JaxRsServiceProvider/pom.xml | 12 ++++ .../CollectionSpaceJaxRsApplication.java | 2 + .../.settings/org.maven.ide.eclipse.prefs | 3 +- .../.settings/org.maven.ide.eclipse.prefs | 3 +- services/build.xml | 8 ++- .../src/main/config/tenant-bindings.xml | 59 +++++++++++++++++++ .../.settings/org.eclipse.jdt.core.prefs | 8 +-- .../resources/OSGI-INF/core-types-contrib.xml | 2 +- .../resources/OSGI-INF/ecm-types-contrib.xml | 6 +- .../client/test/OrgAuthorityServiceTest.java | 23 +++++--- .../importer/OrgAuthorityBaseImport.java | 4 +- .../organization/OrgAuthorityResource.java | 6 +- .../OrganizationDocumentModelHandler.java | 14 ++--- services/pom.xml | 1 + .../sdk/.settings/org.maven.ide.eclipse.prefs | 3 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- 16 files changed, 121 insertions(+), 35 deletions(-) diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index c702b73e3..6e2c4d674 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -62,6 +62,18 @@ org.collectionspace.services.vocabulary.service 1.0 + + org.collectionspace.services + org.collectionspace.services.organization.service + 1.0 + + org.collectionspace.services org.collectionspace.services.relation.service diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java index f84d7d666..ed27f6015 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java @@ -33,6 +33,7 @@ import org.collectionspace.services.dimension.DimensionResource; import org.collectionspace.services.contact.ContactResource; import org.collectionspace.services.vocabulary.VocabularyResource; +import org.collectionspace.services.organization.OrgAuthorityResource; //import org.collectionspace.services.query.QueryResource; @@ -62,6 +63,7 @@ public class CollectionSpaceJaxRsApplication extends Application { singletons.add(new AcquisitionResource()); singletons.add(new NewRelationResource()); singletons.add(new VocabularyResource()); + singletons.add(new OrgAuthorityResource()); singletons.add(new DimensionResource()); singletons.add(new ContactResource()); diff --git a/services/authentication/client/.settings/org.maven.ide.eclipse.prefs b/services/authentication/client/.settings/org.maven.ide.eclipse.prefs index 676ea4d99..84b63f1b8 100644 --- a/services/authentication/client/.settings/org.maven.ide.eclipse.prefs +++ b/services/authentication/client/.settings/org.maven.ide.eclipse.prefs @@ -1,8 +1,9 @@ -#Sun Aug 09 21:43:48 PDT 2009 +#Mon Jan 04 16:40:34 PST 2010 activeProfiles= eclipse.preferences.version=1 fullBuildGoals=process-test-resources includeModules=false resolveWorkspaceProjects=true resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true version=1 diff --git a/services/authentication/service/.settings/org.maven.ide.eclipse.prefs b/services/authentication/service/.settings/org.maven.ide.eclipse.prefs index 676ea4d99..84b63f1b8 100644 --- a/services/authentication/service/.settings/org.maven.ide.eclipse.prefs +++ b/services/authentication/service/.settings/org.maven.ide.eclipse.prefs @@ -1,8 +1,9 @@ -#Sun Aug 09 21:43:48 PDT 2009 +#Mon Jan 04 16:40:34 PST 2010 activeProfiles= eclipse.preferences.version=1 fullBuildGoals=process-test-resources includeModules=false resolveWorkspaceProjects=true resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true version=1 diff --git a/services/build.xml b/services/build.xml index c47b1d33a..40a7dfe5c 100644 --- a/services/build.xml +++ b/services/build.xml @@ -148,6 +148,7 @@ + @@ -159,8 +160,9 @@ description="undeploy services from ${jboss.server.cspace}"> - - + + + @@ -185,6 +187,7 @@ + + + + + nuxeo-java + + + + + + + + + + + + + + + + + + + nuxeo-java + + + + + + + + + + + + + + + + nuxeo-java diff --git a/services/organization/3rdparty/nuxeo-platform-cs-organization/.settings/org.eclipse.jdt.core.prefs b/services/organization/3rdparty/nuxeo-platform-cs-organization/.settings/org.eclipse.jdt.core.prefs index 82d33d354..8c32cc875 100644 --- a/services/organization/3rdparty/nuxeo-platform-cs-organization/.settings/org.eclipse.jdt.core.prefs +++ b/services/organization/3rdparty/nuxeo-platform-cs-organization/.settings/org.eclipse.jdt.core.prefs @@ -1,5 +1,5 @@ -#Tue Oct 06 13:26:44 PDT 2009 +#Mon Jan 04 16:43:20 PST 2010 eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/core-types-contrib.xml b/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/core-types-contrib.xml index 7e1f0fec5..43059a21f 100644 --- a/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/core-types-contrib.xml +++ b/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/core-types-contrib.xml @@ -7,7 +7,7 @@ - + diff --git a/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/ecm-types-contrib.xml b/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/ecm-types-contrib.xml index c29c8f898..e96ec8d3b 100644 --- a/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/ecm-types-contrib.xml +++ b/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/ecm-types-contrib.xml @@ -1,7 +1,7 @@ - + view_documents @@ -14,13 +14,13 @@ - OrgAuthority + Orgauthority - OrgAuthority + Orgauthority diff --git a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java index d5f8dad96..8241900d2 100644 --- a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java +++ b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java @@ -131,15 +131,15 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest { public void createItem(String testName) { setupCreate(testName); - knownItemResourceId = createItemInOrgAuthority(knownResourceId); + knownItemResourceId = createItemInAuthority(knownResourceId); if(logger.isDebugEnabled()){ logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId); } } - private String createItemInOrgAuthority(String vcsid) { + private String createItemInAuthority(String vcsid) { - final String testName = "createItemInOrgAuthority"; + final String testName = "createItemInAuthority"; if(logger.isDebugEnabled()){ logger.debug(testName + ":..."); } @@ -147,7 +147,9 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest { // Submit the request to the service and store the response. String identifier = createIdentifier(); String refName = createRefName(identifier); - MultipartOutput multipart = createOrganizationInstance(vcsid, identifier, refName); + MultipartOutput multipart = createOrganizationInstance(vcsid, + identifier, refName, "Longer Name for "+identifier, + "This is a fake organization that was created by a test method."); ClientResponse res = client.createItem(vcsid, multipart); int statusCode = res.getStatus(); @@ -781,7 +783,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest { // The only relevant ID may be the one used in update(), below. MultipartOutput multipart = createOrganizationInstance( - knownResourceId, NON_EXISTENT_ID, createRefName(NON_EXISTENT_ID)); + knownResourceId, NON_EXISTENT_ID, createRefName(NON_EXISTENT_ID), + null, null); ClientResponse res = client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart); int statusCode = res.getStatus(); @@ -951,7 +954,6 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest { */ @AfterClass(alwaysRun=true) public void cleanUp() { - if (logger.isDebugEnabled()) { logger.debug("Cleaning up temporary resources created for testing ..."); } @@ -970,7 +972,6 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest { // Note: Any non-success responses are ignored and not reported. ClientResponse res = client.delete(resourceId); } - } // --------------------------------------------------------------- @@ -1036,12 +1037,16 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest { return multipart; } - private MultipartOutput createOrganizationInstance(String inOrgAuthority, - String displayName, String refName) { + private MultipartOutput createOrganizationInstance(String inAuthority, + String displayName, String refName, String longName, String description) { OrganizationsCommon organization = new OrganizationsCommon(); organization.setDisplayName(displayName); if(refName!=null) organization.setRefName(refName); + if(longName!=null) + organization.setLongName(longName); + if(description!=null) + organization.setDescription(description); MultipartOutput multipart = new MultipartOutput(); OutputPart commonPart = multipart.addPart(organization, MediaType.APPLICATION_XML_TYPE); diff --git a/services/organization/import/src/main/java/org/collectionspace/services/organization/importer/OrgAuthorityBaseImport.java b/services/organization/import/src/main/java/org/collectionspace/services/organization/importer/OrgAuthorityBaseImport.java index f01658c2c..c4d124c6d 100644 --- a/services/organization/import/src/main/java/org/collectionspace/services/organization/importer/OrgAuthorityBaseImport.java +++ b/services/organization/import/src/main/java/org/collectionspace/services/organization/importer/OrgAuthorityBaseImport.java @@ -91,11 +91,11 @@ public class OrgAuthorityBaseImport { +newOrgAuthorityId ); } for(String itemName : enumValues){ - createItemInOrgAuthority(newOrgAuthorityId, orgAuthorityName, itemName, createRefName(itemName)); + createItemInAuthority(newOrgAuthorityId, orgAuthorityName, itemName, createRefName(itemName)); } } - private String createItemInOrgAuthority(String vcsid, String orgAuthorityName, String itemName, String refName) { + private String createItemInAuthority(String vcsid, String orgAuthorityName, String itemName, String refName) { // Expected status code: 201 Created int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode(); // Type of service request being tested diff --git a/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java b/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java index 4f8ddb8a7..053854bae 100644 --- a/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java +++ b/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java @@ -104,11 +104,11 @@ public class OrgAuthorityResource extends AbstractCollectionSpaceResource { private DocumentHandler createItemDocumentHandler( ServiceContext ctx, - String inOrgAuthority) throws Exception { + String inAuthority) throws Exception { DocumentHandler docHandler = OrganizationHandlerFactory.getInstance().getHandler( ctx.getRepositoryClientType().toString()); docHandler.setServiceContext(ctx); - ((OrganizationDocumentModelHandler) docHandler).setInOrgAuthority(inOrgAuthority); + ((OrganizationDocumentModelHandler) docHandler).setInAuthority(inAuthority); if (ctx.getInput() != null) { Object obj = ((MultipartServiceContext) ctx).getInputPart(ctx.getCommonPartLabel(getItemServiceName()), OrganizationsCommon.class); @@ -406,7 +406,7 @@ public class OrgAuthorityResource extends AbstractCollectionSpaceResource { DocumentFilter myFilter = DocumentFilter.CreatePaginatedDocumentFilter(queryParams); myFilter.setWhereClause( - "organizations_common:inOrgAuthority='" + parentcsid + "'"); + "organizations_common:inAuthority='" + parentcsid + "'"); handler.setDocumentFilter(myFilter); getRepositoryClient(ctx).getFiltered(ctx, handler); organizationObjectList = (OrganizationsCommonList) handler.getCommonPartList(); diff --git a/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java b/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java index 4276f4317..10937af34 100644 --- a/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java +++ b/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java @@ -60,16 +60,16 @@ public class OrganizationDocumentModelHandler private OrganizationsCommonList organizationList; /** - * inOrgAuthority is the parent OrgAuthority for this context + * inAuthority is the parent OrgAuthority for this context */ - private String inOrgAuthority; + private String inAuthority; - public String getInOrgAuthority() { - return inOrgAuthority; + public String getInAuthority() { + return inAuthority; } - public void setInOrgAuthority(String inOrgAuthority) { - this.inOrgAuthority = inOrgAuthority; + public void setInAuthority(String inAuthority) { + this.inAuthority = inAuthority; } @Override @@ -152,7 +152,7 @@ public class OrganizationDocumentModelHandler OrganizationJAXBSchema.DESCRIPTION)); */ String id = NuxeoUtils.extractId(docModel.getPathAsString()); - ilistItem.setUri("/organizations/"+inOrgAuthority+"/items/" + id); + ilistItem.setUri("/organizations/"+inAuthority+"/items/" + id); ilistItem.setCsid(id); list.add(ilistItem); } diff --git a/services/pom.xml b/services/pom.xml index 5455df1c4..3f92548a5 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -21,6 +21,7 @@ acquisition vocabulary + organization id collectionobject intake diff --git a/services/sdk/.settings/org.maven.ide.eclipse.prefs b/services/sdk/.settings/org.maven.ide.eclipse.prefs index b8a9fb600..b78ecd731 100644 --- a/services/sdk/.settings/org.maven.ide.eclipse.prefs +++ b/services/sdk/.settings/org.maven.ide.eclipse.prefs @@ -1,8 +1,9 @@ -#Thu Sep 17 14:30:08 PDT 2009 +#Mon Jan 04 16:40:40 PST 2010 activeProfiles= eclipse.preferences.version=1 fullBuildGoals=process-test-resources includeModules=false resolveWorkspaceProjects=true resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true version=1 diff --git a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.settings/org.eclipse.jdt.core.prefs b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.settings/org.eclipse.jdt.core.prefs index 2c883044b..97fa77c87 100644 --- a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.settings/org.eclipse.jdt.core.prefs +++ b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,4 @@ -#Tue Oct 06 13:26:44 PDT 2009 +#Mon Jan 04 16:43:17 PST 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 -- 2.47.3