Ejemplo n.º 1
0
  /* (non-Javadoc)
   * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    DBSession dbs = (DBSession) incomingRequest.get("dbsession");

    Catalog catalog = new Catalog();

    CatalogSetValues catalogValues = new CatalogSetValues();
    incomingRequest.put("catalog", catalog);
    catalog = (Catalog) catalogValues.executeTask(incomingRequest);

    dbs.add(catalog);
    this.setStatus(dbs.getStatus());

    return catalog;
  }
Ejemplo n.º 2
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      DocText docText = (DocText) incomingRequest.get("docText");
      if (docText == null) {
        throw new Exception("DocText was not found.");
      }

      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      dbs.add(docText);

      result = docText;
      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
Ejemplo n.º 3
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      ReportQueue reportQueue = (ReportQueue) incomingRequest.get("reportQueue");
      if (reportQueue == null) {
        throw new Exception("Report Queue record was not found.");
      }

      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      dbs.add(reportQueue);

      result = reportQueue;
      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
Ejemplo n.º 4
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      AuditRecord auditRecord = (AuditRecord) incomingRequest.get("auditRecord");
      if (auditRecord == null) {
        throw new Exception("auditRecord was not found.");
      }

      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      dbs.add(auditRecord);

      result = auditRecord;
      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
Ejemplo n.º 5
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      News news = (News) incomingRequest.get("news");
      if (news == null) {
        throw new Exception("News was not found.");
      }

      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      dbs.add(news);

      result = news;
      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
Ejemplo n.º 6
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      Country country = (Country) incomingRequest.get("country");
      if (country == null) {
        throw new Exception("Country was not found.");
      }

      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      dbs.add(country);

      result = country;
      this.setStatus(dbs.getStatus());
    } 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;
  }