コード例 #1
1
 public boolean isValidParty(PartyLovVO partyLovVO) throws Exception {
   boolean validParty = false;
   Connection connection = null;
   StringBuilder finalQry = new StringBuilder();
   PreparedStatement pstmt = null;
   ResultSet rs = null;
   QueryFields fields = null;
   String whereCond = "";
   try {
     fields = new QueryFields();
     fields.put("BP.DCS_STATUS", "1");
     fields.put("PR.DCS_CODE", partyLovVO.getPartyRole());
     fields.put("BP.DCS_CODE", partyLovVO.getPartyId());
     if (!StringUtility.isNullEmpty(partyLovVO.getRelatedParty())) {
       fields.put("BP.DCS_CODE", partyLovVO.getRelatedParty());
       fields.put("PR.DCS_CODE", partyLovVO.getRelationShipType());
     }
     whereCond = " AND " + QueryBuilderUtil.buildWhereCond(fields);
     finalQry.append(PartyLovQueries.validatePartyIdQry).append(whereCond);
     connection = getConnection();
     pstmt = connection.prepareStatement(finalQry.toString());
     rs = pstmt.executeQuery();
     if (rs.next()) {
       if (rs.getInt(1) > 0) {
         validParty = true;
       } else {
         validParty = false;
       }
     }
   } finally {
     ConnectionUtil.closeConnection(connection, pstmt, rs);
   }
   return validParty;
 }
