Package smilehouse.openinterface

Examples of smilehouse.openinterface.ExportResult


    }


    public String[] give(SourceInfo info, MessageLogger logger)
            throws FailTransferException, AbortTransferException {
        ExportResult exportResult = null;
        StringBuffer hqlResult = new StringBuffer("");
       
        // If we have already output all data, no need for further communication
        // with OpenInterface. Simply return null as an EOF signal to the Pipe framework.
        if( this.allDataOutput == true ) return null;
       
        // Counter used in the all results at once mode to determine whether
        // a single HQL result should have the XML declaration line or not
        int allResultsAtOnceIndex = 0;
       
        // Increment iteration number
        this.iterationNumber++;
       
        Boolean xmlDeclarationForEachBlock = getXMLdeclarationForEachBlock();
       
        OpenInterfaceIF oi = WorkspaceOIUtils.getOpenInterfaceIF(
      this.oiEndpointAddress,
      getOpenInterfaceHost()
      );
       
        do {
            try {
                exportResult = oi.iterate(this.login, oiIteratorId, resultsPerIteration);
               
            } catch (AccessDeniedException e) {
                logger.logMessage(
                    "Access to OpenInterface was denied. Check your username and password settings.",
                    this,
                    MessageLogger.ERROR);
                PipeComponentUtils.failTransfer();
            } catch (IteratorClosedException e) {

                // Invalidate OpenInterface iterator's number so that we don't attempt to close it later
                this.oiIteratorId = null;

                logger.logMessage(
                  "OpenInterface HQL iterator had been closed due to inactivity. Try increasing session timeout value.",
                  this,
                  MessageLogger.ERROR);
              PipeComponentUtils.failTransfer();
          } catch (OpenInterfaceException e) {
              logger.logMessage("OpenInterfaceException while iterating over the HQL query's result set",
                  this, MessageLogger.ERROR);
              logger.logMessage(e.getMessage(), this, MessageLogger.ERROR);
              Environment.getInstance().log(
                  "OpenInterfaceException while iterating over the HQL query's result set", e);
              PipeComponentUtils.failTransfer();
          } catch (RemoteException e) {
              logger.logMessage("RemoteException from OpenInterface while iterating over the HQL query's result set",
                  this, MessageLogger.ERROR);
              Environment.getInstance().log(
                  "RemoteException from OpenInterface while iterating over the HQL query's result set", e);
              PipeComponentUtils.failTransfer();
          }
 
          if(exportResult != null) {
             
              if(this.allResultsAtOnce == false) {
                 
                  // Normal iteration mode
                if((this.iterationNumber > 1) &&
                   (xmlDeclarationForEachBlock.booleanValue() == false)) {
                       hqlResult.append(Utils.stripXMLdeclaration(exportResult.getXml()));
                   } else {
                       hqlResult.append(exportResult.getXml());
                   }
              } else {
                 
                  // All results at once mode
                  allResultsAtOnceIndex++;
                  // Only the first HQL result will keep its XML declaration line
                  if(allResultsAtOnceIndex == 1) {
                    hqlResult.append(stripResultCloseTag(exportResult.getXml()));
                  } else if(allResultsAtOnceIndex > 1) {
                    hqlResult.append(stripResultTag(Utils.stripXMLdeclaration(exportResult.getXml())));
                  }
              }
          }
         
        } while((this.allResultsAtOnce == true) && (exportResult != null));
View Full Code Here


          criteria.setModifyOperation(customerModifyOperationType);
        }
       
        logger.logMessage("Calling Open Interface", this, MessageLogger.DEBUG);
        try {
            ExportResult result;
                result = getExportResult(
                    criteria,
                    logger);
               
            if(result.getResultSize() != 0) {
                logger.logMessage(
                    "Open Interface result size: " + result.getResultSize() + " customers, XML length: "
                            + result.getXml().length(),
                    this,
                    MessageLogger.DEBUG);
            } else {
                logger.logMessage("No matching customers.", this, MessageLogger.WARNING);
                PipeComponentUtils.abortTransfer();
            }
            return new String[] {result.getXml()};

        } catch(AccessDeniedException ade) {
            logger.logMessage(
                "Access to Open Interface was denied. Check your username and password settings.",
                this,
View Full Code Here

                hqlQuery,
                sessionTimeout,
                logger,
                this);

            ExportResult exportResult = null;

            // Retrieve all results appending them to a StringBuffer
            try {
                do {
                    exportResult = oi.iterate(login, iteratorId, resultsPerIteration);
                    if(exportResult != null) {
                        hqlResult.append(stripResultTag(Utils.stripXMLdeclaration(exportResult
                            .getXml())));
                    }
                } while(exportResult != null);

            } catch(AccessDeniedException e) {
View Full Code Here

        if(sumLessThan != null && !sumLessThan.isNaN())
            criteria.setSumLessThan(sumLessThan);

        logger.logMessage("Calling Open Interface", this, MessageLogger.DEBUG);
        try {
            ExportResult result;
           
            if(ws15CompatibilityMode == true) {
                result = getExportResult(
                    criteria,
                    null,
                    newStatusName,
                    info,
                    logger);
               
            } else {
                // For Workspace 1.6 and newer we don't update the orders' status while
                // exporting them, but after the Pipe execution is successfully completed
                result = getExportResult(
                    criteria,
                    null,
                    null,
                    info,
                    logger);
               
                setNewHandlingStatusName(newStatusName);
               
                // Extract and save a list of order Ids so that we can update the orders'
                // handling statuses after successful execution of the Pipe
                setOrderIds(WorkspaceOIUtils.getOrderIdsFromXML(result.getXml()));
               
                // Also lastUpdateLogId will be stored only after a successful Pipe execution
                if(result.getLastUpdateLogId() != null) {
                    newUpdateLogId = result.getLastUpdateLogId();
                }
            }

            if(result.getResultSize() != 0) {
                logger.logMessage(
                    "Open Interface result size: " + result.getResultSize() + " orders, XML length: "
                            + result.getXml().length(),
                    this,
                    MessageLogger.DEBUG);
            } else {
                logger.logMessage("No matching orders.", this, MessageLogger.WARNING);
                PipeComponentUtils.abortTransfer();
            }
            return new String[] {result.getXml()};

        } catch(AccessDeniedException ade) {
            logger.logMessage(
                "Access to Open Interface was denied. Check your username and password settings.",
                this,
View Full Code Here

TOP

Related Classes of smilehouse.openinterface.ExportResult

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.