private void initColumnsAdnWidths(CleanwiseUser appUser) {
    mShowPrice = appUser.getShowPrice();
    String showSize = mRequest.getParameter("showSize");
    if (Utility.isSet(showSize) && !Utility.isTrue(showSize)) {
      mShowSize = false;
    }
    if (!catalogOnly) {
      mColumnCount++;
    }

    if (mShowSize) {
      mColumnCount++;
    }
    if (mShowPrice) {
      mColumnCount++;
    }

    itmColumnWidth = new int[mColumnCount];
    int i = 0;

    if (!catalogOnly) {
      itmColumnWidth[i++] = 8; // empty
      itmColumnWidth[i++] = 8; // qty
      itmColumnWidth[i++] = 10; // sku
      itmColumnWidth[i++] = 40; // name
      if (mShowSize) {
        itmColumnWidth[i++] = 10; // size
      }
      // itmColumnWidth[i++] = 6;
      // itmColumnWidth[i++] = 6;
      if (mShowPrice) {
        itmColumnWidth[i++] = 16; // price
      }
      itmColumnWidth[i] = 8; // empty

    } else {

      itmColumnWidth[i++] = 10; // empty
      itmColumnWidth[i++] = 12; // sku
      itmColumnWidth[i++] = 36; // name
      if (mShowSize) {
        itmColumnWidth[i++] = 20; // size
      }
      // itmColumnWidth[i++] = 4;
      // itmColumnWidth[i++] = 3;
      if (mShowPrice) {
        itmColumnWidth[i++] = 16; // price
      }
      itmColumnWidth[i] = 3; // spl
    }
  }
Example #2
0
  protected String getField(
      Segment pSegment, int pFieldNum, boolean pMandatoryFl, String pErrorMessage) {
    DataElement de = null;
    String val = null;
    String err = null;

    try {
      de = pSegment.getDataElement(pFieldNum);
    } catch (Exception exc) {
      if (pMandatoryFl) {
        err = pErrorMessage + " (1)";
      }
    }
    if (err == null && de == null && pMandatoryFl) {
      err = pErrorMessage + " (2)";
    }
    if (err == null && de != null) {
      try {
        val = de.get();
      } catch (Exception exc) {
      }
      if (!Utility.isSet(val) && pMandatoryFl) {
        err = pErrorMessage + " (3)";
      }
    }
    if (err != null) {
      errorMsgs.add(err);
    }
    return val;
  }
Example #3
0
  private String getSearchSqlByFilterName(String filterName, String filterVal, int filterType) {
    String nameFilter = "";
    if (Utility.isSet(filterVal)) {

      switch (filterType) {
        case QueryRequest.BEGINS:
          nameFilter =
              " and UPPER("
                  + filterName
                  + ") LIKE UPPER('"
                  + filterVal.replaceAll("'", "''")
                  + "%') \n";
          break;
        case QueryRequest.CONTAINS:
          nameFilter =
              " and UPPER("
                  + filterName
                  + ") LIKE UPPER('%"
                  + filterVal.replaceAll("'", "''")
                  + "%') \n";
          break;
      }
    }
    return nameFilter;
  }
 public static Properties getUiProperties(HttpServletRequest pRequest)
     throws FileNotFoundException, IOException {
   Properties configProps = new Properties();
   String fileName = ClwCustomizerMyFax.getAbsFilePath(pRequest, "config.txt");
   if (Utility.isSet(fileName)) {
     FileInputStream configIS = new FileInputStream(fileName);
     configProps.load(configIS);
   }
   return configProps;
 }
Example #5
0
 public void extractShipByN1(Loop inLoop) throws OBOEException {
   Loop loop = null;
   int numberInVector = inLoop.getCount("N1");
   for (int i = 0; i < numberInVector; i++) {
     loop = inLoop.getLoop("N1", i);
     if (loop == null) return;
     Segment segment = loop.getSegment("N1");
     String qualif = getField(segment, 1, false, null);
     if ("ST".equals(qualif)) {
       String shipToName = getField(segment, 2, false, null);
       ediInp856Vw.setShipToName(shipToName);
       String identQualifier = getField(segment, 3, false, null);
       if ("01".equals(identQualifier)) {
         String shipToCode = getField(segment, 4, false, null);
         ediInp856Vw.setShipToCode(shipToCode);
       }
       extractShipFromN4(loop);
     } else {
       String distName = qualif;
       ediInp856Vw.setDistName(distName);
       String distCodeQualifier = getField(segment, 2, false, null);
       ediInp856Vw.setDistIdentCodeQualif(distCodeQualifier);
       if (!Utility.isSet(distName) && !Utility.isSet(distCodeQualifier)) {
         errorMsgs.add("No distributor info in segment N1");
         setValid(false);
         return;
       }
       if (Utility.isSet(distCodeQualifier)) {
         String distCode = getField(segment, 3, false, null);
         ediInp856Vw.setDistIdentCode(distCode);
         if (!Utility.isSet(distCode) && !Utility.isSet(distName)) {
           errorMsgs.add("No distributor info in segment N1");
           setValid(false);
           return;
         }
       }
     }
   }
 }
