Example usage for java.util LinkedHashMap get

List of usage examples for java.util LinkedHashMap get

Introduction

In this page you can find the example usage for java.util LinkedHashMap get.

Prototype

public V get(Object key) 

Source Link

Document

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Usage

From source file:com.topsec.tsm.sim.report.model.ReportModel.java

public static LinkedHashMap<String, List> expMstReport2(RptMasterTbService rptMasterTbImp, ExpStruct exp,
        HttpServletRequest request) throws Exception {
    String mstRptId = exp.getMstrptid();// ID
    Integer mstRptIdInt = Integer.valueOf(mstRptId);
    String mstSql = ReportUiConfig.MstSubSql;
    Object[] subParam = { mstRptIdInt };
    List subResult = rptMasterTbImp.queryTmpList(mstSql, subParam);
    Map sub = new HashMap();
    List<ExpDateStruct> expList = new ArrayList(); // ?
    String mstTitle = null;// ??
    String pdffooter = null;// pdf footer
    LinkedHashMap<String, List> expMap = new LinkedHashMap();
    int mstType = 0;
    for (int i = 0; i < subResult.size(); i++) {
        sub = (Map) subResult.get(i);
        boolean flag = ReportUiUtil.isSystemLog(sub);
        mstType = Integer.parseInt(sub.get("mstType").toString());

        // ??//from ww w  . ja  v  a 2 s . c o  m
        List ruleResult = getRuleRs(mstType, sub, rptMasterTbImp);
        List<Map> resultList = exp.getResultList();
        if (resultList != null) {
            for (Map map : resultList) {
                for (Object o2 : ruleResult) {
                    Map map2 = (Map) o2;
                    if (map.get("sqlParam").equals(map2.get("sqlParam"))) {
                        map2.put("sqlValue", map.get("sqlValue"));
                        map2.put("sqlDefValue", map.get("sqlValue"));
                    }
                }
            }
        }
        boolean isCoreNode = ReportUiUtil.isCoreNodeReport(sub);
        if (isCoreNode) {
            for (int j = 0; j < ruleResult.size(); j++) {
                Map map = (Map) ruleResult.get(j);
                String talCategoryKey = (String) map.get("sqlParam");
                if ("and dvcAddress = ?".equals(talCategoryKey)
                        || "and alias.dvcAddress = ?".equals(talCategoryKey)
                        || "and fwrisk.dvcAddress = ?".equals(talCategoryKey)) {
                    ruleResult.remove(j);
                    break;
                }
            }
        }

        //  ? vpn risk
        String subSubject = (String) sub.get("subSubject");

        //         ExpDateStruct exptmp = (ExpDateStruct) model.createHtml(sub,ruleResult, null, request, exp);
        Integer subType = (Integer) sub.get("subType");
        boolean qushiFlag = sub.get("chartProperty") != null && sub.get("chartProperty").toString().equals("1");
        SqlStruct struct = null;
        if (qushiFlag) {
            struct = resetImpoTime(mstType, ruleResult, sub, request, exp);
        } else {
            struct = getSqlStruct(mstType, ruleResult, request, exp, sub, exp.getRptTimeS(), exp.getRptTimeE());
        }

        ExpDateStruct exptmp = createExp2(sub, struct, subType, exp, request);
        exptmp.setTalCategoryLevel((short) 2);
        exptmp.setMstType(mstType);
        exptmp.setSubType(subSubject.replace("Monitor/", "") + "*");
        // ??
        if (expMap.get(subSubject) == null) {
            List<ExpDateStruct> tpmExpList = new ArrayList();
            tpmExpList.add(exptmp);
            expMap.put(subSubject, tpmExpList);
        } else
            expMap.get(subSubject).add(exptmp);
        // ?
        //
        String talCategory = "";
        if (!ReportUiUtil.checkNull(exptmp.getTalCategory())) {
            String talCategoryTemp = (String) exp.getMap().get("talCategory");
            if (talCategoryTemp != null) {
                if (flag) {
                    talCategoryTemp = ReportUiUtil.getDeviceTypeName(talCategoryTemp, Locale.getDefault());
                }
                exptmp.setTalCategory(new String[] { talCategoryTemp });
            }
        }

        if (ReportUiUtil.checkNull(exptmp.getTalCategory())) {
            String[] talCategoryArray = exptmp.getTalCategory();
            if (talCategoryArray != null && talCategoryArray.length > 0) {
                for (int j = 0; j < talCategoryArray.length; j++) {
                    if (talCategoryArray[j] != null && !talCategoryArray[j].equals("")
                            && !talCategoryArray[j].equals("null")) {
                        if (flag) {
                            talCategoryArray[j] = ReportUiUtil.getDeviceTypeName(talCategoryArray[j],
                                    Locale.getDefault());
                        }
                        talCategory += "->" + talCategoryArray[j];
                    }
                }
                if (talCategory.length() > 2) {
                    talCategory = talCategory.substring(2);
                }
            }

            exptmp.setTitle(exptmp.getTitle().replace("(", "(" + talCategory + " "));
        }
        expList.add(exptmp);
        exp.setRptSummarize(StringUtil.nvl((String) sub.get("summarize"), ""));
        mstTitle = (String) sub.get("mstName");
        pdffooter = StringUtil.nvl((String) sub.get("pdffooter"), "");
    }
    exp.setRptName(mstTitle);
    exp.setPdffooter(pdffooter);
    return expMap;
}

From source file:jp.or.openid.eiwg.scim.operation.Operation.java

/**
 * /*from w w  w .  j  a va  2s. c  o  m*/
 *
 * @param context
 * @param request
 * @param targetId
 * @param attributes
 * @param filter
 * @param sortBy
 * @param sortOrder
 * @param startIndex
 * @param count
 */
public ArrayList<LinkedHashMap<String, Object>> searchUserInfo(ServletContext context,
        HttpServletRequest request, String targetId, String attributes, String filter, String sortBy,
        String sortOrder, String startIndex, String count) {
    ArrayList<LinkedHashMap<String, Object>> result = null;

    Set<String> returnAttributeNameSet = new HashSet<>();

    // ?
    setError(0, null, null);

    // ??
    if (attributes != null && !attributes.isEmpty()) {
        // 
        String[] tempList = attributes.split(",");
        for (int i = 0; i < tempList.length; i++) {
            String attributeName = tempList[i].trim();
            // ???????
            LinkedHashMap<String, Object> attributeSchema = SCIMUtil.getUserAttributeInfo(context,
                    attributeName, true);
            if (attributeSchema != null && !attributeSchema.isEmpty()) {
                returnAttributeNameSet.add(attributeName);
            } else {
                // ???????
                String message = String.format(MessageConstants.ERROR_INVALID_ATTRIBUTES, attributeName);
                setError(HttpServletResponse.SC_BAD_REQUEST, null, message);
                return result;
            }
        }
    }

    // ????????
    // (sortBy)?
    // (sortOrder)?
    // ?(startIndex)?
    // 1??(count)?
    //
    // ()

    // 
    result = new ArrayList<LinkedHashMap<String, Object>>();

    // ?
    @SuppressWarnings("unchecked")
    ArrayList<LinkedHashMap<String, Object>> users = (ArrayList<LinkedHashMap<String, Object>>) context
            .getAttribute("Users");
    if (users != null && !users.isEmpty()) {
        Iterator<LinkedHashMap<String, Object>> usersIt = users.iterator();
        while (usersIt.hasNext()) {
            boolean isMatched = false;
            LinkedHashMap<String, Object> userInfo = usersIt.next();

            // id???????
            if (targetId != null && !targetId.isEmpty()) {
                Object id = SCIMUtil.getAttribute(userInfo, "id");
                if (id != null && id instanceof String) {
                    // id????
                    if (targetId.equals(id.toString())) {
                        if (filter != null && !filter.isEmpty()) {
                            // ????
                            boolean matched = false;
                            try {
                                matched = SCIMUtil.checkUserSimpleFilter(context, userInfo, filter);
                            } catch (SCIMUtilException e) {
                                result = null;
                                setError(e.getCode(), e.getType(), e.getMessage());
                                break;
                            }

                            if (matched) {
                                isMatched = true;
                            }
                        } else {
                            isMatched = true;
                        }
                    }
                }
            } else {
                if (filter != null && !filter.isEmpty()) {
                    // ????
                    boolean matched = false;
                    try {
                        matched = SCIMUtil.checkUserSimpleFilter(context, userInfo, filter);
                    } catch (SCIMUtilException e) {
                        result = null;
                        setError(e.getCode(), e.getType(), e.getMessage());
                        break;
                    }

                    if (matched) {
                        isMatched = true;
                    }
                } else {
                    isMatched = true;
                }
            }

            if (isMatched) {
                // ??
                LinkedHashMap<String, Object> resultInfo = new LinkedHashMap<String, Object>();
                Iterator<String> attributeIt = userInfo.keySet().iterator();
                while (attributeIt.hasNext()) {
                    // ???
                    String attributeName = attributeIt.next();

                    // ?
                    LinkedHashMap<String, Object> attributeSchema = SCIMUtil.getUserAttributeInfo(context,
                            attributeName, true);
                    Object returned = attributeSchema.get("returned");

                    if (returned != null && returned.toString().equalsIgnoreCase("never")) {
                        continue;
                    }

                    // ?
                    Object attributeValue = userInfo.get(attributeName);

                    resultInfo.put(attributeName, attributeValue);
                }

                result.add(resultInfo);
            }
        }
    }

    return result;
}

From source file:de.ingrid.importer.udk.strategy.v1.IDCStrategy1_0_4.java

