/** GridData 구조에 JSON전문의 headers에 대한 데이터를 입력한다. */ public static void setJsonHeaderData( GridData gridData, List<LinkedHashMap<String, Object>> headersList) throws Exception { /* * 1. 헤더생성 CreateHeader() * 2. 데이터 타입에 따라 입력 * */ // logger.info("headers : " + headersList); // logger.info("headers count : " + headersList.size()); for (LinkedHashMap<String, Object> header : headersList) { String headerType = (String) header.get(json_headers_type); String headerKey = (String) header.get(json_headers_key); GridHeader gridHeader = gridData.createHeader(headerKey, headerType); /* * 콤보데이터 입력. * 콤보리스트 텍스트 -> GridHeader의 multiListValues로 입력 * 콤보리스트 실제값 -> GridHeader의 multiListHiddenValues로 입력 * */ if (t_combo.equals(headerType)) { List<LinkedHashMap<String, Object>> comboListData = (List<LinkedHashMap<String, Object>>) header.get(json_common_value); String[] comboTextData = new String[comboListData.size()]; String[] comboValueData = new String[comboListData.size()]; for (int i = 0; i < comboListData.size(); i++) { comboTextData[i] = (String) comboListData.get(i).get(json_headers_value_text); comboValueData[i] = (String) comboListData.get(i).get(json_common_value); } gridHeader.setComboValues(comboTextData, comboValueData); gridHeader.setOriginComboValues(comboTextData, comboValueData); } else { if (t_imagetext.equals(headerType)) { ArrayList<String> imageDataList = (ArrayList<String>) header.get(json_common_value); String[] imageDataArray = new String[imageDataList.size()]; gridHeader.setImageURLs(imageDataList.toArray(imageDataArray)); } } // logger.info("header info --> " + gridHeader); } }
/** * @param gdReq * @return GridData * @since 2015/09/09 */ public static GridData cloneResponseGridData(GridData gdReq) throws Exception { GridData gdRes = new GridData(); // mode 추가 gdRes.setMode(gdReq.getMode()); String headers[] = gdReq.getHeaderSequence(); for (int i = 0; i < gdReq.getHeaderCount(); i++) { GridHeader ghValue = gdReq.getHeader(headers[i]); String headerDataType = gdReq.getHeader(headers[i]).getDataType(); gdRes.createHeader(headers[i], headerDataType); if (headerDataType.equals("L")) { if (ghValue.getComboValues() != null) if (ghValue.getComboValues().length != 0) gdRes .getHeader(headers[i]) .setComboValues(ghValue.getComboValues(), ghValue.getComboHiddenValues()); // 오리진 콤보데이터 확인을 위한 코드. gdRes .getHeader(headers[i]) .setOriginComboValues( ghValue.getOriginComboValues(), ghValue.getOriginComboHiddenValues()); if (ghValue.hasComboList()) { for (int j = 0; j < ghValue.getComboListCount(); j++) { String comboListKey = ghValue.getComboListKeys()[j]; gdRes .getHeader(headers[i]) .addComboListValues( comboListKey, ghValue.getComboValues(comboListKey), ghValue.getComboHiddenValues(comboListKey)); } } } else if (headerDataType.equals("I")) { if (ghValue.getImageURLs() != null) if (ghValue.getImageURLs().length != 0) gdRes.getHeader(headers[i]).setImageURLs(ghValue.getImageURLs()); } } return gdRes; }