Example #6
0
 public void extractPurchaseOrderReferencePRF(Loop inLoop) throws OBOEException {
   Segment segment = null;
   try {
     segment = inLoop.getSegment("PRF");
   } catch (Exception exc) {
   }
   if (segment == null) {
     return;
   }
   String purchaseOrderNumber = getField(segment, 1, false, null);
   if (Utility.isSet(ediInp856Vw.getDistOrderNum())
       && !ediInp856Vw.getDistOrderNum().equals(purchaseOrderNumber)) {
     ediHandler.appendIntegrationRequest(ediInp856Vw);
     ediInp856Vw = ediInp856Vw.copy();
     ediInp856Vw.setItems(new EdiInp856ItemViewVector());
   }
   ediInp856Vw.setDistOrderNum(purchaseOrderNumber);
   return;
 }
  public static Object getJavaObject(HttpServletRequest pRequest, String pFullClassName)
      throws Exception {
    HttpSession session = pRequest.getSession();
    CleanwiseUser appUser = (CleanwiseUser) session.getAttribute(Constants.APP_USER);
    StoreData storeD = appUser.getUserStore();
    AccountData accountD = appUser.getUserAccount();
    int storeId = 0;
    int accountId = 0;
    if (storeD != null) storeId = storeD.getBusEntity().getBusEntityId();
    if (accountD != null) accountId = accountD.getBusEntity().getBusEntityId();
    String key = storeId + "@" + accountId + "@" + pFullClassName;
    Object javaObj = session.getAttribute(key);
    if (javaObj == null) {
      ArrayList prefAL = new ArrayList();
      String path = "";
      PropertyData storePrefixPD = storeD.getPrefix();
      if (storePrefixPD != null) {
        path = Utility.strNN(storePrefixPD.getValue());
      }
      String accountDir = accountD.getPropertyValue(RefCodeNames.PROPERTY_TYPE_CD.ACCOUNT_FOLDER);
      if (Utility.isSet(accountDir)) {
        path += "/" + accountDir;
      }
      path = path.replace('\\', '/').toLowerCase();
      String[] pathDirA = Utility.parseStringToArray(path, "/");
      String pathInc = null;
      for (int ii = 0; ii < pathDirA.length; ii++) {
        String ss = pathDirA[ii];
        if (Utility.isSet(ss)) {
          if (pathInc == null) {
            pathInc = "." + ss;
          } else {
            pathInc += "." + ss;
          }
          pathDirA[ii] = pathInc;
        } else {
          pathDirA[ii] = null;
        }
      }

      int ll = pFullClassName.lastIndexOf(".");
      String defaultPath = pFullClassName.substring(0, ll);
      String className = pFullClassName.substring(ll);
      Class clazz = null;
      for (int ii = pathDirA.length - 1; ii >= 0; ii--) {
        if (pathDirA[ii] != null) {
          String fullClassNameTest = defaultPath + pathDirA[ii] + className;
          try {
            clazz = Class.forName(fullClassNameTest);
            if (clazz != null) {
              break;
            }
          } catch (Exception exc) {
          }
        }
      }
      if (clazz == null) {
        clazz = Class.forName(pFullClassName);
      }
      if (clazz != null) {
        javaObj = clazz.newInstance();
        session.setAttribute(key, javaObj);
      }
    }
    return javaObj;
  }
  /**
   * Returns the store specific/account specific path for the image. @see storeFileImagePath
   * and @see getSIP
   */
  private static String getSIP(
      String pPortal,
      String pFileName,
      String storePrefix,
      Locale locale,
      HashMap filePathHM,
      StoreData storeD,
      AccountData accountD,
      String webDir,
      String rootDir,
      boolean absolutePath) {
    if (pFileName == null) {
      return "";
    }
    pFileName = pFileName.trim();

    // guess at some values if not provided
    if (locale == null) {
      if (accountD != null && Utility.isSet(accountD.getBusEntity().getLocaleCd())) {
        locale = Utility.parseLocaleCode(accountD.getBusEntity().getLocaleCd());
      }
      if (storeD != null && Utility.isSet(storeD.getBusEntity().getLocaleCd())) {
        locale = Utility.parseLocaleCode(storeD.getBusEntity().getLocaleCd());
      }
    }
    if (filePathHM == null) {
      filePathHM = new HashMap();
    }
    if (rootDir == null) {
      rootDir = ClwCustomizerMyFax.getStoreDir();
    }
    if (!Utility.isSet(storePrefix)) {
      storePrefix = storeD.getPrefix().getValue();
    }
    if (!Utility.isSet(webDir)) {
      webDir = System.getProperty("webdeploy");
    }

    if (pPortal == null) pPortal = "store";
    // Make key

    int storeId = 0;
    int accountId = 0;
    String accountDir = "";

    if (storeD != null) {
      storeId = storeD.getBusEntity().getBusEntityId();
    }

    if (accountD != null) {
      accountId = accountD.getBusEntity().getBusEntityId();
      accountDir = accountD.getPropertyValue(RefCodeNames.PROPERTY_TYPE_CD.ACCOUNT_FOLDER);
    }

    String key =
        pPortal
            + "@"
            + locale
            + "@"
            + pFileName
            + "@"
            + storeId
            + "@"
            + accountId
            + "@"
            + absolutePath;
    String resultFilePath = (String) filePathHM.get(key);
    if (resultFilePath != null) {
      return resultFilePath;
    }

    if (storePrefix == null) storePrefix = "";

    // String webDir = System.getProperty("webdeploy");

    if (webDir == null) webDir = "";
    int ind = webDir.indexOf("deploy");
    if (ind < 0) {
      (new Exception("Invalid current directory: " + webDir)).printStackTrace();
      return "";
    }
    // trying to find file
    String storeAcctPrefix =
        (Utility.isSet(accountDir)) ? storePrefix + "/" + accountDir : storePrefix;
    StringTokenizer tok = new StringTokenizer(storeAcctPrefix, "/");
    String[] storeAcctPrefixA = new String[tok.countTokens() + 1];
    storeAcctPrefixA[0] = "";
    ind = 1;
    while (tok.hasMoreTokens()) {
      String nextToken = tok.nextToken();
      if (ind == 1) {
        storeAcctPrefixA[ind] = nextToken;
      } else {
        storeAcctPrefixA[ind] = storeAcctPrefixA[ind - 1] + "/" + nextToken;
      }
      ind++;
    }
    String absPath = "";
    String filePath = "";
    boolean foundFl = false;
    for (int ii = storeAcctPrefixA.length - 1; ii >= 0; ii--) {
      filePath =
          "/" + pPortal + "/" + storeAcctPrefixA[ii] + "/" + locale + "/" + "images/" + pFileName;
      absPath = webDir + filePath;
      File tf = new File(absPath);
      if (tf.exists()) {
        foundFl = true;
        break;
      }

      filePath = "/" + pPortal + "/" + storeAcctPrefixA[ii] + "/" + "images/" + pFileName;
      absPath = webDir + filePath;
      tf = new File(absPath);
      if (tf.exists()) {
        foundFl = true;
        break;
      }

      filePath = "/" + pPortal + "/" + storeAcctPrefixA[ii] + "/" + "images/" + pFileName;
      absPath = webDir + filePath;
      tf = new File(absPath);
      if (tf.exists()) {
        foundFl = true;
        break;
      }

      /*
      filePath = "/" + pPortal + "/" + storeAcctPrefixA[ii] +
                 "/" + "images/"+ pFileName;
      absPath =  webDir + filePath;
      tf = new File(absPath);
      if(tf.exists()) {
          foundFl = true;
          break;
      }
      */
    }

    if (absolutePath) {
      filePath = absPath;
    } else {
      filePath = "/" + rootDir + filePath;
    }
    if (foundFl) {
      filePathHM.put(key, filePath);
    }
    return filePath;
  }
  public static String getStoreFilePath(
      HttpServletRequest pRequest, String pPortal, String pFileName) {
    if (pFileName == null) {
      return "";
    }
    pFileName = pFileName.trim();
    HttpSession session = pRequest.getSession();
    HashMap filePathHM = (HashMap) session.getAttribute("store.files");
    if (filePathHM == null) {
      filePathHM = new HashMap();
      session.setAttribute("store.files", filePathHM);
    }
    if (pPortal == null) pPortal = "store";
    // Make key
    int storeId = 0;
    int accountId = 0;
    CleanwiseUser user = (CleanwiseUser) session.getAttribute(Constants.APP_USER);
    String accountDir = "";
    if (user != null) {
      StoreData storeD = user.getUserStore();
      if (storeD != null) {
        storeId = storeD.getBusEntity().getBusEntityId();
      }
      AccountData accountD = user.getUserAccount();
      if (accountD != null) {
        accountId = accountD.getBusEntity().getBusEntityId();
        accountDir = accountD.getPropertyValue(RefCodeNames.PROPERTY_TYPE_CD.ACCOUNT_FOLDER);
      }
    }
    Locale locale = ClwI18nUtil.getUserLocale(pRequest);

    String key = pPortal + "@" + locale + "@" + pFileName + "@" + storeId + "@" + accountId;
    String resultFilePath = (String) filePathHM.get(key);
    if (resultFilePath != null) {
      return resultFilePath;
    }

    String storeDir = (String) session.getAttribute("store.dir") + ".clw";
    String storePrefix = (String) session.getAttribute("pages.store.prefix");
    if (storePrefix == null) storePrefix = "";

    // String webDir = System.getProperty("webdeploy");

    String webDir = (String) session.getAttribute("webdeploy");

    if (webDir == null) webDir = "";
    int ind = webDir.indexOf("deploy");
    if (ind < 0) {
      (new Exception("Invalid current directory: " + webDir)).printStackTrace();
      return "";
    }
    // trying to find file
    String storeAcctPrefix =
        (Utility.isSet(accountDir)) ? storePrefix + "/" + accountDir : storePrefix;
    StringTokenizer tok = new StringTokenizer(storeAcctPrefix, "/");
    String[] storeAcctPrefixA = new String[tok.countTokens() + 1];
    storeAcctPrefixA[0] = "";
    ind = 1;
    while (tok.hasMoreTokens()) {
      String nextToken = tok.nextToken();
      if (ind == 1) {
        storeAcctPrefixA[ind] = nextToken;
      } else {
        storeAcctPrefixA[ind] = storeAcctPrefixA[ind - 1] + "/" + nextToken;
      }
      ind++;
    }
    String absPath = "";
    String filePath = "";
    boolean foundFl = false;
    for (int ii = storeAcctPrefixA.length - 1; ii >= 0; ii--) {
      filePath = "/" + pPortal + "/" + storeAcctPrefixA[ii] + "/" + locale + "/" + pFileName;

      absPath = webDir + filePath;
      File tf = new File(absPath);
      if (tf.exists()) {
        foundFl = true;
        break;
      }

      if (Utility.isSet(locale.getLanguage())) {
        filePath =
            "/"
                + pPortal
                + "/"
                + storeAcctPrefixA[ii]
                + "/"
                + locale.getLanguage()
                + "/"
                + pFileName;
        absPath = webDir + filePath;
        tf = new File(absPath);
        if (tf.exists()) {
          foundFl = true;
          break;
        }
      }

      filePath = "/" + pPortal + "/" + storeAcctPrefixA[ii] + "/" + pFileName;
      absPath = webDir + filePath;
      tf = new File(absPath);
      if (tf.exists()) {
        foundFl = true;
        break;
      }

      /*
      filePath = "/" + pPortal  + "/" + storeAcctPrefixA[ii] +  "/" + pFileName;
      absPath =  webDir + filePath;
      tf = new File(absPath);
      if(tf.exists()) {
          foundFl = true;
          break;
      }
      */
    }

    if (foundFl) {
      filePathHM.put(key, filePath);
    }
    return filePath;
  }
