コード例 #1
0
 /* (non-Javadoc)
  * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleCreate(org.collectionspace.services.common.document.DocumentWrapper)
  */
 @Override
 public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
   // first fill all the parts of the document, refname and short ID get set as well
   super.handleCreate(wrapDoc);
   // Ensure we have required fields set properly
   handleInAuthority(wrapDoc.getWrappedObject());
 }
コード例 #2
0
 @Override
 public void fillAllParts(DocumentWrapper<DocumentModel> wrapDoc, Action action) throws Exception {
   //
   // We currently don't override this method with any AuthorityItemDocumentModelHandler specific
   // functionality, so
   // we could remove this method.
   //
   super.fillAllParts(wrapDoc, action);
 }
コード例 #3
0
 @Override
 public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
   super.handleCreate(wrapDoc);
   // CSPACE-3178:
   // Uncomment once debugged and App layer is read to integrate
   // Experimenting with this uncommented now ...
   handleDisplayNameAsShortIdentifier(wrapDoc.getWrappedObject(), authorityCommonSchemaName);
   updateRefnameForAuthority(wrapDoc, authorityCommonSchemaName); // CSPACE-3178
 }
コード例 #4
0
 /**
  * Filters out selected values supplied in an update request.
  *
  * @param objectProps the properties filtered out from the update payload
  * @param partMeta metadata for the object to fill
  */
 @Override
 public void filterReadOnlyPropertiesForPart(
     Map<String, Object> objectProps, ObjectPartType partMeta) {
   super.filterReadOnlyPropertiesForPart(objectProps, partMeta);
   String commonPartLabel = getServiceContext().getCommonPartLabel();
   if (partMeta.getLabel().equalsIgnoreCase(commonPartLabel)) {
     objectProps.remove(AuthorityJAXBSchema.CSID);
     objectProps.remove(AuthorityJAXBSchema.SHORT_IDENTIFIER);
     objectProps.remove(AuthorityJAXBSchema.REF_NAME);
   }
 }
コード例 #5
0
 /* (non-Javadoc)
  * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleUpdate(org.collectionspace.services.common.document.DocumentWrapper)
  */
 @Override
 // FIXME: Once we remove the refName field from the authority item schemas, we can remove this
 // override method since our super does everthing for us now.
 @Deprecated
 public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
   // Must call our super's version first, this updates the core schema and the relationship
   // records to deal with possible refName changes/update
   super.handleUpdate(wrapDoc);
   if (this.hasRefNameUpdate() == true) {
     DocumentModel docModel = wrapDoc.getWrappedObject();
     docModel.setProperty(
         authorityItemCommonSchemaName,
         AuthorityItemJAXBSchema.REF_NAME,
         this
             .newRefNameOnUpdate); // This field is deprecated since it is now a duplicate of what
                                   // is in the collectionspace_core:refName field
   }
 }
コード例 #6
0
  /*
   * This method gets called after the primary update to an authority item has happened.  If the authority item's refName
   * has changed, then we need to updated all the records that use that refname with the new/updated version
   *
   * (non-Javadoc)
   * @see org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl#completeUpdate(org.collectionspace.services.common.document.DocumentWrapper)
   */
  public void completeUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
    // Must call our super class' version first
    super.completeUpdate(wrapDoc);

    //
    // Look for and update authority references with the updated refName
    //
    if (hasRefNameUpdate() == true) {
      // We have work to do.
      if (logger.isDebugEnabled()) {
        final String EOL = System.getProperty("line.separator");
        logger.debug(
            "Need to find and update references to authority item."
                + EOL
                + "   Old refName"
                + oldRefNameOnUpdate
                + EOL
                + "   New refName"
                + newRefNameOnUpdate);
      }
      ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = getServiceContext();
      RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient = getRepositoryClient(ctx);
      RepositoryInstanceInterface repoSession = this.getRepositorySession();

      // Update all the existing records that have a field with the old refName in it
      int nUpdated =
          RefNameServiceUtils.updateAuthorityRefDocs(
              ctx,
              repoClient,
              repoSession,
              oldRefNameOnUpdate,
              newRefNameOnUpdate,
              getRefPropName());

      // Finished so log a message.
      if (logger.isDebugEnabled()) {
        logger.debug("Updated " + nUpdated + " instances of oldRefName to newRefName");
      }
    }
  }
コード例 #7
0
 @Override
 public void extractAllParts(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
   MultipartServiceContext ctx = (MultipartServiceContext) getServiceContext();
   super.extractAllParts(wrapDoc);
 }