Esempio n. 1
0
 public Map handleRequest(Map incomingRequest) throws Exception {
   try {
     PuridiomProcessLoader processLoader =
         new PuridiomProcessLoader((String) incomingRequest.get("organizationId"));
     PuridiomProcess process = processLoader.loadProcess("vendor-deletebyid.xml");
     process.executeProcess(incomingRequest);
     if (process.getStatus() == Status.SUCCEEDED) {
       String errorMsg = (String) incomingRequest.get("deleteVendorErrorMsg");
       if (errorMsg != null && errorMsg.trim().length() > 0) {
         incomingRequest.put("viewPage", incomingRequest.get("deleteVendorFailurePage"));
       } else {
         incomingRequest.put("viewPage", incomingRequest.get("successPage"));
       }
     } else {
       incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
     }
   } catch (Exception exception) {
     incomingRequest.put("errorMsg", exception.getMessage());
     incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
     throw exception;
   } finally {
     if (incomingRequest.get("viewPage") == null) {
       incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
     }
   }
   return incomingRequest;
 }
  public Map handleRequest(Map incomingRequest) throws Exception {
    try {
      String organizationId = (String) incomingRequest.get("organizationId");
      PuridiomProcessLoader processLoader = new PuridiomSupplierPortalProcessLoader(organizationId);
      PuridiomProcess process = processLoader.loadProcess("vendorregister-validate.xml");
      process.executeProcess(incomingRequest);

      if (process.getStatus() == Status.SUCCEEDED) {
        incomingRequest.put("viewPage", incomingRequest.get("successPage"));
      } else {
        incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
      }
    } catch (Exception exception) {
      incomingRequest.put("errorMsg", exception.getMessage());
      incomingRequest.put("exception", exception);
      incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
      //			throw exception;
    } finally {
      if (incomingRequest.get("viewPage") == null) {
        incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
      }
    }

    return incomingRequest;
  }