Example #10
0
  private PdfPTable getNonPersonalized(UserShopForm sForm) throws DocumentException {

    PdfPTable personalInfo = new PdfPTable(2);
    personalInfo.setWidthPercentage(50);
    personalInfo.setWidths(sizes);
    personalInfo.getDefaultCell().setBorder(borderType);

    String dateStr = ClwI18nUtil.getMessage(mRequest, "shop.og.text.date:", null);
    personalInfo.addCell(makePhrase(dateStr + " ", smallHeading, false));
    personalInfo.addCell(
        makePhrase("_____________________________________________ ", smallHeading, true));

    personalInfo.addCell(makePhrase("", smallHeading, false));
    personalInfo.addCell(makePhrase("", smallHeading, true));

    String submittedByStr = ClwI18nUtil.getMessage(mRequest, "shop.og.text.submittedBy:", null);
    personalInfo.addCell(makePhrase(submittedByStr + " ", smallHeading, false));
    personalInfo.addCell(
        makePhrase("_____________________________________________ ", smallHeading, true));

    personalInfo.addCell(makePhrase("", smallHeading, false));
    personalInfo.addCell(makePhrase("", smallHeading, true));

    String companyNameStr = ClwI18nUtil.getMessage(mRequest, "shop.og.text.companyName:", null);
    personalInfo.addCell(makePhrase(companyNameStr + " ", smallHeading, false));
    personalInfo.addCell(
        makePhrase("_____________________________________________ ", smallHeading, true));

    personalInfo.addCell(makePhrase("", smallHeading, false));
    personalInfo.addCell(makePhrase("", smallHeading, true));

    String siteNumStr = ClwI18nUtil.getMessage(mRequest, "shop.og.text.site#:", null);
    personalInfo.addCell(makePhrase(siteNumStr + " ", smallHeading, false));
    personalInfo.addCell(
        makePhrase("_____________________________________________ ", smallHeading, true));

    personalInfo.addCell(makePhrase("", smallHeading, false));
    personalInfo.addCell(makePhrase("", smallHeading, true));

    String address1Str = ClwI18nUtil.getMessage(mRequest, "shop.og.text.address1:", null);
    personalInfo.addCell(makePhrase(address1Str + " ", smallHeading, false));
    personalInfo.addCell(
        makePhrase("_____________________________________________ ", smallHeading, true));

    personalInfo.addCell(makePhrase("", smallHeading, false));
    personalInfo.addCell(makePhrase("", smallHeading, true));

    String address2Str = ClwI18nUtil.getMessage(mRequest, "shop.og.text.address2:", null);
    personalInfo.addCell(makePhrase(address2Str + " ", smallHeading, false));
    personalInfo.addCell(
        makePhrase("_____________________________________________ ", smallHeading, true));

    personalInfo.addCell(makePhrase("", smallHeading, false));
    personalInfo.addCell(makePhrase("", smallHeading, true));

    String address3Str = ClwI18nUtil.getMessage(mRequest, "shop.og.text.address3:", null);
    personalInfo.addCell(makePhrase(address3Str + " ", smallHeading, false));
    personalInfo.addCell(
        makePhrase("_____________________________________________ ", smallHeading, true));

    personalInfo.addCell(makePhrase("", smallHeading, false));
    personalInfo.addCell(makePhrase("", smallHeading, true));

    String cityStr = ClwI18nUtil.getMessage(mRequest, "shop.og.text.city:", null);
    personalInfo.addCell(makePhrase(cityStr + " ", smallHeading, false));
    personalInfo.addCell(
        makePhrase("_____________________________________________ ", smallHeading, true));

    personalInfo.addCell(makePhrase("", smallHeading, false));
    personalInfo.addCell(makePhrase("", smallHeading, true));

    if (sForm.getAppUser().getUserStore().isStateProvinceRequired()) {
      String state = sForm.getAppUser().getSite().getSiteAddress().getStateProvinceCd();
      if (Utility.isSet(state)) {
        String stateStr = ClwI18nUtil.getMessage(mRequest, "shop.og.text.state:", null);
        personalInfo.addCell(makePhrase(stateStr + " ", smallHeading, false));
        personalInfo.addCell(
            makePhrase("_____________________________________________ ", smallHeading, true));
      }
    }

    personalInfo.addCell(makePhrase("", smallHeading, false));
    personalInfo.addCell(makePhrase("", smallHeading, true));

    String postalCodeStr = ClwI18nUtil.getMessage(mRequest, "shop.og.text.postalCode:", null);
    personalInfo.addCell(makePhrase(postalCodeStr + " ", smallHeading, false));
    personalInfo.addCell(
        makePhrase("_____________________________________________ ", smallHeading, true));

    personalInfo.addCell(makePhrase("", smallHeading, false));
    personalInfo.addCell(makePhrase("", smallHeading, true));

    String phoneNumStr = ClwI18nUtil.getMessage(mRequest, "shop.og.text.phone#:", null);
    personalInfo.addCell(makePhrase(phoneNumStr + " ", smallHeading, false));
    personalInfo.addCell(
        makePhrase("_____________________________________________ ", smallHeading, true));

    personalInfo.addCell(makePhrase("", smallHeading, false));
    personalInfo.addCell(makePhrase("", smallHeading, true));

    String orderPlacedByStr = ClwI18nUtil.getMessage(mRequest, "shop.og.text.orderPlacedBy:", null);
    personalInfo.addCell(makePhrase(orderPlacedByStr + " ", smallHeading, false));
    personalInfo.addCell(
        makePhrase("_____________________________________________ ", smallHeading, true));

    return personalInfo;
  }