コード例 #2
0
 public void doReqResDataPreRequisite(HttpServletRequest request) throws Exception {
   byte[] fileContent = null;
   String documentName = null;
   File mFile = null;
   BufferedInputStream br = null;
   String docFormat = null;
   try {
     documentName = httpRequest.getParameter("fileName");
     System.out.println("DocumentName-->" + documentName);
     docFormat = StringUtility.noNull(httpRequest.getParameter("docFormat")).trim();
     request.setAttribute("defaultFormat", "txt");
     if (!StringUtility.isNullEmpty(documentName)) {
       httpSession.setAttribute("documentName", documentName);
       mFile = new File(documentName);
       if (mFile.exists()) {
         if (docFormat.equals(Constants.INT_DATA_TYPE_XML)
             || docFormat.equals(Constants.INT_DATA_TYPE_STRING)) {
           if (docFormat.equals(Constants.INT_DATA_TYPE_XML)) {
             request.setAttribute("defaultFormat", docFormat);
           } else {
             request.setAttribute("defaultFormat", "txt");
           }
           br = new BufferedInputStream(new FileInputStream(mFile));
           fileContent = new byte[(int) mFile.length()];
           br.read(fileContent);
         } else if (docFormat.equals(Constants.INT_DATA_TYPE_VO)) {
           String objStr = InterfaceLogger.serializationObjToStr(documentName);
           fileContent = objStr.getBytes();
         }
       } else {
         fileContent = new String("File not found").getBytes();
       }
       httpSession.setAttribute("baosView", fileContent);
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     fileContent = null;
     if (br != null) br.close();
   }
 }
コード例 #3
0
 public String isValidNickName(PartyLovVO partyLovVO) {
   Statement st = null;
   Connection connection = null;
   ResultSet rs = null;
   String ret = "Invalid";
   String partyRole = partyLovVO.getPartyRole();
   String visiblePartyId = partyLovVO.getPartyNickName();
   String hiddenPartyId = partyLovVO.getPartyId();
   try {
     boolean partyMatch =
         visiblePartyId.equalsIgnoreCase(getNickNameInNickNameMode(hiddenPartyId));
     if (!partyMatch) {
       hiddenPartyId = "";
       partyLovVO.setPartyId("");
     }
     if (!isValidParty(partyLovVO) || StringUtility.isNullEmpty(hiddenPartyId)) {
       boolean temp = false;
       if (!StringUtility.isNullEmpty(hiddenPartyId) && partyMatch) {
         temp = isValidParty(partyLovVO);
         if (!temp && ("*PU_LOCN".equals(partyRole) || "*DEL_LOCN".equals(partyRole))) {
           if ("*PU_LOCN".equals(partyRole)) {
             partyLovVO.setPartyRole("*SHIPPER");
           } else {
             partyLovVO.setPartyRole("*CONSIGNEE");
           }
           temp = isValidParty(partyLovVO);
         }
       }
       if (!temp) {
         connection = getConnection();
         st =
             connection.createStatement(
                 ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
         rs =
             st.executeQuery(
                 "SELECT DCS_CODE FROM ET_BUSINESS_PARTY WHERE DCS_NICK_NAME='"
                     + visiblePartyId
                     + "' AND DCS_PARTY_TYPE LIKE '%"
                     + partyRole
                     + "%'");
         int count = 0;
         if (rs.next()) {
           rs.last();
           count = rs.getRow();
           rs.beforeFirst();
         }
         if (count == 0) {
           ret = "InValidNickName";
         } else if (count == 1) {
           if (rs.first()) {
             partyLovVO.setPartyId(rs.getString("DCS_CODE"));
             temp = isValidParty(partyLovVO);
             if (!temp && ("*PU_LOCN".equals(partyRole) || "*DEL_LOCN".equals(partyRole))) {
               if ("*PU_LOCN".equals(partyRole)) {
                 partyLovVO.setPartyRole("*SHIPPER");
               } else {
                 partyLovVO.setPartyRole("*CONSIGNEE");
               }
               temp = isValidParty(partyLovVO);
             }
             if (temp) {
               ret = partyLovVO.getPartyId();
             }
           } else {
           }
         } else {
           ret = "Duplicate";
         }
       } else {
         ret = hiddenPartyId;
       }
     } else {
       ret = hiddenPartyId;
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     ConnectionUtil.closeConnection(connection, st, rs);
   }
   return ret;
 }
コード例 #4
0
 public String loadAJAXData(PartyLovVO lovAttributes, ESupplyGlobalParameters loginBean)
     throws Exception {
   StringBuilder finalQry = new StringBuilder();
   PreparedStatement pstmt = null;
   ResultSet rs = null;
   String xmlString = "";
   String userDisplaySeparator = "-";
   String partyNickName = "";
   String partyId = "";
   String partyName = "";
   String userDisplay = null;
   String toolTip = null;
   Connection connection = null;
   String whereCond = "";
   try {
     QueryFields fields = new QueryFields();
     if (ETPartyLovConstants.typeAheadLevel1.equals(lovAttributes.getTypeAheadLevel())
         || ETPartyLovConstants.typeAheadLevel3.equals(lovAttributes.getTypeAheadLevel())) {
       finalQry.append("SELECT ");
       finalQry.append(" USER_DISPLAY,");
       finalQry.append(" TOOL_TIP,");
       finalQry.append(" DCS_CODE,");
       finalQry.append(" DCS_NICK_NAME,");
       finalQry.append(" DCS_PARTY_NAME ");
       finalQry.append(" FROM (" + PartyLovQueries.loadAjaxQuery_LEVEl1);
       fields.put("BP.DCS_NICK_NAME", lovAttributes.getPartyNickName(), QueryConstants.LIKE_COND);
       fields.put("BP.DCS_STATUS", "1");
       fields.put("PR.DCS_CODE", lovAttributes.getPartyRole());
       if (!StringUtility.isNullEmpty(lovAttributes.getRelatedParty())) {
         fields.put("BP.DCS_CODE", lovAttributes.getRelatedParty());
         fields.put("PR.DCS_CODE", lovAttributes.getRelationShipType());
       }
       whereCond = " AND " + QueryBuilderUtil.buildWhereCond(fields);
       whereCond +=
           " ORDER BY "
               + lovAttributes.getSearchMode()
               + " ) WHERE ROWNUM<="
               + lovAttributes.getDisplayRows();
       finalQry.append(whereCond);
       connection = getConnection();
       pstmt = connection.prepareStatement(finalQry.toString());
       rs = pstmt.executeQuery();
       xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
       xmlString += "<partyData>";
       while (rs.next()) {
         partyNickName = StringUtility.noNull(rs.getString("DCS_NICK_NAME"));
         partyId = StringUtility.noNull(rs.getString("DCS_CODE"));
         partyName = StringUtility.noNull(rs.getString("DCS_PARTY_NAME"));
         userDisplay = StringUtility.noNull(rs.getString("USER_DISPLAY"));
         toolTip = StringUtility.noNull(rs.getString("TOOL_TIP"));
         xmlString += "<row>";
         if (ETPartyLovConstants.typeAheadLevel1.equals(lovAttributes.getTypeAheadLevel())) {
           xmlString += "<userdisplay>" + userDisplay + "</userdisplay>";
         } else if (ETPartyLovConstants.typeAheadLevel3.equals(
             lovAttributes.getTypeAheadLevel())) {
           xmlString +=
               "<userdisplay>" + userDisplay + userDisplaySeparator + partyName + "</userdisplay>";
         }
         xmlString += "<tooltip>" + toolTip + "</tooltip>";
         if ("NickNameMode".equals(loginBean.getPartyMode())) {
           xmlString += "<partynickname>" + partyNickName + "</partynickname>";
         } else {
           xmlString += "<partynickname>" + partyId + "</partynickname>";
         }
         xmlString += "<partycode>" + partyId + "</partycode>";
         xmlString += "<partyName>" + partyName + "</partyName>";
         xmlString += "</row>";
       }
       xmlString = xmlString + "</partyData>";
     } else if (ETPartyLovConstants.typeAheadLevel2.equals(lovAttributes.getTypeAheadLevel())
         || ETPartyLovConstants.typeAheadLevel4.equals(lovAttributes.getTypeAheadLevel())) {
       finalQry.append("SELECT ");
       finalQry.append(" USER_DISPLAY,");
       finalQry.append(" TOOL_TIP,");
       finalQry.append(" DCS_CODE,");
       finalQry.append(" DCS_NICK_NAME,");
       finalQry.append(" DCS_PARTY_NAME,");
       finalQry.append(" DCS_ADDRESS_NAME,");
       finalQry.append(" DCS_ADDRESS_NAME2,");
       finalQry.append(" DCS_BUILDING_NAME,");
       finalQry.append(" DCS_STREET_NAME,");
       finalQry.append(" DCS_CITY_TOWN,");
       finalQry.append(" DCS_PHONE_NO,");
       finalQry.append(" DCS_FAX,");
       finalQry.append(" DCS_COUNTRY_STATE_CODE,");
       finalQry.append(" DCS_POS_CODE,");
       finalQry.append(" DCS_COUNTRY_CODE,");
       finalQry.append(" DCS_FORMATTED_ADDRESS");
       finalQry.append(" FROM (" + PartyLovQueries.loadAjaxQuery_LEVEl2);
       fields.put("BP.DCS_NICK_NAME", lovAttributes.getPartyNickName(), QueryConstants.LIKE_COND);
       fields.put("BP.DCS_STATUS", "1");
       fields.put("PR.DCS_CODE", lovAttributes.getPartyRole());
       if (!StringUtility.isNullEmpty(lovAttributes.getRelatedParty())) {
         fields.put("BP.DCS_CODE", lovAttributes.getRelatedParty());
         fields.put("PR.DCS_CODE", lovAttributes.getRelationShipType());
       }
       whereCond = " AND " + QueryBuilderUtil.buildWhereCond(fields);
       whereCond +=
           " ORDER BY "
               + lovAttributes.getSearchMode()
               + " ) WHERE ROWNUM<="
               + lovAttributes.getDisplayRows();
       finalQry.append(whereCond);
       connection = getConnection();
       pstmt = connection.prepareStatement(finalQry.toString());
       rs = pstmt.executeQuery();
       xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
       xmlString += "<partyData>";
       while (rs.next()) {
         partyNickName = StringUtility.noNull(rs.getString("DCS_NICK_NAME"));
         partyId = StringUtility.noNull(rs.getString("DCS_CODE"));
         partyName = StringUtility.noNull(rs.getString("DCS_PARTY_NAME"));
         userDisplay = StringUtility.noNull(rs.getString("USER_DISPLAY"));
         toolTip = StringUtility.noNull(rs.getString("TOOL_TIP"));
         xmlString += "<row>";
         xmlString += "<userdisplay>" + userDisplay + "</userdisplay>";
         xmlString += "<tooltip>" + toolTip + "</tooltip>";
         if ("NickNameMode".equals(loginBean.getPartyMode())) {
           xmlString += "<partynickname>" + partyNickName + "</partynickname>";
         } else {
           xmlString += "<partynickname>" + partyId + "</partynickname>";
         }
         xmlString += "<partycode>" + partyId + "</partycode>";
         xmlString += "<partyName>" + partyName + "</partyName>";
         xmlString += "<addressname1>" + rs.getString("DCS_ADDRESS_NAME") + "</addressname1>";
         xmlString += "<addressname2>" + rs.getString("DCS_ADDRESS_NAME2") + "</addressname2>";
         xmlString += "<buildingname>" + rs.getString("DCS_BUILDING_NAME") + "</buildingname>";
         xmlString += "<streetname>" + rs.getString("DCS_STREET_NAME") + "</streetname>";
         xmlString += "<citytown>" + rs.getString("DCS_CITY_TOWN") + "</citytown>";
         xmlString += "<phoneno>" + rs.getString("DCS_PHONE_NO") + "</phoneno>";
         xmlString += "<fax>" + rs.getString("DCS_FAX") + "</fax>";
         xmlString +=
             "<countrystate>" + rs.getString("DCS_COUNTRY_STATE_CODE") + "</countrystate>";
         xmlString += "<poscode>" + rs.getString("DCS_POS_CODE") + "</poscode>";
         xmlString += "<countrycode>" + rs.getString("DCS_COUNTRY_CODE") + "</countrycode>";
         xmlString +=
             "<formatedaddress>" + rs.getString("DCS_FORMATTED_ADDRESS") + "</formatedaddress>";
         xmlString += "</row>";
       }
       xmlString = xmlString + "</partyData>";
     }
   } catch (Exception e) {
     e.printStackTrace();
     throw e;
   } finally {
     ConnectionUtil.closeResultSet(rs);
     ConnectionUtil.closePreparedStatement(pstmt);
     ConnectionUtil.closeConnection(connection);
   }
   return xmlString;
 }
コード例 #5
0
 public String loadConsigneeOnBlurAjaxData(
     PartyLovVO lovAttributes, ESupplyGlobalParameters loginBean, String xmlString)
     throws Exception {
   StringBuilder finalQry = new StringBuilder();
   PreparedStatement pstmt = null;
   ResultSet rs = null;
   String invoiceBranch = null;
   Connection connection = null;
   String whereCond = "";
   String invoiceDept = null;
   String collectParty = null;
   String stParty = null;
   String collectCon = null;
   String stCon = null;
   String collectType = null;
   String onBlurSeq = null;
   String[] onBlurSeqAry = null;
   try {
     QueryFields fields = new QueryFields();
     finalQry.append(PartyLovQueries.loadConsigneeOnBlurAjaxQry);
     fields.put("BP.DCS_STATUS", "1");
     fields.put("PR.DCS_CODE", lovAttributes.getPartyRole());
     fields.put("BP.DCS_CODE", lovAttributes.getPartyId());
     whereCond = " AND " + QueryBuilderUtil.buildWhereCond(fields);
     finalQry.append(whereCond);
     connection = getConnection();
     pstmt = connection.prepareStatement(finalQry.toString());
     rs = pstmt.executeQuery();
     if (rs.next()) {
       onBlurSeq = lovAttributes.getOnBlurSeq();
       invoiceBranch = StringUtility.noNull(rs.getString("INVOICE_BRANCH"));
       invoiceDept = StringUtility.noNull(rs.getString("INVOICE_DEPT"));
       collectParty = StringUtility.noNull(rs.getString("COLLECT_PARTY"));
       stParty = StringUtility.noNull(rs.getString("ST_PARTY"));
       collectCon = StringUtility.noNull(rs.getString("COLLECT_CON"));
       stCon = StringUtility.noNull(rs.getString("ST_CON"));
       if (!StringUtility.isNullEmpty(onBlurSeq)) {
         onBlurSeqAry = onBlurSeq.split(",");
       }
       if (onBlurSeqAry != null && onBlurSeqAry.length > 0) {
         for (String onBlurFinalSeq : onBlurSeqAry) {
           if ("1".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) {
             xmlString += "<invoicebranch>" + invoiceBranch + "</invoicebranch>";
             xmlString += "<invoicedept>" + invoiceDept + "</invoicedept>";
           }
           if ("2".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) {
             if (!"0".equals(collectCon) && !"1".equals(collectCon)) {
               collectType =
                   "1".equals(stCon) ? "Export" : ("2".equals(stCon) ? "Import" : "Both");
             } else if (collectParty != "0" && "1" != collectParty) {
               collectType =
                   "1".equals(stParty) ? "Export" : ("2".equals(stParty) ? "Import" : "Both");
             }
             xmlString += "<collectshipment>" + collectType + "</collectshipment>";
           }
         }
       }
     }
   } finally {
     ConnectionUtil.closeConnection(connection, pstmt, rs);
   }
   return xmlString;
 }
コード例 #6
0
 public String loadCustomerOnBlurAjaxData(
     PartyLovVO lovAttributes, ESupplyGlobalParameters loginBean, String xmlString)
     throws Exception {
   StringBuilder finalQry = new StringBuilder();
   PreparedStatement pstmt = null;
   ResultSet rs = null;
   String invoiceBranch = null;
   String partyId = "";
   Connection connection = null;
   String whereCond = "";
   String invoiceDept = null;
   String tradeTerms = "NoTradeTerm";
   boolean ro = false;
   String creditLimit = null;
   String collectParty = null;
   String stParty = null;
   String collectCon = null;
   String stCon = null;
   String csr = null;
   String salesPersonId = null;
   String salesPersonIdNickName = null;
   String collectType = null;
   String onBlurSeq = null;
   String[] onBlurSeqAry = null;
   try {
     QueryFields fields = new QueryFields();
     finalQry.append(PartyLovQueries.loadCustomerOnBlurAjaxQry);
     fields.put("BP.DCS_STATUS", "1");
     fields.put("PR.DCS_CODE", lovAttributes.getPartyRole());
     fields.put("BP.DCS_CODE", lovAttributes.getPartyId());
     whereCond = " AND " + QueryBuilderUtil.buildWhereCond(fields);
     finalQry.append(whereCond);
     connection = getConnection();
     pstmt = connection.prepareStatement(finalQry.toString());
     rs = pstmt.executeQuery();
     if (rs.next()) {
       onBlurSeq = lovAttributes.getOnBlurSeq();
       partyId = StringUtility.noNull(rs.getString("DCS_CODE"));
       invoiceBranch = StringUtility.noNull(rs.getString("INVOICE_BRANCH"));
       invoiceDept = StringUtility.noNull(rs.getString("INVOICE_DEPT"));
       tradeTerms = StringUtility.noNull(rs.getString("TRADE_TERMS"));
       creditLimit = StringUtility.noNull(rs.getString("CREDIT_LIMIT"));
       collectParty = StringUtility.noNull(rs.getString("COLLECT_PARTY"));
       stParty = StringUtility.noNull(rs.getString("ST_PARTY"));
       collectCon = StringUtility.noNull(rs.getString("COLLECT_CON"));
       stCon = StringUtility.noNull(rs.getString("ST_CON"));
       csr = StringUtility.noNull(rs.getString("CSR"));
       salesPersonId = StringUtility.noNull(rs.getString("SALESPERSONID"));
       salesPersonIdNickName = StringUtility.noNull(rs.getString("SALESPERSONIDNICKNAME"));
       if (!StringUtility.isNullEmpty(onBlurSeq)) {
         onBlurSeqAry = onBlurSeq.split(",");
       }
       if (onBlurSeqAry != null && onBlurSeqAry.length > 0) {
         for (String onBlurFinalSeq : onBlurSeqAry) {
           if ("1".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) {
             xmlString += "<invoicebranch>" + invoiceBranch + "</invoicebranch>";
             xmlString += "<invoicedept>" + invoiceDept + "</invoicedept>";
           }
           if ("2".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) {
             ro = StringUtility.noNull(rs.getString("RO")).equals("1") ? true : false;
             xmlString += "<tradeterm>" + tradeTerms + "</tradeterm>";
             xmlString += "<ro>" + ro + "</ro>";
           }
           if ("3".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) {
             if (!"0".equals(collectCon) && !"1".equals(collectCon)) {
               collectType =
                   "1".equals(stCon) ? "Export" : ("2".equals(stCon) ? "Import" : "Both");
             } else if (collectParty != "0" && "1" != collectParty) {
               collectType =
                   "1".equals(stParty) ? "Export" : ("2".equals(stParty) ? "Import" : "Both");
             }
             xmlString += "<collectshipment>" + collectType + "</collectshipment>";
           }
           if ("4".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) {
             xmlString += "<creditlimit>" + creditLimit + "</creditlimit>";
           }
           if ("5".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) {
             String[] csrTeam = csr.split(",");
             String csrXmlString = "";
             if (!StringUtility.isNullEmpty(csrTeam)) {
               if ("csrAETeam".equals(lovAttributes.getCsrType()) && csrTeam.length > 0) {
                 csrXmlString = csrTeam[0];
               } else if ("csrAITeam".equals(lovAttributes.getCsrType()) && csrTeam.length > 1) {
                 csrXmlString = csrTeam[1];
               } else if ("csrOETeam".equals(lovAttributes.getCsrType()) && csrTeam.length > 2) {
                 csrXmlString = csrTeam[2];
               } else if ("csrOITeam".equals(lovAttributes.getCsrType()) && csrTeam.length > 3) {
                 csrXmlString = csrTeam[3];
               } else {
                 if (csrTeam.length > 4) {
                   csrXmlString = csrTeam[4];
                 }
               }
             }
             xmlString += "<csr>" + csrXmlString + "</csr>";
           }
           if ("6".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) {
             String[] salesPerson =
                 getDefaultSalespersonForCustomer(partyId, loginBean.getTerminalId());
             salesPersonId = !StringUtility.isNullEmpty(salesPerson) ? salesPerson[0] : "";
             salesPersonIdNickName = !StringUtility.isNullEmpty(salesPerson) ? salesPerson[1] : "";
             xmlString += "<salespersonid>" + salesPersonId + "</salespersonid>";
             xmlString +=
                 "<salespersonidnickname>" + salesPersonIdNickName + "</salespersonidnickname>";
           }
         }
       }
     }
   } finally {
     ConnectionUtil.closeConnection(connection, pstmt, rs);
   }
   return xmlString;
 }