protected void updateSysGui() throws Exception {
    if (log.isInfoEnabled()) {
        log.info("Updating sys_gui...");
    }/*from w w w  . j  a  v  a  2s  .c om*/

    if (log.isInfoEnabled()) {
        log.info("Updating sys_gui entries (including Clean Up !)...");
    }

    // clean up, to guarantee no old values !
    sqlStr = "DELETE FROM sys_gui";
    jdbc.executeUpdate(sqlStr);

    LinkedHashMap<String, Integer> initialSysGuis = new LinkedHashMap<String, Integer>();
    Integer initialBehaviour = -1;
    Integer mandatory = 1;

    initialSysGuis.put("1130", initialBehaviour);
    initialSysGuis.put("1140", initialBehaviour);
    initialSysGuis.put("1220", initialBehaviour);
    initialSysGuis.put("1230", initialBehaviour);
    initialSysGuis.put("1240", initialBehaviour);
    initialSysGuis.put("1250", initialBehaviour);
    initialSysGuis.put("1310", initialBehaviour);
    initialSysGuis.put("1320", initialBehaviour);
    initialSysGuis.put("1350", initialBehaviour);
    initialSysGuis.put("1409", mandatory);
    initialSysGuis.put("1410", mandatory);
    initialSysGuis.put("3100", initialBehaviour);
    initialSysGuis.put("3110", initialBehaviour);
    initialSysGuis.put("3120", initialBehaviour);
    initialSysGuis.put("3200", initialBehaviour);
    initialSysGuis.put("3210", initialBehaviour);
    initialSysGuis.put("3230", initialBehaviour);
    initialSysGuis.put("3240", initialBehaviour);
    initialSysGuis.put("3250", initialBehaviour);
    initialSysGuis.put("3300", initialBehaviour);
    initialSysGuis.put("3310", initialBehaviour);
    initialSysGuis.put("3320", initialBehaviour);
    initialSysGuis.put("3330", initialBehaviour);
    initialSysGuis.put("3340", initialBehaviour);
    initialSysGuis.put("3345", initialBehaviour);
    initialSysGuis.put("3350", initialBehaviour);
    initialSysGuis.put("3355", initialBehaviour);
    initialSysGuis.put("3360", initialBehaviour);
    initialSysGuis.put("3365", initialBehaviour);
    initialSysGuis.put("3370", initialBehaviour);
    initialSysGuis.put("3375", initialBehaviour);
    initialSysGuis.put("3380", initialBehaviour);
    initialSysGuis.put("3385", initialBehaviour);
    initialSysGuis.put("3400", initialBehaviour);
    initialSysGuis.put("3410", initialBehaviour);
    initialSysGuis.put("3420", initialBehaviour);
    initialSysGuis.put("3500", initialBehaviour);
    initialSysGuis.put("3515", initialBehaviour);
    initialSysGuis.put("3520", initialBehaviour);
    initialSysGuis.put("3530", initialBehaviour);
    initialSysGuis.put("3535", initialBehaviour);
    initialSysGuis.put("3555", initialBehaviour);
    initialSysGuis.put("3565", initialBehaviour);
    initialSysGuis.put("3570", initialBehaviour);
    initialSysGuis.put("4400", initialBehaviour);
    initialSysGuis.put("4405", initialBehaviour);
    initialSysGuis.put("4410", initialBehaviour);
    initialSysGuis.put("4415", initialBehaviour);
    initialSysGuis.put("4420", initialBehaviour);
    initialSysGuis.put("4425", initialBehaviour);
    initialSysGuis.put("4435", initialBehaviour);
    initialSysGuis.put("4440", initialBehaviour);
    initialSysGuis.put("4510", mandatory);
    initialSysGuis.put("5000", initialBehaviour);
    initialSysGuis.put("5020", initialBehaviour);
    initialSysGuis.put("5021", initialBehaviour);
    initialSysGuis.put("5022", initialBehaviour);
    initialSysGuis.put("5040", initialBehaviour);
    initialSysGuis.put("5052", initialBehaviour);
    initialSysGuis.put("5062", initialBehaviour);
    initialSysGuis.put("5063", initialBehaviour);
    initialSysGuis.put("5069", initialBehaviour);
    initialSysGuis.put("5070", initialBehaviour);
    initialSysGuis.put("N001", initialBehaviour);
    initialSysGuis.put("N002", initialBehaviour);
    initialSysGuis.put("N003", initialBehaviour);
    initialSysGuis.put("N004", initialBehaviour);
    initialSysGuis.put("N005", initialBehaviour);
    initialSysGuis.put("N007", initialBehaviour);
    initialSysGuis.put("N009", initialBehaviour);
    initialSysGuis.put("N010", initialBehaviour);
    initialSysGuis.put("N011", initialBehaviour);
    initialSysGuis.put("N012", initialBehaviour);
    initialSysGuis.put("N013", initialBehaviour);
    initialSysGuis.put("N014", initialBehaviour);
    initialSysGuis.put("N015", initialBehaviour);
    initialSysGuis.put("N016", initialBehaviour);
    initialSysGuis.put("N017", initialBehaviour);
    initialSysGuis.put("N018", initialBehaviour);
    initialSysGuis.put("N019", mandatory);
    initialSysGuis.put("N020", initialBehaviour);
    initialSysGuis.put("N023", initialBehaviour);

    Iterator<String> itr = initialSysGuis.keySet().iterator();
    while (itr.hasNext()) {
        String key = itr.next();
        jdbc.executeUpdate("INSERT INTO sys_gui (id, gui_id, behaviour) VALUES (" + getNextId() + ", '" + key
                + "', " + initialSysGuis.get(key) + ")");
    }

    if (log.isInfoEnabled()) {
        log.info("Updating sys_gui... done");
    }
}

From source file:com.sonicle.webtop.calendar.CalendarManager.java

@Override
public Map<Integer, ShareFolderCalendar> listIncomingCalendarFolders(String rootShareId) throws WTException {
    CoreManager coreMgr = WT.getCoreManager(getTargetProfileId());
    LinkedHashMap<Integer, ShareFolderCalendar> folders = new LinkedHashMap<>();

    for (Integer folderId : shareCache.getFolderIdsByShareRoot(rootShareId)) {
        final String shareFolderId = shareCache.getShareFolderIdByFolderId(folderId);
        if (StringUtils.isBlank(shareFolderId))
            continue;
        SharePermsFolder fperms = coreMgr.getShareFolderPermissions(shareFolderId);
        SharePermsElements eperms = coreMgr.getShareElementsPermissions(shareFolderId);
        if (folders.containsKey(folderId)) {
            final ShareFolderCalendar shareFolder = folders.get(folderId);
            if (shareFolder == null)
                continue;
            shareFolder.getPerms().merge(fperms);
            shareFolder.getElementsPerms().merge(eperms);
        } else {/*from w  w w  .ja va  2 s . c  om*/
            final Calendar calendar = getCalendar(folderId);
            if (calendar == null)
                continue;
            folders.put(folderId, new ShareFolderCalendar(shareFolderId, fperms, eperms, calendar));
        }
    }
    return folders;
}

From source file:de.ingrid.importer.udk.strategy.v1.IDCStrategy1_0_3.java

protected void updateSysGui() throws Exception {
    if (log.isInfoEnabled()) {
        log.info("Updating sys_gui...");
    }/*w w  w  .j  a  va  2s.  c o m*/

    if (log.isInfoEnabled()) {
        log.info("Inserting initial sys_gui entries...");
    }

    // clean up, to guarantee no old values !
    sqlStr = "DELETE FROM sys_gui";
    jdbc.executeUpdate(sqlStr);

    LinkedHashMap<String, Integer> initialSysGuis = new LinkedHashMap<String, Integer>();
    Integer initialBehaviour = -1;
    initialSysGuis.put("1130", initialBehaviour);
    initialSysGuis.put("1140", initialBehaviour);
    initialSysGuis.put("1220", initialBehaviour);
    initialSysGuis.put("1230", initialBehaviour);
    initialSysGuis.put("1240", initialBehaviour);
    initialSysGuis.put("1250", initialBehaviour);
    initialSysGuis.put("1310", initialBehaviour);
    initialSysGuis.put("1320", initialBehaviour);
    initialSysGuis.put("1350", initialBehaviour);
    initialSysGuis.put("1410", initialBehaviour);
    initialSysGuis.put("3100", initialBehaviour);
    initialSysGuis.put("3110", initialBehaviour);
    initialSysGuis.put("3120", initialBehaviour);
    initialSysGuis.put("3200", initialBehaviour);
    initialSysGuis.put("3210", initialBehaviour);
    initialSysGuis.put("3230", initialBehaviour);
    initialSysGuis.put("3240", initialBehaviour);
    initialSysGuis.put("3250", initialBehaviour);
    initialSysGuis.put("3300", initialBehaviour);
    initialSysGuis.put("3310", initialBehaviour);
    initialSysGuis.put("3320", initialBehaviour);
    initialSysGuis.put("3330", initialBehaviour);
    initialSysGuis.put("3340", initialBehaviour);
    initialSysGuis.put("3345", initialBehaviour);
    initialSysGuis.put("3350", initialBehaviour);
    initialSysGuis.put("3355", initialBehaviour);
    initialSysGuis.put("3360", initialBehaviour);
    initialSysGuis.put("3365", initialBehaviour);
    initialSysGuis.put("3370", initialBehaviour);
    initialSysGuis.put("3375", initialBehaviour);
    initialSysGuis.put("3380", initialBehaviour);
    initialSysGuis.put("3385", initialBehaviour);
    initialSysGuis.put("3400", initialBehaviour);
    initialSysGuis.put("3410", initialBehaviour);
    initialSysGuis.put("3420", initialBehaviour);
    initialSysGuis.put("3500", initialBehaviour);
    initialSysGuis.put("3515", initialBehaviour);
    initialSysGuis.put("3520", initialBehaviour);
    initialSysGuis.put("3530", initialBehaviour);
    initialSysGuis.put("3535", initialBehaviour);
    initialSysGuis.put("3555", initialBehaviour);
    initialSysGuis.put("3565", initialBehaviour);
    initialSysGuis.put("3570", initialBehaviour);
    initialSysGuis.put("5000", initialBehaviour);
    initialSysGuis.put("5020", initialBehaviour);
    initialSysGuis.put("5021", initialBehaviour);
    initialSysGuis.put("5022", initialBehaviour);
    initialSysGuis.put("5040", initialBehaviour);
    initialSysGuis.put("5040", initialBehaviour);
    initialSysGuis.put("5052", initialBehaviour);
    initialSysGuis.put("5062", initialBehaviour);
    initialSysGuis.put("5063", initialBehaviour);
    initialSysGuis.put("5069", initialBehaviour);
    initialSysGuis.put("5070", initialBehaviour);
    initialSysGuis.put("N001", initialBehaviour);
    initialSysGuis.put("N002", initialBehaviour);
    initialSysGuis.put("N003", initialBehaviour);
    initialSysGuis.put("N004", initialBehaviour);
    initialSysGuis.put("N005", initialBehaviour);
    initialSysGuis.put("N007", initialBehaviour);
    initialSysGuis.put("N009", initialBehaviour);
    initialSysGuis.put("N010", initialBehaviour);
    initialSysGuis.put("N011", initialBehaviour);
    initialSysGuis.put("N012", initialBehaviour);
    initialSysGuis.put("N013", initialBehaviour);
    initialSysGuis.put("N014", initialBehaviour);
    initialSysGuis.put("N015", initialBehaviour);
    initialSysGuis.put("N016", initialBehaviour);
    initialSysGuis.put("N017", initialBehaviour);
    initialSysGuis.put("N018", initialBehaviour);
    initialSysGuis.put("4400", initialBehaviour);
    initialSysGuis.put("4405", initialBehaviour);
    initialSysGuis.put("4410", initialBehaviour);
    initialSysGuis.put("4415", initialBehaviour);
    initialSysGuis.put("4420", initialBehaviour);
    initialSysGuis.put("4425", initialBehaviour);
    initialSysGuis.put("4435", initialBehaviour);
    initialSysGuis.put("4440", initialBehaviour);
    initialSysGuis.put("4510", initialBehaviour);
    initialSysGuis.put("4500", initialBehaviour);
    initialSysGuis.put("N019", initialBehaviour);
    initialSysGuis.put("N020", initialBehaviour);
    initialSysGuis.put("N023", initialBehaviour);

    Iterator<String> itr = initialSysGuis.keySet().iterator();
    while (itr.hasNext()) {
        String key = itr.next();
        jdbc.executeUpdate("INSERT INTO sys_gui (id, gui_id, behaviour) VALUES (" + getNextId() + ", '" + key
                + "', " + initialSysGuis.get(key) + ")");
    }

    if (log.isInfoEnabled()) {
        log.info("Updating sys_gui... done");
    }
}

From source file:com.gp.cong.logisoft.lcl.report.LclAllBLPdfCreator.java