Example #11
0
  /**
   * <code>getAccountsUIByCriteria</code> returns a vector of AccountUIView's meeting the criteria
   * of the BusEntitySearchCriteria.
   *
   * @param pCrit a <code>BusEntitySearchCriteria</code> value the criteria
   * @return a <code>AccountUIViewVector</code> value
   * @exception SQLException if an error occurs
   */
  public AccountUIViewVector getAccountsUIByCriteria(BusEntitySearchCriteria pCrit)
      throws RemoteException {
    Connection conn = null;
    AccountUIViewVector acctVec = new AccountUIViewVector();
    try {
      // USER FILTER ==========================================================//
      Integer userId = null;
      String userFilterForAccounts = "";
      if (pCrit.getUserIds() != null && pCrit.getUserIds().size() > 0) {
        userId = (Integer) pCrit.getUserIds().get(0);
        userFilterForAccounts = getUserFilterForAccounts(userId.intValue());
      }
      // STORE FILTER===========================================================//
      Integer storeId = null;
      if (pCrit.getStoreBusEntityIds() != null && pCrit.getStoreBusEntityIds().size() > 0) {
        storeId = (Integer) pCrit.getStoreBusEntityIds().get(0);
      } else {
        throw new RemoteException("Store ID can't be null. ");
      }
      String storeFilter =
          "(select STORE_DIM_ID from DW_STORE_DIM \n" + "  where STORE_ID = " + storeId + " ) \n";

      String storeFilterForAccounts = getStoreFilterForAccounts(storeId.intValue());

      // ACCOUNT NAMES FILTER==================================================//
      String accountNameFilter =
          getSearchSqlByFilterName(
              "JD_ACCOUNT_NAME", pCrit.getSearchName(), pCrit.getSearchNameType());
      String accountIdFilter =
          (Utility.isSet(pCrit.getSearchId())) ? " and JD_ACCOUNT_ID = " + pCrit.getSearchId() : "";
      // ========================================================================//
      conn = getReportConnection();
      String sql =
          "select  \n "
              + " wm_concat(ACCOUNT_DIM_ID) ACCOUNT_DIM_IDS, \n"
              + " ACCOUNT_ID,  \n"
              + " JD_ACCOUNT_NAME, JD_ACCOUNT_ID, \n"
              + " JD_ACCOUNT_CITY, JD_ACCOUNT_STATE, \n"
              + " JD_MARKET, JD_ACCOUNT_STATUS_CD \n"
              + "from DW_ACCOUNT_DIM where \n"
              + "   STORE_DIM_ID = "
              + storeFilter
              + " \n"
              +
              /*            " and  account_ID in ( " + storeFilterForAccounts +") \n"
               */
              userFilterForAccounts
              + accountIdFilter
              + accountNameFilter
              + " group by  \n "
              + "    ACCOUNT_ID,  \n"
              + "    JD_ACCOUNT_NAME, JD_ACCOUNT_ID, \n"
              + "    JD_ACCOUNT_CITY, JD_ACCOUNT_STATE,  \n"
              + "    JD_MARKET, JD_ACCOUNT_STATUS_CD \n"
              + " order by JD_ACCOUNT_NAME ";

      Statement stmt = conn.createStatement();
      ResultSet rs = stmt.executeQuery(sql);
      if (pCrit.getResultLimit() != QueryRequest.UNLIMITED) {
        stmt.setMaxRows(2000);
      }
      int rowId = 0;
      while (rs.next()) {
        AccountUIView aui = AccountUIView.createValue();
        rowId--;
        String accountDimIds =
            (rs.getString("ACCOUNT_DIM_IDS") != null) ? rs.getString("ACCOUNT_DIM_IDS") : "";

        BusEntityData be = new BusEntityData();
        be.setBusEntityId(rowId);
        be.setShortDesc(
            (rs.getString("JD_ACCOUNT_NAME") != null) ? rs.getString("JD_ACCOUNT_NAME") : "");
        be.setBusEntityStatusCd(
            (rs.getString("JD_ACCOUNT_STATUS_CD") != null)
                ? rs.getString("JD_ACCOUNT_STATUS_CD")
                : "");

        PropertyData pd = new PropertyData();
        pd.setValue((rs.getString("JD_MARKET") != null) ? rs.getString("JD_MARKET") : "");

        AddressData ad = new AddressData();
        ad.setAddress1("");
        ad.setCity(
            (rs.getString("JD_ACCOUNT_CITY") != null) ? rs.getString("JD_ACCOUNT_CITY") : "");
        ad.setStateProvinceCd(
            (rs.getString("JD_ACCOUNT_STATE") != null) ? rs.getString("JD_ACCOUNT_STATE") : "");

        aui.setAccountDimIds(accountDimIds);
        aui.setBusEntity(be);
        aui.setAccountType(pd);
        aui.setPrimaryAddress(ad);
        acctVec.add(aui);
      }
      stmt.close();
    } catch (Exception exc) {
      exc.printStackTrace();
      throw processException(exc);
    } finally {
      closeConnection(conn);
    }
    return acctVec;
  }
