Package com.esri.gpt.catalog.publication

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


   * @param context the procesing context
   */
  public AGSProcessor(ProcessingContext context) {
    super(context);
    if (context.getTemplate() == null) {
      PublicationRecord template = new PublicationRecord();
      template.setUpdateOnlyIfXmlHasChanged(true);
      context.setTemplate(template);
    }
  }
View Full Code Here


        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();
//          if (sMsg.contains("XSD violation.")) {
View Full Code Here

    try {
     
      // initialize
      String restUrl = "";
      String soapUrl = "";
      PublicationRecord template = new PublicationRecord();
      if (this.parameters != null) {
        restUrl = Val.chkStr(this.parameters.getValue("restUrl"));
        soapUrl = Val.chkStr(this.parameters.getValue("soapUrl"));
        template.setAutoApprove(
            Val.chkStr(this.parameters.getValue("autoApprove")).equalsIgnoreCase("true"));
        template.setUpdateOnlyIfXmlHasChanged(
            Val.chkStr(this.parameters.getValue("updateOnlyIfXmlHasChanged")).equalsIgnoreCase("true"));
      }
      if (restUrl.length() == 0) {
        LOGGER.log(Level.SEVERE,"AGSSynchronizer run aborted: the restUrl parameter was empty.");
        return;
View Full Code Here

    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);
      }
    } catch (ValidationException e) {
      MessageBroker msgBroker = new MessageBroker();
      msgBroker.setBundleBaseName(MessageBroker.DEFAULT_BUNDLE_BASE_NAME);
      ArrayList<String> messages = new ArrayList<String>();
      e.getValidationErrors().buildMessages(msgBroker,messages,true);     
     
      StringBuilder sb = new StringBuilder();
      sb.append("<![CDATA[");
      sb.append("\r\nMetadata Validation Exception");
      if (handle.length() > 0) {
        sb.append("\r\nhandle=").append(handle);
        sb.append(", sk=").append(e.getKey());
      } else {
        sb.append("\r\nsk=").append(e.getKey());
      }
      String id = Val.chkStr(pubRecord.getUuid());
      if (id.length() > 0) {
        sb.append(", id=").append(id);
      }
      for (String msg : messages) {
        sb.append("\r\n").append(msg);
View Full Code Here

TOP

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

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.