public PdfPTable appendChargesAndCommodity() throws Exception {
    LclBlAcDAO lclBlAcDAO = new LclBlAcDAO();
    List<LclBlPiece> lclBlPiecesList = lclbl.getLclFileNumber().getLclBlPieceList();
    List<LclBlAc> chargeList = lclBlAcDAO.getLclCostByFileNumberAsc(lclbl.getFileNumberId());
    PdfPTable chargeTable = new PdfPTable(6);
    PdfPCell chargeCell = null;/* ww w  .  j  a  va2 s. c om*/
    chargeTable.setWidths(new float[] { 3.8f, 1.5f, .8f, 3.8f, 1.5f, .8f });
    chargeTable.setWidthPercentage(100f);
    Paragraph p = null;

    this.total_ar_amount = 0.00;
    this.total_ar_col_amount = 0.00;
    this.total_ar_ppd_amount = 0.00;

    List<LinkedHashMap<String, PdfPCell>> listChargeMap = null;
    LinkedHashMap<String, PdfPCell> chargeMap = null;
    if ("BOTH".equalsIgnoreCase(billType)) {
        listChargeMap = this.getTotalChargesList(chargeList, lclBlPiecesList);
    } else {
        chargeMap = this.getTotalCharges(chargeList, lclBlPiecesList);
    }

    LclBlAc blAC = lclBlAcDAO.manualChargeValidate(lclbl.getFileNumberId(), "OCNFRT", false);
    if (lclBlPiecesList != null && lclBlPiecesList.size() > 0 && blAC != null) {
        BigDecimal CFT = BigDecimal.ZERO, LBS = BigDecimal.ZERO;
        LclBlPiece lclBlPiece = (LclBlPiece) lclBlPiecesList.get(0);
        if (blAC.getRatePerUnitUom() != null) {
            CFT = blAC.getRatePerUnitUom().equalsIgnoreCase("FRV") ? blAC.getRatePerVolumeUnit()
                    : BigDecimal.ZERO;
            LBS = blAC.getRatePerUnitUom().equalsIgnoreCase("FRW") ? blAC.getRatePerWeightUnit()
                    : BigDecimal.ZERO;
        }
        if (CFT != BigDecimal.ZERO || LBS != BigDecimal.ZERO) {
            StringBuilder cbmValues = new StringBuilder();
            if (CFT != BigDecimal.ZERO && lclBlPiece.getActualVolumeImperial() != null) {
                cbmValues.append(NumberUtils
                        .convertToThreeDecimalhash(lclBlPiece.getActualVolumeImperial().doubleValue()));
            }
            if (LBS != BigDecimal.ZERO && lclBlPiece.getActualWeightImperial() != null) {
                cbmValues.append(NumberUtils
                        .convertToThreeDecimalhash(lclBlPiece.getActualWeightImperial().doubleValue()));
            }
            if (null != blAC.getArAmount() && blAC.getArAmount().toString().equalsIgnoreCase(OCNFRT_Total)) {
                if (CFT == BigDecimal.ZERO) {
                    cbmValues.append(" LBS @ ").append(LBS).append(" PER 100 LBS @ ")
                            .append(blAC.getArAmount());
                } else {
                    cbmValues.append(" CFT @ ").append(CFT).append(" PER CFT @").append(blAC.getArAmount());
                }
                chargeCell = new PdfPCell();
                chargeCell.setBorder(0);
                chargeCell.setColspan(6);
                chargeTable.addCell(chargeCell);

                chargeCell = new PdfPCell();
                chargeCell.setBorder(0);
                chargeCell.setColspan(6);
                p = new Paragraph(2f, "" + cbmValues.toString().toUpperCase(), totalFontQuote);
                p.add(new Paragraph(2f,
                        null != lclBlPiece && null != lclBlPiece.getCommodityType()
                                ? "   Commodity# " + lclBlPiece.getCommodityType().getCode()
                                : "   Commodity#",
                        totalFontQuote));
                p.setAlignment(Element.ALIGN_LEFT);
                chargeCell.addElement(p);
                chargeTable.addCell(chargeCell);
            }
        }
    }
    this.OCNFRT_Total = "";
    LinkedHashMap<String, PdfPCell> left_chargeMap = new LinkedHashMap<String, PdfPCell>();
    LinkedHashMap<String, PdfPCell> right_chargeMap = new LinkedHashMap<String, PdfPCell>();
    if ("BOTH".equalsIgnoreCase(billType) && listChargeMap != null && !listChargeMap.isEmpty()) {
        if (listChargeMap.size() > 1) {
            if (listChargeMap.get(0).size() > 6 || listChargeMap.get(1).size() > 6) {
                chargeMap = new LinkedHashMap<String, PdfPCell>();
                chargeMap.putAll(listChargeMap.get(0));
                chargeMap.putAll(listChargeMap.get(1));
                int count = 0, size = chargeMap.size() / 2 <= 6 ? 6 : chargeMap.size() / 2;
                for (String key : chargeMap.keySet()) {
                    if (count++ < size) {
                        left_chargeMap.put(key, chargeMap.get(key));
                    } else {
                        right_chargeMap.put(key, chargeMap.get(key));
                    }
                }
            } else {
                left_chargeMap.putAll(listChargeMap.get(0));
                right_chargeMap.putAll(listChargeMap.get(1));
            }
        } else {
            int count = 0, size = listChargeMap.get(0).size() / 2 <= 6 ? 6 : listChargeMap.get(0).size() / 2;
            for (String key : listChargeMap.get(0).keySet()) {
                if (count++ < size) {
                    left_chargeMap.put(key, listChargeMap.get(0).get(key));
                } else {
                    right_chargeMap.put(key, listChargeMap.get(0).get(key));
                }
            }
        }
    } else if (chargeMap != null && !chargeMap.isEmpty()) {
        int count = 0, size = chargeMap.size() / 2 <= 6 ? 6 : chargeMap.size() / 2;
        for (String key : chargeMap.keySet()) {
            if (count++ < size) {
                left_chargeMap.put(key, chargeMap.get(key));
            } else {
                right_chargeMap.put(key, chargeMap.get(key));
            }
        }
    }

    if (!left_chargeMap.isEmpty()) {
        String chargeDesc = null;
        PdfPTable innner_chargeTable = new PdfPTable(2);
        innner_chargeTable.setWidthPercentage(100f);
        PdfPCell inner_chargeCell = null;

        chargeCell = new PdfPCell();
        chargeCell.setBorder(0);
        chargeCell.setColspan(3);
        chargeCell.setBorderWidthRight(0.6f);
        chargeCell.setPadding(0);
        innner_chargeTable = new PdfPTable(2);
        innner_chargeTable.setWidths(new float[] { 5f, 3f });
        if (!left_chargeMap.isEmpty()) {
            for (String key : left_chargeMap.keySet()) {
                inner_chargeCell = new PdfPCell();
                inner_chargeCell.setBorder(0);
                inner_chargeCell.setPaddingLeft(-15);
                chargeDesc = key.substring(key.indexOf("#") + 1, key.indexOf("$"));
                inner_chargeCell.addElement(new Paragraph(7f, "" + chargeDesc, totalFontQuote));
                innner_chargeTable.addCell(inner_chargeCell);

                inner_chargeCell = new PdfPCell();
                inner_chargeCell.setBorder(0);
                inner_chargeCell = left_chargeMap.get(key);
                innner_chargeTable.addCell(inner_chargeCell);
            }
        }
        chargeCell.addElement(innner_chargeTable);
        chargeTable.addCell(chargeCell);

        chargeCell = new PdfPCell();
        chargeCell.setBorder(0);
        chargeCell.setColspan(3);
        chargeCell.setPadding(0);
        innner_chargeTable = new PdfPTable(2);
        innner_chargeTable.setWidths(new float[] { 5f, 3f });
        if (!left_chargeMap.isEmpty()) {
            for (String key : right_chargeMap.keySet()) {
                inner_chargeCell = new PdfPCell();
                inner_chargeCell.setBorder(0);
                inner_chargeCell.setPaddingLeft(-15);
                chargeDesc = key.substring(key.indexOf("#") + 1, key.indexOf("$"));
                inner_chargeCell.addElement(new Paragraph(7f, "" + chargeDesc, totalFontQuote));
                innner_chargeTable.addCell(inner_chargeCell);

                inner_chargeCell = new PdfPCell();
                inner_chargeCell.setBorder(0);
                inner_chargeCell = right_chargeMap.get(key);
                innner_chargeTable.addCell(inner_chargeCell);
            }
        }
        chargeCell.addElement(innner_chargeTable);
        chargeTable.addCell(chargeCell);
    } else {
        this.total_ar_amount = 0.00;
        this.total_ar_ppd_amount = 0.00;
        this.total_ar_col_amount = 0.00;
    }
    String acctNo = "";
    String billToParty = "";
    if (CommonFunctions.isNotNull(lclbl.getBillToParty()) && CommonUtils.isNotEmpty(lclbl.getBillToParty())) {
        if (lclbl.getBillToParty().equalsIgnoreCase("T")
                && CommonFunctions.isNotNull(lclbl.getThirdPartyAcct())) {
            billToParty = "THIRD PARTY";
            acctNo = lclbl.getThirdPartyAcct().getAccountno();
        } else if (lclbl.getBillToParty().equalsIgnoreCase("S")
                && CommonFunctions.isNotNull(lclbl.getShipAcct())) {
            billToParty = "SHIPPER";
            acctNo = lclbl.getShipAcct().getAccountno();
        } else if (lclbl.getBillToParty().equalsIgnoreCase("F")
                && CommonFunctions.isNotNull(lclbl.getFwdAcct())) {
            billToParty = "FORWARDER";
            acctNo = lclbl.getFwdAcct().getAccountno();
        } else if (lclbl.getBillToParty().equalsIgnoreCase("A")
                && CommonFunctions.isNotNull(lclbl.getAgentAcct())) {
            billToParty = "AGENT";
            if (lclBooking.getBookingType().equals("T")
                    && lclbl.getLclFileNumber().getLclBookingImport().getExportAgentAcctNo() != null) {
                acctNo = lclbl.getLclFileNumber().getLclBookingImport().getExportAgentAcctNo().getAccountno();
            } else if (lclBooking.getAgentAcct() != null) {
                acctNo = lclBooking.getAgentAcct().getAccountno();
            } else {
                acctNo = lclbl.getAgentAcct().getAccountno();
            }
        }
    }

    if ("BOTH".equalsIgnoreCase(billType)) {
        if (this.total_ar_ppd_amount != 0.00 || this.total_ar_col_amount != 0.00) {
            if (this.total_ar_ppd_amount != 0.00) {
                if (CommonFunctions.isNotNullOrNotEmpty(ppdBillToSet) && ppdBillToSet.size() == 1) {
                    for (String billTo : ppdBillToSet) {
                        arBillToParty = billTo;
                        break;
                    }
                    if (arBillToParty.equalsIgnoreCase("T")) {
                        billToParty = "THIRD PARTY";
                        acctNo = null != lclbl.getThirdPartyAcct() ? lclbl.getThirdPartyAcct().getAccountno()
                                : acctNo;
                    } else if (arBillToParty.equalsIgnoreCase("S")) {
                        acctNo = null != lclbl.getShipAcct() ? lclbl.getShipAcct().getAccountno() : acctNo;
                        billToParty = "SHIPPER";
                    } else if (arBillToParty.equalsIgnoreCase("F")) {
                        billToParty = "FORWARDER";
                        acctNo = null != lclbl.getFwdAcct() ? lclbl.getFwdAcct().getAccountno() : acctNo;
                    }
                } else {
                    acctNo = null;
                }
                chargeCell = new PdfPCell();
                chargeCell.setBorder(0);
                chargeCell.setColspan(2);
                p = new Paragraph(7f, "T O T A L (USA)", totalFontQuote);
                p.setAlignment(Element.ALIGN_LEFT);
                chargeCell.addElement(p);
                chargeTable.addCell(chargeCell);

                chargeCell = new PdfPCell();
                chargeCell.setColspan(4);
                chargeCell.setBorder(0);
                if (null != acctNo) {
                    p = new Paragraph(7f, "$" + NumberUtils.convertToTwoDecimal(this.total_ar_ppd_amount)
                            + " PPD " + billToParty + "-" + acctNo, totalFontQuote);
                } else {
                    p = new Paragraph(7f,
                            "$" + NumberUtils.convertToTwoDecimal(this.total_ar_ppd_amount) + " PPD ",
                            totalFontQuote);
                }
                p.setAlignment(Element.ALIGN_LEFT);
                chargeCell.addElement(p);
                chargeTable.addCell(chargeCell);
            }

            if (this.total_ar_col_amount != 0.00) {
                String colAcctNo = "";
                if (lclBooking.getBookingType().equals("T")
                        && lclbl.getLclFileNumber().getLclBookingImport().getExportAgentAcctNo() != null) {
                    colAcctNo = lclbl.getLclFileNumber().getLclBookingImport().getExportAgentAcctNo()
                            .getAccountno();
                } else if (lclBooking.getAgentAcct() != null) {
                    colAcctNo = lclBooking.getAgentAcct().getAccountno();
                } else if (lclbl.getAgentAcct() != null) {
                    colAcctNo = lclbl.getAgentAcct().getAccountno();
                }
                chargeCell = new PdfPCell();
                chargeCell.setBorder(0);
                chargeCell.setColspan(2);
                if (this.total_ar_ppd_amount == 0.00) {
                    p = new Paragraph(7f, "T O T A L (USA)", totalFontQuote);
                } else {
                    p = new Paragraph(7f, "", totalFontQuote);
                }
                p.setAlignment(Element.ALIGN_LEFT);
                chargeCell.addElement(p);
                chargeTable.addCell(chargeCell);

                chargeCell = new PdfPCell();
                chargeCell.setColspan(4);
                chargeCell.setBorder(0);
                p = new Paragraph(7f, "$" + NumberUtils.convertToTwoDecimal(this.total_ar_col_amount)
                        + " COL AGENT-" + colAcctNo, totalFontQuote);
                p.setAlignment(Element.ALIGN_LEFT);
                chargeCell.addElement(p);
                chargeTable.addCell(chargeCell);
            }

            NumberFormat numberFormat = new DecimalFormat("###,###,##0.000");
            if (this.total_ar_ppd_amount != 0.00) {
                String totalString1 = numberFormat.format(this.total_ar_ppd_amount).replaceAll(",", "");
                int indexdot = totalString1.indexOf(".");
                String beforeDecimal = totalString1.substring(0, indexdot);
                String afterDecimal = totalString1.substring(indexdot + 1, totalString1.length());
                chargeCell = new PdfPCell();
                chargeCell.setColspan(6);
                chargeCell.setBorder(0);
                p = new Paragraph(7f, "" + ConvertNumberToWords.convert(Integer.parseInt(beforeDecimal))
                        + " DOLLARS AND " + StringUtils.removeEnd(afterDecimal, "0") + " CENTS",
                        totalFontQuote);
                chargeCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                chargeCell.addElement(p);
                chargeTable.addCell(chargeCell);
            }
            if (this.total_ar_col_amount != 0.00) {
                String totalString1 = numberFormat.format(this.total_ar_col_amount).replaceAll(",", "");
                int indexdot = totalString1.indexOf(".");
                String beforeDecimal = totalString1.substring(0, indexdot);
                String afterDecimal = totalString1.substring(indexdot + 1, totalString1.length());
                chargeCell = new PdfPCell();
                chargeCell.setColspan(6);
                chargeCell.setBorder(0);
                p = new Paragraph(7f, "" + ConvertNumberToWords.convert(Integer.parseInt(beforeDecimal))
                        + " DOLLARS AND " + StringUtils.removeEnd(afterDecimal, "0") + " CENTS",
                        totalFontQuote);
                chargeCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                chargeCell.addElement(p);
                chargeTable.addCell(chargeCell);
            }
        }
    } else if (this.total_ar_amount != 0.00) {
        chargeCell = new PdfPCell();
        chargeCell.setBorder(0);
        chargeCell.setColspan(2);
        chargeCell.setPaddingTop(8f);
        p = new Paragraph(7f, "T O T A L (USA)", totalFontQuote);
        p.setAlignment(Element.ALIGN_LEFT);
        chargeCell.addElement(p);
        chargeTable.addCell(chargeCell);

        chargeCell = new PdfPCell();
        chargeCell.setColspan(4);
        chargeCell.setBorder(0);
        chargeCell.setPaddingTop(8f);
        p = new Paragraph(7f, "$" + NumberUtils.convertToTwoDecimal(this.total_ar_amount) + " " + billType + " "
                + billToParty + "-" + acctNo, totalFontQuote);
        p.setAlignment(Element.ALIGN_LEFT);
        chargeCell.addElement(p);
        chargeTable.addCell(chargeCell);

        NumberFormat numberFormat = new DecimalFormat("###,###,##0.000");

        String totalString1 = numberFormat.format(this.total_ar_amount).replaceAll(",", "");
        int indexdot = totalString1.indexOf(".");
        String beforeDecimal = totalString1.substring(0, indexdot);
        String afterDecimal = totalString1.substring(indexdot + 1, totalString1.length());
        chargeCell = new PdfPCell();
        chargeCell.setColspan(6);
        chargeCell.setBorder(0);
        p = new Paragraph(7f, "" + ConvertNumberToWords.convert(Integer.parseInt(beforeDecimal))
                + " DOLLARS AND " + StringUtils.removeEnd(afterDecimal, "0") + " CENTS", totalFontQuote);
        chargeCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        chargeCell.addElement(p);
        chargeTable.addCell(chargeCell);
    }

    chargeCell = new PdfPCell();
    chargeCell.setBorder(0);
    chargeCell.setColspan(4);
    p = new Paragraph(5f, "" + sailDateFormat, totalFontQuote);
    p.setAlignment(Element.ALIGN_LEFT);
    chargeCell.addElement(p);
    chargeTable.addCell(chargeCell);

    chargeCell = new PdfPCell();
    chargeCell.setColspan(5);
    chargeCell.setBorder(0);
    chargeTable.addCell(chargeCell);

    chargeCell = new PdfPCell();
    chargeCell.setColspan(3);
    chargeCell.setBorder(0);
    chargeCell.setRowspan(3);
    String fdPodValue = null;
    if (agencyInfo != null && CommonUtils.isNotEmpty(agencyInfo[2])) {
        fdPodValue = agencyInfo[2];
    } else if (CommonFunctions.isNotNull(lclbl.getFinalDestination())
            && CommonFunctions.isNotNull(lclbl.getFinalDestination().getCountryId())
            && CommonFunctions.isNotNull(lclbl.getFinalDestination().getCountryId().getCodedesc())) {
        fdPodValue = lclbl.getFinalDestination().getUnLocationName() + ","
                + lclbl.getFinalDestination().getCountryId().getCodedesc();
    }
    p = new Paragraph(7f, fdPodValue != null ? fdPodValue.toUpperCase() : podValues.toUpperCase(),
            totalFontQuote);
    p.setAlignment(Element.ALIGN_LEFT);
    chargeCell.addElement(p);
    chargeTable.addCell(chargeCell);

    chargeCell = new PdfPCell();
    chargeCell.setBorder(0);
    chargeCell.setColspan(3);
    p = new Paragraph(5f, "UNIT# " + unitNumber, headingblackBoldFont);
    p.setAlignment(Element.ALIGN_LEFT);
    chargeCell.addElement(p);
    chargeTable.addCell(chargeCell);

    chargeCell = new PdfPCell();
    chargeCell.setBorder(0);
    chargeCell.setColspan(3);
    chargeCell.setPaddingTop(2f);
    p = new Paragraph(5f, "SEAL# " + sealOut, headingblackBoldFont);
    p.setAlignment(Element.ALIGN_LEFT);
    chargeCell.addElement(p);
    chargeTable.addCell(chargeCell);

    chargeCell = new PdfPCell();
    chargeCell.setBorder(0);
    chargeCell.setColspan(3);
    chargeCell.setPaddingTop(2f);
    p = new Paragraph(5f, "CONTROL-VOY# " + voyageNumber, totalFontQuote);
    p.setAlignment(Element.ALIGN_LEFT);
    chargeCell.addElement(p);
    chargeTable.addCell(chargeCell);

    String emailId = "";
    StringBuilder agentDetails = new StringBuilder();
    //Agent Details
    String agentAcctNo = "";
    if ("Y".equalsIgnoreCase(altAgentKey)) {
        agentAcctNo = CommonUtils.isNotEmpty(altAgentValue) ? altAgentValue : "";
    } else if (lclbl.getAgentAcct() != null) {
        agentAcctNo = (agencyInfo != null && CommonUtils.isNotEmpty(agencyInfo[0])) ? agencyInfo[0]
                : lclbl.getAgentAcct().getAccountno();
    }
    if (CommonUtils.isNotEmpty(agentAcctNo)) {
        CustAddress custAddress = new CustAddressDAO().findPrimeContact(agentAcctNo);
        if (CommonFunctions.isNotNull(custAddress)) {
            if (CommonFunctions.isNotNull(custAddress.getAcctName())) {
                agentDetails.append(custAddress.getAcctName()).append("  ");
            }
            if (CommonFunctions.isNotNull(custAddress.getPhone())) {
                agentDetails.append("Phone: ").append(custAddress.getPhone()).append("\n");
            } else {
                agentDetails.append("\n");
            }
            if (CommonFunctions.isNotNull(custAddress.getCoName())) {
                agentDetails.append(custAddress.getCoName()).append("\n");
            }
            if (CommonFunctions.isNotNull(custAddress.getAddress1())) {
                agentDetails.append(custAddress.getAddress1().replace(", ", "\n")).append("\n");
            }
            if (CommonFunctions.isNotNull(custAddress.getCity1())) {
                agentDetails.append(custAddress.getCity1());
            }
            if (CommonFunctions.isNotNull(custAddress.getState())) {
                agentDetails.append("  ").append(custAddress.getState());
            }
            if (CommonFunctions.isNotNull(custAddress.getEmail1())) {
                emailId = custAddress.getEmail1();
            }
        }
    }
    BigDecimal PrintInvoiceValue = null;
    if (lclbl.getPortOfDestination() != null) {
        boolean schnum = new LCLPortConfigurationDAO().getSchnumValue(lclbl.getPortOfDestination().getId());
        if (schnum) {
            BigDecimal printInvoice = lclbl.getInvoiceValue();
            Long fileId = lclbl.getFileNumberId();
            if (!CommonUtils.isEmpty(printInvoice) && !CommonUtils.isEmpty(fileId)) {
                PrintInvoiceValue = printInvoice;
            }
        }
    }

    chargeCell = new PdfPCell();
    chargeCell.setBorder(2);
    chargeCell.setColspan(6);
    chargeCell.setPadding(0f);
    PdfPTable agent_Contact_Table = new PdfPTable(3);
    agent_Contact_Table.setWidthPercentage(100f);
    agent_Contact_Table.setWidths(new float[] { 2.3f, 1.7f, 1.8f });
    PdfPCell agent_Contact_cell = new PdfPCell();
    agent_Contact_cell.setBorder(0);
    agent_Contact_cell.setBorderWidthTop(1f);
    agent_Contact_cell.setBorderWidthLeft(1f);
    agent_Contact_cell.setBorderWidthBottom(0.06f);
    agent_Contact_cell.setBorderWidthRight(1f);
    p = new Paragraph(7f, "To Pick Up Freight Please Contact: ", blackContentNormalFont);
    p.setAlignment(Element.ALIGN_LEFT);
    agent_Contact_cell.addElement(p);
    agent_Contact_Table.addCell(agent_Contact_cell);

    agent_Contact_cell = new PdfPCell();
    agent_Contact_cell.setBorder(0);
    agent_Contact_cell.setColspan(2);
    agent_Contact_cell.setBorderWidthTop(1f);
    agent_Contact_cell.setPaddingBottom(2f);
    p = new Paragraph(7f, "Email: " + emailId.toLowerCase(), totalFontQuote);
    p.setAlignment(Element.ALIGN_LEFT);
    agent_Contact_cell.addElement(p);
    agent_Contact_Table.addCell(agent_Contact_cell);

    agent_Contact_cell = new PdfPCell();
    agent_Contact_cell.setColspan(2);
    agent_Contact_cell.setBorder(0);
    agent_Contact_cell.setBorderWidthLeft(1f);
    p = new Paragraph(7f, "" + agentDetails.toString(), totalFontQuote);
    p.setAlignment(Element.ALIGN_LEFT);
    agent_Contact_cell.addElement(p);
    agent_Contact_Table.addCell(agent_Contact_cell);

    agent_Contact_cell = new PdfPCell();
    agent_Contact_cell.setBorder(0);
    agent_Contact_cell.setPaddingTop(27f);
    p = new Paragraph(7f, "" + agentAcctNo, totalFontQuote);
    p.setAlignment(Element.ALIGN_RIGHT);
    agent_Contact_cell.addElement(p);
    agent_Contact_Table.addCell(agent_Contact_cell);

    agent_Contact_cell = new PdfPCell();
    agent_Contact_cell.setBorder(0);
    agent_Contact_cell.setColspan(3);
    agent_Contact_cell.setBorderWidthLeft(1f);
    StringBuilder builder = new StringBuilder();
    builder.append(PrintInvoiceValue != null ? "Value of Goods:USD $" + PrintInvoiceValue : "");
    p = new Paragraph(3f, "" + builder.toString(), totalFontQuote);
    p.setAlignment(Element.ALIGN_RIGHT);
    agent_Contact_cell.addElement(p);
    agent_Contact_Table.addCell(agent_Contact_cell);
    chargeCell.addElement(agent_Contact_Table);
    chargeTable.addCell(chargeCell);

    return chargeTable;
}