Example #12
0
  public void extractItemIdentificationLIN(Loop inLoop) throws OBOEException {
    Segment segment = null;
    boolean ignoreMissingLineInfo =
        Utility.isTrue(
            getTranslator()
                .getConfigurationProperty(
                    RefCodeNames.ENTITY_PROPERTY_TYPE.IGNORE_MISSING_LINE_INFO));
    // valid = false;
    try {
      segment = inLoop.getSegment("LIN");
    } catch (Exception exc) {
      exc.printStackTrace();
    }
    if (segment == null && !ignoreMissingLineInfo) {
      errorMsgs.add("Segment LIN missing");
      setValid(false);
      return;
    }
    String orderLineNumS = getField(segment, 1, true, "Missing order line number in LIN segment");
    if (orderLineNumS == null && !ignoreMissingLineInfo) {
      errorMsgs.add("Order Line Number in LIN segment is null");
      setValid(false);
      return;
    }

    int orderLineNum = 0;
    try {
      orderLineNum = Integer.parseInt(orderLineNumS);
    } catch (Exception exc) {
      // JD China will use line num 3.1 for line 3 if order is split for shipment.
      int ix = orderLineNumS.indexOf('.');
      if (ix > 0) {
        String orderLineNumSs = orderLineNumS.substring(0, ix);
        try {
          orderLineNum = Integer.parseInt(orderLineNumSs);
        } catch (Exception ex) {
        }
      }

      if (orderLineNum == 0 && !ignoreMissingLineInfo) {
        errorMsgs.add("Invalid value of order line number in LIN segment: " + orderLineNumS);
        setValid(false);
        return;
      }
    }

    ediInp856ItemVw.setPurchOrderLineNum(orderLineNum);
    for (int fieldNum = 1; fieldNum <= 7; fieldNum += 2) {
      try {
        String productNumQualifier = getField(segment, 1 + fieldNum, false, "");
        if (productNumQualifier == null) {
          // errorMsgs.add("Product Service Id Qualifier is null");
          // setValid(false);
          // return;
          break;
        }
        String productNum = getField(segment, 1 + fieldNum + 1, false, "");
        if ("VP".equals(productNumQualifier) || "VN".equals(productNumQualifier)) {
          ediInp856ItemVw.setDistSkuNum(productNum);
        }
      } catch (Exception exc) {
        break;
      }
    }
    return;
  }
