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;
 }
 private void resetSequence(String tableName, String seqName, Connection con) throws Exception {
   long tableId =
       TagLibStringUtility.getLong(
           QueryBuilderUtil.getId("select MAX(ID) from " + tableName, con));
   long seqId = QueryBuilderUtil.generateSeqNo(seqName, con);
   long diff = 0;
   if (seqId < tableId) {
     diff = tableId - seqId;
   }
   for (int i = 0; i < diff; i++) {
     QueryBuilderUtil.generateSeqNo(seqName, con);
   }
 }
 public void setSrchResults(RELabelSetupSrchParams searchParams) throws Exception {
   Connection con = null;
   PreparedStatement pstmt = null;
   ResultSet rs = null;
   ArrayList<RELabelSetupSrchParams> searchResults = new ArrayList<RELabelSetupSrchParams>();
   String labelFetchQry =
       "SELECT ID, SCREEN_ID,DESCRIPTION,JSP_NAME,VO_CLASS,HANDLER_CLASS,"
           + "REMARKS,STATUS FROM SOFTWARE_SERVICES ";
   try {
     QueryFields fields = new QueryFields();
     fields.put("SCREEN_ID", searchParams.getScrnId(), QueryConstants.LIKE_COND);
     fields.put("DESCRIPTION", searchParams.getDesc(), QueryConstants.LIKE_COND);
     fields.put("JSP_NAME", searchParams.getJspName(), QueryConstants.LIKE_COND);
     fields.put("VO_CLASS", searchParams.getVoClass(), QueryConstants.LIKE_COND);
     fields.put("HANDLER_CLASS", searchParams.getHandlerClass(), QueryConstants.DATE_TYPE);
     fields.put("REMARKS", searchParams.getRemarks(), QueryConstants.LIKE_COND);
     fields.put("STATUS", searchParams.getRemarks(), QueryConstants.LIKE_COND);
     String whereCond = QueryBuilderUtil.buildWhereCond(fields);
     String finalQry = labelFetchQry;
     if (!TagLibStringUtility.isNullEmpty(whereCond)) {
       finalQry = finalQry + " WHERE " + whereCond;
     }
     finalQry = finalQry + "ORDER BY SCREEN_ID DESC";
     con = TagLibConnectionUtil.getConnection();
     searchParams.totalRecords = QueryBuilderUtil.getTotalRowCount(finalQry, con);
     String pagedQry =
         QueryBuilderUtil.getPaginationQry(
             finalQry, searchParams.startNumber, searchParams.endNumber);
     pstmt = con.prepareStatement(pagedQry);
     rs = pstmt.executeQuery();
     while (rs.next()) {
       RELabelSetupSrchParams labelSetup = new RELabelSetupSrchParams();
       labelSetup.setId(rs.getLong("ID"));
       labelSetup.setScrnId(rs.getString("SCREEN_ID"));
       labelSetup.setDesc(rs.getString("DESCRIPTION"));
       labelSetup.setJspName(rs.getString("JSP_NAME"));
       labelSetup.setVoClass(rs.getString("VO_CLASS"));
       labelSetup.setHandlerClass(rs.getString("HANDLER_CLASS"));
       labelSetup.setRemarks(rs.getString("REMARKS"));
       labelSetup.setStatus(rs.getString("STATUS"));
       searchResults.add(labelSetup);
     }
     searchParams.setSearchResults(searchResults);
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     TagLibConnectionUtil.closePreparedStatement(pstmt, rs);
     TagLibConnectionUtil.closeConnection(con);
   }
 }
 private boolean validateLabelMaster(RELabelSetupMainDetails labelTypeMaster) throws Exception {
   Connection con = null;
   MessagesUtil msgUtil = null;
   String scrIdChek = null;
   try {
     con = TagLibConnectionUtil.getConnection();
     msgUtil = new MessagesUtil();
     if ("ADD".equals(labelTypeMaster.getOperation())) {
       scrIdChek = "SELECT 'X' FROM SOFTWARE_SERVICES SR WHERE SR.SCREEN_ID = ?";
       if (QueryBuilderUtil.isRecordExits(con, scrIdChek, labelTypeMaster.getScrnId())) {
         msgUtil.put(
             TagLibConstants.ERROR_LEVEL,
             "Screen Id already Exists--> " + labelTypeMaster.getScrnId());
       }
     }
     if (msgUtil.isEmpty()) {
       return true;
     } else {
       labelTypeMaster.setErrMsgs(msgUtil.getErrMsgs());
       labelTypeMaster.setSucessMsgs(msgUtil.getSucessMsgs());
       return false;
     }
   } finally {
     TagLibConnectionUtil.closeConnection(con);
     msgUtil = null;
     scrIdChek = null;
   }
 }
  private void insertLabelFields(List<RELabelFields> fieldsList, Connection conn, long setupSeqId)
      throws Exception {
    PreparedStatement labelPstmt = null;
    PreparedStatement keysPstmt = null;
    long labelFieldSeqId = 0;
    String labelQuery = null;
    String keysQuery = null;
    try {
      deleteLabelFieldsAndLang(conn, setupSeqId);
      if (!CollectionUtils.isNullEmpty(fieldsList)) {
        labelQuery =
            "INSERT INTO LABEL_FIELDS(ID,SERVICE_ID,FIELD_ID,VO_FIELD_NAME,VO_FIELD_TYPE,LABEL_TYPE,REMARKS,STATUS) VALUES(?,?,?,?,?,?,?,?)";
        keysQuery =
            "INSERT INTO LABEL_FIELDS_SHORTCUTKEYS(ID,FIELD_ID,SHORTCUT_KEY) VALUES(LABEL_FIELD_SHORTCUT_ID_SEQ.NEXTVAL,?,?)";
        labelPstmt = conn.prepareStatement(labelQuery);
        keysPstmt = conn.prepareStatement(keysQuery);
        for (RELabelFields labelFields : fieldsList) {
          labelPstmt.clearParameters();
          keysPstmt.clearParameters();
          if (!TagLibStringUtility.isNullEmpty(labelFields.getLabelId())) {
            labelFieldSeqId = QueryBuilderUtil.generateSeqNo("LABEL_FIELDS_ID_SEQ", conn);
            labelFields.setLabelSeqId(labelFieldSeqId);
            labelPstmt.setLong(1, labelFieldSeqId);
            labelPstmt.setLong(2, setupSeqId);
            labelPstmt.setString(3, labelFields.getLabelId());
            labelPstmt.setString(4, labelFields.getVoFieldName());
            labelPstmt.setString(5, labelFields.getVoFieldType());
            labelPstmt.setString(6, labelFields.getLabelType());
            labelPstmt.setString(7, labelFields.getRemarks());
            labelPstmt.setString(8, labelFields.getStatus());
            labelPstmt.executeUpdate();

            keysPstmt.setLong(1, labelFieldSeqId);
            keysPstmt.setString(2, labelFields.getShortCutKey());
            keysPstmt.executeUpdate();
          }
        }
      }
    } finally {
      labelQuery = null;
      TagLibConnectionUtil.closePreparedStatement(labelPstmt);
    }
  }
 public RELabelSetupMainDetails insertLabelMaster(RELabelSetupMainDetails mainDetails)
     throws Exception {
   Connection connection = null;
   PreparedStatement pstmt = null;
   String insertQuery = "";
   long labelSeqId = 0;
   try {
     if (validateLabelMaster(mainDetails)) {
       connection = TagLibConnectionUtil.getConnection();
       connection.setAutoCommit(false);
       labelSeqId = QueryBuilderUtil.generateSeqNo("SOFTWARE_SERVICES_ID_SEQ", connection);
       insertQuery =
           "INSERT INTO SOFTWARE_SERVICES(ID,SCREEN_ID,DESCRIPTION,JSP_NAME,VO_CLASS, "
               + "HANDLER_CLASS,REMARKS,STATUS) VALUES (?,?,?,?,?,?,?,?)";
       pstmt = connection.prepareStatement(insertQuery);
       pstmt.setLong(1, labelSeqId);
       pstmt.setString(2, mainDetails.getScrnId());
       pstmt.setString(3, mainDetails.getDesc());
       pstmt.setString(4, mainDetails.getJspName());
       pstmt.setString(5, mainDetails.getVoClass());
       pstmt.setString(6, mainDetails.getHandlerClass());
       pstmt.setString(7, mainDetails.getRemarks());
       pstmt.setString(8, mainDetails.getStatus());
       pstmt.executeUpdate();
       insertLabelFields(mainDetails.getFieldsList(), connection, labelSeqId);
       insertLabelFieldLang(
           mainDetails.getFieldsList(),
           mainDetails.getLangWiseFieldDescMap(),
           connection,
           labelSeqId);
       connection.commit();
     }
   } catch (Exception e) {
     connection.rollback();
     throw e;
   } finally {
     TagLibConnectionUtil.closePreparedStatement(pstmt);
     TagLibConnectionUtil.closeConnection(connection);
   }
   return mainDetails;
 }
 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;
 }
 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;
 }
 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;
 }