From source file:de.ingrid.importer.udk.strategy.v1.IDCStrategy1_0_3.java

protected void updateSysList() throws Exception {
    if (log.isInfoEnabled()) {
        log.info("Updating sys_list...");
    }/*from  w w w .  jav  a 2 s  .com*/

    int lstId = 6000;
    if (log.isInfoEnabled()) {
        log.info("Inserting new syslist " + lstId + " (Grad der Konformitt)...");
    }

    // clean up, to guarantee no old values !
    sqlStr = "DELETE FROM sys_list where lst_id = " + lstId;
    jdbc.executeUpdate(sqlStr);

    // insert new syslist (de)
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 1, 'de', 'konform', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 2, 'de', 'nicht konform', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + defaultSyslist6000EntryId + ", 'de', '"
                    + defaultSyslist6000EntryValue + "', 0, 'Y')");

    // insert new syslist (en)
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 1, 'en', 'conformant', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 2, 'en', 'not conformant', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + defaultSyslist6000EntryId
                    + ", 'en', 'not evaluated', 0, 'Y')");

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

    lstId = 6010;
    if (log.isInfoEnabled()) {
        log.info("Inserting new syslist " + lstId + " (Zugangsbeschrnkungen)...");
    }

    // clean up, to guarantee no old values !
    sqlStr = "DELETE FROM sys_list where lst_id = " + lstId;
    jdbc.executeUpdate(sqlStr);

    // insert new syslist (de)
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + noData_Syslist6010EntryId + ", 'de', '"
                    + noData_Syslist6010EntryValue + "', 0, 'Y')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId
                    + ", 2, 'de', 'aufgrund der Vertraulichkeit der Verfahren von Behrden', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId
                    + ", 3, 'de', 'aufgrund internationaler Beziehungen, der ffentliche Sicherheit oder der Landesverteidigung', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId
                    + ", 4, 'de', 'aufgrund laufender Gerichtsverfahren', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId
                    + ", 5, 'de', 'aufgrund der Vertraulichkeit von Geschfts- oder Betriebsinformationen', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + existingData_Syslist6010EntryId + ", 'de', '"
                    + existingData_Syslist6010EntryValue + "', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId
                    + ", 7, 'de', 'aufgrund der Vertraulichkeit personenbezogener Daten', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 8, 'de', 'aufgrund des Schutzes einer Person', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId
                    + ", 9, 'de', 'aufgrund des Schutzes von Umweltbereichen', 0, 'N')");

    // insert new syslist (en)
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + noData_Syslist6010EntryId
                    + ", 'en', 'no conditions apply', 0, 'Y')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId
                    + ", 2, 'en', 'the confidentiality of the proceedings of public authorities', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId
                    + ", 3, 'en', 'international relations, public security or national defence', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 4, 'en', 'the course of justice', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId
                    + ", 5, 'en', 'the confidentiality of commercial or industrial information', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + existingData_Syslist6010EntryId
                    + ", 'en', 'intellectual property rights', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId
                    + ", 7, 'en', 'the confidentiality of personal data and/or files', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId
                    + ", 8, 'en', 'the interests or protection of any person', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 9, 'en', 'the protection of the environment', 0, 'N')");

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

    lstId = 5100;
    if (log.isInfoEnabled()) {
        log.info("Updating syslist " + lstId + " (Service-Klassifikation)...");
    }

    // clean up, to guarantee no old values !
    sqlStr = "DELETE FROM sys_list where lst_id = " + lstId;
    jdbc.executeUpdate(sqlStr);

    // insert new syslist
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 1, 'de', 'Suchdienste (CSW)', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 1, 'en', 'Discovery Service', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + wmsSyslist5100EntryId + ", 'de', '"
                    + wmsSyslist5100EntryValue + "', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + wmsSyslist5100EntryId
                    + ", 'en', 'View Service', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + wfsSyslist5100EntryId + ", 'de', '"
                    + wfsSyslist5100EntryValue + "', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + wfsSyslist5100EntryId
                    + ", 'en', 'Download Service', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 4, 'de', 'Transformationsdienste (WCTS)', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 4, 'en', 'Transformation Service', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 5, 'de', 'Verkettete Geodatendienste', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 5, 'en', 'Invoke Spatial Data Service', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + defaultSyslist5100EntryId + ", 'de', '"
                    + defaultSyslist5100EntryValue + "', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", " + defaultSyslist5100EntryId
                    + ", 'en', 'Other Service', 0, 'N')");

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

    lstId = 5105;
    if (log.isInfoEnabled()) {
        log.info("Inserting new syslist " + lstId + " (Operations for CSW Service)...");
    }

    // clean up, to guarantee no old values !
    sqlStr = "DELETE FROM sys_list where lst_id = " + lstId;
    jdbc.executeUpdate(sqlStr);

    // insert new syslist
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 1, 'de', 'GetCapabilities', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 2, 'de', 'GetRecords', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 3, 'de', 'GetRecordById', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 4, 'de', 'DescribeRecord', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 5, 'de', 'GetDomain', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 6, 'de', 'Transaction', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 7, 'de', 'Harvest', 0, 'N')");

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

    lstId = 5130;
    if (log.isInfoEnabled()) {
        log.info("Inserting new syslist " + lstId + " (Operations for WCTS Service)...");
    }

    // clean up, to guarantee no old values !
    sqlStr = "DELETE FROM sys_list where lst_id = " + lstId;
    jdbc.executeUpdate(sqlStr);

    // insert new syslist
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 1, 'de', 'GetCapabilities', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 2, 'de', 'Transform', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 3, 'de', 'IsTransformable', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 4, 'de', 'GetTransformation', 0, 'N')");
    jdbc.executeUpdate(
            "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                    + getNextId() + ", " + lstId + ", 5, 'de', 'GetResourceById', 0, 'N')");

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

    lstId = 5120;
    if (log.isInfoEnabled()) {
        log.info("Updating syslist " + lstId + " (Operations for WFS Service)...");
    }

    // clean up, to guarantee no old values !
    sqlStr = "DELETE FROM sys_list where lst_id = " + lstId;
    jdbc.executeUpdate(sqlStr);

    newSyslist5120.put(1, "GetCapabilities");
    newSyslist5120.put(2, "DescribeFeatureType");
    newSyslist5120.put(3, "GetFeature");
    newSyslist5120.put(4, "LockFeature");
    newSyslist5120.put(5, "Transaction");

    oldToNewKeySyslist5120.put(1, 2);
    // both old "GetFeature" mapped to new "GetFeature" (error in old syslist)
    oldToNewKeySyslist5120.put(2, 3);
    oldToNewKeySyslist5120.put(3, 3);
    oldToNewKeySyslist5120.put(4, 4);
    oldToNewKeySyslist5120.put(5, 5);

    Iterator<Integer> itr = newSyslist5120.keySet().iterator();
    while (itr.hasNext()) {
        int key = itr.next();
        jdbc.executeUpdate(
                "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                        + getNextId() + ", " + lstId + ", " + key + ", 'de', '" + newSyslist5120.get(key)
                        + "', 0, 'N')");
    }

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

    lstId = 5200;
    if (log.isInfoEnabled()) {
        log.info("Updating syslist " + lstId + " (INSPIRE: Classification of spatial data services)...");
    }

    // clean up, to guarantee no old values !
    sqlStr = "DELETE FROM sys_list where lst_id = " + lstId;
    jdbc.executeUpdate(sqlStr);

    // german syslist
    newSyslist5200_de.put(101, "Katalogdienst (humanCatalogueViewer)");
    newSyslist5200_de.put(102, "Dienst fr geografische Visualisierung");
    newSyslist5200_de.put(103, "Dienst fr geografische Tabellenkalkulation");
    newSyslist5200_de.put(104, "Editor fr Verarbeitungsdienste");
    newSyslist5200_de.put(105, "Editor fr die Definition von Bearbeitungsketten");
    newSyslist5200_de.put(106, "Aufrufprogramm fr Bearbeitungsketten");
    newSyslist5200_de.put(107, "Editor fr geografische Objekte");
    newSyslist5200_de.put(108, "Editor fr geografische Symbole");
    newSyslist5200_de.put(109, "Editor fr die Objektgeneralisierung");
    newSyslist5200_de.put(110, "Betrachter fr geografische Datenstrukturen");
    newSyslist5200_de.put(201, "Dienst fr den Zugriff auf Objekte");
    newSyslist5200_de.put(202, "Dienst fr den Zugriff auf grafische Darstellungen");
    newSyslist5200_de.put(203, "Dienst fr den Zugriff auf Rasterdaten");
    newSyslist5200_de.put(204, "Dienst fr die Beschreibung von Sensoren");
    newSyslist5200_de.put(205, "Dienst fr den Zugriff auf Produkte");
    newSyslist5200_de.put(206, "Dienst fr den Zugriff auf Objektarten");
    newSyslist5200_de.put(207, "Katalogdienst (infoCatalogueService)");
    newSyslist5200_de.put(208, "Registerdienst");
    newSyslist5200_de.put(209, "Gazetteerdienst");
    newSyslist5200_de.put(210, "Auftragsdienst");
    newSyslist5200_de.put(211, "Dauerauftragsdienst");
    newSyslist5200_de.put(301, "Dienst fr die Definition von Bearbeitungsketten");
    newSyslist5200_de.put(302, "Dienst fr die Ausfhrung von Bearbeitungsketten ");
    newSyslist5200_de.put(303, "Abonnementdienst");
    newSyslist5200_de.put(401, "Dienst fr die Konversion von Koordinaten");
    newSyslist5200_de.put(402, "Dienst fr die Transformation von Koordinaten");
    newSyslist5200_de.put(403, "Dienst fr die Umwandlung zwischen Raster- und Vektordaten");
    newSyslist5200_de.put(404, "Dienst fr die Konversion von Bildkoordinaten");
    newSyslist5200_de.put(405, "Entzerrungsdienst");
    newSyslist5200_de.put(406, "Ortho-Entzerrungsdienst");
    newSyslist5200_de.put(407, "Dienst fr die Justierung von Geometriemodellen von Sensoren");
    newSyslist5200_de.put(408, "Dienst fr die Konversion von Geometriemodellen");
    newSyslist5200_de.put(409, "Geografischer Ausschnittsdienst");
    newSyslist5200_de.put(410, "Raumbezogener Auswahldienst");
    newSyslist5200_de.put(411, "Kachelungsdienst");
    newSyslist5200_de.put(412, "Messungsdienst");
    newSyslist5200_de.put(413, "Objektbearbeitungsdienste");
    newSyslist5200_de.put(414, "Vergleichsdienst");
    newSyslist5200_de.put(415, "Generalisierungsdienst");
    newSyslist5200_de.put(416, "Routensuchdienst");
    newSyslist5200_de.put(417, "Positionierungsdienst");
    newSyslist5200_de.put(418, "Analysedienst fr rumliche Nachbarschaftsbeziehungen");
    newSyslist5200_de.put(501, "Berechnungsdienst fr Geoparameter");
    newSyslist5200_de.put(502, "Dienst fr die thematische Klassifizierung");
    newSyslist5200_de.put(503, "Generalisierungsdienst fr Objektarten");
    newSyslist5200_de.put(504, "Themenbezogener Ausschnittsdienst");
    newSyslist5200_de.put(505, "Zhldienst");
    newSyslist5200_de.put(506, "Erkennungsdienst fr Vernderungen");
    newSyslist5200_de.put(507, "Auszugsdienste fr geografische Informationen");
    newSyslist5200_de.put(508, "Themenbezogener Bildverarbeitungsdienst");
    newSyslist5200_de.put(509, "Auflsungsreduzierungsdienst");
    newSyslist5200_de.put(510, "Bildbearbeitungsdienste");
    newSyslist5200_de.put(511, "Interpretationsdienste fr Bilder");
    newSyslist5200_de.put(512, "Bildsynthesedienste");
    newSyslist5200_de.put(513, "Multiband-Bildbearbeitung");
    newSyslist5200_de.put(514, "Objekterkennungsdienst");
    newSyslist5200_de.put(515, "Geoparserdienst");
    newSyslist5200_de.put(516, "Geocodierungsdienst");
    newSyslist5200_de.put(601, "Transformationsdienst fr den Zeitbezug");
    newSyslist5200_de.put(602, "Zeitbezogener Ausschnittsdienst");
    newSyslist5200_de.put(603, "Zeitbezogener Auswahldienst");
    newSyslist5200_de.put(604, "Analysedienst fr zeitbezogene Nachbarschaftsbeziehungen");
    newSyslist5200_de.put(701, "Dienst fr statistische Berechnungen");
    newSyslist5200_de.put(702, "Ergnzungsdienste fr Geodaten");
    newSyslist5200_de.put(801, "Codierungsdienst");
    newSyslist5200_de.put(802, "bertragungsdienst");
    newSyslist5200_de.put(803, "Kompressionsdienst fr Geodaten");
    newSyslist5200_de.put(804, "Umformatierungsdienst fr Geodaten");
    newSyslist5200_de.put(805, "Nachrichtenbermittlungsdienst");
    newSyslist5200_de.put(806, "Dienst fr den Zugriff auf externe Daten und Programme");
    newSyslist5200_de.put(901, "Kein geografischer Dienst");

    // english syslist
    LinkedHashMap<Integer, String> newSyslist5200_en = new LinkedHashMap<Integer, String>();
    newSyslist5200_en.put(101, "Catalogue viewer");
    newSyslist5200_en.put(102, "Geographic viewer");
    newSyslist5200_en.put(103, "Geographic spreadsheet viewer");
    newSyslist5200_en.put(104, "Service editor");
    newSyslist5200_en.put(105, "Chain definition editor");
    newSyslist5200_en.put(106, "Workflow enactment manager");
    newSyslist5200_en.put(107, "Geographic feature editor");
    newSyslist5200_en.put(108, "Geographic symbol editor");
    newSyslist5200_en.put(109, "Feature generalization editor");
    newSyslist5200_en.put(110, "Geographic data-structure viewer");
    newSyslist5200_en.put(201, "Feature access service");
    newSyslist5200_en.put(202, "Map access service");
    newSyslist5200_en.put(203, "Coverage access service");
    newSyslist5200_en.put(204, "Sensor description service");
    newSyslist5200_en.put(205, "Product access service");
    newSyslist5200_en.put(206, "Feature type service");
    newSyslist5200_en.put(207, "Catalogue service");
    newSyslist5200_en.put(208, "Registry Service");
    newSyslist5200_en.put(209, "Gazetteer service");
    newSyslist5200_en.put(210, "Order handling service");
    newSyslist5200_en.put(211, "Standing order service");
    newSyslist5200_en.put(301, "Chain definition service");
    newSyslist5200_en.put(302, "Workflow enactment service");
    newSyslist5200_en.put(303, "Subscription service");
    newSyslist5200_en.put(401, "Coordinate conversion service");
    newSyslist5200_en.put(402, "Coordinate transformation service");
    newSyslist5200_en.put(403, "Coverage/vector conversion service");
    newSyslist5200_en.put(404, "Image coordinate conversion service");
    newSyslist5200_en.put(405, "Rectification service");
    newSyslist5200_en.put(406, "Orthorectification service");
    newSyslist5200_en.put(407, "Sensor geometry model adjustment service");
    newSyslist5200_en.put(408, "Image geometry model conversion service");
    newSyslist5200_en.put(409, "Subsetting service (spatial)");
    newSyslist5200_en.put(410, "Sampling service (spatial)");
    newSyslist5200_en.put(411, "Tiling change service");
    newSyslist5200_en.put(412, "Dimension measurement service");
    newSyslist5200_en.put(413, "Feature manipulation services");
    newSyslist5200_en.put(414, "Feature matching service");
    newSyslist5200_en.put(415, "Feature generalization service (spatial)");
    newSyslist5200_en.put(416, "Route determination service");
    newSyslist5200_en.put(417, "Positioning service");
    newSyslist5200_en.put(418, "Proximity analysis service");
    newSyslist5200_en.put(501, "Geoparameter calculation service");
    newSyslist5200_en.put(502, "Thematic classification service");
    newSyslist5200_en.put(503, "Feature generalization service (thematic)");
    newSyslist5200_en.put(504, "Subsetting service (thematic)");
    newSyslist5200_en.put(505, "Spatial counting service");
    newSyslist5200_en.put(506, "Change detection service");
    newSyslist5200_en.put(507, "Geographic information extraction services");
    newSyslist5200_en.put(508, "Image processing service");
    newSyslist5200_en.put(509, "Reduced resolution generation service");
    newSyslist5200_en.put(510, "Image Manipulation Services");
    newSyslist5200_en.put(511, "Image understanding services");
    newSyslist5200_en.put(512, "Image synthesis services");
    newSyslist5200_en.put(513, "Multi-band image manipulation");
    newSyslist5200_en.put(514, "Object detection service");
    newSyslist5200_en.put(515, "Geoparsing service");
    newSyslist5200_en.put(516, "Geocoding service");
    newSyslist5200_en.put(601, "Temporal reference system transformation service");
    newSyslist5200_en.put(602, "Subsetting service (temporal)");
    newSyslist5200_en.put(603, "Sampling service (temporal)");
    newSyslist5200_en.put(604, "Temporal proximity analysis service");
    newSyslist5200_en.put(701, "Statistical calculation service");
    newSyslist5200_en.put(702, "Geographic annotation services");
    newSyslist5200_en.put(801, "Encoding service");
    newSyslist5200_en.put(802, "Transfer service");
    newSyslist5200_en.put(803, "Geographic compression service");
    newSyslist5200_en.put(804, "Geographic format conversion service");
    newSyslist5200_en.put(805, "Messaging service");
    newSyslist5200_en.put(806, "Remote file and executable management");
    newSyslist5200_en.put(901, "Non Geographic Service");

    oldToNewKeySyslist5200.put(1, 207);
    oldToNewKeySyslist5200.put(2, 202);
    oldToNewKeySyslist5200.put(3, 201);
    oldToNewKeySyslist5200.put(6, 901);

    itr = newSyslist5200_de.keySet().iterator();
    while (itr.hasNext()) {
        int key = itr.next();
        // german version
        jdbc.executeUpdate(
                "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                        + getNextId() + ", " + lstId + ", " + key + ", 'de', '" + newSyslist5200_de.get(key)
                        + "', 0, 'N')");
        // english version
        jdbc.executeUpdate(
                "INSERT INTO sys_list (id, lst_id, entry_id, lang_id, name, maintainable, is_default) VALUES ("
                        + getNextId() + ", " + lstId + ", " + key + ", 'en', '" + newSyslist5200_en.get(key)
                        + "', 0, 'N')");
    }

    if (log.isInfoEnabled()) {
        log.info("Updating sys_list... done");
    }
}