Example #13
0
  /*
   *@param  pCriteria            List of SearchCriteria objects
   *@return  a set of ItemView objects
   *@exception  RemoteException
   */
  public ItemViewVector searchStoreItems(List pCriteria, boolean pDistInfoFl)
      throws RemoteException {
    Connection con = null;
    try {
      con = getReportConnection();

      Integer storeIdI = new Integer(0);
      String categCond = "";
      String shortDescCond = "";
      String manufCond = "";
      String manufSkuCond = "";
      String distSkuCond = "";

      String storeFilter = "";
      /////////////////////
      // Create a set of filters
      for (Iterator iter = pCriteria.iterator(); iter.hasNext(); ) {
        SearchCriteria sc = (SearchCriteria) iter.next();
        String name = sc.getName();
        Object objValue = sc.getObjectValue();
        String strValue = (objValue instanceof String) ? ((String) objValue).trim() : "";
        if (SearchCriteria.STORE_ID.equals(name)) {
          storeIdI = (Integer) objValue;
          storeFilter =
              "select STORE_DIM_ID from DW_STORE_DIM \n"
                  + "  where STORE_ID = "
                  + storeIdI
                  + "  \n";

        } else if (SearchCriteria.CATALOG_CATEGORY.equals(name)) {
          String subStr = " like '%" + strValue.toUpperCase().replaceAll("'", "''") + "%' \n";
          categCond =
              "    and (UPPER(JD_CATEGORY1) "
                  + subStr
                  + " or  \n"
                  + "         UPPER(JD_CATEGORY2) "
                  + subStr
                  + " or  \n"
                  + "         UPPER(JD_CATEGORY3) "
                  + subStr
                  + ") \n";
        } else if (SearchCriteria.PRODUCT_SHORT_DESC.equals(name)) {
          shortDescCond =
              " and UPPER(JD_ITEM_DESC) like '%"
                  + strValue.toUpperCase().replaceAll("'", "''")
                  + "%' \n";
        } else if (SearchCriteria.MANUFACTURER_SHORT_DESC.equals(name)) {
          manufCond =
              " and UPPER(JD_MANUF_NAME) like '%"
                  + strValue.toUpperCase().replaceAll("'", "''")
                  + "%' \n";
        } else if (SearchCriteria.MANUFACTURER_SKU_NUMBER.equals(name)) {
          manufSkuCond =
              " and UPPER(JD_MANUF_SKU) like '%"
                  + strValue.toUpperCase().replaceAll("'", "''")
                  + "%' \n";
        } else if (SearchCriteria.DISTRIBUTOR_SKU_NUMBER.equals(name)) {
          distSkuCond =
              " and UPPER(JD_DIST_SKU) like '%"
                  + strValue.toUpperCase().replaceAll("'", "''")
                  + "%' \n";
        }
      }

      // Get catalog id --------------------------------------------------------//
      /*       int catalogId = 0;
             String sql = "select distinct STORE_CATALOG_ID from DW_CATEGORY_DIM \n" +
                          " where STORE_DIM_ID IN (" + storeFilter  + ")";
             log(
             "DWOperationBean ---------------------------> sql1: " + sql);

             Statement stmt = con.createStatement();
             ResultSet rs = stmt.executeQuery(sql);
             int count = 0;
             while (rs.next()) {
               count++;
               catalogId = rs.getInt(1);
             }
             rs.close();
             stmt.close();
             if (count == 0) {
               String errorMess = "No catalog for store. Store id: " + storeIdI;
               throw new Exception(errorMess);
             }
             if (count > 1) {
               String errorMess = "Multiple active catalogs for store. Store id: " +
                                  storeIdI;
               throw new Exception(errorMess);
             }
      */
      // ---------------------------------------------------------------------//
      String sql =
          "select                \n"
              + " id.ITEM_DIM_ID,      \n"
              + " JD_ITEM_DESC  ,      \n"
              + " JD_ITEM_PACK ,       \n"
              + " JD_ITEM_UOM ,        \n"
              + " JD_MANUF_SKU,        \n"
              + " JD_MANUF_NAME,        \n"
              + " JD_CATEGORY1         \n";

      String fromSql =
          " from DW_ITEM_DIM id,                               \n "
              + "      DW_CATEGORY_DIM cd,                           \n"
              + "      DW_MANUFACTURER_DIM md                        \n";
      String whereSql =
          " where id.CATEGORY_DIM_ID = cd.CATEGORY_DIM_ID     \n"
              +
              //          "    and cd.STORE_CATALOG_ID = " + catalogId + "    \n" +
              "    and cd.STORE_DIM_ID IN ("
              + storeFilter
              + ")  \n"
              + "    and md.MANUFACTURER_DIM_ID  = id.MANUFACTURER_DIM_ID   \n";

      // ---------------------------------------------------------------------//

      if (pDistInfoFl) {
        sql +=
            " , JD_DIST_SKU,                                       \n"
                + " (select JD_DIST_NAME from DW_DISTRIBUTOR_DIM dd      \n"
                + "   where DISTRIBUTOR_DIM_ID  = did.DISTRIBUTOR_DIM_ID \n"
                + " ) JD_DIST_NAME                                       \n";

        fromSql += "    ,DW_ITEM_DISTRIBUTOR did  \n";
        whereSql += "    and id.ITEM_DIM_ID   = did.ITEM_DIM_ID (+)         \n" + distSkuCond;
      }
      sql += fromSql + whereSql;
      sql += categCond + shortDescCond + manufCond + manufSkuCond;
      sql += " order by JD_MANUF_SKU ";

      Statement stmt = con.createStatement();
      ResultSet rs = stmt.executeQuery(sql);
      ItemViewVector itemVwV = new ItemViewVector();
      while (rs.next()) {
        ItemView itemVw = ItemView.createValue();
        itemVwV.add(itemVw);
        itemVw.setStoreId(storeIdI.intValue());
        //         itemVw.setCatalogId(catalogId);

        itemVw.setItemId(rs.getInt("ITEM_DIM_ID"));
        itemVw.setName(Utility.strNN(rs.getString("JD_ITEM_DESC")));
        itemVw.setSku(Utility.strNN(rs.getString("JD_MANUF_SKU")));
        itemVw.setUom(Utility.strNN(rs.getString("JD_ITEM_UOM")));
        itemVw.setPack(Utility.strNN(rs.getString("JD_ITEM_PACK")));
        itemVw.setCategory(Utility.strNN(rs.getString("JD_CATEGORY1")));
        itemVw.setManufName(Utility.strNN(rs.getString("JD_MANUF_NAME")));
        itemVw.setManufSku(Utility.strNN(rs.getString("JD_MANUF_SKU")));
        if (pDistInfoFl) {
          itemVw.setDistId(0);
          itemVw.setDistName(Utility.strNN(rs.getString("JD_DIST_NAME")));
          itemVw.setDistSku(Utility.strNN(rs.getString("JD_DIST_SKU")));
        } else {
          itemVw.setDistId(0);
          itemVw.setDistName("");
          itemVw.setDistSku("");
        }
        itemVw.setSelected(false);
      }
      rs.close();
      stmt.close();
      return itemVwV;
    } catch (Exception e) {
      e.printStackTrace();
      throw new RemoteException(e.getMessage());
    } finally {
      closeConnection(con);
    }
  }
Example #14
0
  public static void buildMenuStr(
      MenuItemView item, StringBuffer menuContent, String uid, int level) {
    if (item.getSubItems() != null && !item.getSubItems().isEmpty()) {
      Iterator it = item.getSubItems().iterator();
      level++;
      String displayStatus = item.getDisplayStatus();
      String ulClassName = null;
      if (MenuItemView.DISPLAY_STATUS.OPEN.equals(displayStatus)
          || Constants.ROOT.equals(item.getKey())) {
        ulClassName = "openelemBlocked";
      } else if (MenuItemView.DISPLAY_STATUS.CLOSE.equals(displayStatus)) {
        ulClassName = "closeelem";
      }

      menuContent.append("<");
      menuContent.append("table");
      menuContent.append(
          Utility.isSet(item.getKey()) ? " id=" + Utility.strNN(uid) + item.getKey() : "");
      menuContent.append(Utility.isSet(ulClassName) ? " class=" + ulClassName : "");
      menuContent.append(">");

      while (it.hasNext()) {

        MenuItemView menuItem = (MenuItemView) it.next();

        String displayStatusChild = menuItem.getDisplayStatus();
        String liClassName = null;
        if (MenuItemView.DISPLAY_STATUS.OPEN.equals(displayStatusChild)) {
          liClassName = "openliBlocked";
        } else if (MenuItemView.DISPLAY_STATUS.CLOSE.equals(displayStatus)) {
          liClassName = "closeli";
        }

        menuContent.append("<"); // open 'li'
        menuContent.append("tr");
        menuContent.append(
            Utility.isSet(menuItem.getKey())
                ? " id=child" + Utility.strNN(uid) + menuItem.getKey()
                : "");
        menuContent.append(Utility.isSet(liClassName) ? " class=" + liClassName : "");
        menuContent.append(">"); // close 'li'
        menuContent.append("<td>");
        menuContent.append("<"); // open 'a'
        menuContent.append("a class=\"categorymenulevel_");
        menuContent.append(level > 3 ? 3 : level);
        menuContent.append(
            MenuItemView.DISPLAY_STATUS.OPEN.equals(displayStatusChild) ? "_block" : "");
        menuContent.append("\"");
        if (menuItem.getSubItems() != null && !menuItem.getSubItems().isEmpty()) {
          menuContent.append(
              Utility.isSet(menuItem.getKey())
                  ? " href=\""
                      + (Utility.isSet(menuItem.getLink()) ? menuItem.getLink() : "#")
                      + "\" onMouseOver=\"javascript:openTreeLevel("
                      + "child"
                      + Utility.strNN(uid)
                      + menuItem.getKey()
                      + ","
                      + Utility.strNN(uid)
                      + menuItem.getKey()
                      + ","
                      + Utility.strNN(uid)
                      + item.getKey()
                      + ")\""
                      + " onMouseOut=\"javascript:closeTreeLevel("
                      + "child"
                      + Utility.strNN(uid)
                      + menuItem.getKey()
                      + ","
                      + Utility.strNN(uid)
                      + menuItem.getKey()
                      + ","
                      + Utility.strNN(uid)
                      + item.getKey()
                      + ")\""
                  : "");
        } else {
          menuContent.append(
              Utility.isSet(menuItem.getKey())
                  ? " href=\""
                      + (Utility.isSet(menuItem.getLink()) ? menuItem.getLink() : "#")
                      + "\" onMouseOver=\"javascript:openItem("
                      + "child"
                      + Utility.strNN(uid)
                      + menuItem.getKey()
                      + ","
                      + Utility.strNN(uid)
                      + item.getKey()
                      + ")\""
                      + " onMouseOut=\"javascript:closeItem("
                      + "child"
                      + Utility.strNN(uid)
                      + menuItem.getKey()
                      + ","
                      + Utility.strNN(uid)
                      + item.getKey()
                      + ")\""
                  : "");
        }
        menuContent.append(">"); // close 'a'

        menuContent.append(menuItem.getName());

        menuContent.append("</a>");

        buildMenuStr(menuItem, menuContent, uid, level);

        menuContent.append("</td>");
        menuContent.append("</tr>");
      }
      menuContent.append("</table>");
    }
  }
