Exemplo n.º 1
0
  public static void main(String[] args) throws Exception {
    try {
      DBSession dbs = new DBSession("PURIDIOM");
      InvoiceLineAdd test = new InvoiceLineAdd();
      Map incomingRequest = new HashMap();

      InvoiceLine invoiceLine = new InvoiceLine();

      dbs.startTransaction();

      incomingRequest.put("dbsession", dbs);
      incomingRequest.put("organizationId", "PURIDIOM");
      incomingRequest.put("userId", "SYSADM");
      incomingRequest.put("invoiceLine", invoiceLine);

      invoiceLine = (InvoiceLine) test.executeTask(incomingRequest);
      if (dbs.getStatus() == Status.SUCCEEDED) {
        System.out.println("InvoiceLineAddTest SUCCESS");
        dbs.commit();
      }

      System.out.println(incomingRequest);
      System.out.println("InvoiceLineAddTest COMPLETE");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 2
0
  public static void main(String[] args) throws Exception {
    try {
      RfqLineCreateHandler test = new RfqLineCreateHandler();
      Map incomingRequest = new HashMap();

      incomingRequest.put("organizationId", "PURIDIOM");
      incomingRequest.put("userId", "KELLI");
      incomingRequest.put("RfqHeader_icRfqHeader", "1145085800000");
      incomingRequest.put("createAction", "SAVE");
      incomingRequest.put("successPage", "SUCCESS");
      incomingRequest.put("failurePage", "FAILURE");

      test.handleRequest(incomingRequest);
      System.out.println(incomingRequest);

      String viewPage = (String) incomingRequest.get("viewPage");
      if (viewPage != null && viewPage.equals("SUCCESS")) {
        System.out.println("RfqLineCreate - SUCCESS");
      }
      RfqLine rfqLine = (RfqLine) incomingRequest.get("rfqLine");
      System.out.println(rfqLine.getRfqLine() + " - " + rfqLine.getItemNumber());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public static void main(String[] args) throws Exception {
    try {
      Map incomingRequest = new HashMap();
      incomingRequest.put("companyName", "Kelli's Test Org");
      OrganizationRegisterNew test = new OrganizationRegisterNew();

      String organizationId = (String) test.executeTask(incomingRequest);

      System.out.println("Organization Id: " + organizationId);

      System.out.println(
          "Organization Valid: "
              + OrganizationManager.getInstance().isOrganizationValid(organizationId));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 4
0
  /* (non-Javadoc)
   * @see com.tsa.puridiom.process.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;

    try {
      String userId = (String) incomingRequest.get("userId");
      String organizationId = (String) incomingRequest.get("organizationId");

      incomingRequest.put("UserProfile_userId", userId);
      incomingRequest.put("UserProfile_organizationId", organizationId);

      this.status = Status.SUCCEEDED;
    } catch (Exception e) {
      this.status = Status.FAILED;
      throw e;
    }
    return null;
  }
  public static void main(String[] args) throws Exception {
    try {
      DocAttachmentRetrieveByHeaderHandler test = new DocAttachmentRetrieveByHeaderHandler();
      Map incomingRequest = new HashMap();

      incomingRequest.put("organizationId", "PURIDIOM");
      incomingRequest.put("userId", "KELLI");
      incomingRequest.put("DocAttachment_icHeader", "123");
      incomingRequest.put("successPage", "SUCCESS");
      incomingRequest.put("failurePage", "FAILURE");

      test.handleRequest(incomingRequest);
      System.out.println(incomingRequest);

      String viewPage = (String) incomingRequest.get("viewPage");
      if (viewPage != null && viewPage.equals("SUCCESS")) {
        System.out.println("DocAttachmentRetrieveByHeaderHandler - SUCCESS");
      }

      List list = (List) incomingRequest.get("docAttachmentList");
      for (int i = 0; i < list.size(); i++) {
        DocAttachment docAttachment = (DocAttachment) list.get(i);
        System.out.println(i + " - " + docAttachment.toString());
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public static void main(String[] args) throws Exception {
    try {
      DBSession dbs = new DBSession("PURIDIOM");
      CountryRetrieveById test = new CountryRetrieveById();
      Map incomingRequest = new HashMap();

      incomingRequest.put("dbsession", dbs);
      incomingRequest.put("organizationId", "PURIDIOM");
      incomingRequest.put("userId", "SYSADM");

      System.out.println("Database Status: " + dbs.getStatus());

      Country country = (Country) test.executeTask(incomingRequest);

      System.out.println("Country: " + country.toString());
      System.out.println("CountryRetrieveByIdTest COMPLETE");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public static void main(String[] args) throws Exception {
    try {
      DBSession dbs = new DBSession("HILTON");
      BomReferenceRetrieveById test = new BomReferenceRetrieveById();
      Map incomingRequest = new HashMap();

      incomingRequest.put("dbsession", dbs);
      incomingRequest.put("organizationId", "HILTON");
      incomingRequest.put("userId", "SYSADM");

      System.out.println("Database Status: " + dbs.getStatus());

      BomReference bomReference = (BomReference) test.executeTask(incomingRequest);

      System.out.println("BomReference: " + bomReference.toString());
      System.out.println("BomReferenceRetrieveByIdTest COMPLETE");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public void funcioncall() {
    try {
      AccountAllocAmountRetrieveHandler test = new AccountAllocAmountRetrieveHandler();
      Map incomingRequest = new HashMap();

      incomingRequest.put("organizationId", "TEST");
      incomingRequest.put("userId", "hiltontest");
      incomingRequest.put("icHeader", "4930180800007");
      incomingRequest.put("successPage", "SUCCESS");
      incomingRequest.put("failurePage", "FAILURE");

      test.handleRequest(incomingRequest);
      System.out.println(incomingRequest);

      String viewPage = (String) incomingRequest.get("viewPage");
      if (viewPage != null && viewPage.equals("SUCCESS")) {
        System.out.println("Account - SUCCESS");
      }

      System.out.println("Tarea terminada");

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public static void main(String[] args) throws Exception {
    try {
      DBSession dbs = new DBSession("puridiom");
      VendorRegisterRetrieveByName test = new VendorRegisterRetrieveByName();
      Map incomingRequest = new HashMap();

      incomingRequest.put("VendorRegister_vendorName", "Technical Services Associates");
      incomingRequest.put("dbsession", dbs);

      // system.out.println("Database Status: " + dbs.getStatus());

      List vendorRegisterList = (List) test.executeTask(incomingRequest);
      for (int i = 0; i < vendorRegisterList.size(); i++) {
        VendorRegister vendorRegister = (VendorRegister) vendorRegisterList.get(i);
        // system.out.println("VendorRegister: " + vendorRegister.toString());
      }

      // system.out.println("COMPLETE");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public static void main(String[] args) {
    try {
      System.out.println("Delete catalogComopnent record");
      PuridiomProcessLoader processLoader = new PuridiomProcessLoader();
      PuridiomProcess process = processLoader.loadProcess("catalogComponent-delete.xml");
      Map incomingRequest = new HashMap();

      incomingRequest.put("catalogID", "936");
      incomingRequest.put("itemNumber", "10");
      incomingRequest.put("sequence", new Integer(1));

      process.executeProcess(incomingRequest);

      CatalogComponent catalogComponent =
          (CatalogComponent) incomingRequest.get("catalogcomponentdelete");
      System.out.println("status: " + process.getStatus());
      System.out.println("end of catalogPriceBrk Delete process test");
    } catch (Exception exception) {
      exception.printStackTrace();
      ErrorHandlingService ehs = ErrorHandlingService.getInstance();
      ehs.handleException("catalogComponentDeleteTest", "executeTask", null, exception);
    }
  }
  public static void main(String[] args) throws Exception {
    try {
      DBSession dbs = new DBSession("PURIDIOM");
      VendorDocumentRetrieveById test = new VendorDocumentRetrieveById();
      Map incomingRequest = new HashMap();

      incomingRequest.put("dbsession", dbs);
      incomingRequest.put("organizationId", "PURIDIOM");
      incomingRequest.put("userId", "SYSADM");
      incomingRequest.put("VendorDocument_docIc", "123456");
      incomingRequest.put("VendorDocument_icRfqHeader", "123000");
      incomingRequest.put("VendorDocument_vendorId", "TMP-VENDOR");

      System.out.println("Database Status: " + dbs.getStatus());

      VendorDocument vendorDocument = (VendorDocument) test.executeTask(incomingRequest);

      System.out.println("VendorDocument: " + vendorDocument.toString());
      System.out.println("VendorDocumentRetrieveByIdTest COMPLETE");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 12
0
 /**
  * Method executeTask.
  *
  * @param object
  *     <p>incomingRequest
  * @author EDSAC returns a copy of asset with tagNumber changed, trackingNumber "N/A" and status
  *     Pending in a list
  */
 public Object executeTask(Object object) throws Exception {
   Map incomingRequest = (Map) object;
   List assetList = new ArrayList();
   try {
     Asset asset = (Asset) incomingRequest.get("asset");
     Asset assetClon =
         new Asset(
             asset.getAssetClass(),
             asset.getSecurityCode(),
             asset.getCommodity(),
             asset.getManufacturer(),
             asset.getModel(),
             asset.getSerialNumber(),
             asset.getAssetCost(),
             asset.getDateInService(),
             asset.getDeprecMethod(),
             asset.getWarrantyStart(),
             asset.getWarrantyEnd(),
             asset.getUpgradeReqs(),
             asset.getContractService(),
             asset.getPurchaseOrder(),
             asset.getDateEntered(),
             asset.getAssetStatus(),
             asset.getAssetUdf1(),
             asset.getAssetUdf2(),
             asset.getAssetUdf3(),
             asset.getAssetUdf4(),
             asset.getAssetUdf5(),
             asset.getTotalCost(),
             asset.getIcText(),
             asset.getImageFile(),
             asset.getPoVendor(),
             asset.getContractorName(),
             asset.getOwner(),
             asset.getDeprecTerm(),
             asset.getDateReceived(),
             asset.getIcReceipt(),
             asset.getAssetUdf6(),
             asset.getAssetUdf7(),
             asset.getAssetUdf8(),
             asset.getAssetUdf9(),
             asset.getAssetUdf10(),
             asset.getIcLineKey(),
             asset.getItemNumber(),
             asset.getItemLocation(),
             asset.getIcAccount(),
             asset.getIcDsbHeader(),
             asset.getIcDsbLine(),
             asset.getLocalCurrencyPrice(),
             asset.getOriginalCost(),
             asset.getExitValue(),
             asset.getDateInactive(),
             asset.getLastChgBy(),
             asset.getDateChanged(),
             asset.getDescription(),
             asset.getLease(),
             asset.getLeaseType(),
             asset.getLeaseTerm(),
             asset.getMonthlyPayment(),
             asset.getLeasingCompany(),
             asset.getRenewalDate(),
             asset.getFinancing(),
             asset.getPrinted(),
             asset.getTrackingNumber(),
             asset.getFiscalYear());
     assetClon.setTagNumber(UniqueKeyGenerator.getInstance().getUniqueKey().toString());
     assetClon.setAssetStatus("Pending");
     assetClon.setTrackingNumber("N/A");
     assetList.add(assetClon);
   } catch (Exception e) {
     Log.error(this, e.toString());
     this.setStatus(Status.FAILED);
   }
   return assetList;
 }
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;

    try {
      List poLineList = (List) incomingRequest.get("poLineList");
      List reqLineList = new ArrayList();
      String icPoHeader = (String) incomingRequest.get("PoHeader_icPoHeader");
      PuridiomProcessLoader processLoader =
          new PuridiomProcessLoader((String) incomingRequest.get("organizationId"));
      PuridiomProcess process = processLoader.loadProcess("requisitionline-create-from-poline.xml");
      HashMap updateParameters = new HashMap();

      updateParameters.put("userId", incomingRequest.get("userId"));
      updateParameters.put("userTimeZone", incomingRequest.get("userTimeZone"));
      updateParameters.put("organizationId", incomingRequest.get("organizationId"));
      updateParameters.put("dbsession", incomingRequest.get("dbsession"));
      updateParameters.put(
          "RequisitionHeader_icReqHeader", incomingRequest.get("RequisitionHeader_icReqHeader"));
      updateParameters.put(
          "RequisitionHeader_icRevisedOrder",
          incomingRequest.get("RequisitionHeader_icRevisedOrder"));
      updateParameters.put(
          "RequisitionHeader_requisitionNumber",
          incomingRequest.get("RequisitionHeader_requisitionNumber"));
      updateParameters.put("requisitionHeader", incomingRequest.get("requisitionHeader"));

      for (int i = 0; i < poLineList.size(); i++) {
        PoLine poLine = (PoLine) poLineList.get(i);

        updateParameters.put("poLine", poLine);

        process.executeProcess(updateParameters);

        if (process.getStatus() == Status.SUCCEEDED) {
          reqLineList.add(updateParameters.get("requisitionLine"));

          updateParameters.remove("requisitionLine");
          updateParameters.remove("poLine");
        } else {
          this.setStatus(process.getStatus());
          throw new Exception("Process to create requisition lines from po lines failed.");
        }
      }

      incomingRequest.put("PoLine_icPoHeader", icPoHeader);

      this.setStatus(Status.SUCCEEDED);
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }

    return null;
  }