From source file:com.huateng.startup.init.MenuInfoUtil.java

/**
 * ???/*from  w  ww  . j  a  va  2  s . c o m*/
 * @param degree
 */
@SuppressWarnings("unchecked")
public static LinkedHashMap<String, Object> setOperatorMenuWithDegree(String degree, String contextPath,
        Document document) {
    String sql = "select * FROM TBL_ROLE_FUNC_MAP WHERE KEY_ID in ( " + degree + ")";
    ICommQueryDAO commQueryDAO = (ICommQueryDAO) ContextUtil.getBean("CommQueryDAO");
    List<Object[]> funcMapList = commQueryDAO.findBySQLQuery(sql);
    valueIdRole(funcMapList);
    List<Object> menuLvl1List = allMenuBean.getDataList();
    LinkedHashMap<String, Object> menuIndexMap = new LinkedHashMap<String, Object>();
    String panelStr = "";
    //?????
    for (int i = 0, n = menuLvl1List.size(); i < n; i++) {
        Map<String, Object> menuLvl1Map = (Map<String, Object>) menuLvl1List.get(i);
        LinkedList<Object> menuLvl2List = (LinkedList<Object>) menuLvl1Map.get(Constants.MENU_CHILDREN);
        List<String> menuList = new ArrayList<String>();
        for (int j = 0, m = menuLvl2List.size(); j < m; j++) {
            Map<String, Object> menuLvl2Map = (Map<String, Object>) menuLvl2List.get(j);
            LinkedList<Object> menuLvl3List = (LinkedList<Object>) menuLvl2Map.get(Constants.MENU_CHILDREN);
            for (int k = 0, l = menuLvl3List.size(); k < l; k++) {
                Map<String, Object> menuLvl3Map = (Map<String, Object>) menuLvl3List.get(k);
                for (int a = 0, b = funcMapList.size(); a < b; a++) {
                    if (StringUtils.trim(funcMapList.get(a)[1].toString())
                            .equals(StringUtils.trim(menuLvl3Map.get(Constants.MENU_ID).toString()))) {
                        if (!menuIndexMap.containsKey(menuLvl1Map.get(Constants.MENU_ID).toString())) {
                            Map<String, Object> menuLvl1HashMap = new LinkedHashMap<String, Object>();
                            String menuId = menuLvl1Map.get(Constants.MENU_ID).toString();
                            menuLvl1HashMap.put(Constants.MENU_ID, menuLvl1Map.get(Constants.MENU_ID));
                            menuLvl1HashMap.put(Constants.MENU_TEXT, menuLvl1Map.get(Constants.MENU_TEXT));
                            menuLvl1HashMap.put(Constants.MENU_CLS, menuLvl1Map.get(Constants.MENU_CLS));
                            menuLvl1HashMap.put(Constants.MENU_HANDLER, Constants.MENU_LVL1_FUNC);
                            menuLvl1HashMap.put(Constants.TOOL_BAR_TYPE, Constants.TOOL_BAR_BUTTON);
                            menuLvl1HashMap.put(Constants.TOOLBAR_ICON, Constants.TOOLBAR_ICON_MENU);
                            menuLvl1HashMap.put(Constants.IS_EXPAND, true);

                            if ("1".equals(menuId) && panelStr.indexOf("baseTree") == -1) {
                                panelStr = panelStr + "baseTree,";
                            }
                            if ("2".equals(menuId) && panelStr.indexOf("mchtTree") == -1) {
                                panelStr = panelStr + "mchtTree,";
                            }
                            if ("3".equals(menuId) && panelStr.indexOf("termTree") == -1) {
                                panelStr = panelStr + "termTree,";
                            }
                            if ("5".equals(menuId) && panelStr.indexOf("queryTree") == -1) {
                                panelStr = panelStr + "queryTree,";
                            }
                            if ("9".equals(menuId) && panelStr.indexOf("onLinePayTree") == -1) {
                                panelStr = panelStr + "onLinePayTree,";
                            }
                            if ("10".equals(menuId) && panelStr.indexOf("taskTree") == -1) {
                                panelStr = panelStr + "taskTree,";
                            }
                            if ("8".equals(menuId) && panelStr.indexOf("clearTree") == -1) {
                                panelStr = panelStr + "clearTree,";
                            }
                            if ("4".equals(menuId) && panelStr.indexOf("riskTree") == -1) {
                                panelStr = panelStr + "riskTree,";
                            }
                            if ("11".equals(menuId) && panelStr.indexOf("provisionsTree") == -1) {
                                panelStr = panelStr + "provisionsTree,";
                            }
                            if ("12".equals(menuId) && panelStr.indexOf("errorTree") == -1) {
                                panelStr = panelStr + "errorTree,";
                            }
                            Map<String, Object> menuLvl2HashMap = new LinkedHashMap<String, Object>();
                            menuLvl2HashMap.put(Constants.MENU_ID, menuLvl2Map.get(Constants.MENU_ID));
                            menuLvl2HashMap.put(Constants.MENU_TEXT, menuLvl2Map.get(Constants.MENU_TEXT));
                            menuLvl2HashMap.put(Constants.MENU_PARENT_ID,
                                    menuLvl2Map.get(Constants.MENU_PARENT_ID));
                            menuLvl2HashMap.put(Constants.MENU_CLS, menuLvl2Map.get(Constants.MENU_CLS));
                            menuLvl2HashMap.put(Constants.TOOLBAR_ICON, Constants.TOOLBAR_ICON_MENUITEM);
                            menuLvl2HashMap.put(Constants.IS_EXPAND, true);

                            Map<String, Object> menuLvl3HashMap = new LinkedHashMap<String, Object>();
                            int index = menuList.lastIndexOf((String) menuLvl3Map.get(Constants.MENU_ID));
                            LinkedList<Object> menuLvl3Child = new LinkedList<Object>();
                            //System.out.println((String)menuLvl3Map.get(Constants.MENU_ID) + ">>>>>>>>>" + index + ">>>>>" + menuList.size());
                            if (-1 == index) {
                                String tbar = MenuUtil.initMenu((String) menuLvl3Map.get(Constants.MENU_ID),
                                        (String) funcMapList.get(a)[5]);
                                menuLvl3HashMap.put(Constants.MENU_ID, menuLvl3Map.get(Constants.MENU_ID));
                                menuLvl3HashMap.put(Constants.MENU_TEXT, menuLvl3Map.get(Constants.MENU_TEXT));
                                menuLvl3HashMap.put(Constants.MENU_PARENT_ID,
                                        menuLvl3Map.get(Constants.MENU_PARENT_ID));
                                menuLvl3HashMap.put(Constants.MENU_LEAF, true);
                                menuLvl3HashMap.put(Constants.MENU_URL, menuLvl3Map.get(Constants.MENU_URL));
                                menuLvl3HashMap.put(Constants.ROLE_FLAG, tbar);
                                menuLvl3HashMap.put(Constants.MENU_CLS, menuLvl3Map.get(Constants.MENU_CLS));
                                menuLvl3HashMap.put(Constants.MENU_HANDLER, Constants.MENU_LVL3_FUNC);
                                menuLvl3HashMap.put(Constants.TOOLBAR_ICON,
                                        menuLvl3Map.get(Constants.TOOLBAR_ICON));
                                menuLvl3HashMap.put(Constants.IS_EXPAND, true);

                                menuList.add((String) menuLvl3Map.get(Constants.MENU_ID));

                                menuLvl3Child.add(menuLvl3HashMap);
                            } else {
                                Map<String, Object> menu = (Map<String, Object>) menuLvl3Child.get(index);
                                menu.put(Constants.ROLE_FLAG,
                                        (String) menu.get(Constants.ROLE_FLAG) + funcMapList.get(a)[5]);
                            }

                            menuLvl2HashMap.put(Constants.MENU_CHILDREN, menuLvl3Child);
                            menuLvl2HashMap.put(Constants.TOOL_BAR_CHILDREN, menuLvl3Child);
                            LinkedList<Object> menuLvl2Child = new LinkedList<Object>();
                            menuLvl2Child.add(menuLvl2HashMap);
                            menuLvl1HashMap.put(Constants.MENU_CHILDREN, menuLvl2Child);
                            menuLvl1HashMap.put(Constants.TOOL_BAR_CHILDREN, menuLvl2Child);

                            menuIndexMap.put(menuLvl1Map.get(Constants.MENU_ID).toString(), menuLvl1HashMap);
                        } else {
                            Map<String, Object> menuLvl1HashMap = (Map<String, Object>) menuIndexMap
                                    .get(menuLvl1Map.get(Constants.MENU_ID).toString());
                            LinkedList<Object> menuLvl2Child = (LinkedList<Object>) menuLvl1HashMap
                                    .get(Constants.MENU_CHILDREN);
                            boolean hasMenu = false;
                            for (int c = 0, d = menuLvl2Child.size(); c < d; c++) {
                                Map<String, Object> menuLvl2HashMap = (Map<String, Object>) menuLvl2Child
                                        .get(c);
                                if (StringUtils.trim(menuLvl2HashMap.get(Constants.MENU_ID).toString()).equals(
                                        StringUtils.trim(menuLvl2Map.get(Constants.MENU_ID).toString()))) {
                                    LinkedList<Object> menuLvl3Child = (LinkedList<Object>) menuLvl2HashMap
                                            .get(Constants.MENU_CHILDREN);
                                    Map<String, Object> menuLvl3HashMap = new LinkedHashMap<String, Object>();
                                    int index = menuList
                                            .lastIndexOf((String) menuLvl3Map.get(Constants.MENU_ID));
                                    if (-1 == index) {
                                        String tbar = MenuUtil.initMenu(
                                                (String) menuLvl3Map.get(Constants.MENU_ID),
                                                (String) funcMapList.get(a)[5]);
                                        menuLvl3HashMap.put(Constants.MENU_ID,
                                                menuLvl3Map.get(Constants.MENU_ID));
                                        menuLvl3HashMap.put(Constants.MENU_TEXT,
                                                menuLvl3Map.get(Constants.MENU_TEXT));
                                        menuLvl3HashMap.put(Constants.MENU_PARENT_ID,
                                                menuLvl3Map.get(Constants.MENU_PARENT_ID));
                                        menuLvl3HashMap.put(Constants.MENU_LEAF, true);
                                        menuLvl3HashMap.put(Constants.MENU_URL,
                                                menuLvl3Map.get(Constants.MENU_URL));
                                        menuLvl3HashMap.put(Constants.ROLE_FLAG, tbar);
                                        menuLvl3HashMap.put(Constants.MENU_CLS,
                                                menuLvl3Map.get(Constants.MENU_CLS));
                                        menuLvl3HashMap.put(Constants.MENU_HANDLER, Constants.MENU_LVL3_FUNC);
                                        menuLvl3HashMap.put(Constants.TOOLBAR_ICON,
                                                menuLvl3Map.get(Constants.TOOLBAR_ICON));
                                        menuLvl3HashMap.put(Constants.IS_EXPAND, true);

                                        menuList.add((String) menuLvl3Map.get(Constants.MENU_ID));
                                        menuLvl3Child.add(menuLvl3HashMap);
                                    }
                                    //                              else{
                                    //                                 Map<String, Object> menu = (Map<String, Object>)menuLvl3Child.get(index);
                                    //                                 menu.put(Constants.ROLE_FLAG,(String)menu.get(Constants.ROLE_FLAG) + funcMapList.get(a)[5]);
                                    //                              }
                                    menuLvl2HashMap.put(Constants.MENU_CHILDREN, menuLvl3Child);
                                    menuLvl2HashMap.put(Constants.TOOL_BAR_CHILDREN, menuLvl3Child);
                                    menuLvl2HashMap.put(Constants.IS_EXPAND, true);
                                    menuLvl2Child.set(c, menuLvl2HashMap);
                                    hasMenu = true;
                                    break;
                                }
                            }
                            if (!hasMenu) {
                                String tbar = MenuUtil.initMenu((String) menuLvl3Map.get(Constants.MENU_ID),
                                        (String) funcMapList.get(a)[5]);
                                Map<String, Object> menuLvl2HashMap = new HashMap<String, Object>();
                                menuLvl2HashMap.put(Constants.MENU_ID, menuLvl2Map.get(Constants.MENU_ID));
                                menuLvl2HashMap.put(Constants.MENU_TEXT, menuLvl2Map.get(Constants.MENU_TEXT));
                                menuLvl2HashMap.put(Constants.MENU_PARENT_ID,
                                        menuLvl2Map.get(Constants.MENU_PARENT_ID));
                                menuLvl2HashMap.put(Constants.MENU_CLS, menuLvl2Map.get(Constants.MENU_CLS));
                                menuLvl2HashMap.put(Constants.TOOLBAR_ICON, Constants.TOOLBAR_ICON_MENUITEM);
                                menuLvl2HashMap.put(Constants.IS_EXPAND, true);
                                LinkedList<Object> menuLvl3Child = new LinkedList<Object>();
                                Map<String, Object> menuLvl3HashMap = new LinkedHashMap<String, Object>();
                                menuLvl3HashMap.put(Constants.MENU_ID, menuLvl3Map.get(Constants.MENU_ID));
                                menuLvl3HashMap.put(Constants.MENU_TEXT, menuLvl3Map.get(Constants.MENU_TEXT));
                                menuLvl3HashMap.put(Constants.MENU_PARENT_ID,
                                        menuLvl3Map.get(Constants.MENU_PARENT_ID));
                                menuLvl3HashMap.put(Constants.MENU_LEAF, true);
                                menuLvl3HashMap.put(Constants.MENU_URL, menuLvl3Map.get(Constants.MENU_URL));
                                menuLvl3HashMap.put(Constants.MENU_CLS, menuLvl3Map.get(Constants.MENU_CLS));
                                menuLvl3HashMap.put(Constants.ROLE_FLAG, tbar);
                                menuLvl3HashMap.put(Constants.MENU_HANDLER, Constants.MENU_LVL3_FUNC);
                                //menuLvl3HashMap.put(Constants.TOOLBAR_ICON, Constants.TOOLBAR_ICON_MENUITEM);
                                menuLvl3HashMap.put(Constants.TOOLBAR_ICON,
                                        menuLvl3Map.get(Constants.TOOLBAR_ICON));
                                menuLvl3HashMap.put(Constants.IS_EXPAND, true);

                                menuLvl3Child.add(menuLvl3HashMap);
                                menuLvl2HashMap.put(Constants.MENU_CHILDREN, menuLvl3Child);
                                menuLvl2HashMap.put(Constants.TOOL_BAR_CHILDREN, menuLvl3Child);
                                menuLvl2Child.add(menuLvl2HashMap);
                            }
                            menuLvl1HashMap.put(Constants.MENU_CHILDREN, menuLvl2Child);
                            menuLvl1HashMap.put(Constants.TOOL_BAR_CHILDREN, menuLvl2Child);
                            menuLvl1HashMap.put(Constants.IS_EXPAND, true);
                            menuIndexMap.put(menuLvl1Map.get(Constants.MENU_ID).toString(), menuLvl1HashMap);
                        }
                    }
                }
            }
        }
    }
    menuIndexMap.remove(Constants.TREE_MENU_PANEL);
    if (panelStr.length() != 0) {
        menuIndexMap.put(Constants.TREE_MENU_PANEL, panelStr.substring(0, panelStr.length() - 1));
    } else {
        menuIndexMap.put(Constants.TREE_MENU_PANEL, "");
    }
    return menuIndexMap;
}