Example #15
0
  // utility function to make an item Element.
  private Table makeItemElement(ShoppingCartItemData pItm) throws DocumentException {

    Table itmTbl = new PTable(mColumnCount);
    itmTbl.setWidth(100);
    itmTbl.setWidths(itmColumnWidth);
    itmTbl.getDefaultCell().setBorderColor(java.awt.Color.black);
    itmTbl.getDefaultCell().setVerticalAlignment(Cell.ALIGN_TOP);
    itmTbl.setOffset(0);
    itmTbl.setBorder(Table.NO_BORDER);

    if (!catalogOnly) {
      String t0 = "";
      if (pItm.getIsaInventoryItem()) {
        t0 = "i";
      }

      if (null != mSiteData
          && mSiteData.isAnInventoryAutoOrderItem(pItm.getProduct().getProductId())) {
        t0 += "a";
      }

      Cell tpc0 = new Cell(makePhrase(t0, small, true));
      if (!pItm.getIsaInventoryItem()) {
        tpc0.setBorder(0);
      }
      itmTbl.addCell(tpc0);
    }

    Cell tpc01 = new Cell(makePhrase("", normal, true));
    itmTbl.addCell(tpc01);

    String t = "";
    if (pItm.getProduct().isPackProblemSku()) {
      t += "*";
    }
    if (t.length() > 0) t += " ";
    Cell tpc1 = new Cell(makePhrase(t + pItm.getActualSkuNum(), normal, true));
    itmTbl.addCell(tpc1);

    itmTbl.addCell(makePhrase(pItm.getProduct().getCatalogProductShortDesc(), normal, true));
    if (mShowSize) {
      itmTbl.addCell(makePhrase(pItm.getProduct().getSize(), normal, true));
    }
    // itmTbl.addCell(makePhrase(pItm.getProduct().getPack(), normal, true));
    // itmTbl.addCell(makePhrase(pItm.getProduct().getUom(), normal, true));
    // itmTbl.addCell(makePhrase(pItm.getProduct().getManufacturerName(),normal,true));

    if (mShowPrice) {
      BigDecimal price = new BigDecimal(pItm.getPrice());
      String priceStr = "";
      try {
        priceStr = mFormatter.priceFormatWithoutCurrency(price);
      } catch (Exception exc) {
        exc.printStackTrace();
      }
      Cell pcell = new Cell(makePhrase(priceStr, normal, true));
      pcell.setHorizontalAlignment(Element.ALIGN_RIGHT);
      itmTbl.addCell(pcell);
    }

    if (catalogOnly) {
      if (pItm.getProduct() != null
          && pItm.getProduct().getCatalogDistrMapping() != null
          && Utility.isTrue(pItm.getProduct().getCatalogDistrMapping().getStandardProductList())) {
        String yStr = ClwI18nUtil.getMessage(mRequest, "shoppingItems.text.y", null);
        itmTbl.addCell(makePhrase(yStr, normal, true));
      } else {
        String nStr = ClwI18nUtil.getMessage(mRequest, "shoppingItems.text.n", null);
        itmTbl.addCell(makePhrase(nStr, normal, true));
      }
    }

    if (!catalogOnly) {
      // BigDecimal amount = new BigDecimal(pItm.getAmount());
      itmTbl.addCell(makePhrase("", normal, true));
    }

    return itmTbl;
  }
