List of usage examples for java.util ResourceBundle getObject
public final Object getObject(String key)
From source file:be.fedict.eid.dss.document.zip.ZIPDSSDocumentService.java
public DocumentVisualization visualizeDocument(byte[] document, String language, List<MimeType> mimeTypes, String documentViewerServlet) throws Exception { // get i18n/*from w w w. ja va 2 s . c o m*/ ResourceBundle zipResourceBundle = ResourceBundle.getBundle("ZIPMessages", new Locale(language)); ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(document)); ZipEntry zipEntry; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("<html>"); stringBuilder.append("<head>"); stringBuilder.append("<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">"); stringBuilder.append("<title>ZIP package</title>"); stringBuilder.append("</head>"); stringBuilder.append("<body>"); stringBuilder.append(String.format("<h2>%s</h2>", zipResourceBundle.getObject("zipTitle"))); stringBuilder.append("<table>"); while (null != (zipEntry = zipInputStream.getNextEntry())) { if (ODFUtil.isSignatureFile(zipEntry)) { continue; } String zipEntryName = zipEntry.getName(); boolean browserViewable = MimeTypeMapper.browserViewable(mimeTypes, zipEntryName); String image = browserViewable ? "view.png" : "download.png"; stringBuilder.append("<tr>"); stringBuilder.append("<td>"); stringBuilder.append(String.format("<a href=\"%s\" target=_blank>", documentViewerServlet + getResourceId(zipEntry))); stringBuilder.append( "<img src=\"./images/" + image + "\" style=\" width: 25px; vertical-align: bottom;\" />"); stringBuilder.append(zipEntryName); stringBuilder.append("</a>"); stringBuilder.append("</td>"); stringBuilder.append("</tr>"); } stringBuilder.append("</table>"); stringBuilder.append("</body></html>"); return new DocumentVisualization("text/html;charset=utf-8", stringBuilder.toString().getBytes()); }
From source file:kg.apc.jmeter.listener.GraphsGeneratorListener.java
/** * Override the setProperty method in order to convert * the original String calcMode property. * This used the locale-dependent display value, so caused * problems when the language was changed. * Note that the calcMode StringProperty is replaced with an IntegerProperty * so the conversion only needs to happen once. *//*www . j av a2 s . c o m*/ @Override public void setProperty(JMeterProperty property) { if (property instanceof StringProperty) { final String pn = property.getName(); if (pn.equals("exportMode")) { final Object objectValue = property.getObjectValue(); try { final BeanInfo beanInfo = Introspector.getBeanInfo(this.getClass()); final ResourceBundle rb = (ResourceBundle) beanInfo.getBeanDescriptor() .getValue(GenericTestBeanCustomizer.RESOURCE_BUNDLE); for (Enum<ExportMode> e : ExportMode.values()) { final String propName = e.toString(); if (objectValue.equals(rb.getObject(propName))) { final int tmpMode = e.ordinal(); if (log.isDebugEnabled()) { log.debug("Converted " + pn + "=" + objectValue + " to mode=" + tmpMode + " using Locale: " + rb.getLocale()); } super.setProperty(pn, tmpMode); return; } } log.warn("Could not convert " + pn + "=" + objectValue + " using Locale: " + rb.getLocale()); } catch (IntrospectionException e) { log.error("Could not find BeanInfo", e); } } } super.setProperty(property); }
From source file:org.schemaspy.Config.java
/** * Returns a {@link Properties} populated with the contents of <code>bundle</code> * * @param bundle ResourceBundle//from w ww . ja v a2s .c o m * @return Properties */ public static Properties asProperties(ResourceBundle bundle) { Properties props = new Properties(); Enumeration<String> iter = bundle.getKeys(); while (iter.hasMoreElements()) { String key = iter.nextElement(); props.put(key, bundle.getObject(key)); } return props; }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private String handleXml_Load(String xmlString) { String xmlReturnString = ""; System.out.println("---------------------------?FPAPI_Load-------------------------------"); // /* ww w . ja va2 s . co m*/ // <loadId>?t_new_import_load.LOAD_NO // <total>?t_new_import_load.TOTAL // <TotalWeight>?t_new_import_load.WEIGHT // <CarEcNo>?t_new_import_load.CAR_NO // <tracyNum>?t_new_import_load.TRACY_NUM // STATUS1 // // t_new_import_load.LOAD_ID?t_new_import_load_detail.LOAD_ID // <outorderId>?t_new_import_load_detail.ORDER_NO Map head = null; boolean isSuccess = true; try { // businessType head = XmlUtil.parseXmlFPAPI_SingleNodes(xmlString, "//LoadHead/child::*"); // ?? ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT_1); // ? // ? Map mainData = new HashMap(); for (Object key : head.keySet()) { if (bundle.containsKey("load_" + key.toString())) { mainData.put(bundle.getObject("load_" + key.toString()), head.get(key)); } } mainData.put("STATUS", "1"); mainData.put("CREAT_DATE", sf.format(new Date())); mainData.put("CREAT_TIME", new Date()); Map primary = new HashMap(); primary.put("primaryId", null); commonManagerMapper.insertTableByNVList("t_new_import_load", new ArrayList<String>(mainData.keySet()), new ArrayList<Object>(mainData.values()), primary); // ?? List<Map> items = XmlUtil.parseXmlFPAPI_MulitpleNodes(xmlString, "//LoadHead/loadContents/loadContent"); for (Map item : items) { Map data = new HashMap(); // ? for (Object key : item.keySet()) { if (bundle.containsKey("load_" + key.toString())) { data.put(bundle.getObject("load_" + key.toString()), item.get(key)); } } // String uniqueCol="SKU"; // String primaryCol="RECEIPT_ID"; // // ? // uniqueCheck("t_new_import_receipt",uniqueCol,data.get(uniqueCol),primaryCol,data.get(primaryCol),false); // ? data.put("LOAD_ID", primary.get("primaryId")); // data.put("CREAT_DATE", sf.format(new Date())); data.put("CREAT_TIME", new Date()); Map primarySub = new HashMap(); primarySub.put("primaryId", null); commonManagerMapper.insertTableByNVList("t_new_import_load_detail", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primarySub); } } catch (Exception e) { e.printStackTrace(); isSuccess = false; } // ? List<LinkedMap> dataList = new ArrayList<LinkedMap>(); for (int i = 0; i < 1; i++) { LinkedMap resultData = new LinkedMap(); resultData.put("loadHeadId", head != null ? head.get("loadHeadId") : ""); resultData.put("loadId", head != null ? head.get("loadId") : ""); resultData.put("returnMessage", isSuccess ? "?" : ""); // resultData.put("errorCode", ""); // resultData.put("errorMsg", ""); dataList.add(resultData); } String root = CommonUtil.getSystemConfigProperty("loadReceiptRoot"); xmlReturnString = XmlUtil.generalReceiptXml_FP(root, null, dataList); return xmlReturnString; }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private String handleXml_cj_deliveryOrderStatus(String xmlDataString) { // String jsonReturnString = ""; SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.RETRIEVAL_TIME_FORMAT); System.out.println(/*from w w w . j a v a 2 s . co m*/ "---------------------------?FPAPI_cj_deliveryOrderStatus-------------------------------"); Map orderInfo = XmlUtil.parseXmlFPAPI_SingleNodes(xmlDataString, "//deliveryorderstatus/child::*"); //?? // ?? List<String> colNames = new ArrayList<String>(); List<Object> colValues = new ArrayList<Object>(); colNames.add("BOL"); colValues.add(orderInfo.get("order_code")); List<Map<String, Object>> items = commonManagerMapper.selectTableListByNVList("t_sn_order", colNames, colValues, null, null); //? Map item = null; if (items.size() > 0) { item = items.get(0); } else { return "<deliveryorderstatusreturn><status>fail</status></deliveryorderstatusreturn>"; } // String statusCode = orderInfo.get("status_code") != null ? orderInfo.get("status_code").toString() : ""; if ("001".equals(statusCode) || "005".equals(statusCode)) { colNames.clear(); colValues.clear(); colNames.add("ORDER_STATUS"); colValues.add("1"); commonManagerMapper.updateTableByNVList("t_sn_order", "BOL", orderInfo.get("order_code"), colNames, colValues); } //??--7.10 JSONObject snRequest = new JSONObject(); JSONArray statusList = new JSONArray(); colNames.clear(); colValues.clear(); colNames.add("STATUS_CODE"); colValues.add(orderInfo.get("status_code")); List<Map<String, Object>> statusChangeList = commonManagerMapper .selectTableListByNVList("T_SN_STATUS_CHANGE", colNames, colValues, null, null); for (Map<String, Object> statusChange : statusChangeList) { JSONObject statusSingleItem = new JSONObject(); String statusType = statusChange.get("STATUS_TYPE") != null ? statusChange.get("STATUS_TYPE").toString() : ""; if ("WMS".equals(statusType)) { //orderDetailorderCode List<Map> orderDetailList = snCommonManagerMapper .selectFlightInfo(orderInfo.get("order_code").toString()); for (Map orderDetail : orderDetailList) { statusSingleItem.put("expressNo", orderDetail.get("ORDER_CODE")); statusSingleItem.put("expressCompanyCode", "WMS"); statusSingleItem.put("mailStatus", statusChange.get("CN_CODE")); statusSingleItem.put("address", statusChange.get("CN_REMARK")); statusSingleItem.put("statusType", statusChange.get("STATUS_TYPE")); statusSingleItem.put("time", CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT).format(new Date())); statusList.add(statusSingleItem); } } else if ("TMS".equals(statusType)) { statusSingleItem.put("expressNo", item.get("TMS_ORDER_CODE")); statusSingleItem.put("expressCompanyCode", item.get("TMS_SERVICE_CODE")); statusSingleItem.put("mailStatus", statusChange.get("CN_CODE")); statusSingleItem.put("address", statusChange.get("CN_REMARK")); statusSingleItem.put("statusType", statusChange.get("STATUS_TYPE")); statusSingleItem.put("time", CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT).format(new Date())); statusList.add(statusSingleItem); } } snRequest.put("statusList", statusList); JSONObject content = new JSONObject(); content.put("snRequest", snRequest); Map requestParam = new HashMap(); requestParam.put("logistic_provider_id", CommonUtil.getSystemConfigProperty("SN_deliveryOrderStatusInfo_logistic_provider_id")); requestParam.put("msg_type", CommonUtil.getSystemConfigProperty("SN_deliveryOrderStatusInfo_msg_type")); requestParam.put("url", CommonUtil.getSystemConfigProperty("SN_deliveryOrderStatusInfo_requestUrl")); System.out.println(content.toString()); // ?? String result = send2SN(requestParam, content.toString()); //?t_sn_return_status // ?? ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); Map primary = new HashMap(); primary.put("primaryId", null); Map data = new HashMap(); for (Object key : orderInfo.keySet()) { if (bundle.containsKey("SN_RETURN_STATUS_" + key.toString().toUpperCase())) { if (orderInfo.get(key) == null || orderInfo.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_RETURN_STATUS_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_RETURN_STATUS_" + key.toString().toUpperCase()), orderInfo.get(key)); } } } data.put("STATUS_TIME", CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT).format(new Date())); data.put("CREAT_TIME", new Date()); commonManagerMapper.insertTableByNVList("T_SN_RETURN_STATUS", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primary); return "<deliveryorderstatusreturn><status>success</status></deliveryorderstatusreturn>"; }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private Map handleOrderC061(String xmlString, ResourceBundle bundle) { Map result = new HashMap(); result.put("isSuccess", true); SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT_1); List<Map> items = XmlUtil.parseXmlFPAPI_MulitpleNodes(xmlString, "//orders/orderImformation/orderItems"); for (Map item : items) { Map data = new HashMap(); // ?//w w w. ja va 2s . c o m for (Object key : item.keySet()) { if (bundle.containsKey("order_" + key.toString())) { data.put(bundle.getObject("order_" + key.toString()), item.get(key)); } } // String uniqueCol="SKU"; // String primaryCol="RECEIPT_ID"; // // ? // uniqueCheck("t_new_import_receipt",uniqueCol,data.get(uniqueCol),primaryCol,data.get(primaryCol),false); // ? data.put("CREAT_DATE", sf.format(new Date())); data.put("CREAT_TIME", new Date()); Map primary = new HashMap(); primary.put("primaryId", null); commonManagerMapper.insertTableByNVList("t_new_import_receipt", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primary); } return result; }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private int insertOrder(JSONObject orderInfo, JSONObject senderInfo, JSONObject receiverInfo) { ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT_1); Map primary = new HashMap(); primary.put("primaryId", null); Map data = new HashMap(); for (Object key : orderInfo.keySet()) { if (bundle.containsKey("SN_ORDER_" + key.toString().toUpperCase())) { if (orderInfo.get(key) == null || orderInfo.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), orderInfo.get(key)); }// ww w. j a va 2 s . c om } } for (Object key : senderInfo.keySet()) { if (bundle.containsKey("SN_ORDER_" + key.toString().toUpperCase())) { if (senderInfo.get(key) == null || senderInfo.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), senderInfo.get(key)); } } } for (Object key : receiverInfo.keySet()) { if (bundle.containsKey("SN_ORDER_" + key.toString().toUpperCase())) { if (receiverInfo.get(key) == null || receiverInfo.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), receiverInfo.get(key)); } } } // ?????receiverAddress?t_sn_order.RECEIVER_ADDRESS? // ???receiverProvincereceiverCityreceiverAreareceiverAddress?t_sn_order // .RECEIVER_ADDRESS String receiverProvince = receiverInfo.get("receiverProvince") != null ? receiverInfo.get("receiverProvince").toString() : ""; String receiverCity = receiverInfo.get("receiverCity") != null ? receiverInfo.get("receiverCity").toString() : ""; String receiverArea = receiverInfo.get("receiverArea") != null ? receiverInfo.get("receiverArea").toString() : ""; String receiverAddress = receiverInfo.get("receiverAddress") != null ? receiverInfo.get("receiverAddress").toString() : ""; data.put("RECEIVER_ADDRESS", receiverProvince + receiverCity + receiverArea + receiverAddress); data.put("ORDER_STATUS", "0"); data.put("CREAT_DATE", sf.format(new Date())); data.put("CREAT_TIME", new Date()); commonManagerMapper.insertTableByNVList("T_SN_ORDER", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primary); return Integer.valueOf(primary.get("primaryId").toString()); }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private String generalRequestXml4TJ(String id, ResourceBundle bundle) { int idInt = Integer.valueOf(id); // step 1 ?xml LinkedHashMap InventoryHead = new LinkedHashMap(); //?/*w w w .j av a 2 s . c om*/ List<LinkedHashMap> headList = snCommonManagerMapper.selectInventoryHead(idInt); if (headList != null) { LinkedHashMap item = headList.get(0); // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_HEAD_" + key.toString())) { InventoryHead.put(bundle.getObject("TJ_HEAD_" + key.toString()), item.get(key)); } else { InventoryHead.put(key.toString(), item.get(key)); } } } } List<LinkedHashMap> InventoryList = new ArrayList<LinkedHashMap>(); //? List<LinkedHashMap> ItemList = snCommonManagerMapper.selectInventoryList(idInt); if (ItemList != null) { for (LinkedHashMap item : ItemList) { //book?? List<LinkedHashMap> bookInfoList = snCommonManagerMapper.selectInventoryListRelateBookInfo( item.get("ORDER_NO").toString(), item.get("ITEM_NO").toString()); for (LinkedHashMap bookInfo : bookInfoList) { //book? item.put("RECORD_NO", bookInfo.get("RECORD_NO")); item.put("GOODS_SERIALNO", bookInfo.get("GOODS_SERIALNO")); item.put("DECL_NO", bookInfo.get("DECL_NO")); LinkedHashMap Inventory = new LinkedHashMap(); //t_new_import_sku.unit2<qty2>????t_new_import_inventory_detail.qty2 //t_new_import_sku.unit2?<qty2>?t_new_import_inventory_detail.qty1 if (item.get("UNIT2") == null || item.get("UNIT2").toString().isEmpty()) { //?? } else { item.put("QTY2", item.get("QTY1")); } // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_LIST_" + key.toString())) { Inventory.put(bundle.getObject("TJ_LIST_" + key.toString()), item.get(key)); } else { Inventory.put(key.toString(), item.get(key)); } } } InventoryList.add(Inventory); } } } LinkedHashMap IODeclContainerList = new LinkedHashMap(); List<LinkedHashMap> IODeclContainerListTemp = snCommonManagerMapper.selectIODeclContainerList(idInt); if (IODeclContainerListTemp != null) { LinkedHashMap item = IODeclContainerListTemp.get(0); // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_IO_" + key.toString())) { IODeclContainerList.put(bundle.getObject("TJ_IO_" + key.toString()), item.get(key)); } else { IODeclContainerList.put(key.toString(), item.get(key)); } } } } LinkedHashMap IODeclOrderRelationList = new LinkedHashMap(); List<LinkedHashMap> IODeclOrderRelationListTemp = snCommonManagerMapper .selectIODeclOrderRelationList(idInt); if (IODeclOrderRelationListTemp != null) { LinkedHashMap item = IODeclOrderRelationListTemp.get(0); // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_IO_" + key.toString())) { IODeclOrderRelationList.put(bundle.getObject("TJ_IO_" + key.toString()), item.get(key)); } else { IODeclOrderRelationList.put(key.toString(), item.get(key)); } } } } LinkedHashMap BaseTransfer = snCommonManagerMapper.selectBaseTransfer(); String resultXmlString = XmlUtil.generalRequestXml4TJ_621(InventoryHead, InventoryList, IODeclContainerList, IODeclOrderRelationList, BaseTransfer, bundle); return resultXmlString; }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private String handleXml_sn_sku(String jsonString) { // String jsonReturnString = ""; System.out.println("---------------------------?FPAPI_SN_SKU-------------------------------"); // //from w w w. j a va 2 s . com JSONObject jsonObject = JSONObject.fromObject(jsonString); JSONArray cmmdtyInfo = (JSONArray) jsonObject.get("cmmdtyInfo"); // JSONArray customerInfo = (JSONArray) jsonObject.get("customerInfo"); // JSONArray barCodeInfo = (JSONArray) jsonObject.get("barCodeInfo"); // ?? ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); JSONObject result = new JSONObject(); JSONArray resultArray = new JSONArray(); for (Iterator it = cmmdtyInfo.iterator(); it.hasNext();) { JSONObject item = (JSONObject) it.next(); Map primary = new HashMap(); primary.put("primaryId", null); Map data = new HashMap(); for (Object key : item.keySet()) { if (bundle.containsKey("SN_SKU_" + key.toString().toUpperCase())) { if (item.get(key) == null || item.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_SKU_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_SKU_" + key.toString().toUpperCase()), item.get(key)); } } } // ? // data.put("CREAT_DATE", sf.format(new Date())); data.put("CREAT_TIME", new Date()); commonManagerMapper.insertTableByNVList("T_SN_SKU", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primary); JSONObject resultItem = new JSONObject(); resultItem.put("kunner", data.get("OWNER")); resultItem.put("sncmmdty_code", data.get("SKU")); resultItem.put("process_stat", "03"); resultItem.put("notes", ""); resultArray.add(resultItem); } result.put("resultInfo", resultArray); return result.toString(); }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private void insertOrderDetail(int orderId, JSONObject orderInfo, JSONArray orderItemList) { ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT_1); for (Iterator it = orderItemList.iterator(); it.hasNext();) { JSONObject item = (JSONObject) it.next(); Map primary_sub = new HashMap(); primary_sub.put("primaryId", null); Map dataSub = new HashMap(); for (Object key : item.keySet()) { if (bundle.containsKey("SN_ORDER_DETAIL_" + key.toString().toUpperCase())) { if (item.get(key) == null || item.get(key).toString().isEmpty()) { dataSub.put(bundle.getObject("SN_ORDER_DETAIL_" + key.toString().toUpperCase()), null); } else { dataSub.put(bundle.getObject("SN_ORDER_DETAIL_" + key.toString().toUpperCase()), item.get(key)); }//w w w . j av a 2 s . c om } } // ? dataSub.put("ORDER_ID", orderId); dataSub.put("ORDER_CODE", orderInfo.get("orderCode")); dataSub.put("FPS_ORDER_ID", orderInfo.get("fpsOrderId")); dataSub.put("ORDER_NUMBER", orderInfo.get("orderNumber")); // data.put("CREAT_DATE", sf.format(new Date())); dataSub.put("CREAT_TIME", new Date()); commonManagerMapper.insertTableByNVList("T_SN_ORDER_DETAIL", new ArrayList<String>(dataSub.keySet()), new ArrayList<Object>(dataSub.values()), primary_sub); } }