Package com.esri.gpt.catalog.publication

Examples of com.esri.gpt.catalog.publication.PublicationRequest


        title = record.getName();
        ProtocolInvoker.setLockTitle(record.getProtocol(), false);
      } else {
        // if the native resource is available, make sure it's a valid metadata resource
        // prepare record for publication; it will validate schema
        PublicationRequest pubReq = new PublicationRequest(context, user, nativeResource.getContent());
        Schema schema = pubReq.prepareForPublication();
        boolean lockTitle = false;
        if (record.getName().length() == 0) {
          title = schema.getMeaning().getTitle();
        } else {
          if (!ProtocolInvoker.getLockTitle(record.getProtocol())) {
View Full Code Here


    // prepare the publisher
    Publisher publisher = new Publisher(context);

    // publication request
    PublicationRequest publishRequest = new PublicationRequest(context,
        publisher, xml);
    publishRequest.getPublicationRecord().setSourceFileName(sourceUri);
    publishRequest.getPublicationRecord().setPublicationMethod(
        MmdEnums.PublicationMethod.batch.toString());
    publishRequest.publish();

    boolean bReplaced = publishRequest.getPublicationRecord()
        .getWasDocumentReplaced();
    StringBuffer sb = new StringBuffer();
    sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    sb.append("<ARCXML version=\"1.1\"><RESPONSE><METADATA_ACTION>");
    if (bReplaced) {
View Full Code Here

          String content = nativeResource.getContent();
          String sourceUri = nativeResource.getSourceUri().asString();

          Publisher publisher = createPublisherOfRepository();

          PublicationRequest publicationRequest = createPublicationRequest(publisher, content, sourceUri);

          publicationRequest.publish();
        }
      } catch (Exception ex) {
        LOGGER.log(Level.INFO, "Unable to create resource definition.", ex);
      }
    }
View Full Code Here

* @param xml source URI
* @return request
*/
private PublicationRequest createPublicationRequest(Publisher publisher, String content, String sourceUri) {
 
  PublicationRequest publicationRequest = new PublicationRequest(getRequestContext(), publisher, content);
  publicationRequest.getPublicationRecord().setUuid(getRepository().getUuid());
  publicationRequest.getPublicationRecord().setPublicationMethod(MmdEnums.PublicationMethod.registration.toString());
  publicationRequest.getPublicationRecord().setSourceUri(sourceUri);
  publicationRequest.getPublicationRecord().setSourceFileName(sourceUri);
  publicationRequest.getPublicationRecord().setAutoApprove(getRequestContext().getApplicationConfiguration().getHarvesterConfiguration().getResourceAutoApprove());
  publicationRequest.getPublicationRecord().setAlternativeTitle(getRepository().getName());
  publicationRequest.getPublicationRecord().setUpdateOnlyIfXmlHasChanged(false);
  publicationRequest.getPublicationRecord().setIndexEnabled(getRepository().getFindable());

  return publicationRequest;
}
View Full Code Here

      } catch (IOException e) {
        throw new ServletException("400: IOException while reading request body.");
      }
      xml = Val.chkStr(Val.removeBOM(xml));
      if (xml.length() > 0) {
        PublicationRequest pubRequest = new PublicationRequest(context,publisher,xml);
        PublicationRecord pubRecord = pubRequest.getPublicationRecord();
       
        pubRecord.setPublicationMethod(MmdEnums.PublicationMethod.upload.toString());
        String pubMethod = Val.chkStr(request.getParameter("publicationMethod"));
        if (pubMethod.length() > 0) {
          try {
            pubMethod = MmdEnums.PublicationMethod.valueOf(Val.chkStr(pubMethod)).toString();
            pubRecord.setPublicationMethod(pubMethod);
          } catch (IllegalArgumentException ex) {
          }
        }
       
        String asDraft = Val.chkStr(request.getParameter("asDraft"));
        if (asDraft.equals("true")) {
          pubRecord.setApprovalStatus(MmdEnums.ApprovalStatus.draft.toString());
        }
       
        this.determineSourceUri(request,context,pubRequest);
        try {
          pubRequest.publish();
          if (!pubRecord.getWasDocumentReplaced()) {
            response.setStatus(HttpServletResponse.SC_CREATED);
          }
//        } catch (ValidationException e) {
//          String sMsg = e.toString();
View Full Code Here

   
    handle = Val.chkStr(handle);
    xml = Val.chkStr(Val.removeBOM(xml));
    TransactionOptions tOptions = context.getRequestOptions().getTransactionOptions();
    TransactionSummary tSummary = tOptions.getSummary();
    PublicationRequest pubRequest = new PublicationRequest(
        context.getRequestContext(),publisher,xml);
    PublicationRecord pubRecord = pubRequest.getPublicationRecord();
    pubRecord.setPublicationMethod(MmdEnums.PublicationMethod.upload.toString());
    if (tOptions.getAutoApprove()) {
      pubRecord.setAutoApprove(true);
    }
    if ((tOptions.getApprovalStatus() != null) && (tOptions.getApprovalStatus().length() > 0)) {
      pubRecord.setApprovalStatus(MmdEnums.ApprovalStatus.valueOf(tOptions.getApprovalStatus()).toString());
    }
    if ((tOptions.getPublicationMethod() != null) && (tOptions.getPublicationMethod().length() > 0)) {
      pubRecord.setPublicationMethod(MmdEnums.PublicationMethod.valueOf(tOptions.getPublicationMethod()).toString());
    }
   
    // TODO: need a sourceUri
    //this.determineSourceUri(request,context,pubRequest);
   
    try {
      pubRequest.publish();
      if (pubRecord.getWasDocumentUnchanged()) {
      } else if (pubRecord.getWasDocumentReplaced()) {
        tSummary.setTotalUpdated(tSummary.getTotalUpdated() + 1);
      } else {
        tSummary.setTotalInserted(tSummary.getTotalInserted() + 1);
View Full Code Here

TOP

Related Classes of com.esri.gpt.catalog.publication.PublicationRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.