From: remillet Date: Wed, 31 Jan 2018 04:35:28 +0000 (-0800) Subject: DRYD-205: Added service for parsing display date strings into structured date strings... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=78e23f4f642a77db63006ead17bebe1745d09f06;p=tmp%2Fjakarta-migration.git DRYD-205: Added service for parsing display date strings into structured date strings. Use 'dateToParse' query param at /csace-services/structureddates GET a structured date. --- diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/structureddate/responses/GetStructuredDate-Both-Template.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/structureddate/responses/GetStructuredDate-Both-Template.res.xml new file mode 100644 index 000000000..9feb343f4 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/structureddate/responses/GetStructuredDate-Both-Template.res.xml @@ -0,0 +1,16 @@ + + + + ${earliestYear} + ${earliestMonth} + ${earliestDay} + urn:cspace:testsci.collectionspace.org:vocabularies:name(dateera):item:name(${earliestEraShortId})'${earliestEraShortDisplayName}' + + + ${latestYear} + ${latestMonth} + ${latestDay} + urn:cspace:testsci.collectionspace.org:vocabularies:name(dateera):item:name(${latestEraShortId})'${latestEraShortDisplayName}' + + false + \ No newline at end of file diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/structureddate/responses/GetStructuredDate-earliestSingleDate-Template.res.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/structureddate/responses/GetStructuredDate-earliestSingleDate-Template.res.xml new file mode 100644 index 000000000..dc643936c --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/structureddate/responses/GetStructuredDate-earliestSingleDate-Template.res.xml @@ -0,0 +1,10 @@ + + + + ${earliestYear} + ${earliestMonth} + ${earliestDay} + urn:cspace:testsci.collectionspace.org:vocabularies:name(dateera):item:name(${earliestEraShortId})'${earliestEraShortDisplayName}' + + false + \ No newline at end of file diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/structureddate/structureddate.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/structureddate/structureddate.xml new file mode 100644 index 000000000..c1ee0a0cf --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/structureddate/structureddate.xml @@ -0,0 +1,450 @@ + + + + + YWRtaW5AdGVzdHNjaS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + + + + + 400 + GET + /cspace-services/structureddates/?dateToParse= + + + 400 + GET + /cspace-services/structureddates/?dateToParse=Octo+19,+1821 + + + GET + /cspace-services/structureddates/?dateToParse=1977 + + + + 1977 + 1 + 1 + ce + CE + + 1977 + 12 + 31 + ce + CE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=53+BC + + + + 53 + 1 + 1 + bce + BCE + + 53 + 12 + 31 + bce + BCE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=53+bc + + + + 53 + 1 + 1 + bce + BCE + + 53 + 12 + 31 + bce + BCE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=53+B.C. + + + + 53 + 1 + 1 + bce + BCE + + 53 + 12 + 31 + bce + BCE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=53+b.c. + + + + 53 + 1 + 1 + bce + BCE + + 53 + 12 + 31 + bce + BCE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=53+BCE + + + + 53 + 1 + 1 + bce + BCE + + 53 + 12 + 31 + bce + BCE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=53+bce + + + + 53 + 1 + 1 + bce + BCE + + 53 + 12 + 31 + bce + BCE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=53+B.C.E. + + + + 53 + 1 + 1 + bce + BCE + + 53 + 12 + 31 + bce + BCE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=53+b.c.e. + + + + 53 + 1 + 1 + bce + BCE + + 53 + 12 + 31 + bce + BCE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + + + GET + /cspace-services/structureddates/?dateToParse=1974+A.D. + + + + 1974 + 1 + 1 + ce + CE + + 1974 + 12 + 31 + ce + CE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=1974+a.d. + + + + 1974 + 1 + 1 + ce + CE + + 1974 + 12 + 31 + ce + CE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=1974+c.e. + + + + 1974 + 1 + 1 + ce + CE + + 1974 + 12 + 31 + ce + CE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=1974+ce + + + + 1974 + 1 + 1 + ce + CE + + 1974 + 12 + 31 + ce + CE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=1800%27s-1900%27s + + + + 1800 + 1 + 1 + ce + CE + + 1999 + 12 + 31 + ce + CE + + + structureddate/responses/GetStructuredDate-Both-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=ca.+1730%27s + + + + 1711 + 1 + 1 + ce + CE + + 1757 + 12 + 31 + ce + CE + + + structureddate/responses/GetStructuredDate-earliestSingleDate-Template.res.xml + + + + + GET + /cspace-services/structureddates/?dateToParse=3%2F12%2F2013 + + + + 2013 + 3 + 12 + ce + CE + + + structureddate/responses/GetStructuredDate-earliestSingleDate-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=7-6-1773 + + + + 1773 + 7 + 6 + ce + CE + + + structureddate/responses/GetStructuredDate-earliestSingleDate-Template.res.xml + + + + GET + /cspace-services/structureddates/?dateToParse=07-06-1773 + + + + 1773 + 7 + 6 + ce + CE + + + structureddate/responses/GetStructuredDate-earliestSingleDate-Template.res.xml + + + + diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index 76070e3e5..898791f52 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -290,6 +290,11 @@ ${project.version} + org.collectionspace.services + org.collectionspace.services.structureddate.service + ${project.version} + + org.collectionspace.services org.collectionspace.services.media.service ${project.version} 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 8fcb91877..5523e8a11 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 @@ -49,6 +49,7 @@ import org.collectionspace.services.report.ReportResource; import org.collectionspace.services.acquisition.AcquisitionResource; import org.collectionspace.services.dimension.DimensionResource; import org.collectionspace.services.servicegroup.ServiceGroupResource; +import org.collectionspace.services.structureddate.StructuredDateResource; import org.collectionspace.services.contact.ContactResource; import org.collectionspace.services.vocabulary.VocabularyResource; import org.collectionspace.services.organization.OrgAuthorityResource; @@ -106,6 +107,7 @@ public class CollectionSpaceJaxRsApplication extends Application singletons.add(new PermissionResource()); singletons.add(new ServiceGroupResource()); singletons.add(new ImportsResource()); + singletons.add(new StructuredDateResource()); addResourceToMapAndSingletons(new VocabularyResource()); addResourceToMapAndSingletons(new PersonAuthorityResource()); diff --git a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml index 7d759a1d9..706cf5b4c 100644 --- a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml +++ b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml @@ -160,13 +160,24 @@ - + default-domain - org.collectionspace.services.servicegroup.nuxeo.ServiceGroupDocumentModelHandler + + org.collectionspace.services.servicegroup.nuxeo.ServiceGroupDocumentModelHandler + + + + + default-domain + + org.collectionspace.services.structureddate.StructureddateDocumentHandler + + + diff --git a/services/common/src/main/cspace/config/services/tenants/tenant-bindings.touchstone.xml b/services/common/src/main/cspace/config/services/tenants/tenant-bindings.touchstone.xml deleted file mode 100644 index d585c8ca9..000000000 --- a/services/common/src/main/cspace/config/services/tenants/tenant-bindings.touchstone.xml +++ /dev/null @@ -1,2748 +0,0 @@ - - - - - - - datePattern - MM/dd/yyyy - - - datePattern - MMM dd, yyyy - - - datePattern - dd.MM.yyyy - - - localeLanguage - en - - - - org.collectionspace.services.account.storage.AccountDocumentHandler - - - - - personRefName - personRefName - - - status - status - - - email - email - - - screenName - screenName - - - - - org.collectionspace.services.account.storage.AccountValidatorHandler - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.person.nuxeo.PersonDocumentModelHandler - - - true - - - shortIdentifier - shortIdentifier - - - surName - personTermGroupList/[0]/surName - - - foreName - personTermGroupList/[0]/foreName - - - entityType - persons_naturalhistory - entityType - - - - - org.collectionspace.services.person.nuxeo.PersonValidatorHandler - - org.collectionspace.services.common.init.AddIndices - - - persons_common - shortidentifier - - - persontermgroup - termdisplayname - - - persons_common - inauthority - - - - - - objectNameProperty - personTermGroupList/[0]/termDisplayName - - - objectNumberProperty - shortIdentifier - - - - - - - - - - - - - - - authRef - birthPlace - - - authRef - deathPlace - - - termRef - personTermGroupList/*/termType - - - - - - - - - - - - - - - - authRef - affiliatedPersonOrgGroupList/*/affiliatedPersonOrg - - - authRef - orgContactNames|orgContactName - - - termRef - affiliatedPersonOrgGroupList/*/affiliatedPersonOrgType - - - termRef - nameTypes|nameType - - - termRef - nameSource - - - termRef - entityType - - - - - - - default-domain - org.collectionspace.services.person.nuxeo.PersonAuthorityDocumentModelHandler - - - - - shortIdentifier - shortIdentifier - - - displayName - displayName - - - vocabType - vocabType - - - - - org.collectionspace.services.person.nuxeo.PersonAuthorityValidatorHandler - - org.collectionspace.services.common.init.AddIndices - - - personauthorities_common - shortidentifier - - - personauthorities_common - displayname - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.concept.nuxeo.ConceptDocumentModelHandler - - - true - - - - - org.collectionspace.services.concept.nuxeo.ConceptValidatorHandler - - org.collectionspace.services.common.init.AddIndices - - - concepttermgroup - termdisplayname - - - concepts_common - shortidentifier - - - concepts_common - inauthority - - - - - - objectNameProperty - conceptTermGroupList/[0]/termDisplayName - - - objectNumberProperty - shortIdentifier - - - - - - - - - - - - - - - termRef - conceptTermGroupList/*/termLanguage - - - - - - - - - - - - default-domain - org.collectionspace.services.concept.nuxeo.ConceptAuthorityDocumentModelHandler - - - - - shortIdentifier - shortIdentifier - - - displayName - displayName - - - vocabType - vocabType - - - - - - org.collectionspace.services.common.init.AddIndices - - - conceptauthorities_common - shortidentifier - - - conceptauthorities_common - displayname - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.location.nuxeo.LocationDocumentModelHandler - - - true - - - - - org.collectionspace.services.location.nuxeo.LocationValidatorHandler - - org.collectionspace.services.common.init.AddIndices - - - loctermgroup - termdisplayname - - - locations_common - shortidentifier - - - locations_common - inauthority - - - - - - objectNameProperty - locTermGroupList/[0]/termDisplayName - - - objectNumberProperty - shortIdentifier - - - - - - - - - - - - - - - termRef - locTermGroupList/*/termLanguage - - - termRef - locationType - - - - - - - - - - - - default-domain - org.collectionspace.services.location.nuxeo.LocationAuthorityDocumentModelHandler - - - - - shortIdentifier - shortIdentifier - - - displayName - displayName - - - vocabType - vocabType - - - - - - org.collectionspace.services.common.init.AddIndices - - - locationauthorities_common - shortidentifier - - - locationauthorities_common - displayname - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.loanin.nuxeo.LoaninDocumentModelHandler - - - - - loanInNumber - loanInNumber - - - loanReturnDate - loanReturnDate - - - lender - lenderGroupList/[0]/lender - - - - - org.collectionspace.services.loanin.nuxeo.LoaninValidatorHandler - - - objectNameProperty - lenderGroupList/[0]/lender - - - objectNumberProperty - loanInNumber - - - - - - - - - - - - - - - authRef - lenderGroupList/*/lendersContact - - - authRef - lenderGroupList/*/lendersAuthorizer - - - authRef - borrowersAuthorizer - - - termRef - loanStatusGroupList/*/loanStatus - - - authRef - borrowersContact - - - authRef - lenderGroupList/*/lender - - - termRef - loanPurpose - - - - - - - - - - - - default-domain - org.collectionspace.services.loanout.nuxeo.LoanoutDocumentModelHandler - - - - - borrower - borrower - - - loanOutNumber - loanOutNumber - - - loanReturnDate - loanReturnDate - - - - - org.collectionspace.services.loanout.nuxeo.LoanoutValidatorHandler - - - objectNameProperty - borrower - - - objectNumberProperty - loanOutNumber - - - - - - - - - - - - - - - authRef - borrower - - - authRef - lendersContact - - - authRef - lendersAuthorizer - - - authRef - borrowersAuthorizer - - - termRef - loanStatusGroupList/*/loanStatus - - - authRef - borrowersContact - - - termRef - loanPurpose - - - - - - - - - - - - default-domain - org.collectionspace.services.acquisition.nuxeo.AcquisitionDocumentModelHandler - - - - - acquisitionReferenceNumber - acquisitionReferenceNumber - - - acquisitionSource - acquisitionSources/[0] - - - owner - owners/[0] - - - - - org.collectionspace.services.acquisition.nuxeo.AcquisitionValidatorHandler - - - objectNameProperty - acquisitionSources/[0] - - - objectNumberProperty - acquisitionReferenceNumber - - - - - - - - - - - - - - - termRef - objectOfferPriceCurrency - - - authRef - acquisitionFundingList/*/acquisitionFundingSource - - - termRef - groupPurchasePriceCurrency - - - termRef - objectPurchasePriceCurrency - - - termRef - acquisitionFundingList/*/acquisitionFundingCurrency - - - termRef - originalObjectPurchasePriceCurrency - - - authRef - acquisitionSources|acquisitionSource - - - authRef - owners|owner - - - termRef - objectPurchaseOfferPriceCurrency - - - authRef - acquisitionAuthorizer - - - termRef - acquisitionMethod - - - - - - - - - - - - default-domain - org.collectionspace.services.organization.nuxeo.OrganizationDocumentModelHandler - - - true - - - - - org.collectionspace.services.organization.nuxeo.OrganizationValidatorHandler - - org.collectionspace.services.common.init.AddIndices - - - organizations_common - shortidentifier - - - organizations_common - inauthority - - - orgtermgroup - termdisplayname - - - - - - objectNameProperty - orgTermGroupList/[0]/termDisplayName - - - objectNumberProperty - shortIdentifier - - - - - - - - - - - - - - - authRef - contactNames|contactName - - - termRef - orgTermGroupList/*/termLanguage - - - authRef - foundingPlace - - - termRef - orgTermGroupList/*/termType - - - termRef - orgTermGroupList/*/termStatus - - - - - - - - - - - - default-domain - org.collectionspace.services.organization.nuxeo.OrgAuthorityDocumentModelHandler - - - - - shortIdentifier - shortIdentifier - - - displayName - displayName - - - vocabType - vocabType - - - - - org.collectionspace.services.organization.nuxeo.OrgAuthorityValidatorHandler - - org.collectionspace.services.common.init.AddIndices - - - orgauthorities_common - shortidentifier - - - orgauthorities_common - displayname - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.collectionobject.nuxeo.CollectionObjectDocumentModelHandler - - - true - - objectNumber - objectNumber - - - - title - titleGroupList/[0]/title - - - objectNumber - objectNumber - - - objectName - objectNameList/[0]/objectName - - - responsibleDepartment - responsibleDepartments/[0] - - - taxon - collectionobjects_naturalhistory - taxonomicIdentGroupList/[0]/taxon - - - - - org.collectionspace.services.collectionobject.nuxeo.CollectionObjectValidatorHandler - - - - - objectNameProperty - objectNameList/[0]/objectName - - - objectNumberProperty - objectNumber - - - - - - - - - - - - - - - authRef - assocEventPersons|assocEventPerson - - - authRef - textualInscriptionGroupList/*/inscriptionContentInscriber - - - termRef - fieldCollectionMethods|fieldCollectionMethod - - - termRef - ownershipExchangePriceCurrency - - - authRef - contentOrganizations|contentOrganization - - - authRef - objectProductionPersonGroupList/*/objectProductionPerson - - - authRef - fieldCollectors|fieldCollector - - - termRef - contentLanguages|contentLanguage - - - authRef - contentConcepts|contentConcept - - - authRef - assocOrganizationGroupList/*/assocOrganization - - - authRef - nonTextualInscriptionGroupList/*/inscriptionDescriptionInscriber - - - termRef - textualInscriptionGroupList/*/inscriptionContentLanguage - - - authRef - measuredPartGroupList/*/dimensionSubGroupList/*/measuredBy - - - authRef - contentPersons|contentPerson - - - authRef - objectProductionOrganizationGroupList/*/objectProductionOrganization - - - authRef - assocPersonGroupList/*/assocPerson - - - termRef - objectNameList/*/objectNameLanguage - - - authRef - assocEventOrganizations|assocEventOrganization - - - termRef - ageQualifier - - - authRef - fieldCollectionPlace - - - authRef - assocConceptGroupList/*/assocConcept - - - authRef - fieldCollectionSources|fieldCollectionSource - - - authRef - owners|owner - - - termRef - titleGroupList/*/titleLanguage - - - termRef - titleGroupList/*/titleTranslationSubGroupList/*/titleTranslationLanguage - - - authRef - computedCurrentLocation - - - authRef - contentActivities|contentActivity - - - authRef - contentEventNameGroupList/*/contentEventNameType - - - authRef - contentOtherGroupList/*/contentOther - - - authRef - contentOtherGroupList/*/contentOtherType - - - authRef - contentPlaces|contentPlace - - - authRef - nonTextualInscriptionGroupList/*/inscriptionDescriptionMethod - - - authRef - materialGroupList/*/material - - - authRef - materialGroupList/*/materialComponent - - - authRef - materialGroupList/*/materialSource - - - authRef - styles|style - - - authRef - objectComponentGroupList/*/objectComponentName - - - - authRef - objectProductionPlaceGroupList/*/objectProductionPlace - - - authRef - techniqueGroupList/*/technique - - - authRef - techniqueGroupList/*/techniqueType - - - authRef - assocPlaceGroupList/*/assocPlace - - - termRef - otherNumberList/*/numberType - - - termRef - objectNameList/*/objectNameCurrency - - - termRef - objectNameList/*/objectNameLevel - - - termRef - objectNameList/*/objectNameSystem - - - termRef - objectNameList/*/objectNameType - - - termRef - responsibleDepartments|responsibleDepartment - - - termRef - collection - - - termRef - titleGroupList/*/titleType - - - termRef - recordStatus - - - - termRef - ageUnit - - - termRef - contentObjectGroupList/*/contentObjectType - - - termRef - contentPositions|contentPosition - - - termRef - contentScripts|contentScript - - - termRef - measuredPartGroupList/*/measuredPart - - - termRef - measuredPartGroupList/*/dimensionSubGroupList/*/dimension - - - termRef - measuredPartGroupList/*/dimensionSubGroupList/*/measurementUnit - - - termRef - measuredPartGroupList/*/dimensionSubGroupList/*/measurementMethod - - - termRef - forms|form - - - termRef - textualInscriptionGroupList/*/inscriptionContentPosition - - - termRef - textualInscriptionGroupList/*/inscriptionContentScript - - - termRef - textualInscriptionGroupList/*/inscriptionContentType - - - termRef - nonTextualInscriptionGroupList/*/inscriptionDescriptionPosition - - - termRef - nonTextualInscriptionGroupList/*/inscriptionDescriptionType - - - termRef - objectStatusList|objectStatus - - - termRef - phase - - - termRef - sex - - - termRef - technicalAttributeGroupList/*/technicalAttribute - - - termRef - technicalAttributeGroupList/*/technicalAttributeMeasurement - - - termRef - technicalAttributeGroupList/*/technicalAttributeMeasurementUnit - - - termRef - objectComponentGroupList/*/objectComponentInformation - - - termRef - assocActivityGroupList/*/assocActivity - - - termRef - assocCulturalContextGroupList/*/assocCulturalContext - - - termRef - assocObjectGroupList/*/assocObject - - - termRef - assocObjectGroupList/*/assocObjectType - - - termRef - ownershipAccess - - - termRef - ownershipCategory - - - termRef - ownershipExchangeMethod - - - termRef - usageGroupList/*/usage - - - - - - - - - - - - - - - - authRef - taxonomicIdentGroupList/*/taxon - - - authRef - taxonomicIdentGroupList/*/identBy - - - authRef - taxonomicIdentGroupList/*/institution - - - authRef - associatedTaxaGroupList/*/taxon - - - - - - - - default-domain - org.collectionspace.services.vocabulary.nuxeo.VocabularyDocumentModelHandler - - - - - shortIdentifier - shortIdentifier - - - displayName - displayName - - - vocabType - vocabType - - - - - org.collectionspace.services.vocabulary.nuxeo.VocabularyValidatorHandler - - org.collectionspace.services.common.init.AddIndices - - - vocabularies_common - shortidentifier - - - vocabularies_common - displayname - - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.movement.nuxeo.MovementDocumentModelHandler - - - true - - - movementReferenceNumber - movementReferenceNumber - - - locationDate - locationDate - - - currentLocation - currentLocation - - - - - org.collectionspace.services.movement.nuxeo.MovementValidatorHandler - - - objectNameProperty - currentLocation - - - objectNumberProperty - movementReferenceNumber - - - - org.collectionspace.services.common.init.AddIndices - - - movements_common - locationdate - - - - - - - - - - - - - - - - authRef - normalLocation - - - authRef - movementContact - - - authRef - inventoryContactList|inventoryContact - - - authRef - currentLocation - - - termRef - currentLocationFitness - - - termRef - movementMethods|movementMethod - - - termRef - reasonForMove - - - termRef - inventoryActionRequired - - - termRef - frequencyForInventory - - - - - - - - - - - - - default-domain - org.collectionspace.services.vocabulary.nuxeo.VocabularyItemDocumentModelHandler - - - true - - - order - order - - - - - order - order - - - - - org.collectionspace.services.vocabulary.nuxeo.VocabularyItemValidatorHandler - - org.collectionspace.services.common.init.AddIndices - - - vocabularyitems_common - inauthority - - - vocabularyitems_common - displayname - - - vocabularyitems_common - shortidentifier - - - - - - objectNameProperty - displayName - - - objectNumberProperty - shortIdentifier - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.place.nuxeo.PlaceDocumentModelHandler - - - true - - - - - org.collectionspace.services.place.nuxeo.PlaceValidatorHandler - - org.collectionspace.services.common.init.AddIndices - - - places_common - inauthority - - - places_common - shortidentifier - - - placetermgroup - termdisplayname - - - - - - objectNameProperty - placeTermGroupList/[0]/termDisplayName - - - objectNumberProperty - shortIdentifier - - - - - - - - - - - - - - - authRef - placeGeoRefGroupList/*/geoReferencedBy - - - authRef - placeOwnerGroupList/*/owner - - - termRef - placeTermGroupList/*/termLanguage - - - termRef - placeType - - - termRef - placeTermGroupList/*/termType - - - termRef - placeTermGroupList/*/termStatus - - - termRef - placeTermGroupList/*/historicalStatus - - - termRef - vCoordSys - - - termRef - vSpatialReferenceSystem - - - termRef - vUnitofMeasure - - - termRef - placeGeoRefGroupList/*/geodeticDatum - - - termRef - placeGeoRefGroupList/*/geoRefProtocol - - - termRef - placeGeoRefGroupList/*/geoRefVerificationStatus - - - - - - - - - - - - - default-domain - org.collectionspace.services.place.nuxeo.PlaceAuthorityDocumentModelHandler - - - - - shortIdentifier - shortIdentifier - - - displayName - displayName - - - vocabType - vocabType - - - - - - org.collectionspace.services.common.init.AddIndices - - - placeauthorities_common - shortidentifier - - - placeauthorities_common - displayname - - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.taxonomy.nuxeo.TaxonDocumentModelHandler - - - true - - - - - org.collectionspace.services.taxonomy.nuxeo.TaxonValidatorHandler - - org.collectionspace.services.common.init.AddIndices - - - taxon_common - inauthority - - - taxontermgroup - termdisplayname - - - taxon_common - shortidentifier - - - - - - objectNameProperty - taxonTermGroupList/[0]/termDisplayName - - - objectNumberProperty - shortIdentifier - - - - - - - - - - - - - - - authRef - taxonAuthorGroupList/*/taxonAuthor - - - termRef - commonNameGroupList/*/commonNameLanguage - - - termRef - taxonTermGroupList/*/termLanguage - - - termRef - taxonRank - - - termRef - taxonCurrency - - - termRef - taxonAuthorGroupList/*/taxonAuthorType - - - termRef - taxonTermGroupList/*/taxonomicStatus - - - termRef - taxonTermGroupList/*/termSource - - - termRef - taxonTermGroupList/*/termType - - - termRef - taxonTermGroupList/*/termStatus - - - - - - - - - - - - - default-domain - org.collectionspace.services.taxonomy.nuxeo.TaxonomyAuthorityDocumentModelHandler - - - - - shortIdentifier - shortIdentifier - - - displayName - displayName - - - vocabType - vocabType - - - - - - org.collectionspace.services.common.init.AddIndices - - - taxonomyauthority_common - shortidentifier - - - taxonomyauthority_common - displayname - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.objectexit.nuxeo.ObjectExitDocumentModelHandler - - - - - currentOwner - currentOwner - setCurrentOwner - - - exitNumber - exitNumber - setExitNumber - - - - - org.collectionspace.services.objectexit.nuxeo.ObjectExitValidatorHandler - - - objectNameProperty - currentOwner - - - objectNumberProperty - exitNumber - - - - - - - - - - - - - - - authRef - currentOwner - - - authRef - depositor - - - termRef - exitMethods|exitMethod - - - termRef - exitReason - - - - - - - - - - - - - default-domain - org.collectionspace.services.intake.nuxeo.IntakeDocumentModelHandler - - - - - currentOwner - currentOwner - - - entryNumber - entryNumber - - - depositor - depositor - - - - - org.collectionspace.services.intake.nuxeo.IntakeValidatorHandler - - - objectNameProperty - currentOwner - - - objectNumberProperty - entryNumber - - - - - - - - - - - - - - - authRef - valuer - - - termRef - currentLocationGroupList/*/currentLocationFitness - - - termRef - fieldCollectionMethods|fieldCollectionMethod - - - termRef - conditionCheckMethods|conditionCheckMethod - - - authRef - insurers|insurer - - - authRef - fieldCollectionSources|fieldCollectionSource - - - authRef - currentOwner - - - termRef - entryMethods|entryMethod - - - authRef - normalLocation - - - authRef - conditionCheckersOrAssessors|conditionCheckerOrAssessor - - - authRef - fieldCollectors|fieldCollector - - - authRef - currentLocationGroupList/*/currentLocation - - - termRef - conditionCheckReasons|conditionCheckReason - - - authRef - depositor - - - authRef - fieldCollectionPlace - - - termRef - entryReason - - - - - - - - - - - - - default-domain - org.collectionspace.services.group.nuxeo.GroupDocumentModelHandler - - - - - title - title - - - owner - owner - - - - - org.collectionspace.services.group.nuxeo.GroupValidatorHandler - - - objectNameProperty - owner - - - objectNumberProperty - title - - - - - - - - - - - - - - - authRef - owner - - - termRef - responsibleDepartment - - - - - - - - - - - - - default-domain - org.collectionspace.services.media.nuxeo.MediaDocumentModelHandler - - - - - title - title - - - identificationNumber - identificationNumber - - - source - source - - - filename - filename - - - blobCsid - blobCsid - - - - - org.collectionspace.services.media.nuxeo.MediaValidatorHandler - - - objectNameProperty - title - - - objectNumberProperty - identificationNumber - - - - - - - - - - - - - - - authRef - rightsHolder - - - authRef - creator - - - authRef - publisher - - - authRef - contributor - - - authRef - measuredPartGroupList/*/dimensionSubGroupList/*/measuredBy - - - termRef - languageList|language - - - authRef - coverage - - - termRef - typeList|type - - - termRef - measuredPartGroupList/*/dimensionSubGroupList/*/dimension - - - termRef - measuredPartGroupList/*/dimensionSubGroupList/*/measurementUnit - - - termRef - measuredPartGroupList/*/dimensionSubGroupList/*/measurementMethod - - - - - - - - - - - - - - - default-domain - - org.collectionspace.services.common.init.RunSqlScripts - - - sqlScriptName - create_id_generators_table.sql - - - sqlScriptName - load_id_generators.sql - - - - - - - - - - default-domain - - - - - - default-domain - org.collectionspace.services.servicegroup.nuxeo.ServiceGroupDocumentModelHandler - - - - - - default-domain - org.collectionspace.services.blob.nuxeo.BlobDocumentModelHandler - - - - - name - name - - - mimeType - mimeType - - - encoding - encoding - - - length - length - - - - - org.collectionspace.services.blob.nuxeo.BlobValidatorHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.batch.nuxeo.BatchDocumentModelHandler - - - - - name - name - setName - - - - - org.collectionspace.services.batch.nuxeo.BatchValidatorHandler - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.imports.nuxeo.ImportsDocumentModelHandler - - - - - importsField - importsField - setImportsField - - - - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.common.workflow.service.nuxeo.WorkflowDocumentModelHandler - org.collectionspace.services.workflow.nuxeo.WorkflowValidatorHandler - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.report.nuxeo.ReportDocumentModelHandler - - - - - name - name - - - - - org.collectionspace.services.report.nuxeo.ReportValidatorHandler - - org.collectionspace.services.report.nuxeo.ReportPostInitHandler - - - readerRoleName - reader - - - - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.relation.nuxeo.RelationDocumentModelHandler - - - - - org.collectionspace.services.relation.nuxeo.RelationValidatorHandler - - - objectNameProperty - subjectCsid - - - objectNumberProperty - predicateDisplayName - - - - org.collectionspace.services.common.init.AddIndices - - - relations_common - subjectcsid,objectcsid - - - - - - - - - - - - - - - - - - - - - - - - - - - - /dimensions/workflow/ - default-domain - org.collectionspace.services.dimension.nuxeo.DimensionDocumentModelHandler - - - - - - - - - - - - - - - - - - - - - - - - default-domain - org.collectionspace.services.contact.nuxeo.ContactDocumentModelHandler - - - - - displayName - displayName - - - - - - - - - - - - - - - authRef - addressGroupList/*/addressMunicipality - - - authRef - addressGroupList/*/addressStateOrProvince - - - - - - termRef - emailGroupList/*/emailType - - - termRef - telephoneNumberGroupList/*/telephoneNumberType - - - termRef - faxNumberGroupList/*/faxNumberType - - - termRef - webAddressGroupList/*/webAddressType - - - termRef - addressGroupList/*/addressCountry - - - termRef - addressGroupList/*/addressType - - - - - - - - - - - - - - - - - - - org.collectionspace.services.authorization.storage.RoleDocumentHandler - org.collectionspace.services.authorization.storage.RoleValidatorHandler - - - - - - - - - - - - - - - - - - org.collectionspace.services.authorization.storage.PermissionDocumentHandler - org.collectionspace.services.authorization.storage.PermissionValidatorHandler - - - - - - - - - - - - - - - - - - - - - org.collectionspace.services.authorization.storage.PermissionRoleDocumentHandler - - - - - - - - - - - - - - - - - - - - org.collectionspace.services.account.storage.AccountRoleDocumentHandler - - - - - - - - - - - - - - - - - - - - - - org.collectionspace.services.authorization.storage.PermissionRoleDocumentHandler - - - - - - - - - - - - - - - - - - - - - - org.collectionspace.services.account.storage.AccountRoleDocumentHandler - - - - - - - - - - - - - - - - - - diff --git a/services/common/src/main/java/org/collectionspace/services/common/config/ServiceConfigUtils.java b/services/common/src/main/java/org/collectionspace/services/common/config/ServiceConfigUtils.java index eb6d80565..cd4e31bbd 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/config/ServiceConfigUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/config/ServiceConfigUtils.java @@ -95,17 +95,20 @@ public class ServiceConfigUtils { ServiceBindingType serviceBinding) throws Exception { DocumentHandler docHandler = null; - ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - Class c = tccl.loadClass(getDocumentHandlerClass(tenantBinding, serviceBinding)); - if (DocumentHandler.class.isAssignableFrom(c)) { - docHandler = (DocumentHandler) c.newInstance(); - if (logger.isDebugEnabled()) { - logger.debug("Created an instance of the DocumentHandler for: " + getDocumentHandlerClass(tenantBinding, serviceBinding)); - } - } else { - throw new IllegalArgumentException("Not of type " - + DocumentHandler.class.getCanonicalName()); - } + if (serviceBinding.isRequiresDocumentHandler() == true) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + Class c = tccl.loadClass(getDocumentHandlerClass(tenantBinding, serviceBinding)); + if (DocumentHandler.class.isAssignableFrom(c)) { + docHandler = (DocumentHandler) c.newInstance(); + if (logger.isDebugEnabled()) { + logger.debug("Created an instance of the DocumentHandler for: " + getDocumentHandlerClass(tenantBinding, serviceBinding)); + } + } else { + String msg = String.format("Tenant:%s Service:%s - The declared document handler '%s' is not an instance of the '%s' interface.", + tenantBinding.getDisplayName(), serviceBinding.getName(), serviceBinding.getDocumentHandler(), DocumentHandler.class.getCanonicalName()); + throw new IllegalArgumentException(msg); + } + } return docHandler; } @@ -117,15 +120,20 @@ public class ServiceConfigUtils { */ private static String getDocumentHandlerClass(TenantBindingType tenantBinding, ServiceBindingType serviceBinding) { - if (serviceBinding.getDocumentHandler() == null - || serviceBinding.getDocumentHandler().isEmpty()) { - String msg = "Missing documentHandler in service binding for service name \"" - + serviceBinding.getName() + "\" for tenant id=" + tenantBinding.getId() - + " name=" + tenantBinding.getName(); - logger.warn(msg); - throw new IllegalStateException(msg); - } - return serviceBinding.getDocumentHandler().trim(); + String result = null; + + if (serviceBinding.isRequiresDocumentHandler() == true) { + if (serviceBinding.getDocumentHandler() == null || serviceBinding.getDocumentHandler().isEmpty()) { + String msg = "Missing documentHandler in service binding for service name \"" + + serviceBinding.getName() + "\" for tenant id=" + tenantBinding.getId() + + " name=" + tenantBinding.getName(); + throw new IllegalStateException(msg); + } else { + result = serviceBinding.getDocumentHandler().trim(); + } + } + + return result; } /** diff --git a/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java b/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java index 75cc0501d..7fbe3e91b 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java @@ -595,28 +595,34 @@ public abstract class AbstractServiceContextImpl */ private DocumentHandler createDocumentHandlerInstance() throws Exception { docHandler = ServiceConfigUtils.createDocumentHandlerInstance(tenantBinding, serviceBinding); + // - // Create a default document filter - // - docHandler.setServiceContext(this); - DocumentFilter docFilter = docHandler.createDocumentFilter(); - // - // If the context was created with query parameters, - // reflect the values of those parameters in the document filter - // to specify sort ordering, pagination, etc. + // The docHandler for a Service can be null, but usually is not. // - MultivaluedMap queryParameters = this.getQueryParams(); - if (queryParameters != null) { - docFilter.setSortOrder(queryParameters); - docFilter.setPagination(queryParameters); - String workflowWhereClause = buildWorkflowWhereClause(queryParameters); - if (workflowWhereClause != null) { - docFilter.appendWhereClause(workflowWhereClause, IQueryManager.SEARCH_QUALIFIER_AND); - } - + if (docHandler != null) { + // + // Create a default document filter + // + docHandler.setServiceContext(this); + DocumentFilter docFilter = docHandler.createDocumentFilter(); + // + // If the context was created with query parameters, + // reflect the values of those parameters in the document filter + // to specify sort ordering, pagination, etc. + // + MultivaluedMap queryParameters = this.getQueryParams(); + if (queryParameters != null) { + docFilter.setSortOrder(queryParameters); + docFilter.setPagination(queryParameters); + String workflowWhereClause = buildWorkflowWhereClause(queryParameters); + if (workflowWhereClause != null) { + docFilter.appendWhereClause(workflowWhereClause, IQueryManager.SEARCH_QUALIFIER_AND); + } + + } + docHandler.setDocumentFilter(docFilter); } - docHandler.setDocumentFilter(docFilter); - + return docHandler; } diff --git a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java index c996233d8..7bd42c9bf 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java +++ b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java @@ -84,6 +84,7 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn /** The Constant logger. */ private static final Logger logger = LoggerFactory.getLogger(SecurityInterceptor.class); private static final String ACCOUNT_PERMISSIONS = "accounts/*/accountperms"; + private static final String STRUCTURED_DATE_REQUEST = "structureddate"; private static final String PASSWORD_RESET = "accounts/requestpasswordreset"; private static final String PROCESS_PASSWORD_RESET = "accounts/processpasswordreset"; private static final String NUXEO_ADMIN = null; @@ -126,11 +127,18 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn private boolean requiresAuthorization(String resName) { boolean result = true; // - // All active users are allowed to see the *their* (we enforce this) current list of permissions. If this is not + // ACCOUNT_PERMISSIONS: All active users are allowed to see the *their* (we enforce this) current list of permissions. If this is not // the request, then we'll do a full AuthZ check. // - if (resName.equalsIgnoreCase(ACCOUNT_PERMISSIONS) == true) { - result = false; + // STRUCTURED_DATE_REQUEST: All user can request the parsing of a structured date string. + // + switch (resName) { + case STRUCTURED_DATE_REQUEST: + case ACCOUNT_PERMISSIONS: + result = false; + break; + default: + result = true; } return result; diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteSubItemDocumentModelHandlerImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteSubItemDocumentModelHandlerImpl.java index a35db35b5..33305060e 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteSubItemDocumentModelHandlerImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteSubItemDocumentModelHandlerImpl.java @@ -35,7 +35,6 @@ import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.document.DocumentUtils; import org.collectionspace.services.config.service.ObjectPartType; -import org.jboss.resteasy.plugins.providers.multipart.InputPart; import javax.ws.rs.core.MediaType; import org.nuxeo.ecm.core.api.DocumentModel; import org.slf4j.Logger; @@ -43,7 +42,7 @@ import org.slf4j.LoggerFactory; import org.w3c.dom.Document; /** - * RemoteDocumentModelHandler + * RemoteDocumentModelHandler - This class does not seem to be used, so it has been deprecated. * * @author pschmitz * $LastChangedRevision: $ @@ -51,6 +50,7 @@ import org.w3c.dom.Document; * @param The {DocumentType}Common class * @param The {DocumentType}CommonList class */ +@Deprecated public abstract class RemoteSubItemDocumentModelHandlerImpl extends RemoteDocumentModelHandlerImpl { diff --git a/services/config/src/main/resources/service.xsd b/services/config/src/main/resources/service.xsd index 9c18f810d..dbe3103f6 100644 --- a/services/config/src/main/resources/service.xsd +++ b/services/config/src/main/resources/service.xsd @@ -75,6 +75,7 @@ + diff --git a/services/loanin/service/pom.xml b/services/loanin/service/pom.xml index 301d8636d..a4642e787 100644 --- a/services/loanin/service/pom.xml +++ b/services/loanin/service/pom.xml @@ -32,6 +32,7 @@ org.collectionspace.services.collectionobject.jaxb ${project.version} + junit diff --git a/services/structureddate/client/pom.xml b/services/structureddate/client/pom.xml new file mode 100644 index 000000000..b91324897 --- /dev/null +++ b/services/structureddate/client/pom.xml @@ -0,0 +1,78 @@ + + + + org.collectionspace.services + org.collectionspace.services.structureddate + 5.0-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.structureddate.client + services.structureddate.client + + + + + org.slf4j + slf4j-api + test + + + org.slf4j + slf4j-log4j12 + test + + + + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.common + true + + + org.collectionspace.services + org.collectionspace.services.client + ${project.version} + + + + + + org.testng + testng + + + org.jboss.resteasy + resteasy-jaxrs + + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + + + + commons-httpclient + commons-httpclient + + + + + collectionspace-services-structureddate-client + + + diff --git a/services/structureddate/client/src/main/java/org/collectionspace/services/structureddate/StructuredDateClient.java b/services/structureddate/client/src/main/java/org/collectionspace/services/structureddate/StructuredDateClient.java new file mode 100644 index 000000000..127403163 --- /dev/null +++ b/services/structureddate/client/src/main/java/org/collectionspace/services/structureddate/StructuredDateClient.java @@ -0,0 +1,14 @@ +package org.collectionspace.services.structureddate; + +/** + * Client class for Structureddate service. + * @author remillet + * + */ +public class StructuredDateClient { + public static final String SERVICE_NAME = "structureddates"; + 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; + public static final String DATE_TO_PARSE_QP = "dateToParse"; +} diff --git a/services/structureddate/client/src/test/resources/log4j.properties b/services/structureddate/client/src/test/resources/log4j.properties new file mode 100644 index 000000000..148a3e865 --- /dev/null +++ b/services/structureddate/client/src/test/resources/log4j.properties @@ -0,0 +1,23 @@ +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 diff --git a/services/structureddate/jaxb/pom.xml b/services/structureddate/jaxb/pom.xml new file mode 100644 index 000000000..950676226 --- /dev/null +++ b/services/structureddate/jaxb/pom.xml @@ -0,0 +1,34 @@ + + + + org.collectionspace.services.structureddate + org.collectionspace.services + 5.0-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.structureddate.jaxb + services.structureddate.jaxb + + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + + + collectionspace-services-structureddate-jaxb + install + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + + + + + diff --git a/services/structureddate/jaxb/src/main/resources/structureddate-common.xsd b/services/structureddate/jaxb/src/main/resources/structureddate-common.xsd new file mode 100644 index 000000000..68af2e685 --- /dev/null +++ b/services/structureddate/jaxb/src/main/resources/structureddate-common.xsd @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/structureddate/pom.xml b/services/structureddate/pom.xml index 965c6a09e..96a5d140a 100644 --- a/services/structureddate/pom.xml +++ b/services/structureddate/pom.xml @@ -9,113 +9,13 @@ 4.0.0 org.collectionspace.services.structureddate services.structureddate - jar - - - - org.slf4j - slf4j-api - provided - - - org.slf4j - slf4j-log4j12 - provided - - - org.testng - testng - provided - - - org.yaml - snakeyaml - 1.6 - test - - - commons-beanutils - commons-beanutils-core - 1.8.3 - test - - - commons-lang - commons-lang - 2.6 - - - joda-time - joda-time - 2.3 - - - org.antlr - antlr4-runtime - 4.1 - - - org.antlr - antlr4-maven-plugin - 4.6 - - - org.sonatype.m2e.extras - org.sonatype.m2e.antlr - 0.13.0.20110622-1538 - - - - - - - org.antlr - antlr4-maven-plugin - 4.1 - - - - antlr4 - - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.antlr - - antlr4-maven-plugin - - - [4.1,) - - - antlr4 - - - - - org.sonatype.m2e.antlr.antlrConfigurator - - - - - - - - - - + pom + + + structureddate + client + jaxb + service + + diff --git a/services/structureddate/service/pom.xml b/services/structureddate/service/pom.xml new file mode 100644 index 000000000..656c52072 --- /dev/null +++ b/services/structureddate/service/pom.xml @@ -0,0 +1,84 @@ + + + + + org.collectionspace.services + org.collectionspace.services.structureddate + 5.0-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.structureddate.service + services.structureddate.service + jar + + + + org.collectionspace.services + org.collectionspace.services.common + + + org.collectionspace.services + org.collectionspace.services.structureddate.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.structureddate.client + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.structureddate.structureddate + ${project.version} + + + + + + junit + junit + test + + + org.testng + testng + + + + + + javax.security + jaas + 1.0.01 + provided + + + + + + org.jboss.resteasy + resteasy-jaxrs + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + + + org.jboss.resteasy + resteasy-multipart-provider + + + + + + collectionspace-services-structureddate-service + + + diff --git a/services/structureddate/service/src/main/java/org/collectionspace/services/structureddate/StructuredDateResource.java b/services/structureddate/service/src/main/java/org/collectionspace/services/structureddate/StructuredDateResource.java new file mode 100644 index 000000000..a19e658fc --- /dev/null +++ b/services/structureddate/service/src/main/java/org/collectionspace/services/structureddate/StructuredDateResource.java @@ -0,0 +1,154 @@ +package org.collectionspace.services.structureddate; + +import java.math.BigInteger; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl; +import org.collectionspace.services.common.CSWebApplicationException; +import org.collectionspace.services.common.ServiceMessages; +import org.collectionspace.services.common.api.Tools; +import org.collectionspace.services.common.context.RemoteServiceContextFactory; +import org.collectionspace.services.common.context.ServiceContext; +import org.collectionspace.services.common.context.ServiceContextFactory; + +@Path(StructuredDateClient.SERVICE_PATH) +@Produces({"application/xml"}) +@Consumes({"application/xml"}) +public class StructuredDateResource extends AbstractCollectionSpaceResourceImpl { + + @Override + public Class getCommonPartClass() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getServiceName() { + return StructuredDateClient.SERVICE_NAME; + } + + @Override + protected String getVersionString() { + // TODO Auto-generated method stub + return null; + } + + // + // API Endpoints + // + + @GET + public StructureddateCommon get(@Context UriInfo ui) { + StructureddateCommon result = null; + + try { + ServiceContext ctx = createServiceContext(getServiceName()); + MultivaluedMap queryParams = ui.getQueryParameters(); + String dateToParse = queryParams.getFirst(StructuredDateClient.DATE_TO_PARSE_QP); + if (Tools.isEmpty(dateToParse) != true) { + StructuredDateInternal structuredDate = StructuredDateInternal.parse(dateToParse); + result = toStructureddateCommon(ctx.getTenantName(), structuredDate); + } else { + String msg = String.format("Use the '%s' query parameter to specify a date string you want parsed.", + StructuredDateClient.DATE_TO_PARSE_QP); + Response response = + Response.status(Response.Status.BAD_REQUEST).entity(msg).type("text/plain").build(); + throw new CSWebApplicationException(response); + } + } catch(StructuredDateFormatException fe) { + Response response = Response.status(Response.Status.BAD_REQUEST).entity(fe.getMessage()).type("text/plain").build(); + throw new CSWebApplicationException(response); + } catch (Exception e) { + throw bigReThrow(e, ServiceMessages.GET_FAILED); + } + + return result; + } + + private StructureddateCommon toStructureddateCommon(String tenantDomain, StructuredDateInternal structuredDate) { + StructureddateCommon result = new StructureddateCommon(); + + String association = structuredDate.getAssociation(); + if (!Tools.isEmpty(association)) { + result.setAssociation(association); + } + + String displayDate = structuredDate.getDisplayDate(); + if (!Tools.isEmpty(displayDate)) { + result.setDisplayDate(displayDate); + } + + String earliestScalarDate = structuredDate.getEarliestScalarDate(); + if (!Tools.isEmpty(earliestScalarDate)) { + result.setEarliestScalarDate(earliestScalarDate); + } + + Date earliestSingleDate = structuredDate.getEarliestSingleDate(); + if (earliestSingleDate != null) { + result.setEarliestSingleDate(toDateCommon(tenantDomain, earliestSingleDate)); + } + + result.setLatestDate(toDateCommon(tenantDomain, structuredDate.getLatestDate())); + Date latestDate = structuredDate.getLatestDate(); + if (latestDate != null) { + result.setLatestDate(toDateCommon(tenantDomain, latestDate)); + } + + return result; + } + + private DateCommon toDateCommon(String tenantDomain, org.collectionspace.services.structureddate.Date date) { + DateCommon result = null; + + if (date != null) { + result = new DateCommon(); + + if (date.getCertainty() != null) { + result.setCertainty(date.getCertainty().toString()); + } + + if (date.getDay() != null) { + result.setDay(BigInteger.valueOf(date.getDay())); + } + + if (date.getEra() != null) { + result.setEra(date.getEra().toString(tenantDomain)); + } + + if (date.getMonth() != null) { + result.setMonth(BigInteger.valueOf(date.getMonth())); + } + + if (date.getQualifierType() != null) { + result.setQualifierType(date.getQualifierType().toString()); + } + + if (date.getQualifierUnit() != null) { + result.setQualifierUnit(date.getQualifierUnit().toString()); + } + + if (date.getQualifierValue() != null) { + result.setQualifierValue(date.getQualifierValue().toString()); + } + + if (date.getYear() != null) { + result.setYear(BigInteger.valueOf(date.getYear())); + } + } + + return result; + } + + @Override + public ServiceContextFactory getServiceContextFactory() { + return (ServiceContextFactory) RemoteServiceContextFactory.get(); + } +} diff --git a/services/structureddate/service/src/main/java/org/collectionspace/services/structureddate/StructureddateDocumentHandler.java b/services/structureddate/service/src/main/java/org/collectionspace/services/structureddate/StructureddateDocumentHandler.java new file mode 100644 index 000000000..610874eb8 --- /dev/null +++ b/services/structureddate/service/src/main/java/org/collectionspace/services/structureddate/StructureddateDocumentHandler.java @@ -0,0 +1,130 @@ +package org.collectionspace.services.structureddate; + +import java.util.List; + +import org.collectionspace.services.common.api.RefName.RefNameInterface; +import org.collectionspace.services.common.context.ServiceContext; +import org.collectionspace.services.common.document.AbstractMultipartDocumentHandlerImpl; +import org.collectionspace.services.common.document.DocumentException; +import org.collectionspace.services.common.document.DocumentFilter; +import org.collectionspace.services.common.document.DocumentWrapper; +import org.collectionspace.services.lifecycle.Lifecycle; +import org.collectionspace.services.lifecycle.TransitionDef; +import org.nuxeo.ecm.core.api.DocumentModel; + +/* + * The StructedDate service uses non of these method. It exists only because it is needed to create a proper ServiceContext instance. + */ +public class StructureddateDocumentHandler extends AbstractMultipartDocumentHandlerImpl, StructureddateCommon, List> { + + @Override + public Lifecycle getLifecycle() { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public Lifecycle getLifecycle(String serviceObjectName) { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void handleWorkflowTransition(ServiceContext ctx, DocumentWrapper wrapDoc, + TransitionDef transitionDef) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void handleCreate(DocumentWrapper wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void handleUpdate(DocumentWrapper wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void handleGet(DocumentWrapper wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void handleGetAll(DocumentWrapper> wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void extractAllParts(DocumentWrapper wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void fillAllParts(DocumentWrapper wrapDoc, + org.collectionspace.services.common.document.DocumentHandler.Action action) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public StructureddateCommon extractCommonPart(DocumentWrapper wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void fillCommonPart(StructureddateCommon obj, DocumentWrapper wrapDoc) + throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public List extractCommonPartList(DocumentWrapper> wrapDoc) + throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public List extractPagingInfo(List theCommonList, + DocumentWrapper> wrapDoc) throws Exception { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public StructureddateCommon getCommonPart() { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void setCommonPart(StructureddateCommon obj) { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public List getCommonPartList() { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public void setCommonPartList(List obj) { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public String getQProperty(String prop) throws DocumentException { + throw new RuntimeException("Unimplemented method."); + } + + @Override + protected String getRefnameDisplayName(DocumentWrapper docWrapper) { + throw new RuntimeException("Unimplemented method."); + } + + @Override + protected RefNameInterface getRefName(DocumentWrapper docWrapper, String tenantName, + String serviceName) { + throw new RuntimeException("Unimplemented method."); + } + + @Override + public DocumentFilter createDocumentFilter() { + throw new RuntimeException("Unimplemented method."); + } +} diff --git a/services/structureddate/service/src/test/resources/log4j.xml b/services/structureddate/service/src/test/resources/log4j.xml new file mode 100644 index 000000000..52121cb83 --- /dev/null +++ b/services/structureddate/service/src/test/resources/log4j.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/structureddate/README.txt b/services/structureddate/structureddate/README.txt similarity index 100% rename from services/structureddate/README.txt rename to services/structureddate/structureddate/README.txt diff --git a/services/structureddate/structureddate/pom.xml b/services/structureddate/structureddate/pom.xml new file mode 100644 index 000000000..cd98f8c88 --- /dev/null +++ b/services/structureddate/structureddate/pom.xml @@ -0,0 +1,121 @@ + + + + org.collectionspace.services + org.collectionspace.services.structureddate + 5.0-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.structureddate.structureddate + services.structureddate.structureddate + jar + + + + org.slf4j + slf4j-api + provided + + + org.slf4j + slf4j-log4j12 + provided + + + org.testng + testng + provided + + + org.yaml + snakeyaml + 1.6 + test + + + commons-beanutils + commons-beanutils-core + 1.8.3 + test + + + commons-lang + commons-lang + 2.6 + + + joda-time + joda-time + 2.3 + + + org.antlr + antlr4-runtime + 4.1 + + + org.antlr + antlr4-maven-plugin + 4.6 + + + org.sonatype.m2e.extras + org.sonatype.m2e.antlr + 0.13.0.20110622-1538 + + + + + + + org.antlr + antlr4-maven-plugin + 4.1 + + + + antlr4 + + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.antlr + + antlr4-maven-plugin + + + [4.1,) + + + antlr4 + + + + + org.sonatype.m2e.antlr.antlrConfigurator + + + + + + + + + + + diff --git a/services/structureddate/src/main/antlr4/org/collectionspace/services/structureddate/antlr/StructuredDate.g4 b/services/structureddate/structureddate/src/main/antlr4/org/collectionspace/services/structureddate/antlr/StructuredDate.g4 similarity index 100% rename from services/structureddate/src/main/antlr4/org/collectionspace/services/structureddate/antlr/StructuredDate.g4 rename to services/structureddate/structureddate/src/main/antlr4/org/collectionspace/services/structureddate/antlr/StructuredDate.g4 diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/Certainty.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/Certainty.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/Certainty.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/Certainty.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/Date.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/Date.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/Date.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/Date.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DateUtils.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DateUtils.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DateUtils.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DateUtils.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyEndDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyEndDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyEndDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyEndDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyStartDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyStartDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyStartDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredCenturyStartDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeEndDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeEndDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeEndDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeEndDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeStartDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeStartDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeStartDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredDecadeStartDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyEndDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyEndDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyEndDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyEndDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyStartDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyStartDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyStartDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredHalfCenturyStartDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumEndDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumEndDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumEndDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumEndDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumStartDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumStartDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumStartDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMillenniumStartDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMonthEndDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMonthEndDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMonthEndDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredMonthEndDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyEndDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyEndDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyEndDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyEndDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyStartDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyStartDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyStartDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialCenturyStartDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeEndDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeEndDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeEndDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeEndDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeStartDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeStartDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeStartDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredPartialDecadeStartDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyEndDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyEndDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyEndDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyEndDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyStartDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyStartDate.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyStartDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/DeferredQuarterCenturyStartDate.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/Era.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/Era.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/Era.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/Era.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/InvalidDateException.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/InvalidDateException.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/InvalidDateException.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/InvalidDateException.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/ParseDates.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/ParseDates.java similarity index 97% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/ParseDates.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/ParseDates.java index 930779567..efa796510 100644 --- a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/ParseDates.java +++ b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/ParseDates.java @@ -67,7 +67,7 @@ public class ParseDates { String scalar = ""; try { - StructuredDate structuredDate = StructuredDate.parse(displayDate); + StructuredDateInternal structuredDate = StructuredDateInternal.parse(displayDate); Date earliestSingleDate = structuredDate.getEarliestSingleDate(); Date latestDate = structuredDate.getLatestDate(); diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/Part.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/Part.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/Part.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/Part.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/QualifierType.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/QualifierType.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/QualifierType.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/QualifierType.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/QualifierUnit.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/QualifierUnit.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/QualifierUnit.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/QualifierUnit.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateEvaluator.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateEvaluator.java similarity index 50% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateEvaluator.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateEvaluator.java index 0544e53af..a2cfca5da 100644 --- a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateEvaluator.java +++ b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateEvaluator.java @@ -1,5 +1,5 @@ package org.collectionspace.services.structureddate; public interface StructuredDateEvaluator { - public StructuredDate evaluate(String displayDate) throws StructuredDateFormatException; + public StructuredDateInternal evaluate(String displayDate) throws StructuredDateFormatException; } diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateFormatException.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateFormatException.java similarity index 100% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateFormatException.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateFormatException.java diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDate.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateInternal.java similarity index 96% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDate.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateInternal.java index b37bb606b..a100bf677 100644 --- a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDate.java +++ b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/StructuredDateInternal.java @@ -7,7 +7,7 @@ import org.collectionspace.services.structureddate.antlr.ANTLRStructuredDateEval /** * A CollectionSpace structured date. */ -public class StructuredDate { +public class StructuredDateInternal { // The UI layer is interpreting scalarValuesComputed as follows: // - If true, the UI should compute scalar values // - If false (or null), the UI should not compute scalar values @@ -27,7 +27,7 @@ public class StructuredDate { private String latestScalarDate; private Boolean scalarValuesComputed; - public StructuredDate() { + public StructuredDateInternal() { scalarValuesComputed = DEFAULT_SCALAR_VALUES_COMPUTED; } @@ -70,7 +70,7 @@ public class StructuredDate { return false; } - StructuredDate that = (StructuredDate) obj; + StructuredDateInternal that = (StructuredDateInternal) obj; return new EqualsBuilder() @@ -157,7 +157,7 @@ public class StructuredDate { setLatestScalarDate(DateUtils.getLatestTimestamp(latestDate)); } - public static StructuredDate parse(String displayDate) throws StructuredDateFormatException { + public static StructuredDateInternal parse(String displayDate) throws StructuredDateFormatException { StructuredDateEvaluator evaluator = new ANTLRStructuredDateEvaluator(); return evaluator.evaluate(displayDate); diff --git a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/antlr/ANTLRStructuredDateEvaluator.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/antlr/ANTLRStructuredDateEvaluator.java similarity index 99% rename from services/structureddate/src/main/java/org/collectionspace/services/structureddate/antlr/ANTLRStructuredDateEvaluator.java rename to services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/antlr/ANTLRStructuredDateEvaluator.java index faba63273..9b2cde1ef 100644 --- a/services/structureddate/src/main/java/org/collectionspace/services/structureddate/antlr/ANTLRStructuredDateEvaluator.java +++ b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/antlr/ANTLRStructuredDateEvaluator.java @@ -33,7 +33,7 @@ import org.collectionspace.services.structureddate.DeferredQuarterCenturyEndDate import org.collectionspace.services.structureddate.DeferredQuarterCenturyStartDate; import org.collectionspace.services.structureddate.Era; import org.collectionspace.services.structureddate.Part; -import org.collectionspace.services.structureddate.StructuredDate; +import org.collectionspace.services.structureddate.StructuredDateInternal; import org.collectionspace.services.structureddate.StructuredDateEvaluator; import org.collectionspace.services.structureddate.StructuredDateFormatException; import org.collectionspace.services.structureddate.antlr.StructuredDateParser.AllOrPartOfContext; @@ -90,7 +90,7 @@ public class ANTLRStructuredDateEvaluator extends StructuredDateBaseListener imp /** * The result of the evaluation. */ - protected StructuredDate result; + protected StructuredDateInternal result; /** * The operation stack. The parse listener methods that are implemented here @@ -103,10 +103,10 @@ public class ANTLRStructuredDateEvaluator extends StructuredDateBaseListener imp } @Override - public StructuredDate evaluate(String displayDate) throws StructuredDateFormatException { + public StructuredDateInternal evaluate(String displayDate) throws StructuredDateFormatException { stack = new Stack(); - result = new StructuredDate(); + result = new StructuredDateInternal(); result.setDisplayDate(displayDate); // Instantiate a parser from the lowercased display date, so that parsing will be diff --git a/services/structureddate/src/test/java/org/collectionspace/services/structureddate/StructuredDateEvaluatorTest.java b/services/structureddate/structureddate/src/test/java/org/collectionspace/services/structureddate/StructuredDateEvaluatorTest.java similarity index 86% rename from services/structureddate/src/test/java/org/collectionspace/services/structureddate/StructuredDateEvaluatorTest.java rename to services/structureddate/structureddate/src/test/java/org/collectionspace/services/structureddate/StructuredDateEvaluatorTest.java index dfbe32dfa..3c4beb056 100644 --- a/services/structureddate/src/test/java/org/collectionspace/services/structureddate/StructuredDateEvaluatorTest.java +++ b/services/structureddate/structureddate/src/test/java/org/collectionspace/services/structureddate/StructuredDateEvaluatorTest.java @@ -35,11 +35,11 @@ public class StructuredDateEvaluatorTest { Map expectedStructuredDateFields = (Map) testCases.get(displayDate); - StructuredDate expectedStructuredDate = createStructuredDateFromYamlSpec(displayDate, expectedStructuredDateFields); - StructuredDate actualStructuredDate = null; + StructuredDateInternal expectedStructuredDate = createStructuredDateFromYamlSpec(displayDate, expectedStructuredDateFields); + StructuredDateInternal actualStructuredDate = null; try { - actualStructuredDate = StructuredDate.parse(displayDate); + actualStructuredDate = StructuredDateInternal.parse(displayDate); } catch(StructuredDateFormatException e) { logger.debug(e.getMessage()); @@ -49,11 +49,11 @@ public class StructuredDateEvaluatorTest { } } - private StructuredDate createStructuredDateFromYamlSpec(String displayDate, Map structuredDateFields) { - StructuredDate structuredDate = null; + private StructuredDateInternal createStructuredDateFromYamlSpec(String displayDate, Map structuredDateFields) { + StructuredDateInternal structuredDate = null; if (structuredDateFields != null) { - structuredDate = new StructuredDate(); + structuredDate = new StructuredDateInternal(); for (String propertyName : structuredDateFields.keySet()) { Object value = structuredDateFields.get(propertyName); diff --git a/services/structureddate/src/test/java/org/collectionspace/services/structureddate/StructuredDateTest.java b/services/structureddate/structureddate/src/test/java/org/collectionspace/services/structureddate/StructuredDateTest.java similarity index 100% rename from services/structureddate/src/test/java/org/collectionspace/services/structureddate/StructuredDateTest.java rename to services/structureddate/structureddate/src/test/java/org/collectionspace/services/structureddate/StructuredDateTest.java diff --git a/services/structureddate/src/test/resources/log4j.properties b/services/structureddate/structureddate/src/test/resources/log4j.properties similarity index 100% rename from services/structureddate/src/test/resources/log4j.properties rename to services/structureddate/structureddate/src/test/resources/log4j.properties diff --git a/services/structureddate/src/test/resources/test-dates.yaml b/services/structureddate/structureddate/src/test/resources/test-dates.yaml similarity index 100% rename from services/structureddate/src/test/resources/test-dates.yaml rename to services/structureddate/structureddate/src/test/resources/test-dates.yaml