Esempio n. 3
0
 public Map handleRequest(Map incomingRequest) throws Exception {
   try {
     PuridiomProcessLoader processLoader =
         new PuridiomProcessLoader((String) incomingRequest.get("organizationId"));
     PuridiomProcess process = processLoader.loadProcess("currcode-add.xml");
     process.executeProcess(incomingRequest);
     if (process.getStatus() == Status.SUCCEEDED) {
       String errorMsg = (String) incomingRequest.get("duplicateCurrCodeErrorMsg");
       if (errorMsg != null && errorMsg.trim().length() > 0) {
         incomingRequest.put("viewPage", incomingRequest.get("duplicateCurrCodeFailurePage"));
       } else {
         incomingRequest.put("viewPage", incomingRequest.get("successPage"));
         /*
          *  kathleen added the following on 06-16-05
          *  so that after a currency code record is successfully added
          *  the user gets returned back to the currency code browse
          *  (browseName is declared on the jsp)
          */
         process = processLoader.loadProcess("browse-retrieve.xml");
         process.executeProcess(incomingRequest);
       }
     } else {
       incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage"));
     }
   } catch (Exception exception) {
     incomingRequest.put("errorMsg", exception.getMessage());
     incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage"));
     throw exception;
   } finally {
     if (incomingRequest.get("viewPage") == null) {
       incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage"));
     }
   }
   return incomingRequest;
 }
 public static void test(String[] args) throws Exception {
   PuridiomProcessLoader processLoader = new PuridiomProcessLoader();
   PuridiomProcess process = processLoader.loadProcess("invalloc-retrieve-all.xml");
   Map incomingRequest = new HashMap();
   // TODO add your parameters to incomingRequest here
   process.executeProcess(incomingRequest);
   System.out.println(incomingRequest);
 }
  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;
  }
 public static void main(String[] args) throws Exception {
   try {
     PuridiomProcessLoader processLoader = new PuridiomProcessLoader();
     PuridiomProcess process = processLoader.loadProcess("requisitionheader-add.xml");
     Map incomingRequest = new HashMap();
     // TODO add your parameters to incomingRequest here
     process.executeProcess(incomingRequest);
     System.out.println(incomingRequest);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 public Map handleRequest(Map incomingRequest) throws Exception {
   try {
     PuridiomProcessLoader processLoader = new PuridiomProcessLoader();
     PuridiomProcess process = processLoader.loadProcess("invmethod-update.xml");
     process.executeProcess(incomingRequest);
     if (process.getStatus() == Status.SUCCEEDED) {
       incomingRequest.put("viewPage", (String) incomingRequest.get("successPage"));
     } else {
       incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage"));
     }
   } catch (Exception exception) {
     incomingRequest.put("errorMsg", exception.getMessage());
     incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage"));
     throw exception;
   } finally {
     if (incomingRequest.get("viewPage") == null) {
       incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage"));
     }
   }
   return incomingRequest;
 }
  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 Map handleRequest(Map incomingRequest) throws Exception {
   try {
     PuridiomProcessLoader processLoader =
         new PuridiomProcessLoader((String) incomingRequest.get("organizationId"));
     PuridiomProcess process = processLoader.loadProcess("labels-delete-by-id-refresh.xml");
     process.executeProcess(incomingRequest);
     if (process.getStatus() == Status.SUCCEEDED) {
       incomingRequest.put("viewPage", incomingRequest.get("successPage"));
     } else {
       incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
     }
   } catch (Exception exception) {
     incomingRequest.put("errorMsg", exception.getMessage());
     incomingRequest.put("exception", exception);
     incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
     throw exception;
   } finally {
     if (incomingRequest.get("viewPage") == null) {
       incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
     }
   }
   return incomingRequest;
 }
 public Map handleRequest(Map incomingRequest) throws Exception {
   try {
     PuridiomProcessLoader processLoader =
         new PuridiomSupplierPortalProcessLoader((String) incomingRequest.get("organizationId"));
     PuridiomProcess process =
         processLoader.loadProcess("suppliercerts-checklistentry-retrieve-by-referencetype.xml");
     incomingRequest.put("ChecklistEntry_referenceType", "VCT");
     process.executeProcess(incomingRequest);
     if (process.getStatus() == Status.SUCCEEDED) {
       incomingRequest.put("viewPage", incomingRequest.get("successPage"));
     } else {
       incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
     }
   } catch (Exception exception) {
     incomingRequest.put("errorMsg", exception.getMessage());
     incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
     throw exception;
   } finally {
     if (incomingRequest.get("viewPage") == null) {
       incomingRequest.put("viewPage", incomingRequest.get("failurePage"));
     }
   }
   return incomingRequest;
 }
  public Object executeTask(Object object) throws Exception {

    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      if (incomingRequest.containsKey("InspectionLine_icInspNo")) {
        PuridiomProcessLoader processLoader =
            new PuridiomProcessLoader((String) incomingRequest.get("organizationId"));
        PuridiomProcess process = processLoader.loadProcess("inspection-update-line-row.xml");

        Object inspCritNoObj = incomingRequest.get("InspectionLine_critNo");
        String inspectCode = (String) incomingRequest.get("InspectionLine_inspectCode");
        if (!HiltonUtility.isEmpty(inspectCode)) {
          if (inspCritNoObj instanceof String[]) {
            int arraySize = ((String[]) inspCritNoObj).length;
            Set keySet = incomingRequest.keySet();

            for (int i = 0; i < arraySize; i++) {
              Map 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(
                  "InspectionLine_icInspNo", incomingRequest.get("InspectionLine_icInspNo"));
              updateParameters.put(
                  "InspectionLine_icInspLine", incomingRequest.get("InspectionLine_icInspLine"));

              Iterator iterator = keySet.iterator();
              while (iterator.hasNext()) {
                String key = (String) iterator.next();
                if (key.indexOf("InspectionLine_") == 0) {
                  Object obj = incomingRequest.get(key);
                  if (obj instanceof String[]) {
                    String arrayObj[] = (String[]) obj;
                    updateParameters.put(key, arrayObj[i]);
                  }
                }
              }
              updateParameters.put(
                  "InspectionLine_inspectCode", incomingRequest.get("InspectionLine_inspectCode"));
              process.executeProcess(updateParameters);
            }
          } else {
            incomingRequest.put(
                "InspectionLine_icInspNo", incomingRequest.get("InspectionLine_icInspNo"));
            incomingRequest.put(
                "InspectionLine_icInspLine", incomingRequest.get("InspectionLine_icInspLine"));
            incomingRequest.put("InspectionLine_seqNo", "1");
            process.executeProcess(incomingRequest);
          }
        }

      } else {
        throw new Exception("The value for InspectionLine_icInspNo was not found.");
      }

      this.setStatus(Status.SUCCEEDED);
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
  /* (non-Javadoc)
   * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      if (incomingRequest.containsKey("InspectionStd_standardCode")) {
        PuridiomProcessLoader processLoader =
            new PuridiomProcessLoader((String) incomingRequest.get("organizationId"));
        PuridiomProcess process = processLoader.loadProcess("inspectionstd-update-std-row.xml");
        Object inspObj = incomingRequest.get("InspectionStd_inspectCode");

        if (inspObj instanceof String[]) {
          int arraySize = ((String[]) inspObj).length;
          Set keySet = incomingRequest.keySet();

          for (int i = 0; i < arraySize; i++) {
            Map 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(
                "InspectionStd_icInspStd", incomingRequest.get("InspectionStd_icInspStd"));
            updateParameters.put(
                "InspectionStd_standardCode", incomingRequest.get("InspectionStd_standardCode"));
            updateParameters.put(
                "InspectionStd_description", incomingRequest.get("InspectionStd_description"));
            updateParameters.put("InspectionStd_cgdNo", incomingRequest.get("InspectionStd_cgdNo"));
            updateParameters.put(
                "InspectionStd_cgdRev", incomingRequest.get("InspectionStd_cgdRev"));
            updateParameters.put(
                "InspectionStd_inspectType", incomingRequest.get("InspectionStd_inspectType"));
            updateParameters.put(
                "InspectionStd_defaultFlag", incomingRequest.get("InspectionStd_defaultFlag_" + i));
            updateParameters.put("InspectionStd_owner", incomingRequest.get("InspectionStd_owner"));
            updateParameters.put(
                "InspectionStd_status", incomingRequest.get("InspectionStd_status"));
            updateParameters.put(
                "InspectionStd_dateEntered", incomingRequest.get("InspectionStd_dateEntered"));
            updateParameters.put(
                "InspectionStd_dateExpires", incomingRequest.get("InspectionStd_dateExpires"));

            Iterator iterator = keySet.iterator();
            while (iterator.hasNext()) {
              String key = (String) iterator.next();
              if (key.indexOf("InspectionStd_") == 0) {
                Object obj = incomingRequest.get(key);
                System.out.println(key + "=" + obj);
                if (obj instanceof String[]) {
                  String arrayObj[] = (String[]) obj;
                  updateParameters.put(key, arrayObj[i]);
                  System.out.println(key + "=" + arrayObj[i]);
                }
              }
            }
            process.executeProcess(updateParameters);
          }
        } else {
          incomingRequest.put(
              "InspectionStd_defaultFlag", incomingRequest.get("InspectionStd_defaultFlag_0"));
          process.executeProcess(incomingRequest);
        }
      } else {
        throw new Exception("Unable to find Standard Code");
      }

      this.setStatus(Status.SUCCEEDED);
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
  /* (non-Javadoc)
   * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {

    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      String organizationId = (String) incomingRequest.get("organizationId");
      String userDateFormat = (String) incomingRequest.get("userDateFormat");
      PropertiesManager propertiesManager = PropertiesManager.getInstance(organizationId);
      CatalogSecurity catalogSecurity = (CatalogSecurity) incomingRequest.get("catalogSecurity");
      String isCatalog = HiltonUtility.ckNull((String) incomingRequest.get("isCatalog"));
      String catalogId = (String) catalogSecurity.getCatalogId();
      String accesType = (String) catalogSecurity.getAccessType();
      String accessId = (String) catalogSecurity.getAccessId();

      if (HiltonUtility.isEmpty(userDateFormat)) {
        userDateFormat = propertiesManager.getProperty("MISC", "DateFormat", "MM-dd-yyyy");
      }

      String today = Dates.today(userDateFormat, (String) incomingRequest.get("userTimeZone"));

      if (isCatalog.equalsIgnoreCase("V")) {
        DBSession dbs = (DBSession) incomingRequest.get("dbsession");

        String queryString =
            "from CatalogSecurity as cs "
                + "where cs.catalogId = ? and cs.itemNumber != '0' "
                + "and cs.accessType = ? ";

        List resultList =
            dbs.query(
                queryString,
                new Object[] {catalogId, accesType},
                new Type[] {Hibernate.STRING, Hibernate.STRING});

        if (resultList != null && resultList.size() > 0) {
          for (int i = 0; i < resultList.size(); i++) {
            CatalogSecurity catalogItemSecurity = (CatalogSecurity) resultList.get(i);

            if (!accessId.equalsIgnoreCase(catalogItemSecurity.getAccessId())) {
              PuridiomProcessLoader processLoader =
                  new PuridiomProcessLoader((String) incomingRequest.get("organizationId"));
              PuridiomProcess process = processLoader.loadProcess("catalogsecurity-add.xml");

              Map updateParameters = new HashMap();

              updateParameters.put("organizationId", organizationId);
              updateParameters.put("dbsession", incomingRequest.get("dbsession"));

              updateParameters.put(
                  "CatalogSecurity_catalogId", (String) catalogSecurity.getCatalogId());
              updateParameters.put(
                  "CatalogSecurity_itemNumber", (String) catalogItemSecurity.getItemNumber());
              updateParameters.put(
                  "CatalogSecurity_accessType", (String) catalogSecurity.getAccessType());
              updateParameters.put(
                  "CatalogSecurity_accessId", (String) catalogSecurity.getAccessId());
              updateParameters.put("CatalogSecurity_owner", (String) catalogSecurity.getOwner());
              updateParameters.put("CatalogSecurity_dateEntered", today);
              updateParameters.put("CatalogSecurity_dateChanged", today);
              updateParameters.put(
                  "CatalogSecurity_lastChangedBy", (String) catalogSecurity.getCatalogId());

              process.executeProcess(updateParameters);

              catalogSecurity.setAccessId(accessId);

              dbs.add(catalogSecurity);
              if (dbs.getStatus() != Status.SUCCEEDED) {
                throw new TsaException(
                    "error ocurred at update catalog security from  for "
                        + catalogSecurity.getItemNumber());
              }
            }
          }
        }
      }

      this.setStatus(Status.SUCCEEDED);
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      Log.error(this, "An Error occurred at CatalogItemSecurityAddFromCatalog" + e);
      e.printStackTrace();
      throw e;
    }
    return result;
  }