public String getCargoPackType() { String packType = null; if (!CollectionUtils.isNullEmpty(cargoPackList)) { for (ETCargoPackVO cargoPackVO : cargoPackList) { if (packType != null && !packType.equals(cargoPackVO.getPackageType())) { return "PCS"; } packType = cargoPackVO.getPackageType(); ; } } return packType; }
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); } }
private void insertLabelFieldLang( List<RELabelFields> fieldsList, Map<String, Map<String, String>> langWiseFieldDescMap, Connection conn, long setupSeqId) throws Exception { PreparedStatement fieldPstmt = null; String fieldLanguage = null; Map<String, String> labelDescMap = null; String lang = null; try { if (!CollectionUtils.isNullEmpty(fieldsList)) { fieldLanguage = "INSERT INTO LABEL_FIELD_LANGUAGE(ID, LABEL_ID, LANGUAGE_ID, LABEL_DESCRIPTION) VALUES(LABEL_FIELD_LANGUAGE_ID_SEQ.NEXTVAL,?,?,?)"; fieldPstmt = conn.prepareStatement(fieldLanguage); Iterator<String> langKey = langWiseFieldDescMap.keySet().iterator(); while (langKey.hasNext()) { lang = langKey.next(); labelDescMap = langWiseFieldDescMap.get(lang); for (RELabelFields labelFields : fieldsList) { fieldPstmt.clearParameters(); String labelId = labelFields.getLabelId(); String desc = labelDescMap.get(labelFields.getLabelId()); if (!TagLibStringUtility.isNullEmpty(labelId) && !TagLibStringUtility.isNullEmpty(desc)) { fieldPstmt.setLong(1, labelFields.getLabelSeqId()); fieldPstmt.setString(2, lang); fieldPstmt.setString(3, desc); fieldPstmt.executeUpdate(); } } } } } finally { fieldLanguage = null; labelDescMap = null; lang = null; TagLibConnectionUtil.closePreparedStatement(fieldPstmt); } }
public RELabelSetupMainDetails loadLabelSetupMainDetails(String setupSeqId) throws Exception { String FETCH_QRY = "SELECT ID,SCREEN_ID,DESCRIPTION,JSP_NAME,VO_CLASS,HANDLER_CLASS, REMARKS, STATUS FROM SOFTWARE_SERVICES WHERE ID=?"; String LABEL_QUERY = "SELECT LF.ID,LF.FIELD_ID, LF.LABEL_TYPE, LF.VO_FIELD_TYPE, LF.REMARKS, LF.STATUS, LF.VO_FIELD_NAME, " + "(SELECT T4.SHORTCUT_KEY FROM LABEL_FIELDS_SHORTCUTKEYS T4 WHERE T4.FIELD_ID = LF.ID AND ROWNUM = 1) SHORTCUT_KEY " + "FROM LABEL_FIELDS LF WHERE LF.SERVICE_ID=?"; Connection con = null; PreparedStatement pstmt = null; PreparedStatement labelpstmt = null; ResultSet rs = null; ResultSet labelRs = null; RELabelSetupMainDetails mainDetails = null; RELabelFields labelFields = null; List<RELabelFields> labelList = null; try { con = TagLibConnectionUtil.getConnection(); labelFields = new RELabelFields(); mainDetails = new RELabelSetupMainDetails(); mainDetails.setLang("ENGLISH"); pstmt = con.prepareStatement(FETCH_QRY); labelpstmt = con.prepareStatement(LABEL_QUERY); pstmt.setString(1, setupSeqId); rs = pstmt.executeQuery(); if (rs.next()) { mainDetails.setSeqId(rs.getLong("ID")); mainDetails.setScrnId(rs.getString("SCREEN_ID")); mainDetails.setDesc(rs.getString("DESCRIPTION")); mainDetails.setJspName(rs.getString("JSP_NAME")); mainDetails.setVoClass(rs.getString("VO_CLASS")); mainDetails.setHandlerClass(rs.getString("HANDLER_CLASS")); mainDetails.setRemarks(rs.getString("REMARKS")); mainDetails.setStatus(rs.getString("STATUS")); labelpstmt.setString(1, setupSeqId); labelRs = labelpstmt.executeQuery(); labelList = new ArrayList<RELabelFields>(); while (labelRs.next()) { labelFields = new RELabelFields(); labelFields.setLabelSeqId(labelRs.getLong("ID")); labelFields.setLabelId(labelRs.getString("FIELD_ID")); labelFields.setLabelType(labelRs.getString("LABEL_TYPE")); labelFields.setVoFieldName(labelRs.getString("VO_FIELD_NAME")); labelFields.setVoFieldType(labelRs.getString("VO_FIELD_TYPE")); labelFields.setShortCutKey(labelRs.getString("SHORTCUT_KEY")); labelFields.setLabelType(labelRs.getString("LABEL_TYPE")); ; labelFields.setStatus(labelRs.getString("STATUS")); labelFields.setRemarks(labelRs.getString("REMARKS")); labelList.add(labelFields); } if (CollectionUtils.isNullEmpty(labelList)) { labelFields = new RELabelFields(); labelList.add(labelFields); } mainDetails.setFieldsList(labelList); mainDetails.setLangWiseFieldDescMap(getLangWiseFieldDescMap(mainDetails.getSeqId(), con)); } } finally { TagLibConnectionUtil.closePreparedStatement(pstmt, rs); TagLibConnectionUtil.closePreparedStatement(labelpstmt, labelRs); TagLibConnectionUtil.closeConnection(con); } return mainDetails; }