Example #16
0
 public int doEndTag() throws JspException {
   try {
     UiControlView control = ancestor.getAncestor().getControl();
     if (RefCodeNames.UI_CONTROL_STATUS_CD.ACTIVE.equals(control.getUiControlData().getStatusCd())
         || ancestor.getAncestor().getAncestor().isConfigMode()) {
       return super.doEndTag();
     } else if (RefCodeNames.UI_CONTROL_STATUS_CD.INACTIVE.equals(
         control.getUiControlData().getStatusCd())) {
       if (this.multiple != null) {
         for (String value : this.match) {
           String body =
               "<input type=\"hidden\" name=\""
                   + this.property
                   + "\""
                   + (value != null ? " value=\"" + value + "\"" : "")
                   + "/>";
           ancestor.getAncestor().addElementBody(ancestor.getControlElement(), body);
         }
       } else {
         Object value =
             PropertyUtils.getProperty(
                 pageContext.findAttribute(Utility.strNN(this.name)), this.property);
         this.value = value != null ? String.valueOf(value) : null;
         String body =
             "<input type=\"hidden\" name=\""
                 + this.property
                 + "\""
                 + (this.value != null ? " value=\"" + this.value + "\"" : "")
                 + "/>";
         ancestor.getAncestor().addElementBody(ancestor.getControlElement(), body);
       }
     } else if (RefCodeNames.UI_CONTROL_STATUS_CD.DEFAULT.equals(
         control.getUiControlData().getStatusCd())) {
       if (this.multiple != null) {
         if (this.match == null || this.match.length == 0) {
           String[] elementValues =
               ancestor.getControlElement() != null
                   ? new UiControlElementDataWrapper(ancestor.getControlElement()).getValues()
                   : new String[0];
           for (String value : elementValues) {
             String body =
                 "<input type=\"hidden\" name=\""
                     + this.property
                     + "\""
                     + (value != null ? " value=\"" + value + "\"" : "")
                     + "/>";
             ancestor.getAncestor().addElementBody(ancestor.getControlElement(), body);
           }
         } else {
           for (String value : this.match) {
             String body =
                 "<input type=\"hidden\" name=\""
                     + this.property
                     + "\""
                     + (value != null ? " value=\"" + value + "\"" : "")
                     + "/>";
             ancestor.getAncestor().addElementBody(ancestor.getControlElement(), body);
           }
         }
       } else {
         Object value =
             PropertyUtils.getProperty(
                 pageContext.findAttribute(Utility.strNN(this.name)), this.property);
         this.value = value != null ? String.valueOf(value) : null;
         String elementValue =
             ancestor.getControlElement() != null ? ancestor.getControlElement().getValue() : null;
         String body =
             "<input type=\"hidden\" name=\""
                 + this.property
                 + "\" value=\""
                 + (Utility.isSet(this.value)
                     ? String.valueOf(this.value)
                     : Utility.strNN(elementValue))
                 + "\"/>";
         ancestor.getAncestor().addElementBody(ancestor.getControlElement(), body);
       }
     }
     return EVAL_PAGE;
   } catch (Exception e) {
     throw new JspException(e.getMessage());
   } finally {
     this.release();
   }
 }
Example #17
0
  /**
   * <code>getUserSites</code> returns a vector of SiteView's meeting the criteria of the
   * parameters.
   *
   * @param pStoreId a <code>int</code> ID value (from Main DB) of Store selected
   * @param pUserId a <code>int</code> ID value (from Main DB) of Reporting User selected (appUser
   *     if user is not selected or 0 - if user assigned to All Accounts( has property RepOA^))
   * @param pNameTempl <code>String</code> NANE filter value
   * @param nameBeginsFl <code>int</code> NANE filter type (QueryRequest.BEGINS or
   *     QueryRequest.CONTAINS)
   * @param pCity <code>String</code> filter value for CITY
   * @param pState <code>String</code> filter value for STATE
   * @param pAccountIdv <code>IdVector</code> filter of AccountDimIds (null if no filter)
   * @return a <code>SiteViewVector</code> value
   *     <p>/**
   *     ========================================================================================
   */
  public SiteViewVector getUserSites(
      int pStoreId,
      int pUserId,
      Integer pSiteDimId,
      String pNameTempl,
      int nameBeginsFl,
      String pCity,
      String pState,
      IdVector pAccountIdv,
      boolean showInactiveFl,
      int pResultLimit)
      throws RemoteException {

    Connection conn = null;
    SiteViewVector siteV = new SiteViewVector();

    try {
      String storeDimFilter =
          "(select STORE_DIM_ID from DW_STORE_DIM \n" + "  where STORE_ID = " + pStoreId + " ) \n";

      String userFilterForAccounts = ""; // if user is not RepOA^ and accounts where not selected
      if (pUserId > 0 && (pAccountIdv == null || pAccountIdv.size() == 0)) {
        userFilterForAccounts = getUserFilterForAccounts(pUserId);
      }

      String siteNameFilter = getSearchSqlByFilterName("SITE_NAME", pNameTempl, nameBeginsFl);
      String accountIdsFilter =
          (pAccountIdv != null && pAccountIdv.size() > 0)
              ? "and ACCOUNT_DIM_ID in (" + convertToString(pAccountIdv) + ")"
              : "";
      String cityFilter =
          (Utility.isSet(pCity)) ? " and UPPER(SITE_CITY) LIKE UPPER('" + pCity + "%')" : "";
      String stateFilter =
          (Utility.isSet(pState)) ? " and UPPER(SITE_STATE) LIKE UPPER('" + pState + "%')" : "";

      //     conn = getConnection();
      conn = getReportConnection();

      String sql =
          "select  SITE_DIM_ID, \n"
              + " ACCOUNT_DIM_ID, ACCOUNT_ID, \n"
              + " (Select JD_ACCOUNT_NAME from DW_ACCOUNT_DIM a \n"
              + "  where a.ACCOUNT_DIM_ID = s.ACCOUNT_DIM_ID) JD_ACCOUNT_NAME, \n"
              + " SITE_ID,  \n"
              + " SITE_NAME, SITE_STREET_ADDRESS, SITE_CITY, SITE_STATE, SITE_STATUS_CD \n"
              + "from DW_SITE_DIM  s\n"
              + "where \n"
              + "   STORE_DIM_ID = "
              + storeDimFilter
              + " \n"
              + userFilterForAccounts
              + accountIdsFilter
              + siteNameFilter
              + cityFilter
              + stateFilter
              + "order by SITE_NAME ";

      Statement stmt = conn.createStatement();
      ResultSet rs = stmt.executeQuery(sql);
      if (pResultLimit != QueryRequest.UNLIMITED) {
        stmt.setMaxRows(Constants.MAX_SITES_TO_RETURN);
      }
      while (rs.next()) {
        SiteView sv = SiteView.createValue();
        sv.setId(rs.getInt("SITE_DIM_ID"));
        sv.setName(rs.getString("SITE_NAME"));
        sv.setAccountId(rs.getInt("ACCOUNT_ID"));
        sv.setAccountName(rs.getString("JD_ACCOUNT_NAME"));
        sv.setAddress(rs.getString("SITE_STREET_ADDRESS"));
        sv.setCity(rs.getString("SITE_CITY"));
        sv.setState(rs.getString("SITE_STATE"));
        sv.setStatus(rs.getString("SITE_STATUS_CD"));
        String targetS = null; // rs.getString("SITE_RANK");
        int target = 0;
        if (targetS != null) {
          try {
            target = Integer.parseInt(targetS);
          } catch (NumberFormatException e) {
          }
        }
        sv.setTargetFacilityRank(target);

        siteV.add(sv);
      }
      stmt.close();

    } catch (Exception exc) {
      exc.printStackTrace();
      throw processException(exc);
    } finally {
      closeConnection(conn);
    }
    return siteV;
  }