From source file:com.pari.nm.utils.db.InventoryDBHelper.java

public static NetworkNode readDevice(NetworkNode node) {
    try {// ww  w . ja  va2 s .  co m
        LinkedHashMap<String, String> queryTypes = node.getQueryTypes();
        if (queryTypes != null) {
            for (String qtype : queryTypes.keySet()) {
                InventoryDBHelper.loadQuery(node, queryTypes.get(qtype), qtype);
            }
        }
    } catch (Exception ee) {
        logger.warn("Error in readDevice for the deviceId=" + node.getNodeId(), ee);
    }

    return node;
}

From source file:com.gtwm.pb.model.manageData.DataManagement.java

/**
 * Used by both the public saveRecord and globalEdit methods
 *//*  w ww  .  jav a2s.  co  m*/
private void saveRecord(HttpServletRequest request, TableInfo table,
        LinkedHashMap<BaseField, BaseValue> dataToSave, boolean newRecord, Set<Integer> rowIds,
        SessionDataInfo sessionData, List<FileItem> multipartItems)
        throws InputRecordException, ObjectNotFoundException, SQLException, CantDoThatException,
        CodingErrorException, DisallowedException, MissingParametersException {
    if ((dataToSave.size() == 0) && (!newRecord)) {
        // Note: this does actually happen quite a lot, from two particular
        // users, therefore I've commented out the log warning.
        // Haven't tracked down the cause but it doesn't seem to be creating
        // a problem.
        // logger.warn("Call to saveRecord with no data to save. User = "
        // + request.getRemoteUser() + ", table = " + table + ", rowIds = "
        // + rowIds);
        return;
    }
    this.setHiddenFieldValues(request, table, dataToSave, newRecord);
    boolean globalEdit = false;
    int rowId = -1;
    if (rowIds.size() > 1) {
        globalEdit = true;
    } else if (rowIds.size() == 1) {
        rowId = (new LinkedList<Integer>(rowIds)).getFirst();
    } else {
        throw new ObjectNotFoundException("Row ID list " + rowIds + " is invalid");
    }
    StringBuilder SQLCodeBuilder = new StringBuilder();
    // Generate CSV of fields and placeholders to use in update/insert SQL
    // string
    StringBuilder fieldsCsvBuilder = new StringBuilder();
    StringBuilder fieldsAndPlaceholdersCsvBuilder = new StringBuilder();
    StringBuilder valuePlaceholdersCsvBuilder = new StringBuilder();
    for (BaseField field : dataToSave.keySet()) {
        fieldsCsvBuilder.append(field.getInternalFieldName());
        fieldsCsvBuilder.append(", ");
        valuePlaceholdersCsvBuilder.append("?, ");
        fieldsAndPlaceholdersCsvBuilder.append(field.getInternalFieldName());
        fieldsAndPlaceholdersCsvBuilder.append("=?, ");
    }
    // Used if doing an INSERT
    String fieldsCsv = fieldsCsvBuilder.toString();
    String valuePlaceholdersCsv = valuePlaceholdersCsvBuilder.toString();
    // Used if doing an UPDATE
    String fieldsAndPlaceholdersCsv = fieldsAndPlaceholdersCsvBuilder.toString();
    if (!fieldsCsv.equals("")) {
        fieldsCsv = fieldsCsv.substring(0, fieldsCsv.length() - 2);
        valuePlaceholdersCsv = valuePlaceholdersCsv.substring(0, valuePlaceholdersCsv.length() - 2);
        fieldsAndPlaceholdersCsv = fieldsAndPlaceholdersCsv.substring(0, fieldsAndPlaceholdersCsv.length() - 2);
    }
    if (newRecord) {
        SQLCodeBuilder.append("INSERT INTO " + table.getInternalTableName());
        if (fieldsCsv.equals("")) {
            SQLCodeBuilder.append(" VALUES(default)");
        } else {
            SQLCodeBuilder.append("(" + fieldsCsv + ") VALUES (" + valuePlaceholdersCsv + ")");
        }
    } else {
        SQLCodeBuilder.append("UPDATE " + table.getInternalTableName() + " SET " + fieldsAndPlaceholdersCsv);
        if (globalEdit) {
            // add filter for various row ids
            SQLCodeBuilder.append(" WHERE " + table.getPrimaryKey().getInternalFieldName() + " in (?");
            for (int i = 1; i < rowIds.size(); i++) {
                SQLCodeBuilder.append(",?");
            }
            SQLCodeBuilder.append(")");
        } else {
            // add filter for single row id
            SQLCodeBuilder.append(" WHERE " + table.getPrimaryKey().getInternalFieldName() + "=?");
        }
    }
    Connection conn = null;
    int fieldNumber = 0;
    // Will be set if we're inserting a record
    int newRowId = -1;
    TableDataInfo tableData = new TableData(table);
    try {
        conn = this.dataSource.getConnection();
        conn.setAutoCommit(false);
        PreparedStatement statement = conn.prepareStatement(SQLCodeBuilder.toString());
        for (BaseField field : dataToSave.keySet()) {
            // If an exception is raised, currentField will be the field
            // which caused it
            // currentField = field;
            fieldNumber++;
            BaseValue fieldValue = dataToSave.get(field);
            if (field instanceof FileField) {
                if (fieldValue.isNull() || fieldValue.toString().equals("")) {
                    throw new InputRecordException("No file specified for the upload", field);
                }
            }
            if (fieldValue.isNull()) {
                statement.setNull(fieldNumber, Types.NULL);
            } else {
                if (fieldValue instanceof TextValue) {
                    String textValue = ((TextValue) fieldValue).toXmlString();
                    statement.setString(fieldNumber, textValue);
                } else if (fieldValue instanceof IntegerValue) {
                    // if no related value, set relation field to null
                    if (field instanceof RelationField && (((IntegerValue) fieldValue).getValueInteger() == -1)
                            || (fieldValue.isNull())) {
                        statement.setNull(fieldNumber, Types.NULL);
                    } else {
                        statement.setInt(fieldNumber, ((IntegerValue) fieldValue).getValueInteger());
                    }
                } else if (fieldValue instanceof DurationValue) {
                    statement.setString(fieldNumber, ((DurationValue) fieldValue).getSqlFormatInterval());
                } else if (fieldValue instanceof DecimalValue) {
                    statement.setDouble(fieldNumber, ((DecimalValue) fieldValue).getValueFloat());
                } else if (fieldValue instanceof DateValue) {
                    if (((DateValue) fieldValue).getValueDate() != null) {
                        java.util.Date javaDateValue = ((DateValue) fieldValue).getValueDate().getTime();
                        java.sql.Timestamp sqlTimestampValue = new java.sql.Timestamp(javaDateValue.getTime());
                        statement.setTimestamp(fieldNumber, sqlTimestampValue);
                    } else {
                        statement.setTimestamp(fieldNumber, null);
                    }
                } else if (fieldValue instanceof CheckboxValue) {
                    statement.setBoolean(fieldNumber, ((CheckboxValue) fieldValue).getValueBoolean());
                } else if (fieldValue instanceof FileValue) {
                    statement.setString(fieldNumber, ((FileValue) fieldValue).toString());
                } else {
                    throw new CodingErrorException("Field value " + fieldValue + " is of unknown type "
                            + fieldValue.getClass().getSimpleName());
                }
            }
        }
        // We've finished setting individual fields, if an SQL error occurs
        // after here we won't know which
        // field caused it without looking for it by other means
        // currentField = null;
        if (!newRecord) {
            if (globalEdit) {
                // Fill in the 'WHERE [row id field] in (?,..,?)' for use in
                // the UPDATE statement
                for (Integer aRowId : rowIds) {
                    if (tableData.isRecordLocked(conn, sessionData, aRowId)) {
                        throw new CantDoThatException(
                                "Record " + aRowId + " from table " + table + " is locked to prevent editing");
                    }
                    statement.setInt(++fieldNumber, aRowId);
                }
            } else {
                // Fill in the 'WHERE [row id field]=?' for use in the
                // UPDATE statement
                if (tableData.isRecordLocked(conn, sessionData, rowId)) {
                    throw new CantDoThatException(
                            "Record " + rowId + " from table " + table + " is locked to prevent editing");
                }
                statement.setInt(fieldNumber + 1, rowId);
            }
        }
        int numRowsAffected = statement.executeUpdate();
        statement.close();
        if ((numRowsAffected != 1) && (!globalEdit)) {
            conn.rollback();
            if (numRowsAffected > 0) {
                throw new ObjectNotFoundException(String.valueOf(numRowsAffected)
                        + " records would be altered during a single record save");
            } else {
                throw new ObjectNotFoundException(
                        "The current record can't be found to edit - perhaps someone else has deleted it");
            }
        }
        if (newRecord) {
            // Find the newly inserted Row ID
            // postgres-specific code, not database independent
            String SQLCode = "SELECT currval('" + table.getInternalTableName() + "_"
                    + table.getPrimaryKey().getInternalFieldName() + "_seq')";
            statement = conn.prepareStatement(SQLCode);
            ResultSet results = statement.executeQuery();
            if (results.next()) {
                newRowId = results.getInt(1);
            } else {
                results.close();
                statement.close();
                throw new SQLException(
                        "Row ID not found for the newly inserted record. '" + SQLCodeBuilder + "' didn't work");
            }
            results.close();
            statement.close();
        }
        conn.commit();
    } catch (SQLException sqlex) {
        // Find out which field caused the error by looking for internal
        // field names in the error message
        String errorMessage = sqlex.getMessage();
        for (BaseField possibleCauseField : dataToSave.keySet()) {
            if (errorMessage.contains(possibleCauseField.getInternalFieldName())) {
                if (errorMessage.contains("check constraint")) {
                    errorMessage = "The value " + dataToSave.get(possibleCauseField)
                            + " falls outside the allowed range";
                } else if (errorMessage.contains("not-null constraint")) {
                    errorMessage = "No value entered";
                } else if (errorMessage.contains("unique constraint")) {
                    errorMessage = "Value " + dataToSave.get(possibleCauseField)
                            + " is already in the database and cannot be entered again";
                } else if (errorMessage.contains("foreign key constraint")
                        && possibleCauseField instanceof RelationField) {
                    errorMessage = "Please select a valid "
                            + ((RelationField) possibleCauseField).getRelatedTable() + " record first";
                } else {
                    errorMessage = "Value " + dataToSave.get(possibleCauseField) + " not allowed ("
                            + Helpers.replaceInternalNames(errorMessage, table.getDefaultReport()) + ")";
                }
                throw new InputRecordException(errorMessage, possibleCauseField, sqlex);
            }
        }
        // Not able to find field
        errorMessage = Helpers.replaceInternalNames(errorMessage, table.getDefaultReport());
        throw new InputRecordException(errorMessage, null, sqlex);
    } finally {
        if (conn != null) {
            conn.close();
        }
    }
    // If any fields were files to upload, do the actual uploads.
    // Do this after the commit in case the uploads take a long time and
    // time out the SQL connection.
    for (BaseField field : dataToSave.keySet()) {
        if (field instanceof FileField) {
            try {
                if (newRecord) {
                    this.uploadFile(request, (FileField) field, (FileValue) dataToSave.get(field), newRowId,
                            multipartItems);
                } else {
                    this.uploadFile(request, (FileField) field, (FileValue) dataToSave.get(field), rowId,
                            multipartItems);
                }
            } catch (CantDoThatException cdtex) {
                throw new InputRecordException("Error uploading file: " + cdtex.getMessage(), field, cdtex);
            } catch (FileUploadException fuex) {
                throw new InputRecordException("Error uploading file: " + fuex.getMessage(), field, fuex);
            }
        }
    }
    if (newRecord) {
        sessionData.setRowId(table, newRowId);
    }
    this.logLastDataChangeTime(request);
    logLastTableDataChangeTime(table);
    UsageLogger usageLogger = new UsageLogger(this.dataSource);
    AppUserInfo user = null;
    if (request.getRemoteUser() == null) {
        user = ServletUtilMethods.getPublicUserForRequest(request, this.authManager.getAuthenticator());
    } else {
        user = this.authManager.getUserByUserName(request, request.getRemoteUser());
    }
    // Send websocket notification
    // UsageLogger.sendNotification(user, table, sessionData.getReport(),
    // rowId, "edit", "Record saved: " + dataToSave);
    // Log everything apart from hidden (auto set) fields
    Map<BaseField, BaseValue> dataToLog = new LinkedHashMap<BaseField, BaseValue>();
    for (Map.Entry<BaseField, BaseValue> entrySet : dataToSave.entrySet()) {
        BaseField field = entrySet.getKey();
        if (!field.getHidden()) {
            BaseValue value = entrySet.getValue();
            dataToLog.put(field, value);
        }
    }
    if (newRecord) {
        usageLogger.logDataChange(user, table, null, AppAction.SAVE_NEW_RECORD, newRowId, dataToLog.toString());
    } else if (globalEdit) {
        // TODO: need better logging of global edits
        usageLogger.logDataChange(user, table, null, AppAction.GLOBAL_EDIT, rowId, dataToLog.toString());
    } else {
        BaseField fieldUpdated = null;
        Set<BaseField> fieldSet = new TreeSet<BaseField>();
        for (BaseField field : dataToSave.keySet()) {
            if (!field.getHidden()) {
                fieldSet.add(field);
            }
        }
        if (fieldSet.size() == 1) {
            fieldUpdated = new LinkedList<BaseField>(fieldSet).getFirst();
        }
        usageLogger.logDataChange(user, table, fieldUpdated, AppAction.UPDATE_RECORD, rowId,
                dataToLog.toString());
    }
    UsageLogger.startLoggingThread(usageLogger);
}