Permalink
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
| @@ -0,0 +1,30 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.co.profitcube.eacris.report.attribute.judgement.normalization; | ||
|  | ||
| import java.io.IOException; | ||
|  | ||
| /** | ||
| * @author PC User | ||
| * | ||
| */ | ||
| public class BatchRun { | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| public BatchRun() { | ||
| } | ||
|  | ||
| /** | ||
| * @param args | ||
| * @throws IOException | ||
| */ | ||
| public static void main(String[] args) throws IOException { | ||
| String cmd = "cmd.exe /c start E:\\view\\renFile.bat"; | ||
| Runtime.getRuntime().exec(cmd); | ||
|  | ||
| } | ||
|  | ||
| } | 
| @@ -0,0 +1,108 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package facss.co.jp.java.src; | ||
|  | ||
| import java.util.List; | ||
|  | ||
| //import org.apache.commons.lang3.StringUtils; | ||
|  | ||
| /** | ||
| * @author PC User | ||
| * | ||
| */ | ||
| public class BattleShip { | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| public BattleShip() { | ||
|  | ||
| } | ||
|  | ||
| public String[] setOrgName(List<BattleShipDto> dataDto, int startIndex, int endIndex){ | ||
|  | ||
| String[] retArray = new String[endIndex]; | ||
|  | ||
| System.out.println("配列の数: "+ endIndex); | ||
| for(int index = startIndex; index < endIndex ; index++){ | ||
|  | ||
| // 団体名使用済みフラグ | ||
| boolean orgNameUseFlag = false; | ||
| StringBuilder sbOutPutOrgName = new StringBuilder(); | ||
|  | ||
| if(!this.isBlank(dataDto.get(index).abbreviation)){ | ||
| sbOutPutOrgName.append(dataDto.get(index).abbreviation); | ||
| } | ||
|  | ||
| if(!this.isBlank(dataDto.get(index).orgName1)){ | ||
| sbOutPutOrgName.append(","); | ||
| sbOutPutOrgName.append(dataDto.get(index).orgName1); | ||
| } else { | ||
| if(!orgNameUseFlag){ | ||
| sbOutPutOrgName.append(","); | ||
| sbOutPutOrgName.append(dataDto.get(index).orgName); | ||
| orgNameUseFlag = true; | ||
| } | ||
| } | ||
|  | ||
| if(!this.isBlank(dataDto.get(index).orgName2)){ | ||
| sbOutPutOrgName.append(","); | ||
| sbOutPutOrgName.append(dataDto.get(index).orgName2); | ||
| } else { | ||
| if(!orgNameUseFlag){ | ||
| sbOutPutOrgName.append(","); | ||
| sbOutPutOrgName.append(dataDto.get(index).orgName); | ||
| orgNameUseFlag = true; | ||
| } | ||
| } | ||
|  | ||
| if(!this.isBlank(dataDto.get(index).orgName3)){ | ||
| sbOutPutOrgName.append(","); | ||
| sbOutPutOrgName.append(dataDto.get(index).orgName3); | ||
|  | ||
| } else { | ||
| if(!orgNameUseFlag){ | ||
| sbOutPutOrgName.append(","); | ||
| sbOutPutOrgName.append(dataDto.get(index).orgName); | ||
| orgNameUseFlag = true; | ||
| } | ||
| } | ||
|  | ||
| if(!this.isBlank(dataDto.get(index).orgName4)){ | ||
| sbOutPutOrgName.append(","); | ||
| sbOutPutOrgName.append(dataDto.get(index).orgName4); | ||
| } else { | ||
| if(!orgNameUseFlag){ | ||
| sbOutPutOrgName.append(","); | ||
| sbOutPutOrgName.append(dataDto.get(index).orgName); | ||
| orgNameUseFlag = true; | ||
| } | ||
| } | ||
|  | ||
| // if(!StringUtils.isBlank(dataDto.get(index).orgName4)){ | ||
| // sbOutPutOrgName.append(dataDto.get(index).orgName4); | ||
| // } else { | ||
| // if(!orgNameUseFlag){ | ||
| // sbOutPutOrgName.append(dataDto.get(index).orgName); | ||
| // orgNameUseFlag = true; | ||
| // } | ||
| // } | ||
|  | ||
| retArray[index] = sbOutPutOrgName.toString(); | ||
| } | ||
| return retArray; | ||
| } | ||
|  | ||
| /** | ||
| * @param target | ||
| * @return | ||
| */ | ||
| private boolean isBlank(String target) { | ||
|  | ||
| if(target == null || "".equals(target)){ | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
| } | 
| @@ -0,0 +1,43 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package facss.co.jp.java.src; | ||
|  | ||
| /** | ||
| * @author PC User | ||
| * | ||
| */ | ||
| public class BattleShipDto { | ||
|  | ||
|  | ||
| // public List<BattleShipDto> battleShipList; | ||
| // | ||
| // public List<BattleShipDto> heavyCruiser; | ||
| // | ||
| // public List<BattleShipDto> lightCruiser; | ||
| // | ||
| // public List<BattleShipDto> destroyer; | ||
|  | ||
| public String orgCode = ""; | ||
|  | ||
| public String orgName = ""; | ||
|  | ||
| public String abbreviation = ""; | ||
|  | ||
| public String orgCode1 = ""; | ||
|  | ||
| public String orgName1 = ""; | ||
|  | ||
| public String orgCode2; | ||
|  | ||
| public String orgName2; | ||
|  | ||
| public String orgCode3 = ""; | ||
|  | ||
| public String orgName3 = ""; | ||
|  | ||
| public String orgCode4; | ||
|  | ||
| public String orgName4; | ||
|  | ||
| } | 
| @@ -0,0 +1,111 @@ | ||
| /* | ||
| * @(#)ByteArrayUtil.java | ||
| * | ||
| */ | ||
| package jp.console.main; | ||
|  | ||
| import java.io.BufferedInputStream; | ||
| import java.io.File; | ||
| import java.io.FileInputStream; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|  | ||
| /** | ||
| * バイト配列操作のヘルパークラス | ||
| */ | ||
| public class ByteArrayUtil { | ||
|  | ||
| /** | ||
| * 可変長配列からバイトの配列を生成 | ||
| * | ||
| * @param list | ||
| * 可変長配列 | ||
| * @return バイトの配列 | ||
| */ | ||
| public static byte[] toArray(List<Byte> list) { | ||
| byte[] array = new byte[list.size()]; | ||
| for (int i = 0; i < array.length; i++) { | ||
| array[i] = list.get(i).byteValue(); | ||
| } | ||
| return array; | ||
| } | ||
|  | ||
| /** | ||
| * バイトの配列から可変長配列を生成 | ||
| * | ||
| * @param array | ||
| * バイトの配列 | ||
| * @return 可変長配列 | ||
| */ | ||
| public static List<Byte> asList(byte[] array) { | ||
| List<Byte> list = new ArrayList<Byte>(array.length); | ||
| for (int i = 0; i < array.length; i++) { | ||
| list.add(array[i]); | ||
| } | ||
| return list; | ||
| } | ||
|  | ||
| /** | ||
| * 可変長配列に指定された範囲の配列を追加 | ||
| * | ||
| * @param list | ||
| * 可変長配列 | ||
| * @param array | ||
| * コピーされる配列 | ||
| * @param from | ||
| * コピーされる範囲の最初のインデックス | ||
| * @param to | ||
| * コピーされる範囲の最後の次のインデックス(範囲外) | ||
| */ | ||
| public static void appendOfRange(List<Byte> list, byte[] array, int from, | ||
| int to) { | ||
| for (int i = from; i < to; i++) { | ||
| list.add(array[i]); | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * 可変長配列に指定されたファイルを追加 | ||
| * | ||
| * @param list | ||
| * 可変長配列 | ||
| * @param file | ||
| * 追加するファイル | ||
| * @throws IOException | ||
| * ファイルI/Oエラー | ||
| */ | ||
| public static void applendFile(List<Byte> list, File file) | ||
| throws IOException { | ||
| InputStream stream = new BufferedInputStream(new FileInputStream(file)); | ||
| try { | ||
| int ch; | ||
| while ((ch = stream.read()) >= 0) { | ||
| list.add((byte) ch); | ||
| } | ||
| } finally { | ||
| stream.close(); | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * バイナリファイルの読み込み | ||
| * | ||
| * @param file | ||
| * ファイル | ||
| * @return バイトの配列 | ||
| * @throws IOException | ||
| * ファイルI/Oエラー | ||
| */ | ||
| public static byte[] readFile(File file) throws IOException { | ||
| byte[] array = new byte[(int) file.length()]; | ||
| InputStream stream = new BufferedInputStream(new FileInputStream(file)); | ||
| try { | ||
| stream.read(array); | ||
| } finally { | ||
| stream.close(); | ||
| } | ||
| return array; | ||
| } | ||
| } | 
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| * 作成日:2005/05/24 | ||
| * | ||
| * (C) COPYRIGHT Open Future System Corp. 2005 | ||
| * All Rights Reserved. | ||
| */ | ||
| package jp.co.profitcube.eacris.web.bridge.util; | ||
|  | ||
| import java.io.File; | ||
| import java.io.FileOutputStream; | ||
| import java.io.IOException; | ||
| import java.io.OutputStream; | ||
|  | ||
| /** | ||
| * バイト配列を操作するユーティリティメソッド郡。 | ||
| * <p> | ||
| * @author daisaku | ||
| * @version 1.0 | ||
| */ | ||
| public class ByteUtil { | ||
|  | ||
| /** | ||
| * 新規のファイルにバイト配列の内容を書き込む。 | ||
| * 既存のファイルに上書きしようとした場合は実行時例外が発生する。 | ||
| * <p> | ||
| * @param b バイト配列 | ||
| * @param newFile 新規作成ファイル | ||
| */ | ||
| public static synchronized void toFile(byte[] b, File newFile){ | ||
| if(FileUtil.isReadFile(newFile)){ | ||
| throw new ByteUtilRuntimeException("already exist file: file-path["+newFile.getPath()+"]"); | ||
| } | ||
| OutputStream stream = null; | ||
| try { | ||
| stream = new FileOutputStream(newFile); | ||
| stream.write(b); | ||
| stream.flush(); | ||
| stream.close(); | ||
| } catch (Exception e) { | ||
| throw new ByteUtilRuntimeException(e); | ||
| }finally{ | ||
| if(stream != null){ | ||
| try { | ||
| stream.close(); | ||
| } catch (IOException e) { | ||
| throw new ByteUtilRuntimeException(e); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|  | ||
| } | ||
|  | ||
| class ByteUtilRuntimeException extends RuntimeException{ | ||
| public ByteUtilRuntimeException(String message){ | ||
| super(message); | ||
| } | ||
| public ByteUtilRuntimeException(Exception e){ | ||
| super(e); | ||
| } | ||
| } | 
| @@ -0,0 +1,47 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.local.src.main; | ||
|  | ||
| import java.io.UnsupportedEncodingException; | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| public class ChangeHexa { | ||
|  | ||
|  | ||
| /** | ||
| * @param args | ||
| * @throws Exception | ||
| */ | ||
| public static void main(String[] args) throws Exception { | ||
|  | ||
| String target = args[0]; | ||
|  | ||
| int intHex = 0; | ||
|  | ||
| for(int index = 0 ; index < target.length() ; index++){ | ||
| String strChar = String.valueOf(target.charAt(index)); | ||
| String hexString = getHexa(strChar); | ||
| intHex = intHex + Integer.parseInt(hexString, 16); | ||
| } | ||
|  | ||
| System.out.println(target +"\n"); | ||
|  | ||
| System.out.println("16進数: " + Integer.toHexString(intHex).toUpperCase()); | ||
| System.out.println("10進数: " + intHex); | ||
| System.out.println("08進数: " + Integer.toOctalString(intHex)); | ||
| System.out.println("02進数: " + Integer.toBinaryString(intHex)); | ||
| } | ||
|  | ||
| /** | ||
| * | ||
| * @param target | ||
| * @throws UnsupportedEncodingException | ||
| */ | ||
| public static String getHexa(String target) throws UnsupportedEncodingException { | ||
| char[] buf = new String(target.getBytes("MS932"), "8859_1").toCharArray(); | ||
| return Integer.toHexString(buf[0]) + Integer.toHexString(buf[1]); | ||
| } | ||
| } | 
| @@ -0,0 +1,70 @@ | ||
| package com.smbc.jimuwf.saimu.jisutil.commonstatuscheck.ap; | ||
|  | ||
| import com.nec.jp.fs1.bpmg.bcc00.util.CmMessageUtil; | ||
| import com.nec.jp.systemdirector.ent.apfrw.BusinessLogicException; | ||
|  | ||
| public class CheckException extends BusinessLogicException { | ||
|  | ||
| private static final long serialVersionUID = 1L; | ||
|  | ||
| /** 警告メッセージID */ | ||
| private String messageId = null; | ||
|  | ||
| /** ワークフロー情報クラス(DTO) */ | ||
| private WorkFlowInfo workFrowStatusData = null; | ||
|  | ||
| /** 受付文字 */ | ||
| private String[] umekomiMoji; | ||
|  | ||
| public CheckException(String messageId) { | ||
| this.messageId = messageId; | ||
| } | ||
|  | ||
| /** | ||
| * 警告メッセージを戻します。 | ||
| * | ||
| * @param return 警告メッセージ | ||
| */ | ||
| public String getMessage() { | ||
|  | ||
| // メッセージの引数に対してNullチェック | ||
| if (this.umekomiMoji != null) { | ||
| if (this.umekomiMoji.length > 0) { | ||
| return CmMessageUtil.getMesageString(this.messageId, this.umekomiMoji); | ||
| } else { | ||
| return CmMessageUtil.getMesageString(this.messageId); | ||
| } | ||
| } else { | ||
| return CmMessageUtil.getMesageString(this.messageId); | ||
| } | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * 受付文字(警告メッセージの引数)を設定します。 | ||
| * | ||
| * @param umekomiMoji | ||
| */ | ||
| public void setUmekomiMoji(String... umekomiMoji) { | ||
| this.umekomiMoji = umekomiMoji; | ||
| } | ||
|  | ||
| /** | ||
| * ワークフロー情報クラス(DTO)を設定します。 | ||
| * | ||
| * @param data | ||
| */ | ||
| public void setWorkFrowInfo(WorkFlowInfo data) { | ||
| this.workFrowStatusData = new WorkFlowInfo(data); | ||
| } | ||
|  | ||
| /** | ||
| * ワークフロー情報クラス(DTO)を取得します | ||
| * | ||
| * @return ワークフロー情報クラス(DTO) | ||
| */ | ||
| public WorkFlowInfo getWorkFrowStatusData() { | ||
| return this.workFrowStatusData; | ||
| } | ||
|  | ||
| } | 
| @@ -0,0 +1,19 @@ | ||
| package com.smbc.jimuwf.saimu.jisutil.commonstatuscheck.ap; | ||
|  | ||
| import java.util.List; | ||
|  | ||
| public class CommonStatusCheck { | ||
|  | ||
| public static void check(List<WorkFlowInfo> worklist, StatusCheckChain check) throws CheckException { | ||
|  | ||
| for (WorkFlowInfo work : worklist) { | ||
| CommonStatusCheck.check(work, check); | ||
| } | ||
|  | ||
| } | ||
|  | ||
| public static void check(WorkFlowInfo work, StatusCheckChain check) throws CheckException { | ||
|  | ||
| check.check(work); | ||
| } | ||
| } | 
| @@ -0,0 +1,225 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.util; | ||
|  | ||
| import java.util.ArrayList; | ||
|  | ||
| /** | ||
| * @author PC User | ||
| * | ||
| */ | ||
| public class ConverterUtil { | ||
|  | ||
| /** | ||
| * | ||
| * 漢数字を半角数字に変換します。 | ||
| * | ||
| * @param chinaNum | ||
| * 変換したい漢数字 | ||
| * @return long 変換した値 | ||
| */ | ||
| public static String chinaNumToArabicNum(String chinaNum) { | ||
|  | ||
| long retNum = 0; | ||
|  | ||
| int maxSize = chinaNum.length(); | ||
|  | ||
| String calValue = new String(chinaNum); | ||
| int count = 0; | ||
| for (int i = 0; i < maxSize; i++) { | ||
|  | ||
| if (getNum(chinaNum.substring(i, i + 1)) != -1) { | ||
|  | ||
| calValue = chinaNum.substring(count, maxSize); | ||
| break; | ||
| } else { | ||
| count++; | ||
| } | ||
| } | ||
|  | ||
| String spritChinaNum[] = new String[3]; | ||
|  | ||
| ArrayList<String> list = new ArrayList<>(); | ||
|  | ||
| list.add("百"); | ||
| list.add("十"); | ||
|  | ||
| for (int i = 0; i < 2; i++) { | ||
| if (calValue.indexOf(list.get(i)) > -1) { | ||
|  | ||
| spritChinaNum[i] = calValue.substring(0, | ||
| calValue.indexOf(list.get(i)) + 1); | ||
| if (spritChinaNum[i].equals(list.get(i))) { | ||
| spritChinaNum[i] = "一" + spritChinaNum[i]; | ||
| } | ||
| calValue = calValue.substring(calValue.indexOf(list.get(i)) + 1, calValue.length()); | ||
| } else { | ||
| spritChinaNum[i] = "零"; | ||
| } | ||
| } | ||
|  | ||
| spritChinaNum[2] = calValue; | ||
|  | ||
| long hundredsPlaceArray[] = { 0, 0 }; | ||
| long tensPlaceArray[] = { 0, 0 }; | ||
|  | ||
| for (String num : spritChinaNum) { | ||
|  | ||
| if (num.matches(".*" + list.get(0) + ".*")) { | ||
| for (int i = 0; i < num.length(); i++) { | ||
| // hundredsPlaceArray.add(getNum(num.substring(i,i+1))); | ||
| hundredsPlaceArray[i] = getNum(num.substring(i, i + 1)); | ||
|  | ||
| } | ||
| } | ||
|  | ||
| if (num.matches(".*" + list.get(1) + ".*")) { | ||
| for (int i = 0; i < num.length(); i++) { | ||
| // tensPlaceArray.add(getNum(num.substring(i,i+1))); | ||
| tensPlaceArray[i] = getNum(num.substring(i, i + 1)); | ||
| } | ||
| } | ||
| } | ||
|  | ||
| long hundredsPlace = 0; | ||
| long tensPlace = 0; | ||
| long onesPlace = 0; | ||
|  | ||
| hundredsPlace = Math.abs(hundredsPlaceArray[0] * hundredsPlaceArray[1]); | ||
| tensPlace = Math.abs(tensPlaceArray[0] * tensPlaceArray[1]); | ||
|  | ||
| for (int i = 0; i < calValue.length(); i++) { | ||
| if (i == 0) { | ||
| if (calValue.length() >= 3) { | ||
| onesPlace += getNum(calValue.substring(i, i + 1)) * 100; | ||
| } else if (calValue.length() == 2) { | ||
| onesPlace += getNum(calValue.substring(i, i + 1)) * 10; | ||
| } else { | ||
| onesPlace += getNum(calValue); | ||
| } | ||
| } else if (i == 1) { | ||
| if (calValue.length() >= 3) { | ||
| onesPlace += getNum(calValue.substring(i, i + 1)) * 10; | ||
| } else { | ||
| onesPlace += getNum(calValue); | ||
| } | ||
| } else if (i == 2) { | ||
| onesPlace += getNum(calValue); | ||
| } | ||
| } | ||
| // 百の位、十の位と一の位を加算 | ||
| retNum = hundredsPlace + tensPlace + onesPlace; | ||
|  | ||
| //半角数字を全角数字にする。 | ||
| String ret = convertMultiByteNum(retNum); | ||
|  | ||
|  | ||
| return ret; | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * 半角数字を全角数字にする。 | ||
| * @param inNum | ||
| * @return | ||
| */ | ||
| public static String convertMultiByteNum(long inNum) { | ||
|  | ||
| String strInNum = Long.toString(inNum); | ||
| StringBuffer sb = new StringBuffer(strInNum); | ||
| for (int i = 0; i < sb.length(); i++) { | ||
| char c = sb.charAt(i); | ||
| if (c >= '0' && c <= '9') { | ||
| sb.setCharAt(i, (char) (c - '0' + '0')); | ||
| } | ||
| } | ||
|  | ||
| return sb.toString(); | ||
| } | ||
|  | ||
| /** | ||
| * 漢数字を半角数字にする詳細 | ||
| * @param strNum | ||
| * @return | ||
| */ | ||
| private static long getNum(String strNum) { | ||
|  | ||
| long num = 0L; | ||
| // 漢数字を数値化する。 | ||
| for (int i = 0; i < strNum.length(); i++) { | ||
| char cBuf = strNum.charAt(i); | ||
| switch (cBuf) { | ||
| case '零': | ||
| case '〇': | ||
| num = 0; | ||
| break; | ||
| case '壱': | ||
| case '一': | ||
| num = 1; | ||
| break; | ||
| case '弐': | ||
| case '二': | ||
| num = 2; | ||
| break; | ||
| case '参': | ||
| case '三': | ||
| num = 3; | ||
| break; | ||
| case '四': | ||
| num = 4; | ||
| break; | ||
| case '五': | ||
| num = 5; | ||
| break; | ||
| case '六': | ||
| num = 6; | ||
| break; | ||
| case '七': | ||
| num = 7; | ||
| break; | ||
| case '八': | ||
| num = 8; | ||
| break; | ||
| case '九': | ||
| num = 9; | ||
| break; | ||
| case '十': | ||
| num = 10; | ||
| break; | ||
|  | ||
| case '百': | ||
| num = 100; | ||
| break; | ||
| default: | ||
| num = -1; | ||
| break; | ||
| } | ||
| } | ||
| return num; | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * 文字の全角と半角を判定して半角であれば正を返す | ||
| * | ||
| * @param targetString | ||
| * @return boolean | ||
| */ | ||
| public static boolean isSingleByte(String targetString) { | ||
| // 取得した文字サイズの計算 | ||
| int strSize = targetString.length(); | ||
| int byteSize = targetString.getBytes().length; | ||
|  | ||
| // 文字数とバイト数が同じ→半角 | ||
| if (strSize == byteSize) { | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|  | ||
| } | ||
|  | ||
|  | ||
|  | ||
|  | 
| @@ -0,0 +1,188 @@ | ||
| package jp.util; | ||
|  | ||
| import static org.junit.Assert.*; | ||
|  | ||
| import org.junit.After; | ||
| import org.junit.AfterClass; | ||
| import org.junit.Before; | ||
| import org.junit.BeforeClass; | ||
| import org.junit.Test; | ||
|  | ||
| public class ConverterUtilTest { | ||
|  | ||
| @BeforeClass | ||
| public static void setUpBeforeClass() throws Exception { | ||
| } | ||
|  | ||
| @AfterClass | ||
| public static void tearDownAfterClass() throws Exception { | ||
| } | ||
|  | ||
| @Before | ||
| public void setUp() throws Exception { | ||
| } | ||
|  | ||
| @After | ||
| public void tearDown() throws Exception { | ||
| } | ||
|  | ||
| /** | ||
| * 漢数字の変換 001 | ||
| */ | ||
| @Test | ||
| public void chinaNumToArabicNumTestCase001() { | ||
|  | ||
| String rValue = new String(); | ||
| String pValue = "256"; | ||
| String iValue = "弐百五十六"; | ||
|  | ||
|  | ||
| System.out.println("**********Case001 Test START**********"); | ||
|  | ||
|  | ||
| rValue = StringUtil.chinaNumToArabicNum(iValue); | ||
|  | ||
| System.out.println("入力値: " + iValue); | ||
| System.out.println("想定値: " + pValue); | ||
| System.out.println("戻り値: " + rValue); | ||
|  | ||
| assertEquals(pValue,rValue); | ||
|  | ||
| System.out.println("**********Case001 Test END**********"); | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * 漢数字の変換 002 | ||
| */ | ||
| @Test | ||
| public void chinaNumToArabicNumTestCase002() { | ||
|  | ||
| String rValue = new String(); | ||
| String pValue = "99"; | ||
| String iValue = "九十九"; | ||
|  | ||
| System.out.println(); | ||
| System.out.println("**********Case002 Test START**********"); | ||
|  | ||
| System.out.println("入力値: " + iValue); | ||
| System.out.println("想定値: " + pValue); | ||
| rValue = StringUtil.chinaNumToArabicNum(iValue); | ||
| System.out.println("戻り値: " + rValue); | ||
|  | ||
| assertEquals(pValue,rValue); | ||
|  | ||
| System.out.println("**********Case002 Test END**********"); | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * 漢数字の変換 003 | ||
| */ | ||
| @Test | ||
| public void chinaNumToArabicNumTestCase003() { | ||
|  | ||
| String iValue = "百十九"; | ||
| String rValue = new String(); | ||
| String pValue = "119"; | ||
|  | ||
|  | ||
| System.out.println(); | ||
| System.out.println("**********Case003 Test START**********"); | ||
|  | ||
|  | ||
|  | ||
|  | ||
| System.out.println("入力値: " + iValue); | ||
| System.out.println("想定値: " + pValue); | ||
| rValue = StringUtil.chinaNumToArabicNum(iValue); | ||
| System.out.println("戻り値: " + rValue); | ||
| assertEquals(pValue,rValue); | ||
|  | ||
| System.out.println("**********Case003 Test END**********"); | ||
|  | ||
| } | ||
|  | ||
|  | ||
| /** | ||
| * 漢数字の変換 004 | ||
| */ | ||
| @Test | ||
| public void chinaNumToArabicNumTestCase004() { | ||
|  | ||
| String iValue = "二"; | ||
| String pValue = "2"; | ||
| String rValue = new String(); | ||
|  | ||
|  | ||
| System.out.println(); | ||
| System.out.println("**********Case004 Test START**********"); | ||
|  | ||
|  | ||
|  | ||
|  | ||
| System.out.println("入力値: " + iValue); | ||
| System.out.println("想定値: " + pValue); | ||
| rValue = StringUtil.chinaNumToArabicNum(iValue); | ||
| System.out.println("戻り値: " + rValue); | ||
| assertEquals(pValue,rValue); | ||
|  | ||
| System.out.println("**********Case004 Test END**********"); | ||
|  | ||
| } | ||
|  | ||
|  | ||
| /** | ||
| * 漢数字の変換 005 | ||
| */ | ||
| @Test | ||
| public void chinaNumToArabicNumTestCase005() { | ||
|  | ||
| String iValue = "弐五六"; | ||
| String pValue = "256"; | ||
| String rValue = new String(); | ||
|  | ||
|  | ||
| System.out.println(); | ||
| System.out.println("**********Case005 Test START**********"); | ||
|  | ||
|  | ||
|  | ||
|  | ||
| System.out.println("入力値: " + iValue); | ||
| System.out.println("想定値: " + pValue); | ||
| rValue = StringUtil.chinaNumToArabicNum(iValue); | ||
| System.out.println("戻り値: " + rValue); | ||
| assertEquals(pValue,rValue); | ||
|  | ||
| System.out.println("**********Case005 Test END**********"); | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * 漢数字の変換 006 | ||
| */ | ||
| @Test | ||
| public void chinaNumToArabicNumTestCase006() { | ||
|  | ||
| String iValue = "千五十九"; | ||
| String pValue = "59"; | ||
| String rValue = new String(); | ||
|  | ||
|  | ||
| System.out.println(); | ||
| System.out.println("**********Case006 Test START**********"); | ||
|  | ||
|  | ||
| System.out.println("入力値: " + iValue); | ||
| System.out.println("想定値: " + pValue); | ||
| rValue = StringUtil.chinaNumToArabicNum(iValue); | ||
| System.out.println("戻り値: " + rValue); | ||
| assertEquals(pValue,rValue); | ||
|  | ||
| System.out.println("**********Case006 Test END**********"); | ||
|  | ||
| } | ||
|  | ||
|  | ||
| } | 
| @@ -0,0 +1,104 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.util; | ||
|  | ||
| import java.io.Serializable; | ||
| import java.sql.Timestamp; | ||
| import java.text.SimpleDateFormat; | ||
| import java.util.Calendar; | ||
| import java.util.Date; | ||
|  | ||
| /** | ||
| * @author PC User | ||
| * | ||
| */ | ||
| public final class DateProcessingUtil implements Serializable { | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| private static final long serialVersionUID = 1L; | ||
|  | ||
| //private static int hour = 0; | ||
| //private static int minute = 0; | ||
| private static int second = 0; | ||
|  | ||
| private static int year= 1900; | ||
| private static int date = 1; | ||
| private static Calendar cal; | ||
|  | ||
|  | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| private static final class DateProcessingUtilHolder{ | ||
| private static final DateProcessingUtil instance = new DateProcessingUtil(); | ||
| } | ||
|  | ||
|  | ||
| private DateProcessingUtil() { | ||
| } | ||
|  | ||
| public static DateProcessingUtil getInstance(){ | ||
| return DateProcessingUtilHolder.instance; | ||
| } | ||
|  | ||
|  | ||
| public static String setSystemDate() { | ||
| return setSystemDate(new Date()); | ||
| } | ||
|  | ||
| public static String setSystemDate(Date date) { | ||
| SimpleDateFormat fmt = new SimpleDateFormat("[yyyy/MM/dd HH:mm:ss.SSS] "); | ||
| return fmt.format(date); | ||
| } | ||
|  | ||
|  | ||
| public static String setSystemDate(Timestamp date) { | ||
| SimpleDateFormat fmt = new SimpleDateFormat("[yyyy/MM/dd HH:mm:ss.SSS] "); | ||
| return fmt.format(date); | ||
| } | ||
|  | ||
|  | ||
| public static Timestamp getIncrementDate(int index){ | ||
|  | ||
| if(index > 0){ | ||
| second = cal.get(Calendar.SECOND); | ||
| date= cal.get(Calendar.DAY_OF_MONTH); | ||
| year= cal.get(Calendar.YEAR); | ||
|  | ||
| } | ||
|  | ||
| if(index % 800 == 0 && index / 800 > 0){ | ||
|  | ||
| date++; | ||
| second++; | ||
| cal.set(Calendar.DATE, cal.get(Calendar.DATE)+1); | ||
|  | ||
| }else { | ||
| second++; | ||
| } | ||
| cal.set(Calendar.SECOND, second); | ||
|  | ||
| if(date < cal.get(Calendar.DATE)){ | ||
| cal.set(Calendar.DATE, date); | ||
| } | ||
|  | ||
| // Step3:導出した月初日をTimestamp型に変換する | ||
| Timestamp fromTm = new Timestamp(cal.getTimeInMillis()); | ||
| return fromTm; | ||
| } | ||
|  | ||
| public static void setCalenders(Calendar cal_){ | ||
| cal = cal_; | ||
| year = cal.get(Calendar.YEAR); | ||
| date = cal.get(Calendar.DAY_OF_MONTH); | ||
| } | ||
|  | ||
| } | 
| @@ -0,0 +1,17 @@ | ||
| package com.smbc.jimuwf.saimu.jisutil.commonstatuscheck.ap; | ||
|  | ||
| public class DeleteFlagCheck extends StatusCheckChain { | ||
|  | ||
| @Override | ||
| protected void privateCheck(WorkFlowInfo data) throws CheckException { | ||
| // 論理削除フラグが1 | ||
| if (data.getDelFlag() == 1) { | ||
|  | ||
| CheckException err = new CheckException("MIJS556W"); | ||
| err.setUmekomiMoji(data.getUketuke_NO()); | ||
| err.setWorkFrowInfo(data); | ||
| throw err; | ||
| } | ||
|  | ||
| } | ||
| } | 
| @@ -0,0 +1,57 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.util; | ||
|  | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|  | ||
| /** | ||
| * @author PC User | ||
| * | ||
| */ | ||
| public class DelimiterChecker { | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| public DelimiterChecker() { | ||
| // TODO 自動生成されたコンストラクター・スタブ | ||
| } | ||
|  | ||
| /** | ||
| * @throws Exception | ||
| */ | ||
| public List<String> delimiterCheck(String strData) throws Exception { | ||
| String delimiter = "<\\?xml"; | ||
|  | ||
|  | ||
| List<String> retList = new ArrayList<>(); | ||
|  | ||
| String[] strArray = strData.split(delimiter); | ||
|  | ||
| for(int index = 0 ; index < strArray.length ; index++){ | ||
|  | ||
| String str = strArray[index]; | ||
| if(index == 0) { | ||
|  | ||
| str = str.replaceAll("\n",""); | ||
| str = str.replaceAll("\t",""); | ||
| str = str.replaceAll("\\s",""); | ||
| str = str.replaceAll(" ",""); | ||
|  | ||
|  | ||
| if(str.length() > 0){ | ||
|  | ||
| System.out.println("delimiter ERR: " + str); | ||
| return retList; | ||
| } | ||
| } else { | ||
| retList.add("<?xml"+str); | ||
| } | ||
| } | ||
| return retList; | ||
| } | ||
|  | ||
|  | ||
| } | 
| @@ -0,0 +1,34 @@ | ||
| package jp.co.core.ddm.pack.sbti.excel.poi.data; | ||
|  | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|  | ||
| /** | ||
| * Excelファイルと、出力用データを結びつける(明細・縦方向連続データ用) | ||
| * @author TOZAWA | ||
| * | ||
| */ | ||
| public class DetailsData { | ||
|  | ||
| private int numOfDtails = 0; | ||
|  | ||
| private Map<String, Object[]> dataListMap = new HashMap<String, Object[]>(); | ||
|  | ||
| public Map<String, Object[]> getDataListMap() { | ||
| return dataListMap; | ||
| } | ||
|  | ||
| public void setDataListMap(Map<String, Object[]> dataListMap) { | ||
| this.dataListMap = dataListMap; | ||
| } | ||
|  | ||
| public int getNumOfDetails() { | ||
| return numOfDtails; | ||
| } | ||
|  | ||
| public void setNumOfDetails(int numOfDtails) { | ||
| this.numOfDtails = numOfDtails; | ||
| } | ||
|  | ||
|  | ||
| } | 
| @@ -0,0 +1,383 @@ | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| package jp.co.profitcube.eacris.report.attribute.judgement.normalization; | ||
|  | ||
| import java.io.IOException; | ||
| import java.io.UnsupportedEncodingException; | ||
| import java.sql.Timestamp; | ||
| import java.util.ArrayList; | ||
| import java.util.Calendar; | ||
| import java.util.List; | ||
|  | ||
| import jp.util.CaptionExpression; | ||
| import jp.util.DateProcessingUtil; | ||
| import jp.util.LoopClasses; | ||
| import jp.util.ReadCSV; | ||
| import jp.util.StringUtil; | ||
| import jp.util.SystemDateUtil; | ||
|  | ||
| import org.apache.log4j.Logger; | ||
|  | ||
| /** | ||
| * @author さぶれ(*´艸`) | ||
| * | ||
| */ | ||
| public class ExperimentView { | ||
|  | ||
|  | ||
| public static Logger logger; | ||
|  | ||
| SystemDateUtil systemDate = new SystemDateUtil(); | ||
|  | ||
|  | ||
|  | ||
|  | ||
| public static void systemView(String str) { | ||
|  | ||
| SystemDateUtil systemDate = new SystemDateUtil(); | ||
|  | ||
| System.out.println(systemDate.setSystemDate() + str); | ||
| } | ||
|  | ||
| public static void systemView(int intStr) { | ||
| SystemDateUtil systemDate = new SystemDateUtil(); | ||
| System.out.println(systemDate.setSystemDate() + intStr); | ||
| } | ||
|  | ||
| // private static void systemView(long longStr) { | ||
| // SystemDateUtil systemDate = new SystemDateUtil(); | ||
| // System.out.println(systemDate.setSystemDate() + longStr); | ||
| // } | ||
|  | ||
|  | ||
| /** | ||
| * | ||
| * | ||
| * @param args | ||
| * @throws IOException | ||
| */ | ||
| public static void main(String[] args) throws IOException { | ||
| if(args.length <= 0){ | ||
| doView_08(); | ||
| System.exit(0); | ||
| } | ||
|  | ||
| try { | ||
|  | ||
| int intCase = Integer.valueOf(args[0]); | ||
| switch (intCase) { | ||
| case 1: | ||
| doView_01(); | ||
| break; | ||
| case 2: | ||
| doView_02(); | ||
| break; | ||
| case 3: | ||
| doView_03(); | ||
| break; | ||
| case 4: | ||
| doView_04(); | ||
| break; | ||
| case 5: | ||
| doView_05(); | ||
| break; | ||
| case 6: | ||
| doView_06(); | ||
| break; | ||
| case 7: | ||
| doView_07(); | ||
| break; | ||
| case 8: | ||
| doView_08(); | ||
| break; | ||
| // case 9: | ||
| // doView_09(); | ||
| // break; | ||
| // case 10: | ||
| // doView_10(); | ||
| // break; | ||
| case 99: | ||
| doView_01(); | ||
| doView_02(); | ||
| doView_03(); | ||
| doView_04(); | ||
| doView_05(); | ||
| doView_06(); | ||
| // doView_07(); | ||
| // doView_08(); | ||
| // doView_09(); | ||
| break; | ||
|  | ||
| default: | ||
| break; | ||
| } | ||
| }catch(NumberFormatException e){ | ||
|  | ||
| System.err.println("No name"); | ||
| System.exit(1); | ||
| } | ||
| } | ||
|  | ||
|  | ||
|  | ||
| private static void doView_08() { | ||
| StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); | ||
| CaptionExpression.setStackTraceElements(stackTraceElements); | ||
| CaptionExpression.start(1); | ||
|  | ||
| Timestamp timestamp = new Timestamp(System.currentTimeMillis()); | ||
| Calendar cal = Calendar.getInstance(); | ||
| cal.setTimeInMillis(timestamp.getTime()); | ||
|  | ||
|  | ||
| //int hour = cal.get(Calendar.HOUR); | ||
| //int minute = 0; | ||
| //int second = 0; | ||
|  | ||
|  | ||
| cal.set(Calendar.HOUR, 9); | ||
| cal.set(Calendar.MINUTE, 59); | ||
| cal.set(Calendar.SECOND, 0); | ||
|  | ||
|  | ||
| DateProcessingUtil.getInstance(); | ||
| DateProcessingUtil.setCalenders(cal); | ||
|  | ||
|  | ||
| LoopClasses loops = new LoopClasses(); | ||
|  | ||
|  | ||
| int maxLoop = 800 * 10; | ||
|  | ||
| loops.doMain(maxLoop); | ||
|  | ||
|  | ||
| CaptionExpression.end(1); | ||
|  | ||
| } | ||
|  | ||
| private static void doView_07() { | ||
| StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); | ||
| CaptionExpression.setStackTraceElements(stackTraceElements); | ||
| CaptionExpression.start(1); | ||
|  | ||
| Timestamp timestamp = new Timestamp(System.currentTimeMillis()); | ||
| // STEP1:DBから取得したデータ(Timestamp型)をCalendar型に変換する | ||
| Calendar cal = Calendar.getInstance(); | ||
| cal.setTimeInMillis(timestamp.getTime()); | ||
|  | ||
|  | ||
| int hour = cal.get(Calendar.HOUR); | ||
| int minute = 0; | ||
| int second = 0; | ||
|  | ||
|  | ||
| cal.set(Calendar.HOUR, hour); | ||
| cal.set(Calendar.MINUTE, minute); | ||
| cal.set(Calendar.SECOND, second); | ||
|  | ||
| int year= cal.get(Calendar.YEAR); | ||
| int date = cal.get(Calendar.DAY_OF_MONTH); | ||
|  | ||
| for(int index = 0 ; index < 900000 ; index++){ | ||
|  | ||
| if(index > 0){ | ||
| second = cal.get(Calendar.SECOND); | ||
| date= cal.get(Calendar.DAY_OF_MONTH); | ||
| year= cal.get(Calendar.YEAR); | ||
|  | ||
| } | ||
|  | ||
| if(index % 800 == 0 && index / 800 > 0){ | ||
|  | ||
| date++; | ||
| cal.set(Calendar.DATE, cal.get(Calendar.DATE)+1); | ||
|  | ||
| }else { | ||
| second++; | ||
| } | ||
| cal.set(Calendar.SECOND, second); | ||
|  | ||
| if(date < cal.get(Calendar.DATE)){ | ||
| cal.set(Calendar.DATE, date); | ||
| } else { | ||
| // if(year < cal.get(Calendar.YEAR)){ | ||
| // cal.set(Calendar.YEAR, year); | ||
| // } | ||
| } | ||
|  | ||
|  | ||
|  | ||
| // Step3:導出した月初日をTimestamp型に変換する | ||
| Timestamp fromTm = new Timestamp(cal.getTimeInMillis()); | ||
| System.out.println(StringUtil.digitNumber(index + 1, 8) + " : " + fromTm.toString()); | ||
| //Thread.sleep(500); | ||
| } | ||
|  | ||
|  | ||
|  | ||
| CaptionExpression.end(1); | ||
| } | ||
|  | ||
| private static void doView_06() { | ||
|  | ||
| StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); | ||
| CaptionExpression.setStackTraceElements(stackTraceElements); | ||
| CaptionExpression.start(1); | ||
|  | ||
| //String target = "㈱日㈲産㈹自動車㈱"; | ||
| String target = "㍾㍽㍼"; | ||
|  | ||
|  | ||
| char[] charArray = target.toCharArray(); | ||
|  | ||
| systemView("[in ]: " + target); | ||
|  | ||
| // | ||
| List<Character> charList = new ArrayList<Character>(); | ||
|  | ||
|  | ||
| for(char character : charArray){ | ||
| NormalizeUtil.placeCharacterList(charList, character); | ||
| } | ||
|  | ||
| try { | ||
| String outPutStr = NormalizeUtil.stringToCharacterList(charList); | ||
| systemView("[out ]: " + outPutStr); | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
| } finally { | ||
| CaptionExpression.end(1); | ||
| } | ||
|  | ||
| } | ||
|  | ||
|  | ||
|  | ||
| private static void doView_05() { | ||
|  | ||
| StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); | ||
| CaptionExpression.setStackTraceElements(stackTraceElements); | ||
| CaptionExpression.start(1); | ||
|  | ||
|  | ||
| String nameKana = "株株式会社㈱"; | ||
| byte[] bNameKana; | ||
| try { | ||
| bNameKana = nameKana.getBytes("Shift_JIS"); | ||
|  | ||
| String strHex = StringUtil.asHex(bNameKana); | ||
|  | ||
| System.out.println("hex:"+strHex); | ||
|  | ||
| String newStr = new String(StringUtil.asByteArray(strHex), "Shift_JIS"); | ||
|  | ||
| System.out.println("str:"+newStr); | ||
|  | ||
| } catch (UnsupportedEncodingException e) { | ||
| e.printStackTrace(); | ||
| } finally { | ||
| CaptionExpression.end(1); | ||
| } | ||
| } | ||
|  | ||
| private static void doView_04() { | ||
|  | ||
| StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); | ||
| CaptionExpression.setStackTraceElements(stackTraceElements); | ||
| CaptionExpression.start(1); | ||
|  | ||
| String strBuf = "一二三四五六七八九〇"; | ||
|  | ||
|  | ||
|  | ||
| char[] charArray = strBuf.toCharArray(); | ||
| for (char charBuf : charArray) { | ||
|  | ||
| int intValues = (int)charBuf; | ||
|  | ||
| System.out.println(charBuf + " : " + intValues); | ||
| } | ||
|  | ||
|  | ||
| System.out.println(strBuf.replaceAll("゙", "")); | ||
|  | ||
| strBuf = "ドドヴノミスス"; | ||
| System.out.println(strBuf); | ||
| System.out.println(strBuf.replaceAll("ヴ", "フ")); | ||
| CaptionExpression.end(1); | ||
|  | ||
|  | ||
| } | ||
|  | ||
| private static void doView_03() { | ||
| StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); | ||
| CaptionExpression.setStackTraceElements(stackTraceElements); | ||
| CaptionExpression.start(1); | ||
|  | ||
| String str = ConverterUtil.chinaNumToArabicNum("百十"); | ||
| System.out.println(str); | ||
|  | ||
| str = ConverterUtil.chinaNumToArabicNum("五百十二"); | ||
| System.out.println(str); | ||
| CaptionExpression.end(1); | ||
| } | ||
|  | ||
| private static void doView_02() { | ||
|  | ||
| StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); | ||
| CaptionExpression.setStackTraceElements(stackTraceElements); | ||
| CaptionExpression.start(1); | ||
|  | ||
| String str = "あ"; | ||
| byte[] bytes; | ||
| try { | ||
| bytes = str.getBytes("JIS"); | ||
| int loop = 0; | ||
| for(byte code : bytes){ | ||
| systemView(code); | ||
| systemView(StringUtil.digitNumber(loop, 5) + ""); | ||
| loop++; | ||
|  | ||
| } | ||
| // 文字「あ」です。 | ||
| char c = 'あ'; | ||
|  | ||
| // 文字に対応するUnicodeコードを取得します。 (UTF-8) | ||
| int code = (int)c; | ||
|  | ||
| // 文字コードを表示します。 | ||
| System.out.println(code); | ||
| System.out.printf("%02x\n", code); | ||
| systemView(code); | ||
|  | ||
| } catch (UnsupportedEncodingException e) { | ||
| e.printStackTrace(); | ||
| } finally { | ||
| CaptionExpression.end(1); | ||
| } | ||
|  | ||
|  | ||
| } | ||
|  | ||
| private static void doView_01() { | ||
|  | ||
| StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); | ||
| CaptionExpression.setStackTraceElements(stackTraceElements); | ||
|  | ||
| CaptionExpression.start(1); | ||
|  | ||
| ReadCSV csvRead = new ReadCSV(); | ||
|  | ||
| ArrayList<String> list = csvRead.doMain("E:/Users/CSV/Input/writers.csv"); | ||
|  | ||
| for (String str : list) { | ||
| systemView(str); | ||
| } | ||
|  | ||
| CaptionExpression.end(1); | ||
|  | ||
| } | ||
| } | 
| @@ -0,0 +1,67 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.local.src.main; | ||
|  | ||
| import java.util.ArrayList; | ||
| import java.util.HashMap; | ||
|  | ||
| /** | ||
| * @author t-hitozawa | ||
| * | ||
| */ | ||
| public class Factorization { | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| public Factorization() { | ||
| // TODO Auto-generated constructor stub | ||
| } | ||
| public HashMap<Integer,Integer> doAnswer(int radix){ | ||
|  | ||
| ArrayList<Integer> ret = new ArrayList<Integer>(); | ||
|  | ||
|  | ||
| // 2 で割れるだけ割り算する | ||
| while(radix % 2 == 0){ | ||
| ret.add(2); | ||
| radix /= 2; | ||
| } | ||
| // 奇数で割り算していく | ||
| for(int intOdd = 3; intOdd * intOdd <= radix; intOdd += 2){ | ||
| while(radix % intOdd == 0){ | ||
| radix /= intOdd; | ||
| ret.add(intOdd); | ||
| } | ||
| } | ||
| if(radix > 1) { | ||
| ret.add(radix); | ||
| } | ||
|  | ||
|  | ||
| HashMap<Integer,Integer> map = new HashMap<>(); | ||
|  | ||
| int count = 1; | ||
| for(int i = 0 ; i < ret.size() ; i++){ | ||
| if(i + 1 < ret.size()){ | ||
| if(ret.get(i) != ret.get(i+1)){ | ||
| map.put(ret.get(i), count); | ||
| count = 1; | ||
| } else { | ||
| count++; | ||
| } | ||
| } else { | ||
| map.put(ret.get(i), count); | ||
| } | ||
| } | ||
| // for(Integer key : map.keySet()){ | ||
| // System.out.println("Key : " + key + " val : " + map.get(key)); | ||
| // } | ||
|  | ||
|  | ||
| return map; | ||
|  | ||
| } | ||
|  | ||
| } | 
| @@ -0,0 +1,28 @@ | ||
| package jp.local.src.main; | ||
|  | ||
| import java.util.HashSet; | ||
|  | ||
| public class Factorization_OLD { | ||
| public static void main(String[] args){ | ||
| HashSet<Integer> set = new HashSet<>(); | ||
|  | ||
| int intRadix = 21; | ||
| // 2 で割れるだけ割り算する | ||
| while(intRadix % 2 == 0){ | ||
| System.out.print(2); | ||
| System.out.print(" "); | ||
| intRadix /= 2; | ||
| } | ||
| // 奇数で割り算していく | ||
| for(int intOdd = 3; intOdd * intOdd <= intRadix; intOdd += 2){ | ||
| while(intRadix % intOdd == 0){ | ||
| System.out.print(intOdd + " "); | ||
| intRadix /= intOdd; | ||
| set.add(intOdd); | ||
| } | ||
| } | ||
| if(intRadix > 1) { | ||
| System.out.println(intRadix); | ||
| } | ||
| } | ||
| } | 
| @@ -0,0 +1,79 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.util; | ||
|  | ||
| import java.io.BufferedReader; | ||
| import java.io.File; | ||
| import java.io.FileReader; | ||
| import java.util.List; | ||
|  | ||
| /** | ||
| * @author PC User | ||
| * | ||
| */ | ||
| public class FileToByte { | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| public FileToByte() { | ||
| } | ||
|  | ||
| public void doMain() throws Exception{ | ||
|  | ||
|  | ||
| File file = new File("e:/tmp/xml/test.xml"); | ||
| BufferedReader br = new BufferedReader(new FileReader(file)); | ||
|  | ||
| String strData = br.readLine(); | ||
| String fileData = null; | ||
| while(strData != null){ | ||
| // System.out.println(strData); | ||
| if(fileData != null){ | ||
|  | ||
| fileData += strData; | ||
| } else { | ||
|  | ||
| fileData = strData; | ||
| } | ||
|  | ||
| strData = br.readLine(); | ||
| } | ||
|  | ||
|  | ||
| DelimiterChecker delimiter = new DelimiterChecker(); | ||
|  | ||
| byte[] byteData = fileData.getBytes("UTF8"); | ||
|  | ||
| int index = 1; | ||
| for(byte byteItem : byteData){ | ||
| if(index % 256 == 0){ | ||
| System.out.println(); | ||
| }else{ | ||
|  | ||
| System.out.printf("%5s",Byte.toString(byteItem)); | ||
|  | ||
| } | ||
| index++; | ||
|  | ||
| } | ||
| System.out.println(); | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
| List<String> result = delimiter.delimiterCheck(new String(byteData, "UTF8")); | ||
|  | ||
| for(String item : result){ | ||
|  | ||
|  | ||
| System.out.println(item); | ||
| } | ||
|  | ||
| br.close(); | ||
|  | ||
| } | ||
|  | ||
| } | 
| @@ -0,0 +1,309 @@ | ||
| /* | ||
| * 作成日:2005/05/24 | ||
| * | ||
| * (C) COPYRIGHT Open Future System Corp. 2005 | ||
| * All Rights Reserved. | ||
| */ | ||
| package jp.co.profitcube.eacris.web.bridge.util; | ||
|  | ||
| import java.beans.XMLDecoder; | ||
| import java.beans.XMLEncoder; | ||
| import java.io.BufferedInputStream; | ||
| import java.io.BufferedOutputStream; | ||
| import java.io.BufferedReader; | ||
| import java.io.BufferedWriter; | ||
| import java.io.File; | ||
| import java.io.FileInputStream; | ||
| import java.io.FileOutputStream; | ||
| import java.io.FilenameFilter; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.io.InputStreamReader; | ||
| import java.io.ObjectInputStream; | ||
| import java.io.ObjectOutputStream; | ||
| import java.io.OutputStreamWriter; | ||
| import java.nio.channels.FileChannel; | ||
| import java.util.ArrayList; | ||
| import java.util.Iterator; | ||
| import java.util.List; | ||
|  | ||
| /** | ||
| * コメント | ||
| * <p> | ||
| * @author daisaku | ||
| * @version 1.0 | ||
| */ | ||
| public class FileUtil { | ||
|  | ||
| /** | ||
| * 読み込み可能なファイルか否か。 | ||
| * <p> | ||
| * @param file 対象ファイル | ||
| * @return true:読み込み可能、false:それ以外 | ||
| */ | ||
| public static boolean isReadFile(File file){ | ||
| //ファイルが存在するか否か | ||
| if(file.exists()){ | ||
| //ファイルがファイルか否か | ||
| if(file.isFile()){ | ||
| //ファイルが読込み可能か否か | ||
| if(file.canRead()){ | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|  | ||
| /** | ||
| * ファイルから指定のエンコード方式で文字列を読込み、 | ||
| * 改行単位で格納したString配列を返す。 | ||
| * 改行コードはOSに準拠したものを利用する。 | ||
| * <p> | ||
| * @param file ファイル | ||
| * @param encode エンコード方式 | ||
| * @return ファイルから読込んだ文字列の配列 | ||
| */ | ||
| public static String[] toLines(File file, String encode){ | ||
| InputStream stream = null; | ||
| InputStreamReader reader = null; | ||
| BufferedReader bReader = null; | ||
| try{ | ||
| stream = new FileInputStream(file); | ||
| reader = new InputStreamReader(stream, encode); | ||
| bReader = new BufferedReader(reader); | ||
| String line = null; | ||
| List list = new ArrayList(); | ||
| while(bReader.ready()){ | ||
| line = bReader.readLine(); | ||
| list.add(line); | ||
| } | ||
| String[] lines = new String[list.size()]; | ||
| Iterator i = list.iterator(); | ||
| for(int j = 0; i.hasNext(); j++){ | ||
| lines[j] = (String)i.next(); | ||
| } | ||
| return lines; | ||
| }catch(Exception e){ | ||
| throw new FileUtilRuntimeException(e); | ||
| }finally{ | ||
| if(stream != null){ | ||
| try { | ||
| stream.close(); | ||
| } catch (IOException e) { | ||
| throw new FileUtilRuntimeException(e); | ||
| } | ||
| } | ||
| if(reader != null){ | ||
| try { | ||
| reader.close(); | ||
| } catch (IOException e) { | ||
| throw new FileUtilRuntimeException(e); | ||
| } | ||
| } | ||
| if(bReader != null){ | ||
| try { | ||
| bReader.close(); | ||
| } catch (IOException e) { | ||
| throw new FileUtilRuntimeException(e); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * ファイルの内容をバイト配列で取得する。 | ||
| * <p> | ||
| * @param file 読込むファイル | ||
| * @return ファイルから読込んだバイト配列 | ||
| */ | ||
| public static byte[] toBytes(File file){ | ||
| FileInputStream stream = null; | ||
| try{ | ||
| stream = new FileInputStream(file); | ||
| byte[] b = new byte[(int) file.length()]; | ||
| stream.read(b); | ||
| /* | ||
| fChannel = stream.getChannel(); | ||
| ByteBuffer bb = ByteBuffer.allocate((int)fChannel.size()); | ||
| fChannel.read(bb); | ||
| System.out.println(Dumper.dump(bb.array())); | ||
| return bb.array(); | ||
| */ | ||
| return b; | ||
| }catch(Exception e){ | ||
| throw new FileUtilRuntimeException(e); | ||
| }finally{ | ||
| if(stream != null){ | ||
| try { | ||
| stream.close(); | ||
| } catch (IOException e) { | ||
| throw new FileUtilRuntimeException(e); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|  | ||
| // 2010/04/27 option tsuda_t MOV from 2009/04/30 FH_0020 ADD M.Sasaki start. | ||
| /** | ||
| * ファイルのコピーを行う。 | ||
| * @param source コピー元ファイル | ||
| * @param target コピー先ファイル | ||
| */ | ||
| public static void copy(File source, File target) throws IOException | ||
| { | ||
| FileChannel sChannel = new FileInputStream(source).getChannel(); | ||
| FileChannel tChannel = new FileOutputStream(target).getChannel(); | ||
|  | ||
| sChannel.transferTo(0, sChannel.size(), tChannel); | ||
|  | ||
| sChannel.close(); | ||
| tChannel.close(); | ||
| } | ||
|  | ||
| /** | ||
| * オブジェクト直列化書出しを行う。 | ||
| * @param obj 直列化可能オブジェクト | ||
| * @param outFile 出力先ファイル名 | ||
| */ | ||
| public static void writeSerFile(Object obj, String outFile) throws IOException | ||
| { | ||
| FileOutputStream fos = new FileOutputStream(outFile); | ||
| ObjectOutputStream oStream = new ObjectOutputStream(fos); | ||
| oStream.writeObject(obj); | ||
| oStream.close(); | ||
| } | ||
|  | ||
| /** | ||
| * オブジェクト直列化XML書出しを行う。 | ||
| * @param obj 直列化可能オブジェクト | ||
| * @param outFile 出力先ファイル名 | ||
| */ | ||
| public static void writeXmlSerFile(Object obj, String outFile) throws IOException | ||
| { | ||
| FileOutputStream fos = new FileOutputStream(outFile); | ||
| XMLEncoder oStream = new XMLEncoder(new BufferedOutputStream(fos)); | ||
| oStream.writeObject(obj); | ||
| oStream.close(); | ||
| } | ||
|  | ||
| /** | ||
| * 直列化ファイルの読出しを行う。 | ||
| * @param inFile 読出し元ファイル | ||
| * @return オブジェクト | ||
| */ | ||
| public static Object readSerFile(String inFile) throws IOException, ClassNotFoundException | ||
| { | ||
| Object retVal = null; | ||
|  | ||
| FileInputStream fis = new FileInputStream(inFile); | ||
| ObjectInputStream iStream = new ObjectInputStream(fis); | ||
| retVal = iStream.readObject(); | ||
| iStream.close(); | ||
|  | ||
| return retVal; | ||
| } | ||
|  | ||
| /** | ||
| * 直列化XMLファイルの読出しを行う。 | ||
| * @param inFile 読出し元ファイル | ||
| * @return オブジェクト | ||
| */ | ||
| public static Object readXmlSerFile(String inFile) throws IOException, ClassNotFoundException | ||
| { | ||
| Object retVal = null; | ||
|  | ||
| FileInputStream fis = new FileInputStream(inFile); | ||
| XMLDecoder iStream = new XMLDecoder(new BufferedInputStream(fis)); | ||
| retVal = iStream.readObject(); | ||
| iStream.close(); | ||
|  | ||
| return retVal; | ||
| } | ||
|  | ||
| /** | ||
| * ファイルの書込を行う。 | ||
| * @param filePath 出力先ファイル | ||
| * @param outString 出力文字列 | ||
| * @param encoding エンコーディング | ||
| */ | ||
| public static void writeFile(String filePath, String outString, String encoding) throws Exception | ||
| { | ||
| BufferedWriter bWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath), encoding)); | ||
| bWriter.write(outString); | ||
| bWriter.close(); | ||
| } | ||
|  | ||
| /** | ||
| * バイト列の書込を行う。 | ||
| * @param outByte 出力バイト列 | ||
| * @param outFile 出力先ファイル名 | ||
| */ | ||
| public static void writeByteFile(byte[] outByte, String outFile) throws IOException | ||
| { | ||
| FileOutputStream fos = new FileOutputStream(outFile); | ||
| fos.write(outByte); | ||
| fos.close(); | ||
| } | ||
| // 2010/04/27 option tsuda_t MOV from 2009/04/30 FH_0020 ADD M.Sasaki end. | ||
|  | ||
| // 2014/01/22 SBIM 自動再照会・別姓/補正 対応 ADD START hishinuma_d 回答補正 | ||
| /** | ||
| * 指定ディレクトリ以下のファイル・ディレクトリを削除する。 | ||
| * @param dirPath 削除対象ディレクトリ | ||
| */ | ||
| public static void deleteFile(String dirPath) { | ||
| File dir = new File(dirPath); | ||
| File[] files = dir.listFiles(getFileRegexFilter("*")); | ||
|  | ||
| for (File file : files) { | ||
| deleteDirectory(file); | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * 再帰的にファイル・ディレクトリを削除する。 | ||
| * @param file | ||
| */ | ||
| public static void deleteDirectory(File file) { | ||
| if (file.exists() == false){ | ||
| return; | ||
| } | ||
|  | ||
| if (file.isFile()) { | ||
| file.delete(); | ||
|  | ||
| } else if (file.isDirectory()) { | ||
| File[] files = file.listFiles(); | ||
| for (int i = 0; i < files.length; i++) { | ||
| deleteDirectory(files[i]); | ||
| } | ||
| file.delete(); | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * 正規表現を使うためのフィルタークラス | ||
| * @param regex | ||
| * @return | ||
| */ | ||
| public static FilenameFilter getFileRegexFilter(String regex) { | ||
| final String regex_ = regex; | ||
| return new FilenameFilter() { | ||
| public boolean accept(File file, String name) { | ||
| boolean ret = name.matches(regex_); | ||
| return ret; | ||
| } | ||
| }; | ||
| } | ||
| // 2014/01/22 SBIM 自動再照会・別姓/補正 対応 ADD END hishinuma_d 回答補正 | ||
| } | ||
|  | ||
| class FileUtilRuntimeException extends RuntimeException{ | ||
| public FileUtilRuntimeException(String message){ | ||
| super(message); | ||
| } | ||
| public FileUtilRuntimeException(Exception e){ | ||
| super(e); | ||
| } | ||
| } | 
| @@ -0,0 +1,43 @@ | ||
| package jp.util; | ||
|  | ||
| import java.io.BufferedReader; | ||
| import java.io.FileReader; | ||
| import java.util.ArrayList; | ||
|  | ||
| public class FileUtilitys { | ||
|  | ||
|  | ||
| private ArrayList<String> list ; | ||
|  | ||
|  | ||
| public FileUtilitys(String fileName) { | ||
| list = new ArrayList<String>(); | ||
| String newName = new String(fileName); | ||
|  | ||
| try { | ||
| getLineDetail(newName); | ||
| } catch (Exception e) { | ||
| System.err.println(e.getMessage()); | ||
| System.exit(1); | ||
| } | ||
| } | ||
|  | ||
|  | ||
| private void getLineDetail(String file) throws Exception | ||
| { | ||
| FileReader fr = new FileReader(file); | ||
| BufferedReader br = new BufferedReader(fr); | ||
| String line; | ||
| while ((line = br.readLine()) != null) { | ||
| list.add(line); | ||
| } | ||
| br.close(); | ||
| fr.close(); | ||
|  | ||
| } | ||
|  | ||
| public ArrayList<String> getList() { | ||
| return list; | ||
| } | ||
|  | ||
| } | 
| @@ -0,0 +1,18 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package com.smbc.jimuwf.saimu.jisutil.commonstatuscheck.ap; | ||
|  | ||
| public class FrontStatusCheckAnser extends StatusCheckChain { | ||
|  | ||
| @Override | ||
| protected void privateCheck(WorkFlowInfo data) throws CheckException { | ||
|  | ||
| // フロント最終区分が1 | ||
| if ("1".equals(data.getFront_Saisyu_KBN())) { | ||
| CheckException err = new CheckException("MIJS555W"); | ||
| err.setWorkFrowInfo(data); | ||
| throw err; | ||
| } | ||
| } | ||
| } | 
| @@ -0,0 +1,13 @@ | ||
| package jp.local.src.main; | ||
|  | ||
| public class Gcd { | ||
|  | ||
| public int gcd(int radixA, int radixB){ | ||
|  | ||
| return radixB == 0 ? radixA : gcd(radixB, radixA % radixB); | ||
|  | ||
| } | ||
|  | ||
|  | ||
|  | ||
| } | 
| @@ -0,0 +1,33 @@ | ||
| package jp.co.core.ddm.pack.sbti.excel.poi.data; | ||
|  | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|  | ||
| /** | ||
| * Excelファイルと、出力用データを結びつける(見出し用) | ||
| * @author TOZAWA | ||
| * | ||
| */ | ||
| public class HeaderData { | ||
|  | ||
| private String reportName = null; | ||
|  | ||
| private Map<String, String> dataMap = new HashMap<String, String>(); | ||
|  | ||
| public Map<String, String> getDataMap() { | ||
| return dataMap; | ||
| } | ||
|  | ||
| public void setDataMap(Map<String, String> dataMap) { | ||
| this.dataMap = dataMap; | ||
| } | ||
|  | ||
| public String getReportName() { | ||
| return reportName; | ||
| } | ||
|  | ||
| public void setReportName(String reportName) { | ||
| this.reportName = reportName; | ||
| } | ||
|  | ||
| } | 
| @@ -0,0 +1,114 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package co.jp.any.swing.component; | ||
|  | ||
| import javax.swing.JButton; | ||
| import javax.swing.JFrame; | ||
|  | ||
| import co.jp.any.swing.excecute.SwingExec; | ||
|  | ||
| /** | ||
| * @author tozawa_h01 | ||
| * | ||
| */ | ||
| public class JButtonTest { | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| private static final long serialVersionUID = 1L; | ||
|  | ||
| private static final int DEFAULT_BUTTON_XPOSI_SIZE = 150; | ||
|  | ||
| private static final int DEFAULT_BUTTON_YPOSI_SIZE = 30; | ||
|  | ||
| private static final int DEFAULT_SPACE_SIZE = 10; | ||
|  | ||
| private static final int ACTIVE_BAR_SIZE = 33; | ||
|  | ||
|  | ||
| private static Object connectButton[] = {new JButton("高さ"),new JButton("幅"),new JButton("閉じる")}; | ||
|  | ||
| private static JFrame frame = new JFrame("JButtonTest"); | ||
|  | ||
| private static final SwingExec swingExecute = new SwingExec(); | ||
|  | ||
| public JButtonTest() { | ||
| components(); | ||
| } | ||
|  | ||
| private void components() { | ||
| // 表示開始位置 | ||
| int x_Position = 10; | ||
| int y_Position = 10; | ||
|  | ||
| int index = 0; | ||
| // ボタン表示位置 | ||
| for(Object bttons : connectButton){ | ||
| if (bttons instanceof JButton) { | ||
| JButton btton = (JButton) bttons; | ||
| btton.setBounds(x_Position,y_Position,DEFAULT_BUTTON_XPOSI_SIZE, DEFAULT_BUTTON_YPOSI_SIZE); | ||
| x_Position = x_Position + DEFAULT_BUTTON_XPOSI_SIZE + DEFAULT_SPACE_SIZE; | ||
|  | ||
| // リスナーのセット | ||
| setActionListeners(index, btton); | ||
| index++; | ||
| } | ||
| } | ||
|  | ||
| // フレームにボタンを追加 | ||
| for(Object bttons : connectButton){ | ||
| if (bttons instanceof JButton) { | ||
| JButton btton = (JButton) bttons; | ||
| frame.getContentPane().add(btton); | ||
| } | ||
| } | ||
|  | ||
| frame.getContentPane().setLayout(null); | ||
| frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
| frame.addWindowListener(swingExecute.new MyWindowAdapter()); | ||
| frame.setTitle("JButtonTest"); | ||
|  | ||
|  | ||
| int frameXSize = x_Position + DEFAULT_SPACE_SIZE; | ||
| int frameYSize = y_Position + DEFAULT_BUTTON_YPOSI_SIZE + DEFAULT_SPACE_SIZE + ACTIVE_BAR_SIZE; | ||
|  | ||
| frame.setSize( frameXSize, frameYSize); | ||
| frame.setVisible(true); | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * @param index | ||
| * @param btton | ||
| */ | ||
| private void setActionListeners(int index, JButton btton) { | ||
| // リスナー | ||
| switch(index){ | ||
| case 0: | ||
| btton.addActionListener(swingExecute.new bottanOkActionHandler()); | ||
| break; | ||
|  | ||
| case 1: | ||
| btton.addActionListener(swingExecute.new bottanNgActionHandler()); | ||
| break; | ||
|  | ||
| case 2: | ||
| btton.addActionListener(swingExecute.new bottanEndActionHandler()); | ||
| break; | ||
|  | ||
| default: | ||
| System.err.println(index); | ||
| break; | ||
| } | ||
| } | ||
|  | ||
| public static int getFrameWidth(){ | ||
| return frame.getWidth(); | ||
| } | ||
|  | ||
| public static int getFrameHeight(){ | ||
| return frame.getHeight(); | ||
| } | ||
| } | 
| @@ -0,0 +1,30 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package co.jp.any.swing.component; | ||
|  | ||
| import java.awt.FlowLayout; | ||
|  | ||
| import javax.swing.JFrame; | ||
|  | ||
| /** | ||
| * @author tozawa_h01 | ||
| * | ||
| */ | ||
| public class JFrameTest extends JFrame { | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| private static final long serialVersionUID = 1L; | ||
|  | ||
|  | ||
| public JFrameTest() { | ||
| getContentPane().setLayout(new FlowLayout()); | ||
| setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
| setTitle("JFrameTest"); | ||
| setSize(640, 480); | ||
| //pack(); | ||
| setVisible(true); | ||
| } | ||
| } | 
| @@ -0,0 +1,37 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.util; | ||
|  | ||
| /** | ||
| * @author PC User | ||
| * | ||
| */ | ||
| public class LoopClasses { | ||
|  | ||
|  | ||
|  | ||
| public LoopClasses(){ | ||
|  | ||
| } | ||
|  | ||
|  | ||
| public void doMain(int maxLoop){ | ||
|  | ||
|  | ||
| for(int index = 0 ; index < maxLoop ; index++){ | ||
|  | ||
| String strTimeStanp = DateProcessingUtil.setSystemDate(DateProcessingUtil.getIncrementDate(index)); | ||
| System.out.println(StringUtil.digitNumber(index + 1, 8) + " : " + strTimeStanp ); | ||
|  | ||
|  | ||
| } | ||
| } | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
| } | 
| @@ -0,0 +1,388 @@ | ||
| /* | ||
| * @(#)MessageInfoGetter.java | ||
| * | ||
| * Copyright (c) 2014, NTT DATA Getronics Corporation. | ||
| */ | ||
| package jp.co.nttdg.bfep.stp.bean.hub; | ||
|  | ||
| import java.io.ByteArrayInputStream; | ||
| import java.nio.charset.Charset; | ||
| import java.util.LinkedHashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|  | ||
| import javax.xml.parsers.DocumentBuilder; | ||
| import javax.xml.parsers.DocumentBuilderFactory; | ||
| import javax.xml.xpath.XPath; | ||
| import javax.xml.xpath.XPathExpression; | ||
| import javax.xml.xpath.XPathFactory; | ||
|  | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpException; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLogger; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLoggerFactory; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpMain; | ||
|  | ||
| import org.apache.camel.Exchange; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.w3c.dom.Document; | ||
|  | ||
| /** | ||
| * 電文情報取得Bean | ||
| * | ||
| * @author h_tozawa | ||
| * @version 1.0 | ||
| * | ||
| */ | ||
| public class MessageInfoGetter { | ||
|  | ||
| /** トレースロガー */ | ||
| private static final Logger logger = LoggerFactory | ||
| .getLogger(MessageInfoGetter.class); | ||
|  | ||
| /** B-FEP STPロガー */ | ||
| private static final BfepStpLogger stplogger = BfepStpLoggerFactory | ||
| .getLogger(MessageInfoGetter.class); | ||
|  | ||
| /** XPath状態フラグ */ | ||
| private final boolean isXPath; | ||
|  | ||
| /** 電文情報取得クラスマップ */ | ||
| private Map<String, BaseMessageInfo> baseMmessageInfoMap = new LinkedHashMap<String, BaseMessageInfo>(); | ||
|  | ||
| /** | ||
| * コンストラクタ | ||
| * | ||
| * @param messageInfoList | ||
| * 取得情報リスト<BR> | ||
| * @throws BfepStpException | ||
| * STPソリューション固有例外<BR> | ||
| */ | ||
| public MessageInfoGetter(List<String> messageInfoList) | ||
| throws BfepStpException { | ||
|  | ||
| isXPath = this.setMessageInfo(messageInfoList, null); | ||
| } | ||
|  | ||
| /** | ||
| * コンストラクタ | ||
| * | ||
| * @param encode | ||
| * 文字コード<BR> | ||
| * @param messageInfoList | ||
| * 取得情報リスト<BR> | ||
| * @throws BfepStpException | ||
| * STPソリューション固有例外<BR> | ||
| */ | ||
| public MessageInfoGetter(String encode, List<String> messageInfoList) | ||
| throws BfepStpException { | ||
|  | ||
| Charset charSet = null; | ||
|  | ||
| try { | ||
| charSet = Charset.forName(encode); | ||
|  | ||
| } catch (Exception e) { | ||
|  | ||
| logger.error("文字コード不正", e); | ||
| stplogger.log(2052, encode, e.getMessage()); | ||
| throw new BfepStpException(e.getMessage(), e); | ||
|  | ||
| } | ||
|  | ||
| isXPath = this.setMessageInfo(messageInfoList, charSet); | ||
| } | ||
|  | ||
| /** | ||
| * 電文情報を Exchange のheader部に格納する | ||
| * | ||
| * @param exchange | ||
| * 処理対象の Exchange<BR> | ||
| * @throws BfepStpException | ||
| * STPソリューション固有例外<BR> | ||
| */ | ||
| public void process(Exchange exchange) throws BfepStpException { | ||
|  | ||
| // 電文情報初期化 | ||
| for (String key : baseMmessageInfoMap.keySet()) { | ||
|  | ||
| exchange.getIn().setHeader(key, ""); | ||
| } | ||
|  | ||
| Object telegram = exchange.getIn().getBody(); | ||
|  | ||
| // XPathの場合 | ||
| boolean isXPathError = false; | ||
| if (isXPath) { | ||
| try { | ||
| DocumentBuilderFactory factory = DocumentBuilderFactory | ||
| .newInstance(); | ||
| factory.setNamespaceAware(false); | ||
| factory.setValidating(true); | ||
| DocumentBuilder builder = factory.newDocumentBuilder(); | ||
| telegram = builder.parse(new ByteArrayInputStream( | ||
| (byte[]) telegram)); | ||
| } catch (Exception e) { | ||
|  | ||
| logger.error("DOM変換失敗", e); | ||
| stplogger.routeLog(2053, exchange, e.getMessage()); | ||
| isXPathError = true; | ||
| } | ||
| } | ||
|  | ||
| // 電文情報取得 | ||
| for (String key : baseMmessageInfoMap.keySet()) { | ||
|  | ||
| String value = null; | ||
| try { | ||
| value = baseMmessageInfoMap.get(key) | ||
| .getValue((Object) telegram); | ||
| } catch (Exception e) { | ||
|  | ||
| if (!isXPathError) { | ||
| logger.error("電文情報取得失敗", e); | ||
| stplogger.routeLog(2054, exchange, key, e.getMessage()); | ||
| } | ||
| value = ""; | ||
| } | ||
|  | ||
| exchange.getIn().setHeader(key, value); | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * 電文情報設定 | ||
| * | ||
| * @param messageInfoList | ||
| * 取得情報リスト<BR> | ||
| * @param charSet | ||
| * キャラセット<BR> | ||
| * @throws BfepStpException | ||
| * STPソリューション固有例外<BR> | ||
| */ | ||
| private boolean setMessageInfo(List<String> messageInfoList, Charset charSet) | ||
| throws BfepStpException { | ||
|  | ||
| int xPathNum = 0; | ||
| for (int index = 0; index < messageInfoList.size(); index++) { | ||
|  | ||
| String[] messageInfoArray = null; | ||
| int pattern = -1; | ||
| try { | ||
|  | ||
| messageInfoArray = messageInfoList.get(index).split("\\|", 3); | ||
| if (messageInfoArray.length != 3) { | ||
| stplogger.log(2050, index, messageInfoList.get(index)); | ||
| throw new BfepStpException(); | ||
| } | ||
|  | ||
| pattern = Integer.valueOf(messageInfoArray[0]); | ||
| if (charSet == null) { | ||
|  | ||
| // 種別が固定長 | ||
| if (pattern == 2) { | ||
| stplogger.log(2050, index, messageInfoList.get(index)); | ||
| throw new BfepStpException(); | ||
| } | ||
| } else { | ||
|  | ||
| // 種別がXPath | ||
| if (pattern == 1) { | ||
| stplogger.log(2050, index, messageInfoList.get(index)); | ||
| throw new BfepStpException(); | ||
| } | ||
| } | ||
|  | ||
| // 重複チェック(パラメータ(Key)がすでに存在している) | ||
| if (this.baseMmessageInfoMap.containsKey(messageInfoArray[1])) { | ||
| stplogger.log(2050, index, messageInfoList.get(index)); | ||
| throw new BfepStpException(); | ||
| } | ||
|  | ||
| // 種別ごとに、情報取得取クラスのインスタンスをセットする | ||
| switch (pattern) { | ||
| case 0: | ||
|  | ||
| baseMmessageInfoMap.put(messageInfoArray[1], | ||
| new FixedValueMessageInfo(messageInfoArray[2])); | ||
| break; | ||
|  | ||
| case 1: | ||
|  | ||
| baseMmessageInfoMap.put(messageInfoArray[1], | ||
| new XPathMessageInfo(messageInfoArray[2])); | ||
| xPathNum++; | ||
| break; | ||
|  | ||
| case 2: | ||
|  | ||
| baseMmessageInfoMap.put(messageInfoArray[1], | ||
| new FixedLengthMessageInfo(messageInfoArray[2], | ||
| charSet)); | ||
| break; | ||
| default: | ||
| stplogger.log(2050, index, messageInfoList.get(index)); | ||
| throw new BfepStpException(); | ||
| } | ||
| } catch (BfepStpException be) { | ||
| throw be; | ||
| } catch (Exception e) { | ||
|  | ||
| logger.error("電文情報設定失敗", e); | ||
| stplogger.log(2051, index, messageInfoList.get(index), | ||
| e.getMessage()); | ||
| throw new BfepStpException(e.getMessage(), e); | ||
| } | ||
| } | ||
|  | ||
| return xPathNum == 0 ? false : true; | ||
| } | ||
|  | ||
| /** | ||
| * インナークラス 情報取得基底クラス | ||
| * | ||
| */ | ||
| abstract class BaseMessageInfo { | ||
|  | ||
| /** | ||
| * 電文情報取得 | ||
| * | ||
| * @param data | ||
| * データ<BR> | ||
| * @return 電文情報<BR> | ||
| * @throws Exception | ||
| * 基底例外<BR> | ||
| */ | ||
| public abstract String getValue(Object data) throws Exception; | ||
| } | ||
|  | ||
| /** インナークラス 固定値情報取得基底クラス */ | ||
| class FixedValueMessageInfo extends BaseMessageInfo { | ||
|  | ||
| /** 固定値 */ | ||
| private String fixedValue; | ||
|  | ||
| /** | ||
| * コンストラクタ | ||
| * | ||
| * @param value | ||
| * 値<BR> | ||
| */ | ||
| public FixedValueMessageInfo(String value) { | ||
|  | ||
| this.fixedValue = value; | ||
| } | ||
|  | ||
| /** 固定値電文情報取得 */ | ||
| @Override | ||
| public String getValue(Object data) throws BfepStpException { | ||
|  | ||
| return this.fixedValue; | ||
| } | ||
| } | ||
|  | ||
| /** インナークラス XPath情報取得基底クラス */ | ||
| class XPathMessageInfo extends BaseMessageInfo { | ||
|  | ||
| /** コンパイル済み XPath式 */ | ||
| XPathExpression expression; | ||
|  | ||
| /** | ||
| * コンストラクタ | ||
| * | ||
| * @param value | ||
| * 値<BR> | ||
| * @throws Exception | ||
| * 基底例外<BR> | ||
| */ | ||
| public XPathMessageInfo(String value) throws Exception { | ||
|  | ||
| // 渡された値をコンパイルしてメンバに保持 | ||
| String factoryClassName = System.getProperty( | ||
| BfepStpMain.XPATH_FACTORY_PROPERTY_NAME, ""); | ||
| XPathFactory factory; | ||
| factory = XPathFactory.newInstance( | ||
| XPathFactory.DEFAULT_OBJECT_MODEL_URI, factoryClassName, | ||
| null); | ||
| XPath xpath = factory.newXPath(); | ||
| this.expression = xpath.compile(value); | ||
| } | ||
|  | ||
| /** | ||
| * XPath電文情報取得 | ||
| * | ||
| * @return XPath式<BR> | ||
| * @throws Exception | ||
| * 基底例外<BR> | ||
| */ | ||
| @Override | ||
| public String getValue(Object data) throws Exception { | ||
|  | ||
| return expression.evaluate((Document) data); | ||
| } | ||
| } | ||
|  | ||
| /** インナークラス 固定長情報取得基底クラス */ | ||
| class FixedLengthMessageInfo extends BaseMessageInfo { | ||
|  | ||
| /** オフセット */ | ||
| private int offset; | ||
|  | ||
| /** レングス */ | ||
| private int length; | ||
|  | ||
| /** 文字コード */ | ||
| private Charset charSet = null; | ||
|  | ||
| /** | ||
| * コンストラクタ | ||
| * | ||
| * @param value | ||
| * 値 | ||
| * @param charSet | ||
| * 文字コード | ||
| * @throws Exception | ||
| * 基底例外<BR> | ||
| */ | ||
| public FixedLengthMessageInfo(String value, Charset charSet) | ||
| throws Exception { | ||
|  | ||
| String[] valueArray = value.split(","); | ||
|  | ||
| // 値を2つに分割できないとき | ||
| if (valueArray.length != 2) { | ||
| throw new Exception(); | ||
| } | ||
|  | ||
| // 数値型に変換 | ||
| int[] itemArray = new int[valueArray.length]; | ||
| for (int i = 0; i < valueArray.length; i++) { | ||
|  | ||
| // NumberFormatExceptionはそのまま例外が投げられる | ||
| itemArray[i] = Integer.valueOf(valueArray[i]); | ||
| if (itemArray[i] < 0) { | ||
| // 値が負の整数のとき | ||
| throw new Exception(); | ||
| } | ||
| } | ||
| // それそれメンバに格納 | ||
| this.offset = itemArray[0]; | ||
| this.length = itemArray[1]; | ||
|  | ||
| // 文字コードをメンバに格納 | ||
| this.charSet = charSet; | ||
| } | ||
|  | ||
| /** | ||
| * 固定長電文情報取得 | ||
| * | ||
| * @throws Exception | ||
| * 基底例外<BR> | ||
| */ | ||
| @Override | ||
| public String getValue(Object data) throws Exception { | ||
| return new String((byte[]) data, this.offset, this.length, | ||
| this.charSet); | ||
| } | ||
| } | ||
| } | 
| @@ -0,0 +1,396 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.co.profitcube.eacris.report.attribute.judgement.normalization; | ||
|  | ||
| import java.io.UnsupportedEncodingException; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|  | ||
|  | ||
| /** | ||
| * @author tozawa_h01 | ||
| * | ||
| */ | ||
| public class NormalizeUtil { | ||
|  | ||
|  | ||
| /** | ||
| * 法人名略称の略称の16進数文字列配列 | ||
| */ | ||
| private final static String[] corporateNameAbbreviationArray = new String[] { | ||
| "3231","3232","3233","3234","3235","3236","3237","3238","3239","323a","323b","323c","323d","323e","323f","3240", | ||
| "3241","3242","3243", | ||
|  | ||
| "3291","3292","3293","3294","3295","3296","3297","3298","3299","329A","329B","329C","329D","329E","329F","32A0", | ||
| "32A1","32A2","32A3","32A4","32A5","32A6","32A7","32A8","32A9","32AA","32AB","32AC","32AD","32AE","32AF", | ||
| "337D" | ||
| }; | ||
|  | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| public NormalizeUtil() { | ||
| } | ||
|  | ||
| public void normalize(InputData inputData) { | ||
| } | ||
|  | ||
|  | ||
|  | ||
| /** | ||
| * 文字を文字リストに配置します。この時文字が規定のUTF-8コードリストに存在すれば、配置されない。 | ||
| * @param charList 配置される | ||
| * @param character | ||
| * @param hexCode | ||
| */ | ||
| public static void placeCharacterList(List<Character> charList, char character, String hex) { | ||
|  | ||
| int code = (int)character; | ||
| String hexCode = Integer.toHexString(code); | ||
|  | ||
| if(hex.equals(hexCode.toUpperCase())) { | ||
| charList.add(character); | ||
| } | ||
|  | ||
| } | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
| /** | ||
| * 文字を文字リストに再配置します。この時文字が規定のUTF-8コードリストに存在すれば、配置されない。 | ||
| * @param charList 再配置される | ||
| * @param character | ||
| * @param hexCode | ||
| */ | ||
| public static void placeCharacterList(List<Character> charList, char character) { | ||
|  | ||
| int code = (int)character; | ||
| String hexCode = Integer.toHexString(code); | ||
|  | ||
|  | ||
| boolean flag = false; | ||
| for(String hex : corporateNameAbbreviationArray){ | ||
| if(hex.equals(hexCode.toUpperCase())) { | ||
| flag = true; | ||
| } | ||
| } | ||
| if(!flag){ | ||
| charList.add(character); | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * char Listを文字列に変換します。 | ||
| * @param charList 対象のリスト | ||
| * @return String 変換後の文字列 | ||
| * @throws Exception | ||
| */ | ||
| public static String stringToCharacterList(ArrayList<Character> charList) throws Exception{ | ||
|  | ||
| char[] newCharaArray = new char[charList.size()]; | ||
|  | ||
| for(int index = 0 ; index < charList.size() ; index++){ | ||
| newCharaArray[index] = charList.get(index); | ||
| } | ||
| return String.valueOf(newCharaArray); | ||
| } | ||
|  | ||
|  | ||
| /** | ||
| * char Listを文字列に変換します。 | ||
| * @param charList 対象のリスト | ||
| * @return String 変換後の文字列 | ||
| * @throws Exception | ||
| */ | ||
| public static String stringToCharacterList(List<Character> charList) throws Exception{ | ||
|  | ||
| char[] newCharaArray = new char[charList.size()]; | ||
|  | ||
| for(int index = 0 ; index < charList.size() ; index++){ | ||
| newCharaArray[index] = charList.get(index); | ||
| } | ||
| return String.valueOf(newCharaArray); | ||
| } | ||
|  | ||
| // 正規化部品 | ||
| /** | ||
| * 半角・全角トリム | ||
| * @param targetStr | ||
| * @return | ||
| */ | ||
| public static String trimSpace(String targetStr) { | ||
| char[] value = targetStr.toCharArray(); | ||
| int len = value.length; | ||
| int st = 0; | ||
| char[] val = value; | ||
|  | ||
| while ((st < len) && (val[st] <= ' ' || val[st] == ' ')) { | ||
| st++; | ||
| } | ||
| while ((st < len) && (val[len - 1] <= ' ' || val[len - 1] == ' ')) { | ||
| len--; | ||
| } | ||
|  | ||
| return ((st>0) || (len<value.length)) ? targetStr.substring(st,len):targetStr; | ||
| } | ||
|  | ||
|  | ||
| /** | ||
| * 数値に変換可能な文字を変換する。 | ||
| * 数値に変換できない文字列は0に変換される | ||
| * | ||
| * @param str 数値変換したい文字列 | ||
| * @return long 変換された数値 | ||
| */ | ||
| public static long getNumerical(String str) { | ||
| long ret = -1; | ||
| try { | ||
| ret = Long.parseLong(str); | ||
| } catch (NumberFormatException e) { | ||
| ret = 0; | ||
| } | ||
| return ret; | ||
| } | ||
|  | ||
|  | ||
| /** | ||
| * 文字の全角と半角を判定して半角であれば正を返す | ||
| * | ||
| * @param targetString 調べたい文字列 | ||
| * @return boolean 結果 | ||
| */ | ||
| public static boolean isSingleByte(String targetString) { | ||
| // 取得した文字サイズの計算 | ||
| int strSize = targetString.length(); | ||
| int byteSize = targetString.getBytes().length; | ||
|  | ||
| // 文字数とバイト数が同じ→半角 | ||
| if (strSize == byteSize) { | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|  | ||
| /** | ||
| * 文字列のバイト数を取得 | ||
| * @param str 調べたい文字列 | ||
| * @param encode 文字タイプ | ||
| * @return Byte数 | ||
| */ | ||
| public static int getTextByteLenght(String str, String encode) { | ||
| int nLen; | ||
| try { | ||
| if (encode != null) { | ||
| nLen = str.getBytes(encode).length; | ||
|  | ||
| } else { | ||
| nLen = str.getBytes().length; | ||
| } | ||
|  | ||
| } catch (UnsupportedEncodingException e) { | ||
| nLen = str.getBytes().length; | ||
| } | ||
| return nLen; | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * | ||
| * 漢数字を全角数字に変換します。 | ||
| * | ||
| * @param chinaNum 変換したい漢数字 | ||
| * @return long 変換した値 | ||
| */ | ||
| public static String chinaNumToArabicNum(String chinaNum) { | ||
|  | ||
| long retNum = 0; | ||
|  | ||
| int maxSize = chinaNum.length(); | ||
|  | ||
| String calValue = new String(chinaNum); | ||
| int count = 0; | ||
| for (int i = 0; i < maxSize; i++) { | ||
|  | ||
| if (getNum(chinaNum.substring(i, i + 1)) != -1) { | ||
|  | ||
| calValue = chinaNum.substring(count, maxSize); | ||
| break; | ||
| } else { | ||
| count++; | ||
| } | ||
| } | ||
|  | ||
| String spritChinaNum[] = new String[3]; | ||
|  | ||
| ArrayList<String> list = new ArrayList<>(); | ||
|  | ||
| list.add("百"); | ||
| list.add("十"); | ||
|  | ||
| for (int i = 0; i < 2; i++) { | ||
| if (calValue.indexOf(list.get(i)) > -1) { | ||
|  | ||
| spritChinaNum[i] = calValue.substring(0, | ||
| calValue.indexOf(list.get(i)) + 1); | ||
| if (spritChinaNum[i].equals(list.get(i))) { | ||
| spritChinaNum[i] = "一" + spritChinaNum[i]; | ||
| } | ||
| calValue = calValue.substring(calValue.indexOf(list.get(i)) + 1, calValue.length()); | ||
| } else { | ||
| spritChinaNum[i] = "零"; | ||
| } | ||
| } | ||
|  | ||
| spritChinaNum[2] = calValue; | ||
|  | ||
| long hundredsPlaceArray[] = { 0, 0 }; | ||
| long tensPlaceArray[] = { 0, 0 }; | ||
|  | ||
| for (String num : spritChinaNum) { | ||
|  | ||
| if (num.matches(".*" + list.get(0) + ".*")) { | ||
| for (int i = 0; i < num.length(); i++) { | ||
| // 100の位 | ||
| hundredsPlaceArray[i] = getNum(num.substring(i, i + 1)); | ||
| } | ||
| } | ||
|  | ||
| if (num.matches(".*" + list.get(1) + ".*")) { | ||
| for (int i = 0; i < num.length(); i++) { | ||
| // 10の位 | ||
| tensPlaceArray[i] = getNum(num.substring(i, i + 1)); | ||
| } | ||
| } | ||
| } | ||
|  | ||
| long hundredsPlace = 0; | ||
| long tensPlace = 0; | ||
| long onesPlace = 0; | ||
|  | ||
| hundredsPlace = Math.abs(hundredsPlaceArray[0] * hundredsPlaceArray[1]); | ||
| tensPlace = Math.abs(tensPlaceArray[0] * tensPlaceArray[1]); | ||
|  | ||
| for (int i = 0; i < calValue.length(); i++) { | ||
| if (i == 0) { | ||
| if (calValue.length() >= 3) { | ||
| onesPlace += getNum(calValue.substring(i, i + 1)) * 100; | ||
| } else if (calValue.length() == 2) { | ||
| onesPlace += getNum(calValue.substring(i, i + 1)) * 10; | ||
| } else { | ||
| onesPlace += getNum(calValue); | ||
| } | ||
| } else if (i == 1) { | ||
| if (calValue.length() >= 3) { | ||
| onesPlace += getNum(calValue.substring(i, i + 1)) * 10; | ||
| } else { | ||
| onesPlace += getNum(calValue); | ||
| } | ||
| } else if (i == 2) { | ||
| onesPlace += getNum(calValue); | ||
| } | ||
| } | ||
| retNum = hundredsPlace + tensPlace + onesPlace; | ||
|  | ||
| //半角数字を全角数字にする。 | ||
| String ret = convertMultiByteNum(retNum); | ||
| return ret; | ||
| } | ||
|  | ||
|  | ||
| /** | ||
| * 漢数字を数値に変換する。 | ||
| * @param targetNum 対象とする漢数字 | ||
| * @return long 変換した数値 | ||
| */ | ||
| public static long getNum(String targetNum) { | ||
|  | ||
| long num = 0L; | ||
| // 漢数字を数値化する。 | ||
| for (int i = 0; i < targetNum.length(); i++) { | ||
| char cBuf = targetNum.charAt(i); | ||
| switch (cBuf) { | ||
| case '零': | ||
| num = 0; | ||
| break; | ||
|  | ||
| case '壱': | ||
| case '一': | ||
| num = 1; | ||
| break; | ||
|  | ||
| case '弐': | ||
| case '二': | ||
| num = 2; | ||
| break; | ||
|  | ||
| case '参': | ||
| case '三': | ||
| num = 3; | ||
| break; | ||
|  | ||
| case '四': | ||
| num = 4; | ||
| break; | ||
|  | ||
| case '五': | ||
| num = 5; | ||
| break; | ||
|  | ||
| case '六': | ||
| num = 6; | ||
| break; | ||
|  | ||
| case '七': | ||
| num = 7; | ||
| break; | ||
|  | ||
| case '八': | ||
| num = 8; | ||
| break; | ||
|  | ||
| case '九': | ||
| num = 9; | ||
| break; | ||
|  | ||
| case '十': | ||
| num = 10; | ||
| break; | ||
|  | ||
| case '百': | ||
| num = 100; | ||
| break; | ||
|  | ||
| default: | ||
| num = -1; | ||
| break; | ||
| } | ||
|  | ||
| } | ||
| return num; | ||
| } | ||
|  | ||
| /** | ||
| * 半角数字を全角数字にする。 | ||
| * @param longTergetNum 対象とする数字 | ||
| * @return String 変換した全角数字 | ||
| */ | ||
| public static String convertMultiByteNum(long longTergetNum) { | ||
|  | ||
| String strInNum = Long.toString(longTergetNum); | ||
| StringBuffer strBuf = new StringBuffer(strInNum); | ||
| for (int i = 0; i < strBuf.length(); i++) { | ||
| char cBuf = strBuf.charAt(i); | ||
| if ( cBuf >= '0' && cBuf <= '9' ) { | ||
| strBuf.setCharAt(i, (char) (cBuf - '0' + '0')); | ||
| } | ||
| } | ||
| return strBuf.toString(); | ||
| } | ||
|  | ||
| } | 
| @@ -0,0 +1,30 @@ | ||
| package com.smbc.jimuwf.saimu.jisutil.commonstatuscheck.ap; | ||
|  | ||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
|  | ||
| public class NotStatusCheck extends StatusCheckChain { | ||
| private List<String> successList = new ArrayList<String>(); | ||
|  | ||
| private String msgId = null; | ||
|  | ||
| public NotStatusCheck(String msgId, String... statuses) { | ||
|  | ||
| this.msgId = msgId; | ||
| successList = Arrays.asList(statuses); | ||
| } | ||
|  | ||
| @Override | ||
| protected void privateCheck(WorkFlowInfo data) throws CheckException { | ||
|  | ||
| // 回付先ステータスが等しい(リストに含まる) | ||
| if (successList.contains(data.getStatus())) { | ||
| CheckException err = new CheckException(this.msgId); | ||
| err.setUmekomiMoji(data.getUketuke_NO(), data.getStatusNM()); | ||
| err.setWorkFrowInfo(data); | ||
|  | ||
| throw err; | ||
| } | ||
| } | ||
| } | 
| @@ -0,0 +1,84 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.console.main; | ||
|  | ||
| import java.util.ArrayList; | ||
|  | ||
| /** | ||
| * @author tozawa_h01 | ||
| * | ||
| */ | ||
| public class Numr0n { | ||
|  | ||
|  | ||
| private int countEAT_ = 0; | ||
|  | ||
| private int countBITE_ = 0; | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| public Numr0n() { | ||
| } | ||
| public Numr0n(String myself, String opponent) { | ||
|  | ||
| judge(myself, opponent); | ||
| } | ||
|  | ||
|  | ||
| private void judge(String myself, String opponent){ | ||
|  | ||
| char[] myCharArray = myself.toCharArray(); | ||
| char[] opCharArray = opponent.toCharArray(); | ||
|  | ||
| ArrayList<Character> myTempList = new ArrayList<Character>(); | ||
| ArrayList<Character> opTempList = new ArrayList<Character>(); | ||
|  | ||
|  | ||
| int countEAT = 0; | ||
| int countBITE = 0; | ||
| if(myCharArray.length == opCharArray.length){ | ||
|  | ||
| // EAT Check | ||
| for(int index = 0 ; index < myCharArray.length ; index++ ) { | ||
| if(myCharArray[index] == opCharArray[index]){ | ||
| countEAT++; | ||
| } else { | ||
| myTempList.add(myCharArray[index]); | ||
| opTempList.add(opCharArray[index]); | ||
| } | ||
| } | ||
| countEAT_ = countEAT; | ||
|  | ||
| // BITE Check | ||
| for(int indexA = 0 ; indexA < myTempList.size() ; indexA++) { | ||
|  | ||
| for(int indexB = 0 ; indexB < opTempList.size() ; indexB++) { | ||
|  | ||
| if(myTempList.get(indexA) == opTempList.get(indexB)){ | ||
| countBITE++; | ||
| } | ||
| } | ||
| } | ||
| countBITE_ = countBITE; | ||
| } | ||
| } | ||
|  | ||
|  | ||
| /** | ||
| * @return countEAT_ | ||
| */ | ||
| public int getEAT() { | ||
| return countEAT_; | ||
| } | ||
| /** | ||
| * @return countBITE_ | ||
| */ | ||
| public int getBITE() { | ||
| return countBITE_; | ||
| } | ||
|  | ||
|  | ||
|  | ||
| } | 
| @@ -0,0 +1,251 @@ | ||
| package jp.co.core.ddm.pack.sbti.localMain; | ||
|  | ||
| import java.text.SimpleDateFormat; | ||
| import java.util.ArrayList; | ||
| import java.util.Date; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|  | ||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | ||
|  | ||
| import jp.co.core.ddm.pack.sbti.excel.poi.data.DetailsData; | ||
| import jp.co.core.ddm.pack.sbti.excel.poi.data.HeaderData; | ||
| import jp.co.core.ddm.pack.sbti.excel.poi.data.ReportData; | ||
| import jp.co.core.ddm.pack.sbti.excel.poi.dto.Scr0005Dto; | ||
| import jp.co.core.ddm.pack.sbti.excel.poi.dto.Scr0005ItemDto; | ||
| import jp.co.core.ddm.pack.sbti.logic.StaticsOPILogic; | ||
|  | ||
|  | ||
| public class OpiSample { | ||
|  | ||
| /** | ||
| * @param args | ||
| * @throws Exception | ||
| */ | ||
| public static void main(String[] args) throws Exception { | ||
|  | ||
|  | ||
| StaticsOPILogic poiLogic = new StaticsOPILogic(); | ||
|  | ||
| //String input = "C:/local/inout/inputSalesList.xlsx"; | ||
| //String otput = "C:/local/inout/outputSalesList.xlsx"; | ||
|  | ||
| String input = "C:/local/inout/○○組_テンプレート.xlsx"; | ||
|  | ||
|  | ||
| StringBuffer sb = new StringBuffer("C:/local/inout/○○組_"); | ||
|  | ||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); | ||
|  | ||
| sb.append(sdf.format(new Date())); | ||
| sb.append(".xlsx"); | ||
| String otput = sb.toString(); | ||
|  | ||
| // Excel形式チェック(必須ではない) | ||
| if (!poiLogic.isExistExcelFile(input)) { | ||
| System.out.println("error of inputFile"); | ||
| System.exit(1); | ||
| } | ||
|  | ||
| // Excel形式チェック(必須ではない) | ||
| if (!poiLogic.isExcelFile(otput)) { | ||
| System.out.println("error of outputFile"); | ||
| System.exit(1); | ||
| } | ||
|  | ||
| // ワークブック生成 | ||
| XSSFWorkbook wb = poiLogic.getWorkbook(input); | ||
| // データ生成 | ||
| List<ReportData> dataList = new ArrayList<ReportData>(); | ||
|  | ||
| // データベースから直接取得したり、加工したり、 | ||
| Scr0005Dto dto = new Scr0005Dto(); | ||
|  | ||
| // ヘッダ部 | ||
| dto.organizationName = "○○組"; | ||
|  | ||
|  | ||
| // 明細部分の取得 | ||
| List<Scr0005ItemDto> listData = new ArrayList<Scr0005ItemDto>(); | ||
|  | ||
| // | ||
| dto.itemList = listData; | ||
|  | ||
| dataList.add(setData(dto)); | ||
| // create controller | ||
| XSSFWorkbook newWorkBook = poiLogic.create(wb, dataList); | ||
| // データを設定してExcelファイルの出力 | ||
| poiLogic.write(newWorkBook, otput); | ||
| } | ||
|  | ||
| /** | ||
| * | ||
| * @return 出力データ設定 | ||
| */ | ||
| private static ReportData setData(Scr0005Dto reportDto) { | ||
|  | ||
| ReportData dataContainer = new ReportData(); | ||
|  | ||
| HeaderData header = new HeaderData(); | ||
| // header.setReportName("SalesList"); | ||
| header.setReportName("OrganizationList"); | ||
| Map<String, String> dataMap = header.getDataMap(); | ||
|  | ||
| // ヘッダー部編集 | ||
| // dataMap.put("$OUTPUT_DATE", sdf.format(new Date())); | ||
| // dataMap.put("$PERIOD", "2010年4月"); | ||
| // dataMap.put("$TOTAL_SALES", "780,000"); | ||
|  | ||
| dataMap.put("$ORGANIZATION_NAME", reportDto.organizationName); | ||
| dataMap.put("$ORG_CODE", "00023"); | ||
| dataMap.put("$OFFICE_LOCATE_ADD", "滋賀県大津市坂本本町"); | ||
| dataMap.put("$JURISDICTION_NAME", "浦和署"); | ||
| dataContainer.setHeader(header); | ||
|  | ||
| DetailsData details = new DetailsData(); | ||
| Map<String, Object[]> dataListMap = details.getDataListMap(); | ||
|  | ||
| // TODO | ||
| // 明細行(縦方向にデータを設定) | ||
| // 明細部分取得 | ||
| List<Scr0005ItemDto> itemList = reportDto.itemList; | ||
|  | ||
| Integer[] numArray = new Integer[itemList.size()]; | ||
| String[] orgPosition1NameArry = new String[itemList.size()]; | ||
| String[] orgPosition2NameArry = new String[itemList.size()]; | ||
|  | ||
| String[] orgPosition3NameArry = new String[itemList.size()]; | ||
| String[] orgPosition4NameArry = new String[itemList.size()]; | ||
| String[] orgPosition5NameArry = new String[itemList.size()]; | ||
|  | ||
|  | ||
|  | ||
|  | ||
| for(int index = 0 ; index < itemList.size() ; index++){ | ||
| numArray[index] = index + 1; | ||
| orgPosition1NameArry[index] = itemList.get(index).orgPosition1Name; | ||
| orgPosition2NameArry[index] = itemList.get(index).orgPosition2Name; | ||
| orgPosition3NameArry[index] = itemList.get(index).orgPosition3Name; | ||
| orgPosition4NameArry[index] = itemList.get(index).orgPosition4Name; | ||
| orgPosition5NameArry[index] = itemList.get(index).orgPosition5Name; | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
| } | ||
| // TODO | ||
|  | ||
|  | ||
|  | ||
| dataListMap.put("$NUMBER[]", new Integer[] { 1, 2, 3, 4 }); | ||
| dataListMap.put("$NUMBER[]", new Integer[] { 1, 2, 3, 4 }); | ||
|  | ||
|  | ||
|  | ||
| dataListMap.put("$ORG_POSITION1_NAME[]", new String[] { "ああああ(ああああ)", "あああい(ああああ)", | ||
| "あああう(ああああ)", "あああえ(ああああ)" }); | ||
| dataListMap.put("$ORG_POSITION2_NAME[]", new String[] { "いあああ(ああああ)", "いああい(ああああ)", | ||
| "いああう(ああああ)", "いああえ(ああああ)" }); | ||
| dataListMap.put("$ORG_POSITION3_NAME[]", new String[] { "うあああ(ああああ)", "うああい(ああああ)", | ||
| "うああう(ああああ)", "うああえ(ああああ)" }); | ||
| dataListMap.put("$ORG_POSITION4_NAME[]", new String[] { "えあああ(ああああ)", "えああい(ああああ)", | ||
| "えああう(ああああ)", "えああえ(ああああ)" }); | ||
| dataListMap.put("$ORG_POSITION5_NAME[]", new String[] { "おあああ(ああああ)", "おああい(ああああ)", | ||
| "おああう(ああああ)", "おああえ(ああああ)" }); | ||
| dataListMap.put("$EXECUTIVE[]", new String[] { "○", "","", "" }); | ||
| dataListMap.put("$PERSONAL_NUMBER[]", new String[] { "99-99-99990", "99-99-99991","99-99-99992", "99-99-99993" }); | ||
| dataListMap.put("$NAME[]", new String[] { "ああああああああああ金剛", "ああああああああああ比叡", | ||
| "ああああああああああ榛名", "ああああああああああ霧島" }); | ||
| dataListMap.put("$RUBY[]", new String[] { "アアアアアアアアアアアア", "イアアアアアアアアアアア", | ||
| "ウアアアアアアアアアアア", "エアアアアアアアアアアア" }); | ||
| dataListMap.put("$BIRTHDAY[]", new String[] { "2000/12/31", "2005/12/31","2010/12/31", "2015/12/31" }); | ||
| dataListMap.put("$RESPONSIBILITY[]", new String[] { "埼玉県", "埼玉県","埼玉県", "埼玉県" }); | ||
| dataListMap.put("$MATERIAL_POSITIVE[]", new String[] { "○", "○","○", "○" }); | ||
| dataListMap.put("$MATERIAL_NEGATIVE[]", new String[] { "○", "○","○", "○" }); | ||
| dataListMap.put("$CROSS_FINGER[]", new String[] { "○", "○","○", "○" }); | ||
| dataListMap.put("$TATTOO[]", new String[] { "○", "○","○", "○" }); | ||
| dataListMap.put("$SOCIAL_POSITION[]", new String[] { "○", "○","○", "○" }); | ||
| dataListMap.put("$DOMICILE[]", new String[] { "埼玉県さいたま市浦和区高砂3-15-1", | ||
| "埼玉県さいたま市浦和区高砂3-15-2", | ||
| "埼玉県さいたま市浦和区高砂3-15-3", | ||
| "埼玉県さいたま市浦和区高砂3-15-4" }); | ||
| dataListMap.put("$ADDRESS[]", new String[] { "埼玉県さいたま市浦和区高砂3-25-1", | ||
| "埼玉県さいたま市浦和区高砂3-25-2", | ||
| "埼玉県さいたま市浦和区高砂3-25-3", | ||
| "埼玉県さいたま市浦和区高砂3-25-4" }); | ||
| dataListMap.put("$RESIDENCE[]", new String[] { "埼玉県さいたま市浦和区高砂3-35-1", | ||
| "埼玉県さいたま市浦和区高砂3-35-2", | ||
| "埼玉県さいたま市浦和区高砂3-35-3", | ||
| "埼玉県さいたま市浦和区高砂3-35-4" }); | ||
| dataListMap.put("$OFFENSE[]", new String[] { "道路交通法違反", "恫喝","薬物取り扱い法違反", "銃刀法違反" }); | ||
| dataListMap.put("$FIXED_DATE[]", new String[] { "2000/12/31", "2005/12/31","2010/12/31", "2015/12/31" }); | ||
| dataListMap.put("$DISPOSAL_RESULT[]", new String[] { "ああああああああああああああああああああああああああああ", | ||
| "いあああああああああああああああああああああああああああ", | ||
| "うあああああああああああああああああああああああああああ", | ||
| "えあああああああああああああああああああああああああああ" }); | ||
|  | ||
| dataListMap.put("$VALIDITY_PERIOD[]", new String[] { "2000/12/31", "2005/12/31","2010/12/31", "2015/12/31" }); | ||
| dataListMap.put("$ARREST[]", new Integer[] { 900, 800,700,999 }); | ||
| dataListMap.put("$INSTRUCTION[]", new Integer[] { 600, 500,400,99 }); | ||
| dataListMap.put("$RECURRENCE[]", new Integer[] { 30, 20,10,0 }); | ||
|  | ||
| dataListMap.put("$REMARKS[]", new String[] { "鬼嫁", "鬼神","鬼才", "鬼怒" }); | ||
|  | ||
|  | ||
|  | ||
|  | ||
| // dataListMap.put("$SALES_NO[]", new String[] { "S0000001", "S0000002", | ||
| // "S0000003", "S0000004", "S0000005", "S0000006", "S0000007", | ||
| // "S0000008", "S0000009", "S0000010", "S0000011", "S0000012", | ||
| // "S0000013", "S0000014", "S0000015", "S0000016", "S0000017", | ||
| // "S0000018", "S0000019", "S0000020", "S0000021", "S0000022", | ||
| // "S0000023", "S0000024", "S0000025", "S0000026", "S0000027" }); | ||
| // dataListMap.put("$SALES_DATE[]", new String[] { "2010/04/01", | ||
| // "2010/04/01", "2010/04/01", "2010/04/01", "2010/04/01", | ||
| // "2010/04/01", "2010/04/01", "2010/04/01", "2010/04/01", | ||
| // "2010/04/01", "2010/04/01", "2010/04/01", "2010/04/01", | ||
| // "2010/04/01", "2010/04/01", "2010/04/01", "2010/04/01", | ||
| // "2010/04/01", "2010/04/01", "2010/04/02", "2010/04/02", | ||
| // "2010/04/02", "2010/04/02", "2010/04/02", "2010/04/02", | ||
| // "2010/04/02", "2010/04/02" }); | ||
| // dataListMap.put("$CUSTOMER_CODE[]", new String[] { "C11111", "C11111", | ||
| // "C11111", "C11111", "C11111", "C11111", "C11112", "C11112", | ||
| // "C11112", "C11112", "C11112", "C11113", "C11113", "C11113", | ||
| // "C11113", "C11113", "C11117", "C11117", "C11117", "C11117", | ||
| // "C11117", "C11115", "C11115", "C11115", "C11119", "C11119", | ||
| // "C11119" }); | ||
| // dataListMap.put("$EMPLOYEE_CODE[]", new String[] { "E0001", "E0001", | ||
| // "E0001", "E0001", "E0001", "E0001", "E0005", "E0005", "E0005", | ||
| // "E0005", "E0005", "E0003", "E0003", "E0003", "E0003", "E0003", | ||
| // "E0012", "E0012", "E0012", "E0012", "E0012", "E0007", "E0007", | ||
| // "E0007", "E0015", "E0015", "E0015" }); | ||
| // dataListMap.put("$PRODUCE_CODE[]", new String[] { "P00001", "P00002", | ||
| // "P00003", "P00004", "P00005", "P00006", "P00001", "P00002", | ||
| // "P00003", "P00004", "P00005", "P00001", "P00002", "P00003", | ||
| // "P00004", "P00005", "P00001", "P00002", "P00003", "P00004", | ||
| // "P00005", "P00001", "P00002", "P00003", "P00001", "P00002", | ||
| // "P00003" }); | ||
| // dataListMap.put("$AMOUNT[]", new Integer[] { 1, 2, 3, 4, 5, 6, 1, 2, 3, | ||
| // 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 1, 2, 3, }); | ||
| // dataListMap.put("$SALES_AMOUNT[]", new Integer[] { 10000, 20000, 30000, | ||
| // 40000, 50000, 60000, 10000, 20000, 30000, 40000, 50000, 10000, | ||
| // 20000, 30000, 40000, 50000, 10000, 20000, 30000, 40000, 50000, | ||
| // 10000, 20000, 30000, 10000, 20000, 30000, }); | ||
|  | ||
| details.setNumOfDetails(dataListMap.get("$NUMBER[]").length); | ||
|  | ||
| dataContainer.setDetails(details); | ||
|  | ||
| return dataContainer; | ||
| } | ||
| } | 
| @@ -0,0 +1,41 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.co.nttdg.bfep.stp.bean; | ||
|  | ||
| import org.apache.camel.Exchange; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|  | ||
| /** | ||
| * @author h_tozawa | ||
| * | ||
| */ | ||
| public class PreRouter { | ||
|  | ||
| /** トレースロガー */ | ||
| private static final Logger logger = LoggerFactory.getLogger(Router.class); | ||
|  | ||
| // private static final BfepStpLogger stpLogger = BfepStpLoggerFactory | ||
| // .getLogger(Router.class); | ||
|  | ||
| /** | ||
| * 初期化処理 | ||
| * | ||
| * @param routngFilePath | ||
| * 経路情報ファイルのパス | ||
| */ | ||
| public PreRouter(String routngFilePath) { | ||
| logger.info(String.format("経路判定-スタブコンストラクタ参考情報 経路情報ファイルのパス=%s", | ||
| routngFilePath)); | ||
| } | ||
|  | ||
| /** | ||
| * 経路判定前処理 - スタブ | ||
| * | ||
| * @param exchange | ||
| * 処理対象の Exchange | ||
| */ | ||
| public void process(Exchange exchange) { | ||
| } | ||
| } | 
| @@ -0,0 +1,19 @@ | ||
| package jp.util; | ||
|  | ||
| import java.util.ArrayList; | ||
|  | ||
| public class ReadCSV { | ||
|  | ||
| public ReadCSV() { | ||
| } | ||
|  | ||
|  | ||
| public ArrayList<String> doMain(String path){ | ||
| ArrayList<String> list = new ArrayList<String>(); | ||
|  | ||
| FileUtilitys files = new FileUtilitys(path); | ||
| list = files.getList(); | ||
|  | ||
| return list; | ||
| } | ||
| } | 
| @@ -0,0 +1,144 @@ | ||
| package jp.util; | ||
|  | ||
| import java.io.FileInputStream; | ||
| import java.io.FileOutputStream; | ||
| import java.io.IOException; | ||
| import java.io.InputStreamReader; | ||
| import java.io.OutputStreamWriter; | ||
| import java.util.HashMap; | ||
| import java.util.Properties; | ||
|  | ||
| /** | ||
| * @author Administrator | ||
| * | ||
| */ | ||
| public class ReadProperties { | ||
|  | ||
|  | ||
|  | ||
| public static HashMap<String, String> getPropMap(String path) { | ||
|  | ||
|  | ||
| Properties propUTF8 = null; | ||
|  | ||
|  | ||
|  | ||
| HashMap<String, String> propMap = new HashMap<String, String>(); | ||
|  | ||
|  | ||
| try { | ||
| propUTF8 = loadUTF8Properties(path); | ||
|  | ||
|  | ||
| if (propUTF8 == null) { | ||
| throw new NullPointerException(); | ||
| } else { | ||
| for (String propertyName : propUTF8.stringPropertyNames()) { | ||
| propMap.put(propertyName, propUTF8.getProperty(propertyName)); | ||
| } | ||
|  | ||
| } | ||
|  | ||
|  | ||
| } catch (IOException e) { | ||
|  | ||
| e.printStackTrace(); | ||
| } | ||
|  | ||
|  | ||
|  | ||
|  | ||
| return propMap; | ||
|  | ||
| } | ||
|  | ||
| public static HashMap<String, String> getSjisPropMap(String path) { | ||
|  | ||
|  | ||
| Properties prop = null; | ||
|  | ||
|  | ||
|  | ||
| HashMap<String, String> propMap = new HashMap<String, String>(); | ||
|  | ||
|  | ||
| try { | ||
| prop = loadSJISProperties(path); | ||
|  | ||
|  | ||
| if (prop == null) { | ||
| throw new NullPointerException(); | ||
| } else { | ||
| for (String propertyName : prop.stringPropertyNames()) { | ||
| propMap.put(propertyName, prop.getProperty(propertyName)); | ||
| } | ||
|  | ||
| } | ||
|  | ||
|  | ||
| } catch (IOException e) { | ||
|  | ||
| e.printStackTrace(); | ||
| } | ||
|  | ||
|  | ||
|  | ||
|  | ||
| return propMap; | ||
|  | ||
| } | ||
|  | ||
|  | ||
| public static void setPropMap(HashMap<String, String> map, String path){ | ||
|  | ||
| try { | ||
| Properties myConf = new Properties(); | ||
|  | ||
| InputStreamReader myConfFileIn = new InputStreamReader(new FileInputStream(path),"SJIS"); | ||
|  | ||
| myConf.load(myConfFileIn); // ← ① ファイルから読み込む。 | ||
|  | ||
|  | ||
|  | ||
|  | ||
| for (String key : map.keySet()) { | ||
| // System.out.println(SystemDateUtil.getSystemDate() + key + " : " + map.get(key)); | ||
| myConf.setProperty(key, map.get(key)); | ||
| } | ||
|  | ||
| OutputStreamWriter myConfFileOut = new OutputStreamWriter(new FileOutputStream(path),"SJIS"); | ||
| myConf.store(myConfFileOut, "CostPropertyFile"); // ← ④ | ||
| // 変更した内容をファイルに書き込む。 | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
| } | ||
|  | ||
|  | ||
| } | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
|  | ||
| private static Properties loadUTF8Properties(String path) throws IOException { | ||
| Properties retProp = new Properties(); | ||
| retProp.load(new InputStreamReader(new FileInputStream(path), "UTF-8")); | ||
| return retProp; | ||
| } | ||
|  | ||
| private static Properties loadSJISProperties(String path) | ||
| throws IOException { | ||
| Properties retProp = new Properties(); | ||
| retProp.load(new InputStreamReader(new FileInputStream(path), "SJIS")); | ||
| return retProp; | ||
| } | ||
|  | ||
| } | 
| @@ -0,0 +1,30 @@ | ||
| package jp.co.core.ddm.pack.sbti.excel.poi.data; | ||
|  | ||
| /** | ||
| * 帳票データクラス | ||
| * @author TOZAWA | ||
| * | ||
| */ | ||
| public class ReportData { | ||
|  | ||
| private HeaderData header; | ||
|  | ||
| private DetailsData details; | ||
|  | ||
| public DetailsData getDetails() { | ||
| return details; | ||
| } | ||
|  | ||
| public void setDetails(DetailsData details) { | ||
| this.details = details; | ||
| } | ||
|  | ||
| public HeaderData getHeader() { | ||
| return header; | ||
| } | ||
|  | ||
| public void setHeader(HeaderData header) { | ||
| this.header = header; | ||
| } | ||
|  | ||
| } | 
| @@ -0,0 +1,66 @@ | ||
| /* | ||
| * @(#)RouteLogger.java | ||
| * | ||
| * Copyright (c) 2014, NTT DATA Getronics Corporation. | ||
| */ | ||
| package jp.co.nttdg.bfep.stp.bean.hub; | ||
|  | ||
| import java.util.ArrayList; | ||
|  | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLogger; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLoggerFactory; | ||
|  | ||
| import org.apache.camel.Exchange; | ||
|  | ||
| /** | ||
| * ログ出力Bean | ||
| * | ||
| * @author h_tozawa | ||
| * @version 1.0 | ||
| */ | ||
| public class RouteLogger { | ||
|  | ||
| /** B-FEP STPロガー */ | ||
| private static final BfepStpLogger stplogger = BfepStpLoggerFactory | ||
| .getLogger(RouteLogger.class); | ||
|  | ||
| /* | ||
| * 定数定義 | ||
| */ | ||
|  | ||
| /** メッセージ番号 */ | ||
| private static final String PARAMETER_NAME_MESSAGE_NO = "jp.co.nttdg.bfep.stp.hub.log.messageNo"; | ||
|  | ||
| /** メッセージパラメータ */ | ||
| private static final String PARAMETER_NAME_MESSAGE_PARAM = "jp.co.nttdg.bfep.stp.hub.log.messageParam"; | ||
|  | ||
| /** | ||
| * ルートログ出力処理 | ||
| * | ||
| * @param exchange | ||
| * 処理対象の Exchange | ||
| * @throws Exception | ||
| * 基底の例外<BR> | ||
| */ | ||
| public void process(Exchange exchange) throws Exception { | ||
|  | ||
| // メッセージ番号の取得 | ||
| int messageNo = (Integer) exchange.getIn().getHeader( | ||
| PARAMETER_NAME_MESSAGE_NO); | ||
|  | ||
| // 埋め込みパラメータの取得 | ||
| ArrayList<?> embeddingParamList = (ArrayList<?>) exchange.getIn() | ||
| .getHeader(PARAMETER_NAME_MESSAGE_PARAM); | ||
|  | ||
| // ArrayListをObject配列に変換する | ||
| if (embeddingParamList == null) { | ||
| embeddingParamList = new ArrayList<Object>(); | ||
| } | ||
|  | ||
| Object[] embeddingParamArray = (Object[]) embeddingParamList | ||
| .toArray(new Object[0]); | ||
|  | ||
| // ログ出力 | ||
| stplogger.routeLog(messageNo, exchange, embeddingParamArray); | ||
| } | ||
| } | 
| @@ -0,0 +1,287 @@ | ||
| /* | ||
| * @(#)RooteLogger.java | ||
| * | ||
| * Copyright (c) 2014, NTT DATA Getronics Corporation. | ||
| */ | ||
| package jp.co.nttdg.bfep.stp.bean.hub; | ||
|  | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|  | ||
| import jp.co.nttdg.bfep.stp.bean.hub.RouteLogger; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpException; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLoggerFactory; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpTestLogger; | ||
|  | ||
| import org.apache.camel.Exchange; | ||
| import org.apache.camel.test.junit4.ExchangeTestSupport; | ||
| import org.junit.Before; | ||
| import org.junit.BeforeClass; | ||
| import org.junit.Test; | ||
|  | ||
| /** | ||
| * @author h_tozawa | ||
| * @version 1.0 | ||
| * | ||
| */ | ||
| public class RouteLoggerTest extends ExchangeTestSupport { | ||
|  | ||
| /** テストケースの初期化処理 */ | ||
| @BeforeClass | ||
| public static void propertySet() { | ||
| System.setProperty(BfepStpLoggerFactory.TEST, "12"); | ||
| } | ||
|  | ||
| /** テストケース実行前にMessageListを初期化 */ | ||
| @Before | ||
| public void cleartMessageList() { | ||
| this.logger.clearMessageList(); | ||
| } | ||
|  | ||
| /** テスト用ロガーインスタンス。 */ | ||
| BfepStpTestLogger logger = BfepStpTestLogger.getInstance(); | ||
|  | ||
| /** テストクラスの初期化 */ | ||
| RouteLogger target = new RouteLogger(); | ||
|  | ||
| /** | ||
| * 正常データテスト 埋め込みパラメータが1つ | ||
| * | ||
| * @throws Exception | ||
| * | ||
| * @throws BfepStpException | ||
| */ | ||
| @Test | ||
| public void testCase01() throws Exception { | ||
|  | ||
| // Exchangeの設定 | ||
|  | ||
| Exchange exchange = createExchange(); | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageNo", | ||
| 1000); | ||
|  | ||
| ArrayList<Object> targetList = new ArrayList<Object>(); | ||
|  | ||
| String testMessages = "正常データテスト"; | ||
|  | ||
| targetList.add(testMessages); | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageParam", | ||
| targetList); | ||
|  | ||
| target.process(exchange); | ||
|  | ||
| List<BfepStpTestLogger.Message> list = this.logger.getMessageList(); | ||
| BfepStpTestLogger.Message message = list.get(0); | ||
| assertEquals(1000, message.no); | ||
| assertEquals(1, message.args.length); | ||
|  | ||
| int i = 0; | ||
| for (Object obj : message.args) { | ||
| assertEquals(targetList.get(i), (String) obj); | ||
| i++; | ||
| } | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * 正常データテスト埋め込みパラメータが3つ | ||
| * | ||
| * @throws Exception | ||
| */ | ||
| @Test | ||
| public void testCase02() throws Exception { | ||
|  | ||
| // Exchangeの設定 | ||
| Exchange exchange = createExchange(); | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageNo", | ||
| 1000); | ||
|  | ||
| ArrayList<Object> targetList = new ArrayList<Object>(); | ||
|  | ||
| targetList.add("正常データリスト1"); | ||
| targetList.add("正常データリスト2"); | ||
| targetList.add("正常データリスト3"); | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageParam", | ||
| targetList); | ||
|  | ||
| target.process(exchange); | ||
|  | ||
| List<BfepStpTestLogger.Message> list = this.logger.getMessageList(); | ||
| BfepStpTestLogger.Message message = list.get(0); | ||
| assertEquals(1000, message.no); | ||
| assertEquals(targetList.size(), message.args.length); | ||
|  | ||
| int i = 0; | ||
| for (Object obj : message.args) { | ||
| assertEquals(targetList.get(i), (String) obj); | ||
| i++; | ||
| } | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * 正常データテスト埋め込みパラメータが5つ | ||
| * | ||
| * @throws Exception | ||
| */ | ||
| @Test | ||
| public void testCase03() throws Exception { | ||
|  | ||
| // Exchangeの設定 | ||
| Exchange exchange = createExchange(); | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageNo", | ||
| 1000); | ||
|  | ||
| ArrayList<Object> targetList = new ArrayList<Object>(); | ||
|  | ||
| targetList.add("埋め込みパラメータ1"); | ||
| targetList.add("埋め込みパラメータ2"); | ||
| targetList.add("埋め込みパラメータ3"); | ||
| targetList.add("埋め込みパラメータ4"); | ||
| targetList.add("埋め込みパラメータ5"); | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageParam", | ||
| targetList); | ||
|  | ||
| target.process(exchange); | ||
|  | ||
| List<BfepStpTestLogger.Message> list = this.logger.getMessageList(); | ||
| BfepStpTestLogger.Message message = list.get(0); | ||
| assertEquals(1000, message.no); | ||
| assertEquals(targetList.size(), message.args.length); | ||
|  | ||
| int i = 0; | ||
| for (Object obj : message.args) { | ||
| assertEquals(targetList.get(i), (String) obj); | ||
| i++; | ||
| } | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * 正常データテスト 埋め込みパラメータなし | ||
| * | ||
| * @throws Exception | ||
| */ | ||
| @Test | ||
| public void testCase04() throws Exception { | ||
|  | ||
| // Exchangeの設定 | ||
| Exchange exchange = createExchange(); | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageNo", | ||
| 1000); | ||
|  | ||
| ArrayList<Object> targetList = new ArrayList<Object>(); | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageParam", | ||
| targetList); | ||
|  | ||
| target.process(exchange); | ||
|  | ||
| List<BfepStpTestLogger.Message> list = this.logger.getMessageList(); | ||
| BfepStpTestLogger.Message message = list.get(0); | ||
| assertEquals(1000, message.no); | ||
| assertEquals(targetList.size(), message.args.length); | ||
|  | ||
| int i = 0; | ||
| for (Object obj : message.args) { | ||
| assertEquals(targetList.get(i), (String) obj); | ||
| i++; | ||
| } | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * 異常データテスト メッセージナンバープロパティなし | ||
| */ | ||
| @Test | ||
| public void testCase05() { | ||
|  | ||
| // Exchangeの設定 | ||
| Exchange exchange = createExchange(); | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.noMessageNo", | ||
| 1000); | ||
|  | ||
| ArrayList<Object> targetList = new ArrayList<Object>(); | ||
|  | ||
| targetList.add("埋め込みパラメータ1"); | ||
| targetList.add("埋め込みパラメータ2"); | ||
| targetList.add("埋め込みパラメータ3"); | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageParam", | ||
| targetList); | ||
|  | ||
| try { | ||
| target.process(exchange); | ||
|  | ||
| } catch (Exception e) { | ||
|  | ||
| List<BfepStpTestLogger.Message> list = this.logger.getMessageList(); | ||
| assertEquals(0, list.size()); | ||
|  | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * 正常データテスト リストプロパティなし | ||
| */ | ||
| @Test | ||
| public void testCase06() { | ||
|  | ||
| // Exchangeの設定 | ||
| Exchange exchange = createExchange(); | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageNo", | ||
| 1000); | ||
|  | ||
| ArrayList<Object> targetList = new ArrayList<Object>(); | ||
|  | ||
| targetList.add("プロパティなしリスト"); | ||
|  | ||
| exchange.getIn().setHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.log.noPropertyParam", targetList); | ||
|  | ||
| try { | ||
| target.process(exchange); | ||
|  | ||
| } catch (Exception e) { | ||
|  | ||
| List<BfepStpTestLogger.Message> list = this.logger.getMessageList(); | ||
| assertEquals(0, list.size()); | ||
|  | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * 異常データテスト メッセージ番号が数字に変換できない。 | ||
| */ | ||
| @Test | ||
| public void testCase07() { | ||
|  | ||
| // Exchangeの設定 | ||
| Exchange exchange = createExchange(); | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageNo", | ||
| "100%"); | ||
|  | ||
| ArrayList<Object> targetList = new ArrayList<Object>(); | ||
|  | ||
| targetList.add("正常データリスト1"); | ||
| targetList.add("正常データリスト2"); | ||
| targetList.add("正常データリスト3"); | ||
| targetList.add("正常データリスト4"); | ||
| targetList.add("正常データリスト5"); | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.hub.log.messageParam", | ||
| targetList); | ||
|  | ||
| try { | ||
| target.process(exchange); | ||
| } catch (Exception e) { | ||
|  | ||
| List<BfepStpTestLogger.Message> list = this.logger.getMessageList(); | ||
| assertEquals(0, list.size()); | ||
|  | ||
| } | ||
| } | ||
| } | 
| @@ -0,0 +1,203 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.co.nttdg.bfep.stp.bean; | ||
|  | ||
| import java.io.File; | ||
| import java.io.FilenameFilter; | ||
| import java.io.IOException; | ||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.regex.Matcher; | ||
| import java.util.regex.Pattern; | ||
|  | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpException; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLogger; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLoggerFactory; | ||
|  | ||
| import org.apache.camel.Exchange; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|  | ||
| /** | ||
| * * 経路判定 スタブ | ||
| * | ||
| * @author h_tozawa | ||
| * @version 1.0 | ||
| * | ||
| */ | ||
| public class Router { | ||
|  | ||
| /** トレースロガー */ | ||
| private static final Logger logger = LoggerFactory.getLogger(Router.class); | ||
|  | ||
| private static final BfepStpLogger stpLogger = BfepStpLoggerFactory | ||
| .getLogger(Router.class); | ||
|  | ||
| /** | ||
| * 初期化処理 | ||
| * | ||
| * @param routngFilePath | ||
| * 経路情報ファイルのパス | ||
| * @throws BfepStpException | ||
| * 経路判定エンジンの初期化失敗 | ||
| */ | ||
| public Router(String routngFilePath) throws BfepStpException { | ||
| logger.info(String.format("経路判定-スタブコンストラクタ参考情報 経路情報ファイルのパス=%s", | ||
| routngFilePath)); | ||
| } | ||
|  | ||
| /** | ||
| * 経路判定処理 - スタブ | ||
| * | ||
| * @param exchange | ||
| * 処理対象の Exchange | ||
| * @throws IOException | ||
| */ | ||
| public void process(Exchange exchange) throws IOException { | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.routingError", false); | ||
| exchange.getIn() | ||
| .setHeader("jp.co.nttdg.bfep.stp.fromMessageFormat", ""); | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.toMessageFormat", ""); | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.sendQueues", | ||
| new ArrayList<String>()); | ||
|  | ||
| // logger.info(String.format("経路判定カレントディレクトリ 絶対ディレクトリ名=%s", | ||
| // new File(".").getAbsolutePath())); | ||
| // | ||
| // logger.info(String.format("経路判定カレントディレクトリ 完全ディレクトリ名=%s", | ||
| // new File(".").getCanonicalPath())); | ||
|  | ||
| // 指定ファイルの読み込み | ||
| StringBuilder regular = new StringBuilder("ROUTER_"); | ||
| regular.append(".*#"); | ||
|  | ||
| if ((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.systemCdFrom") != null) { | ||
|  | ||
| regular.append((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.systemCdFrom")); | ||
| } | ||
| regular.append("#"); | ||
|  | ||
| if ((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.kessaiDt") != null) { | ||
|  | ||
| regular.append((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.kessaiDt")); | ||
|  | ||
| } | ||
|  | ||
| File file = new File(new File("./").getCanonicalPath()); | ||
|  | ||
| String[] files = file.list(getFileExtensionFilter(regular.toString())); | ||
|  | ||
| if (files.length == 0) { | ||
|  | ||
| // 指定ファイルの読み込み | ||
| regular = new StringBuilder("ROUTER_"); | ||
| regular.append(".*#"); | ||
|  | ||
| if ((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.systemCdFrom") != null) { | ||
|  | ||
| regular.append((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.systemCdFrom")); | ||
| } | ||
| regular.append("#"); | ||
|  | ||
| if ((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.tsuban") != null) { | ||
|  | ||
| regular.append((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.tsuban")); | ||
|  | ||
| } | ||
|  | ||
| files = file.list(getFileExtensionFilter(regular.toString())); | ||
|  | ||
| } | ||
|  | ||
| logger.info(String.format("正規化ファイル名=%s", regular.toString())); | ||
|  | ||
| String fileName = ""; | ||
|  | ||
| if (files.length != 0) { | ||
| fileName = files[0].substring(0, files[0].indexOf("#")); | ||
| } else { | ||
| regular = new StringBuilder("ROUTER_"); | ||
| regular.append(".*"); | ||
| file = new File(new File("./").getCanonicalPath()); | ||
| files = file.list(getFileExtensionFilter(regular.toString())); | ||
| for (String item : files) { | ||
| if (item.indexOf("#") == -1) { | ||
| fileName = item; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|  | ||
| logger.info(String.format("経路判定ファイル取得 ファイル名=%s", fileName)); | ||
|  | ||
| String[] spritFileName = fileName.split("_"); | ||
|  | ||
| // 分割したファイル名にNGがあるときは、経路判定失敗とする。 | ||
|  | ||
| if ("NG".equals(spritFileName[1])) { | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.routingError", | ||
| true); | ||
| stpLogger.routeLog(2002, exchange, ""); | ||
|  | ||
| return; | ||
| } | ||
| // 変換元データIDは分割したファイル名の3番目 | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.fromMessageFormat", | ||
| spritFileName[2]); | ||
|  | ||
| // 変換後データIDは分割したファイル名の4番目 | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.toMessageFormat", | ||
| spritFileName[3]); | ||
|  | ||
| // キュー名は分割したファイル名の5番目 | ||
|  | ||
| logger.info(String.format("分割したファイル名の5番目 %s", spritFileName[4])); | ||
| if (spritFileName.length == 5) { | ||
|  | ||
| if ("VOID".equals(spritFileName[4])) { | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.sendQueues", | ||
| Arrays.asList(spritFileName[4])); | ||
|  | ||
| } else { | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.sendQueues", | ||
| Arrays.asList("jms:queue:" + spritFileName[4])); | ||
| } | ||
|  | ||
| } | ||
|  | ||
| } | ||
|  | ||
| /** | ||
| * 正規表現ファイルと一致したファイル名が返却するフィルタ | ||
| * | ||
| * @param regular | ||
| * 正規表現<BR> | ||
| * @return 正規表現ファイルと一致したファイル名<BR> | ||
| */ | ||
| private static FilenameFilter getFileExtensionFilter(String regular) { | ||
| final Pattern ptn = Pattern.compile(regular); | ||
|  | ||
| return new FilenameFilter() { | ||
| public boolean accept(File file, String name) { | ||
| Matcher match = ptn.matcher(name); | ||
| boolean ret = match.matches(); | ||
| return ret; | ||
| } | ||
| }; | ||
| } | ||
| } | 
| @@ -0,0 +1,190 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.co.nttdg.bfep.stp.bean; | ||
|  | ||
| import java.io.File; | ||
| import java.io.FilenameFilter; | ||
| import java.io.IOException; | ||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.regex.Matcher; | ||
| import java.util.regex.Pattern; | ||
|  | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpException; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLogger; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLoggerFactory; | ||
|  | ||
| import org.apache.camel.Exchange; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|  | ||
| /** | ||
| * * 経路判定2 スタブ | ||
| * | ||
| * @author h_tozawa | ||
| * @version 1.0 | ||
| * | ||
| */ | ||
| public class Router2 { | ||
|  | ||
| /** トレースロガー */ | ||
| private static final Logger logger = LoggerFactory.getLogger(Router2.class); | ||
|  | ||
| private static final BfepStpLogger stpLogger = BfepStpLoggerFactory | ||
| .getLogger(Router2.class); | ||
|  | ||
| /** | ||
| * 初期化処理 | ||
| * | ||
| * @param routngFilePath | ||
| * 経路情報ファイルのパス | ||
| * @throws BfepStpException | ||
| * 経路判定エンジンの初期化失敗 | ||
| */ | ||
| public Router2(String routngFilePath) throws BfepStpException { | ||
| logger.info(String.format("経路判定-スタブコンストラクタ参考情報 経路情報ファイルのパス=%s", | ||
| routngFilePath)); | ||
| } | ||
|  | ||
| /** | ||
| * 経路判定処理 - スタブ | ||
| * | ||
| * @param exchange | ||
| * 処理対象の Exchange | ||
| * @throws IOException | ||
| */ | ||
| public void process(Exchange exchange) throws IOException { | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.routingError", false); | ||
| exchange.getIn() | ||
| .setHeader("jp.co.nttdg.bfep.stp.fromMessageFormat", ""); | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.toMessageFormat", ""); | ||
|  | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.sendQueues", | ||
| new ArrayList<String>()); | ||
|  | ||
| // 指定ファイルの読み込み | ||
| StringBuilder regular = new StringBuilder("ROUTER2_"); | ||
| regular.append(".*#"); | ||
|  | ||
| if ((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.systemCdFrom") != null) { | ||
|  | ||
| regular.append((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.systemCdFrom")); | ||
| } | ||
| regular.append("#"); | ||
|  | ||
| if ((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.kessaiDt") != null) { | ||
|  | ||
| regular.append((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.kessaiDt")); | ||
|  | ||
| } | ||
|  | ||
| File file = new File(new File("./").getCanonicalPath()); | ||
|  | ||
| String[] files = file.list(getFileExtensionFilter(regular.toString())); | ||
|  | ||
| if (files.length == 0) { | ||
|  | ||
| // 指定ファイルの読み込み | ||
| regular = new StringBuilder("ROUTER2_"); | ||
| regular.append(".*#"); | ||
| if ((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.systemCdFrom") != null) { | ||
|  | ||
| regular.append((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.systemCdFrom")); | ||
| } | ||
| regular.append("#"); | ||
|  | ||
| if ((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.tsuban") != null) { | ||
|  | ||
| regular.append((String) exchange.getIn().getHeader( | ||
| "jp.co.nttdg.bfep.stp.hub.message.tsuban")); | ||
|  | ||
| } | ||
|  | ||
| files = file.list(getFileExtensionFilter(regular.toString())); | ||
|  | ||
| } | ||
|  | ||
| logger.info(String.format("正規化ファイル名=%s", regular.toString())); | ||
|  | ||
| // String[] files = | ||
| // file.list(getFileExtensionFilter(regular.toString())); | ||
| String fileName = ""; | ||
|  | ||
| if (files.length != 0) { | ||
| fileName = files[0].substring(0, files[0].indexOf("#")); | ||
| } else { | ||
| regular = new StringBuilder("ROUTER2_"); | ||
| regular.append(".*"); | ||
| file = new File(new File("./").getCanonicalPath()); | ||
| files = file.list(getFileExtensionFilter(regular.toString())); | ||
| for (String item : files) { | ||
| if (item.indexOf("#") == -1) { | ||
| fileName = item; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|  | ||
| logger.info(String.format("経路判定ファイル取得 ファイル名=%s", fileName)); | ||
|  | ||
| String[] spritFileName = fileName.split("_"); | ||
|  | ||
| // 分割したファイル名にOKがあるときは、経路判定失敗とする。 | ||
| if ("NG".equals(spritFileName[1])) { | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.routingError", | ||
| true); | ||
| stpLogger.routeLog(2002, exchange, ""); | ||
|  | ||
| return; | ||
| } | ||
| // 変換元データIDは分割したファイル名の3番目 | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.fromMessageFormat", | ||
| spritFileName[2]); | ||
| // 変換後データIDは分割したファイル名の4番目 | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.toMessageFormat", | ||
| spritFileName[3]); | ||
|  | ||
| // キュー名は分割したファイル名の5番目 | ||
| if (spritFileName.length == 5) { | ||
|  | ||
| if ("VOID".equals(spritFileName[4])) { | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.sendQueues", | ||
| Arrays.asList(spritFileName[4])); | ||
|  | ||
| } else { | ||
| exchange.getIn().setHeader("jp.co.nttdg.bfep.stp.sendQueues", | ||
| Arrays.asList("jms:queue:" + spritFileName[4])); | ||
| } | ||
|  | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * 正規表現ファイルと一致したファイル名が返却するフィルタ | ||
| * | ||
| * @param regular | ||
| * 正規表現<BR> | ||
| * @return 正規表現ファイルと一致したファイル名<BR> | ||
| */ | ||
| private static FilenameFilter getFileExtensionFilter(String regular) { | ||
| final Pattern ptn = Pattern.compile(regular); | ||
|  | ||
| return new FilenameFilter() { | ||
| public boolean accept(File file, String name) { | ||
| Matcher match = ptn.matcher(name); | ||
| boolean ret = match.matches(); | ||
| return ret; | ||
| } | ||
| }; | ||
| } | ||
| } | 
| @@ -0,0 +1,194 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.co.core.ddm.pack.sbti.poi.dto; | ||
|  | ||
| import java.util.List; | ||
|  | ||
| /** | ||
| * ○○組用DTO | ||
| * | ||
| */ | ||
| //@Entity | ||
| public class Scr0005Dto { | ||
|  | ||
|  | ||
| /** | ||
| * 明細データ | ||
| */ | ||
| public List<Scr0005Dto> scr0005Dtoitems; | ||
|  | ||
|  | ||
| /** | ||
| * 団体名 | ||
| */ | ||
| public String organizationName; | ||
|  | ||
| /** | ||
| * 団体番号 | ||
| */ | ||
| public String orgCode; | ||
|  | ||
| /** | ||
| * 事務所所在地 | ||
| */ | ||
| public String officeLocateAdd; | ||
|  | ||
| /** | ||
| * 管轄 | ||
| */ | ||
| public String jurisdictionName; | ||
|  | ||
| // 明細情報部 | ||
|  | ||
| /** | ||
| * 所属団体の地位・肩書_一次 | ||
| */ | ||
| public String orgPosition1Name; | ||
|  | ||
| /** | ||
| * 所属団体の地位・肩書_二次 | ||
| */ | ||
| public String orgPosition2Name; | ||
|  | ||
|  | ||
| /** | ||
| * 所属団体の地位・肩書_三次 | ||
| */ | ||
| public String orgPosition3Name; | ||
|  | ||
|  | ||
| /** | ||
| * 所属団体の地位・肩書_四次 | ||
| */ | ||
| public String orgPosition4Name; | ||
|  | ||
| /** | ||
| * 所属団体の地位・肩書_五次 | ||
| */ | ||
|  | ||
| public String orgPosition5Name; | ||
|  | ||
| /** | ||
| * 法上幹部 | ||
| */ | ||
| public String executive; | ||
|  | ||
|  | ||
| /** | ||
| * 個人番号 | ||
| */ | ||
| public String personalNumber; | ||
|  | ||
| /** | ||
| * 氏名 | ||
| */ | ||
| public String name; | ||
|  | ||
|  | ||
| /** | ||
| * フリガナ | ||
| */ | ||
| public String ruby; | ||
|  | ||
| /** | ||
| * 生年月日(和暦) | ||
| */ | ||
| public String birthday; | ||
|  | ||
|  | ||
| /** | ||
| * 登録責任 | ||
| */ | ||
| public String responsibility; | ||
|  | ||
|  | ||
| /** | ||
| * 資料肯定 | ||
| */ | ||
| public String materialPositive; | ||
|  | ||
| /** | ||
| * 資料否定 | ||
| */ | ||
| public String materialNegative; | ||
|  | ||
|  | ||
|  | ||
| /** | ||
| * 断指有無 | ||
| */ | ||
| public String crossFinger; | ||
|  | ||
|  | ||
| /** | ||
| * 入墨有無 | ||
| */ | ||
| public String tattoo; | ||
|  | ||
|  | ||
| /** | ||
| * 身上有無 | ||
| */ | ||
| public String socialPosition; | ||
|  | ||
|  | ||
| /** | ||
| * 本籍 | ||
| */ | ||
| public String domicile; | ||
|  | ||
|  | ||
| /** | ||
| * 住所 | ||
| */ | ||
| public String address; | ||
|  | ||
| /** | ||
| * 住居 | ||
| */ | ||
| public String residence; | ||
|  | ||
| /** | ||
| * 犯罪保有状況・罪名 | ||
| */ | ||
| public String offense; | ||
|  | ||
| /** | ||
| * 犯罪保有状況・確定日 | ||
| */ | ||
| public String fixedDate; | ||
|  | ||
| /** | ||
| * 犯罪保有状況・処分結果 | ||
| */ | ||
| public String disposalResult; | ||
|  | ||
| /** | ||
| * 犯罪保有状況・有効期間 | ||
| */ | ||
| public String validityPeriod; | ||
|  | ||
| /** | ||
| * 威力事件・検拳 | ||
| */ | ||
| public int arrest; | ||
|  | ||
| /** | ||
| * 威力事件・命令 | ||
| */ | ||
| public int instruction; | ||
|  | ||
| /** | ||
| * 威力事件・再発 | ||
| */ | ||
| public int recurrence; | ||
|  | ||
| /** | ||
| * 威力事件・備考 | ||
| */ | ||
| public String remarks; | ||
|  | ||
|  | ||
|  | ||
| } | 
| @@ -0,0 +1,153 @@ | ||
| package jp.co.core.ddm.pack.sbti.dto; | ||
|  | ||
| public class Scr0005ItemDto { | ||
| /** | ||
| * 所属団体の地位・肩書_一次 | ||
| */ | ||
| public String orgPosition1Name; | ||
|  | ||
| /** | ||
| * 所属団体の地位・肩書_二次 | ||
| */ | ||
| public String orgPosition2Name; | ||
|  | ||
|  | ||
| /** | ||
| * 所属団体の地位・肩書_三次 | ||
| */ | ||
| public String orgPosition3Name; | ||
|  | ||
|  | ||
| /** | ||
| * 所属団体の地位・肩書_四次 | ||
| */ | ||
| public String orgPosition4Name; | ||
|  | ||
| /** | ||
| * 所属団体の地位・肩書_五次 | ||
| */ | ||
|  | ||
| public String orgPosition5Name; | ||
|  | ||
| /** | ||
| * 法上幹部 | ||
| */ | ||
| public String executive; | ||
|  | ||
|  | ||
| /** | ||
| * 個人番号 | ||
| */ | ||
| public String personalNumber; | ||
|  | ||
| /** | ||
| * 氏名 | ||
| */ | ||
| public String name; | ||
|  | ||
|  | ||
| /** | ||
| * フリガナ | ||
| */ | ||
| public String ruby; | ||
|  | ||
| /** | ||
| * 生年月日(和暦) | ||
| */ | ||
| public String birthday; | ||
|  | ||
|  | ||
| /** | ||
| * 登録責任 | ||
| */ | ||
| public String responsibility; | ||
|  | ||
|  | ||
| /** | ||
| * 資料肯定 | ||
| */ | ||
| public String materialPositive; | ||
|  | ||
| /** | ||
| * 資料否定 | ||
| */ | ||
| public String materialNegative; | ||
|  | ||
|  | ||
|  | ||
| /** | ||
| * 断指有無 | ||
| */ | ||
| public String crossFinger; | ||
|  | ||
|  | ||
| /** | ||
| * 入墨有無 | ||
| */ | ||
| public String tattoo; | ||
|  | ||
|  | ||
| /** | ||
| * 身上有無 | ||
| */ | ||
| public String socialPosition; | ||
|  | ||
|  | ||
| /** | ||
| * 本籍 | ||
| */ | ||
| public String domicile; | ||
|  | ||
|  | ||
| /** | ||
| * 住所 | ||
| */ | ||
| public String address; | ||
|  | ||
| /** | ||
| * 住居 | ||
| */ | ||
| public String residence; | ||
|  | ||
| /** | ||
| * 犯罪保有状況・罪名 | ||
| */ | ||
| public String offense; | ||
|  | ||
| /** | ||
| * 犯罪保有状況・確定日 | ||
| */ | ||
| public String fixedDate; | ||
|  | ||
| /** | ||
| * 犯罪保有状況・処分結果 | ||
| */ | ||
| public String disposalResult; | ||
|  | ||
| /** | ||
| * 犯罪保有状況・有効期間 | ||
| */ | ||
| public String validityPeriod; | ||
|  | ||
| /** | ||
| * 威力事件・検拳 | ||
| */ | ||
| public String arrest; | ||
|  | ||
| /** | ||
| * 威力事件・命令 | ||
| */ | ||
| public String instruction; | ||
|  | ||
| /** | ||
| * 威力事件・再発 | ||
| */ | ||
| public String recurrence; | ||
|  | ||
| /** | ||
| * 威力事件・備考 | ||
| */ | ||
| public String remarks; | ||
|  | ||
|  | ||
| } | 
| @@ -0,0 +1,261 @@ | ||
| /* | ||
| * @(#)SplitterCP.java | ||
| * | ||
| * Copyright (c) 2014, NTT DATA Getronics Corporation. | ||
| */ | ||
| package jp.co.nttdg.bfep.stp.bean.hub; | ||
|  | ||
| import java.nio.charset.Charset; | ||
| import java.sql.Connection; | ||
| import java.sql.PreparedStatement; | ||
| import java.sql.SQLException; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|  | ||
| import javax.sql.DataSource; | ||
|  | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpException; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLogger; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLoggerFactory; | ||
|  | ||
| import org.apache.camel.Exchange; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|  | ||
| /** | ||
| * 電文分割(電子CP)Bean<BR> | ||
| * | ||
| * @author h_tozawa | ||
| * @version 1.0 | ||
| * | ||
| */ | ||
| public class SplitterCP { | ||
|  | ||
| /** トレースロガー */ | ||
| private static final Logger logger = LoggerFactory | ||
| .getLogger(SplitterCP.class); | ||
|  | ||
| /** B-FEP STPロガー */ | ||
| private static final BfepStpLogger stplogger = BfepStpLoggerFactory | ||
| .getLogger(SplitterCP.class); | ||
|  | ||
| /** データソース */ | ||
| private final DataSource datasource; | ||
|  | ||
| /** DB用APLID */ | ||
| private final String aplId; | ||
|  | ||
| /** キャラセット */ | ||
| private final Charset charset; | ||
|  | ||
| /* | ||
| * 定数定義 | ||
| */ | ||
| /** 分割用文字列(デリミタ) */ | ||
| private static final String SPLIT_DELIMITER = "<\\?xml"; | ||
|  | ||
| /** 追加用文字列(宣言部) */ | ||
| private static final String ADD_DECLARATION = "<?xml"; | ||
|  | ||
| /** デリミタエラーステータス */ | ||
| private static final String SATAUS_ERROR_DELIMITER_SPLIT = "D"; | ||
|  | ||
| /** 正常時(エラーなし)テータス */ | ||
| private static final String SATAUS_NORMAL = "0"; | ||
|  | ||
| /** システム区分コードFROM */ | ||
| private static final String PARAMETER_NAME_CD_FROM = "jp.co.nttdg.bfep.stp.hub.message.systemCdFrom"; | ||
|  | ||
| /** ファイル通番 */ | ||
| private static final String PARAMETER_NAME_FILE_TSUBAN = "jp.co.nttdg.bfep.stp.hub.fileTsuban"; | ||
|  | ||
| /** ファイル名 */ | ||
| private static final String PARAMETER_NAME_FILE_NAME = "jp.co.nttdg.bfep.stp.hub.fileName"; | ||
|  | ||
| /** | ||
| * コンストラクタ | ||
| * | ||
| * @param charset | ||
| * キャラセット<BR> | ||
| * @param datasource | ||
| * データソース<BR> | ||
| * @param dbAplID | ||
| * DB用APLID<BR> | ||
| * @throws BfepStpException | ||
| * STPソリューション固有例外<BR> | ||
| */ | ||
| public SplitterCP(String charset, DataSource datasource, String dbAplID) | ||
| throws BfepStpException { | ||
|  | ||
| try { | ||
| this.charset = Charset.forName(charset); | ||
| this.datasource = datasource; | ||
| this.aplId = dbAplID; | ||
|  | ||
| } catch (Exception e) { | ||
|  | ||
| logger.error("文字コード不正", e); | ||
| stplogger.log(2119, charset, e.getMessage()); | ||
| throw new BfepStpException(e.getMessage(), e); | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * プロセス | ||
| * | ||
| * @param exchange | ||
| * 処理対象の Exchange<BR> | ||
| * @return | ||
| * 分割データのバイト配列リスト | ||
| * @throws BfepStpException | ||
| * STPソリューション固有例外<BR> | ||
| */ | ||
| public List<byte[]> process(Exchange exchange) throws BfepStpException { | ||
|  | ||
| List<byte[]> returnByteArray = new ArrayList<byte[]>(); | ||
|  | ||
| List<String> returnList = null; | ||
|  | ||
| String status = SATAUS_NORMAL; | ||
|  | ||
| // データの取得 | ||
| byte[] inBodyData = (byte[]) exchange.getIn().getBody(); | ||
|  | ||
| // データが存在する時 | ||
| if (inBodyData.length > 0) { | ||
|  | ||
| // 文字列に変換して、分割 | ||
| String xml = new String(inBodyData, this.charset); | ||
| returnList = xmlSprit(xml); | ||
|  | ||
| // データが <?xml で始まらない | ||
| if (returnList.size() < 1) { | ||
|  | ||
| stplogger.routeLog(2106, exchange, | ||
| exchange.getIn().getHeader(PARAMETER_NAME_FILE_NAME)); | ||
| status = SATAUS_ERROR_DELIMITER_SPLIT; | ||
| } else { | ||
| // 戻り値に値を設定する。 | ||
| for (String item : returnList) { | ||
|  | ||
| byte[] bytesItem = item.getBytes(this.charset); | ||
| returnByteArray.add(bytesItem); | ||
| } | ||
| } | ||
| } | ||
| // ファイル管理テーブル追加 | ||
| addMessageFileManagementTable(exchange, status); | ||
|  | ||
| // 戻り値として、バイト配列を戻す。 | ||
| return returnByteArray; | ||
| } | ||
|  | ||
| /** | ||
| * XMLをデリミタ単位で分割 | ||
| * | ||
| * @param xml | ||
| * XML<BR> | ||
| * @return | ||
| * 分割した値のリスト<BR> | ||
| */ | ||
| private List<String> xmlSprit(String xml) { | ||
|  | ||
| List<String> returnList = new ArrayList<String>(); | ||
|  | ||
| String[] xmlArray = xml.split(SPLIT_DELIMITER); | ||
|  | ||
| for (int index = 0; index < xmlArray.length; index++) { | ||
|  | ||
| String items = xmlArray[index]; | ||
|  | ||
| // 分割した最初の配列 | ||
| if (index == 0) { | ||
|  | ||
| items = items.replaceAll("\n", ""); | ||
| items = items.replaceAll("\t", ""); | ||
| items = items.replaceAll("\\s", ""); | ||
|  | ||
| // データが <?xml で始まらない時は、分割リストは不要 | ||
| if (items.length() > 0) { | ||
| break; | ||
| } | ||
| continue; | ||
| } | ||
|  | ||
| returnList.add(ADD_DECLARATION + items); | ||
|  | ||
| } | ||
|  | ||
| return returnList; | ||
| } | ||
|  | ||
| /** | ||
| * 電文ファイル管理テーブルに追加する。 | ||
| * | ||
| * @param exchange | ||
| * 処理対象の Exchange<BR> | ||
| * @param fileTsuban | ||
| * ファイル通番<BR> | ||
| * @param status | ||
| * ステータス<BR> | ||
| * @throws BfepStpException | ||
| * STPソリューション固有例外<BR> | ||
| */ | ||
| private void addMessageFileManagementTable(Exchange exchange, String status) | ||
| throws BfepStpException { | ||
|  | ||
| try { | ||
|  | ||
| Connection conn = this.datasource.getConnection(); | ||
| try { | ||
|  | ||
| PreparedStatement pstmt = conn | ||
| .prepareStatement("INSERT INTO DENBUN_FILE_MGR (TASK_NO, SYSTEM_CD, FILE_TSUBAN, FILE_NAME, STATUS, INS_TIMESTAMP, INS_APLID) " | ||
| + "VALUES (?, ?, ?, ?, ?, SYSDATE, ?)"); | ||
| try { | ||
|  | ||
| // タスク№ | ||
| pstmt.setString(1, exchange.getFromRouteId()); | ||
|  | ||
| // システム区分コード | ||
| pstmt.setString( | ||
| 2, | ||
| (String) exchange.getIn().getHeader( | ||
| PARAMETER_NAME_CD_FROM)); | ||
|  | ||
| // ファイル通番 | ||
| pstmt.setInt( | ||
| 3, | ||
| (Integer) exchange.getIn().getHeader( | ||
| PARAMETER_NAME_FILE_TSUBAN)); | ||
|  | ||
| // ファイル名 | ||
| pstmt.setString( | ||
| 4, | ||
| (String) exchange.getIn().getHeader( | ||
| PARAMETER_NAME_FILE_NAME)); | ||
|  | ||
| // ステータス | ||
| pstmt.setString(5, status); | ||
|  | ||
| // 登録APLID | ||
| pstmt.setString(6, this.aplId); | ||
|  | ||
| // SQL実行 | ||
| pstmt.executeUpdate(); | ||
|  | ||
| } finally { | ||
| pstmt.close(); | ||
| } | ||
| } finally { | ||
| conn.close(); | ||
| } | ||
| } catch (SQLException e) { | ||
|  | ||
| logger.error("INSERT失敗", e); | ||
| stplogger | ||
| .routeLog(4000, exchange, e.getErrorCode(), e.getMessage()); | ||
| throw new BfepStpException(e.getMessage(), e); | ||
| } | ||
| } | ||
| } | 
| @@ -0,0 +1,348 @@ | ||
| /* | ||
| * @(#)SplitterYen.java | ||
| * | ||
| * Copyright (c) 2014, NTT DATA Getronics Corporation. | ||
| */ | ||
| package jp.co.nttdg.bfep.stp.bean.hub; | ||
|  | ||
| import java.nio.ByteBuffer; | ||
| import java.sql.Connection; | ||
| import java.sql.PreparedStatement; | ||
| import java.sql.SQLException; | ||
| import java.util.Arrays; | ||
|  | ||
| import javax.sql.DataSource; | ||
|  | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpException; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLogger; | ||
| import jp.co.nttdg.bfep.stp.framework.BfepStpLoggerFactory; | ||
|  | ||
| import org.apache.camel.Exchange; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|  | ||
| /** | ||
| * 電文分割(円資金管理)Bean<BR> | ||
| * | ||
| * @author h_tozawa | ||
| * @version 1.0 | ||
| * | ||
| */ | ||
| public class SplitterYen { | ||
|  | ||
| /** トレースロガー */ | ||
| private static final Logger logger = LoggerFactory | ||
| .getLogger(SplitterYen.class); | ||
|  | ||
| /** B-FEP STPロガー */ | ||
| private static final BfepStpLogger stplogger = BfepStpLoggerFactory | ||
| .getLogger(SplitterYen.class); | ||
|  | ||
| /** 電文長 */ | ||
| private final int telegramLength; | ||
|  | ||
| /** 共通情報終端位置 */ | ||
| private final int comInfoLastIndex; | ||
|  | ||
| /** スタート取引電文終端位置 */ | ||
| private final int startTelegramLastIndex; | ||
|  | ||
| /** エンド取引判定項目オフセット */ | ||
| private final int endTelegramOffset; | ||
|  | ||
| /** エンド取引判定項目レングス */ | ||
| private final int endTelegramLength; | ||
|  | ||
| /** データソース */ | ||
| private final DataSource datasource; | ||
|  | ||
| /** DB用APLID */ | ||
| private final String aplId; | ||
|  | ||
| /* | ||
| * 定数定義 | ||
| */ | ||
| /** 電文長エラーステータス */ | ||
| private static final String SATAUS_ERROR_TELEGRAM_SIZE = "D"; | ||
|  | ||
| /** 正常時(エラーなし)テータス */ | ||
| private static final String SATAUS_NORMAL = "0"; | ||
|  | ||
| /** 結合用定数 「0」 */ | ||
| private static final char BIND_START_ONLY = '0'; | ||
|  | ||
| /** 結合用定数 「1」 */ | ||
| private static final char BIND_START = '1'; | ||
|  | ||
| /** 結合用定数 「2」 */ | ||
| private static final char BIND_END = '2'; | ||
|  | ||
| /** メッセージ スタート取引 */ | ||
| private static final String PARAMETER_NAME_MESSAGE_BODY_START = "jp.co.nttdg.bfep.stp.hub.message.body.start"; | ||
|  | ||
| /** 電文分割エラー */ | ||
| private static final String PARAMETER_NAME_SPLIT_ERROR = "jp.co.nttdg.bfep.stp.hub.splitError"; | ||
|  | ||
| /** メッセージ エンド取引 */ | ||
| private static final String PARAMETER_NAME_MESSAGE_BODY_END = "jp.co.nttdg.bfep.stp.hub.message.body.end"; | ||
|  | ||
| /** ファイル名 */ | ||
| private static final String PARAMETER_NAME_FILE_NAME = "jp.co.nttdg.bfep.stp.hub.fileName"; | ||
|  | ||
| /** システム区分コードFROM */ | ||
| private static final String PARAMETER_NAME_CD_FROM = "jp.co.nttdg.bfep.stp.hub.message.systemCdFrom"; | ||
|  | ||
| /** ファイル通番 */ | ||
| private static final String PARAMETER_NAME_FILE_TSUBAN = "jp.co.nttdg.bfep.stp.hub.fileTsuban"; | ||
|  | ||
| /** | ||
| * コンストラクタ<BR> | ||
| * | ||
| * @param telegramSize | ||
| * 電文長<BR> | ||
| * @param comInfoLastIndex | ||
| * 共通情報終端位置<BR> | ||
| * @param startTelegramLastIndex | ||
| * スタート取引電文終端位置<BR> | ||
| * @param endTelegramOffset | ||
| * エンド取引判定項目オフセット<BR> | ||
| * @param endTelegramSize | ||
| * エンド取引判定項目レングス<BR> | ||
| * @param datasource | ||
| * データソース<BR> | ||
| * @param aplId | ||
| * DB用APLID<BR> | ||
| * @throws BfepStpException | ||
| * STPソリューション固有例外<BR> | ||
| */ | ||
| public SplitterYen(int telegramSize, int comInfoLastIndex, | ||
| int startTelegramLastIndex, int endTelegramOffset, | ||
| int endTelegramSize, DataSource datasource, String aplId) | ||
| throws BfepStpException { | ||
|  | ||
| this.telegramLength = telegramSize; | ||
| this.comInfoLastIndex = comInfoLastIndex; | ||
| this.startTelegramLastIndex = startTelegramLastIndex; | ||
| this.endTelegramOffset = endTelegramOffset; | ||
| this.endTelegramLength = endTelegramSize; | ||
| this.datasource = datasource; | ||
| this.aplId = aplId; | ||
|  | ||
| // 電文サイズチェック | ||
| // 共通情報終端位置が電文長より大きい | ||
| if (this.telegramLength < this.comInfoLastIndex) { | ||
| stplogger.log(2107, this.telegramLength, "共通情報終端位置", | ||
| this.comInfoLastIndex); | ||
| throw new BfepStpException(); | ||
| } | ||
|  | ||
| // スタート取引電文終端位置が電文長より大きい | ||
| if (this.telegramLength < this.startTelegramLastIndex) { | ||
| stplogger.log(2107, this.telegramLength, "スタート取引電文終端位置", | ||
| this.startTelegramLastIndex); | ||
| throw new BfepStpException(); | ||
| } | ||
|  | ||
| // エンド取引判定項目オフセットが電文長より大きい | ||
| if (this.telegramLength < this.endTelegramOffset) { | ||
| stplogger.log(2107, this.telegramLength, "エンド取引判定項目オフセット", | ||
| this.endTelegramOffset); | ||
| throw new BfepStpException(); | ||
| } | ||
|  | ||
| // エンド取引判定項目オフセット + エンド取引判定項目レングスが電文長より大きい | ||
| if (this.telegramLength < (this.endTelegramOffset + this.endTelegramLength)) { | ||
| stplogger.log(2107, this.telegramLength, | ||
| "エンド取引判定項目オフセット + エンド取引判定項目レングス", | ||
| (this.endTelegramOffset + this.endTelegramLength)); | ||
| throw new BfepStpException(); | ||
| } | ||
| } | ||
|  | ||
| /** | ||
| * プロセス<BR> | ||
| * | ||
| * @param exchange | ||
| * 処理対象の Exchange<BR> | ||
| * @throws BfepStpException | ||
| * STPソリューション固有例外<BR> | ||
| */ | ||
| public void process(Exchange exchange) throws BfepStpException { | ||
|  | ||
| exchange.getIn().setHeader(PARAMETER_NAME_SPLIT_ERROR, false); | ||
|  | ||
| byte[] bodyDataArray = new byte[0]; | ||
|  | ||
| exchange.getIn().setHeader(PARAMETER_NAME_MESSAGE_BODY_START, | ||
| bodyDataArray); | ||
|  | ||
| exchange.getIn().setHeader(PARAMETER_NAME_MESSAGE_BODY_END, | ||
| bodyDataArray); | ||
|  | ||
| bodyDataArray = (byte[]) exchange.getIn().getBody(); | ||
| int bodyDataSize = bodyDataArray.length; | ||
|  | ||
| // 引数指定の電文長と実際の電文長が違う | ||
| if (bodyDataSize != this.telegramLength) { | ||
|  | ||
| String fileName = (String) exchange.getIn().getHeader( | ||
| PARAMETER_NAME_FILE_NAME); | ||
|  | ||
| stplogger.routeLog(2108, exchange, fileName, bodyDataSize, | ||
| this.telegramLength); | ||
|  | ||
| exchange.getIn().setHeader(PARAMETER_NAME_SPLIT_ERROR, true); | ||
|  | ||
| // ファイル管理テーブル追加 | ||
| addMessageFileManagementTable(exchange, SATAUS_ERROR_TELEGRAM_SIZE); | ||
|  | ||
| // 処理終了 | ||
| return; | ||
| } | ||
|  | ||
| // 判定項目の取得 | ||
| byte[] judgeItemsArray = Arrays.copyOfRange(bodyDataArray, | ||
| this.endTelegramOffset, | ||
| (this.endTelegramOffset + this.endTelegramLength)); | ||
|  | ||
| // 取引種別初期化 | ||
| char type; | ||
|  | ||
| // 判定項目のチェック | ||
| if (!this.existsEndTeleglam(judgeItemsArray)) { | ||
|  | ||
| // スタート取引の末尾に種別を付与 | ||
| type = BIND_START_ONLY; | ||
| } else { | ||
|  | ||
| // スタート取引の末尾に種別を付与 | ||
| type = BIND_START; | ||
|  | ||
| // エンド取引電文の末尾に「2」を付与し、Exchangeにセット | ||
| // 共通情報 | ||
| byte[] comInfo = Arrays.copyOf(bodyDataArray, comInfoLastIndex + 1); | ||
|  | ||
| // エンド取引電文生成 | ||
| int endTelegramStartIndex = this.startTelegramLastIndex + 1; | ||
| byte[] endDataArray = Arrays.copyOfRange(bodyDataArray, | ||
| endTelegramStartIndex, bodyDataArray.length); | ||
|  | ||
| ByteBuffer byteBuf = ByteBuffer.allocate(comInfo.length | ||
| + endDataArray.length + 1); | ||
| byteBuf.put(comInfo); | ||
| byteBuf.put(endDataArray); | ||
| byteBuf.put((byte) BIND_END); | ||
| byte[] endTelegramDataArray = byteBuf.array(); | ||
|  | ||
| exchange.getIn().setHeader(PARAMETER_NAME_MESSAGE_BODY_END, | ||
| endTelegramDataArray); | ||
| } | ||
|  | ||
| // スタート取引電文生成 | ||
| byte[] startTelegramDataArray = Arrays.copyOf(bodyDataArray, | ||
| this.startTelegramLastIndex + 1); | ||
|  | ||
| // スタート取引電文の末尾に「1」を付与し、Exchangeにセット | ||
| ByteBuffer byteBuf = ByteBuffer | ||
| .allocate(startTelegramDataArray.length + 1); | ||
| byteBuf.put(startTelegramDataArray); | ||
| byteBuf.put((byte) type); | ||
| byte[] newBodyDataArray = byteBuf.array(); | ||
| exchange.getIn().setHeader(PARAMETER_NAME_MESSAGE_BODY_START, | ||
| newBodyDataArray); | ||
|  | ||
| // ファイル管理テーブル追加 | ||
| addMessageFileManagementTable(exchange, SATAUS_NORMAL); | ||
| } | ||
|  | ||
| /** | ||
| * 判定項目が一文字でも半角スペースで無い時にTrueを返す | ||
| * | ||
| * @param judgeItemsArray | ||
| * 判定項目<BR> | ||
| * @return | ||
| * 一文字でもスペースで無い時にはtrueを返す。<BR> | ||
| */ | ||
| private boolean existsEndTeleglam(byte[] judgeItemsArray) { | ||
|  | ||
| boolean isNotSpace = false; | ||
|  | ||
| for (byte judgeItems : judgeItemsArray) { | ||
| if (judgeItems != (byte) ' ') { | ||
| isNotSpace = true; | ||
| break; | ||
| } | ||
| } | ||
|  | ||
| return isNotSpace; | ||
| } | ||
|  | ||
| /** | ||
| * 電文ファイル管理テーブルに追加する。 | ||
| * | ||
| * @param exchange | ||
| * 処理対象の Exchange<BR> | ||
| * @param fileTsuban | ||
| * ファイル通番<BR> | ||
| * @param status | ||
| * ステータス<BR> | ||
| * @throws BfepStpException | ||
| * STPソリューション固有例外<BR> | ||
| */ | ||
| private void addMessageFileManagementTable(Exchange exchange, String status) | ||
| throws BfepStpException { | ||
|  | ||
| try { | ||
|  | ||
| Connection conn = this.datasource.getConnection(); | ||
| try { | ||
|  | ||
| PreparedStatement pstmt = conn | ||
| .prepareStatement("INSERT INTO DENBUN_FILE_MGR (TASK_NO, SYSTEM_CD, FILE_TSUBAN, FILE_NAME, STATUS, INS_TIMESTAMP, INS_APLID) " | ||
| + "VALUES (?, ?, ?, ?, ?, SYSDATE, ?)"); | ||
| try { | ||
|  | ||
| // タスク№ | ||
| pstmt.setString(1, exchange.getFromRouteId()); | ||
|  | ||
| // システム区分コード | ||
| pstmt.setString( | ||
| 2, | ||
| (String) exchange.getIn().getHeader( | ||
| PARAMETER_NAME_CD_FROM)); | ||
|  | ||
| // ファイル通番 | ||
| pstmt.setInt( | ||
| 3, | ||
| (Integer) exchange.getIn().getHeader( | ||
| PARAMETER_NAME_FILE_TSUBAN)); | ||
|  | ||
| // ファイル名 | ||
| pstmt.setString( | ||
| 4, | ||
| (String) exchange.getIn().getHeader( | ||
| PARAMETER_NAME_FILE_NAME)); | ||
|  | ||
| // ステータス | ||
| pstmt.setString(5, status); | ||
|  | ||
| // 登録APLID | ||
| pstmt.setString(6, this.aplId); | ||
|  | ||
| // SQL実行 | ||
| pstmt.executeUpdate(); | ||
| } finally { | ||
| pstmt.close(); | ||
| } | ||
| } finally { | ||
| conn.close(); | ||
| } | ||
| } catch (SQLException e) { | ||
|  | ||
| logger.error("INSERT失敗", e); | ||
| stplogger | ||
| .routeLog(4000, exchange, e.getErrorCode(), e.getMessage()); | ||
| throw new BfepStpException(e.getMessage(), e); | ||
| } | ||
| } | ||
| } | 
| @@ -0,0 +1,274 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package jp.co.core.ddm.pack.sbti.logic; | ||
|  | ||
| import java.io.File; | ||
| import java.io.FileInputStream; | ||
| import java.io.FileOutputStream; | ||
| import java.io.InputStream; | ||
| import java.io.OutputStream; | ||
| import java.io.Serializable; | ||
| import java.util.Date; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|  | ||
| import org.apache.poi.ss.usermodel.Cell; | ||
| import org.apache.poi.ss.usermodel.CellStyle; | ||
| import org.apache.poi.ss.usermodel.Sheet; | ||
| import org.apache.poi.ss.usermodel.WorkbookFactory; | ||
| import org.apache.poi.xssf.usermodel.XSSFCell; | ||
| import org.apache.poi.xssf.usermodel.XSSFRow; | ||
| import org.apache.poi.xssf.usermodel.XSSFSheet; | ||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | ||
|  | ||
| import jp.co.core.ddm.pack.sbti.poi.data.ReportData; | ||
|  | ||
|  | ||
|  | ||
| /** | ||
| * 統計情報Excel出力(POI)ロジッククラス | ||
| * | ||
| */ | ||
| public class StaticsOPILogic implements Serializable { | ||
|  | ||
| public StaticsOPILogic() { | ||
| } | ||
| /** | ||
| * Excelファイルの取得 | ||
| * @param fileName Excel2007形式以降のExcelファイル | ||
| * @return Excel2007形式以降のwbオブジェクトデータ | ||
| * @throws Exception | ||
| */ | ||
| public XSSFWorkbook getWorkbook(String fileName) throws Exception { | ||
| InputStream inp = new FileInputStream(fileName); | ||
| XSSFWorkbook wb = (XSSFWorkbook) WorkbookFactory.create(inp); | ||
| System.out.println("ファイル名「" + fileName + "」を読込ました"); | ||
| return wb; | ||
| } | ||
|  | ||
| /** | ||
| * Excel2007形式以降か確認 | ||
| * | ||
| * @param inputFile Excel2007形式以降のExcelファイル | ||
| * @return true/false | ||
| */ | ||
| public boolean isExcelFile(String inputFile) { | ||
| if (inputFile != null) { | ||
| if (inputFile.endsWith("xlsx")) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|  | ||
| /** | ||
| * 存在するExcelファイルか確認 | ||
| * @param inputFile Excel2007形式以降のExcelファイル | ||
| * @return true/false | ||
| */ | ||
| public boolean isExistExcelFile(String inputFile) { | ||
| if (isExcelFile(inputFile)) { | ||
| File file = new File(inputFile); | ||
| if (file.exists() && file.isFile()) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|  | ||
| /** | ||
| * Excelファイルの出力 | ||
| * @param wb 編集済みワークブックオブジェクト | ||
| * @param outFile 出力ファイル名(Excel2007形式) | ||
| * @throws Exception | ||
| */ | ||
| public void write(XSSFWorkbook wb, String outFile) throws Exception { | ||
| OutputStream out = new FileOutputStream(outFile); | ||
| wb.write(out); | ||
| System.out.println("ファイル名「" + outFile + "」が出力されました"); | ||
| out.close(); | ||
| } | ||
|  | ||
|  | ||
| // レポート用のワークブックを作成 | ||
| public XSSFWorkbook create(XSSFWorkbook wb, List<ReportData> dataList) { | ||
|  | ||
| //List<ReportData> reportList = dataList; | ||
|  | ||
| int numOfDetails = 0; | ||
|  | ||
| // 印刷範囲を取得 | ||
| String printArea = wb.getPrintArea(wb.getSheetIndex("TEMPLATE")); | ||
| if (printArea != null) { | ||
| int sheetPosition = printArea.indexOf("!"); | ||
| if (sheetPosition != -1) { | ||
| printArea = printArea.substring(sheetPosition + 1); | ||
| } else { | ||
| printArea = null; | ||
| } | ||
| } | ||
|  | ||
| if (dataList.size() > 1) { | ||
| for (int reportIndex = 0; reportIndex < dataList.size(); reportIndex++) { | ||
| // テンプレートシートをデータ数分シートコピーする | ||
| Sheet cloneSheet = wb.cloneSheet(wb.getSheetIndex("TEMPLATE")); | ||
| // ワークシート名を設定 | ||
| wb.setSheetName(wb.getSheetIndex(cloneSheet), dataList.get( | ||
| reportIndex).getHeader().getReportName()); | ||
| // 印刷範囲を設定 | ||
| if (printArea != null) { | ||
| wb.setPrintArea(wb.getSheetIndex(cloneSheet), printArea); | ||
| } | ||
| } | ||
| // テンプレートシートの削除 | ||
| wb.removeSheetAt(wb.getSheetIndex("TEMPLATE")); | ||
| } | ||
|  | ||
| ReportData reportData = null; | ||
| Map<String, String> headerMap = null; | ||
| Map<String, Object[]> detailsMap = null; | ||
|  | ||
| // ワークシート単位の繰返し処理 | ||
| int numOfSheet = wb.getNumberOfSheets(); | ||
| for (int sheetIndex = 0; sheetIndex < numOfSheet; sheetIndex++) { | ||
| XSSFSheet sheet = wb.getSheetAt(sheetIndex); | ||
|  | ||
| // ワークシートに対応するデータを取得 | ||
| reportData = dataList.get(sheetIndex); | ||
| headerMap = reportData.getHeader().getDataMap(); | ||
| detailsMap = reportData.getDetails().getDataListMap(); | ||
| if (reportData.getDetails().getNumOfDetails() != 0) { | ||
| numOfDetails = reportData.getDetails().getNumOfDetails(); | ||
| } | ||
|  | ||
| // 行単位の繰返し処理 | ||
| int lastRow = sheet.getLastRowNum(); | ||
| for (int rowIndex = 0; rowIndex <= lastRow; rowIndex++) { | ||
| XSSFRow row = sheet.getRow(rowIndex); | ||
| if (row == null) { | ||
| continue; | ||
| } | ||
|  | ||
| // セル単位の繰返し処理 | ||
| int lastColumn = row.getLastCellNum(); | ||
| for (int columnIndex = 0; columnIndex < lastColumn; columnIndex++) { | ||
| XSSFCell cell = row.getCell(columnIndex); | ||
| if (cell == null) { | ||
| continue; | ||
| } | ||
|  | ||
| if (cell.getCellType() == Cell.CELL_TYPE_STRING) { | ||
| // 値を置換える為に準備したセルであればデータを設定 | ||
| String key = cell.getStringCellValue(); | ||
| if (headerMap.containsKey(key)) { | ||
| setCellValue(cell, headerMap.get(key)); | ||
| } else if (detailsMap.containsKey(key)) { | ||
| setCellValues(cell, sheet, detailsMap.get(key),numOfDetails); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| // 完成したワークブックオブジェクトを戻す | ||
| return wb; | ||
| } | ||
|  | ||
| // セルに値を設定 | ||
| private void setCellValue(XSSFCell cell, Object value) { | ||
|  | ||
| CellStyle style = cell.getCellStyle(); | ||
|  | ||
| if (value != null) { | ||
| if (value instanceof String) { | ||
| cell.setCellValue((String) value); | ||
| } else if (value instanceof Number) { | ||
| Number numValue = (Number) value; | ||
| if (numValue instanceof Float) { | ||
| Float floatValue = (Float) numValue; | ||
| numValue = new Double(String.valueOf(floatValue)); | ||
| } | ||
| cell.setCellValue(numValue.doubleValue()); | ||
| } else if (value instanceof Date) { | ||
| Date dateValue = (Date) value; | ||
| cell.setCellValue(dateValue); | ||
| } else if (value instanceof Boolean) { | ||
| Boolean boolValue = (Boolean) value; | ||
| cell.setCellValue(boolValue); | ||
| } | ||
| } else { | ||
| cell.setCellType(Cell.CELL_TYPE_BLANK); | ||
| cell.setCellStyle(style); | ||
| } | ||
|  | ||
| } | ||
|  | ||
| private void setCellValues(XSSFCell baseCell, XSSFSheet sheet, Object[] values, int numOfDetails) { | ||
|  | ||
| // 繰返し処理開始セルの位置情報を保持 | ||
| int startRowPosition = baseCell.getRowIndex(); | ||
| int columnPosition = baseCell.getColumnIndex(); | ||
|  | ||
| // 明細の数分繰返し処理をする | ||
| for (int i = 0; i < numOfDetails; i++) { | ||
|  | ||
| // 行を取得または生成 | ||
| XSSFRow row = sheet.getRow(startRowPosition + i); | ||
| if (row == null) { | ||
| row = sheet.createRow(startRowPosition + i); | ||
| // 繰返し処理開始行と同じ高さを設定 | ||
| row.setHeight(sheet.getRow(startRowPosition).getHeight()); | ||
| } | ||
| // セルを取得または生成 | ||
| XSSFCell cell = row.getCell(columnPosition); | ||
| if (cell == null) { | ||
| cell = row.createCell(columnPosition); | ||
| // 繰返し処理開始セルの情報をコピー | ||
| copyCell(baseCell, cell); | ||
| } | ||
| // セルに値を設定 | ||
| setCellValue(cell, values[i]); | ||
| } | ||
|  | ||
| } | ||
|  | ||
| // セルの値を別セルにコピーする | ||
| public static void copyCell(XSSFCell fromCell, XSSFCell toCell) { | ||
|  | ||
| if (fromCell != null) { | ||
|  | ||
| int cellType = fromCell.getCellType(); | ||
| switch (cellType) { | ||
| case XSSFCell.CELL_TYPE_BLANK: | ||
| break; | ||
| case XSSFCell.CELL_TYPE_FORMULA: | ||
| toCell.setCellFormula(fromCell.getCellFormula()); | ||
| break; | ||
| case XSSFCell.CELL_TYPE_BOOLEAN: | ||
| toCell.setCellValue(fromCell.getBooleanCellValue()); | ||
| break; | ||
| case XSSFCell.CELL_TYPE_ERROR: | ||
| toCell.setCellErrorValue(fromCell.getErrorCellValue()); | ||
| break; | ||
| case XSSFCell.CELL_TYPE_NUMERIC: | ||
| toCell.setCellValue(fromCell.getNumericCellValue()); | ||
| break; | ||
| case XSSFCell.CELL_TYPE_STRING: | ||
| toCell.setCellValue(fromCell.getRichStringCellValue()); | ||
| break; | ||
| default: | ||
| } | ||
|  | ||
| if (fromCell.getCellStyle() != null) { | ||
| toCell.setCellStyle(fromCell.getCellStyle()); | ||
| } | ||
|  | ||
| if (fromCell.getCellComment() != null) { | ||
| toCell.setCellComment(fromCell.getCellComment()); | ||
| } | ||
| } | ||
| } | ||
|  | ||
|  | ||
|  | ||
| } | 
| @@ -0,0 +1,31 @@ | ||
| package com.smbc.jimuwf.saimu.jisutil.commonstatuscheck.ap; | ||
|  | ||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
|  | ||
| public class StatusCheck extends StatusCheckChain { | ||
| private List<String> successList = new ArrayList<String>(); | ||
|  | ||
| private String msgId = null; | ||
|  | ||
| public StatusCheck(String msgId, String... statuses) { | ||
|  | ||
| this.msgId = msgId; | ||
| successList = Arrays.asList(statuses); | ||
| } | ||
|  | ||
| @Override | ||
| public void privateCheck(WorkFlowInfo data) throws CheckException { | ||
| // 回付先ステータスが等しくない(リストに含まれていない) | ||
| if (!successList.contains(data.getStatus())) { | ||
|  | ||
| CheckException err = new CheckException(this.msgId); | ||
| err.setUmekomiMoji(data.getUketuke_NO(), data.getStatusNM()); | ||
| err.setWorkFrowInfo(data); | ||
|  | ||
| throw err; | ||
| } | ||
| } | ||
|  | ||
| } | 
| @@ -0,0 +1,24 @@ | ||
| package com.smbc.jimuwf.saimu.jisutil.commonstatuscheck.ap; | ||
|  | ||
|  | ||
| public abstract class StatusCheckChain { | ||
| private StatusCheckChain next; | ||
|  | ||
| abstract protected void privateCheck(WorkFlowInfo e) throws CheckException; | ||
|  | ||
| public void check(WorkFlowInfo e) throws CheckException { | ||
| privateCheck(e); | ||
| if (next != null) { | ||
| next.check(e); | ||
| } | ||
| } | ||
|  | ||
| public StatusCheckChain nextCheck(StatusCheckChain chain) { | ||
| if (this.next == null) { | ||
| this.next = chain; | ||
| } else { | ||
| next.nextCheck(chain); | ||
| } | ||
| return this; | ||
| } | ||
| } | 
| @@ -0,0 +1,76 @@ | ||
| /** | ||
| * | ||
| */ | ||
| package co.jp.console.sample; | ||
|  | ||
| /** | ||
| * @author h_tozawa | ||
| * | ||
| */ | ||
| public class StringSPlits { | ||
|  | ||
| /** | ||
| * | ||
| */ | ||
| public StringSPlits() { | ||
| // TODO 自動生成されたコンストラクター・スタブ | ||
| } | ||
|  | ||
| /** | ||
| * @param args | ||
| */ | ||
| public static void main(String[] args) { | ||
|  | ||
| String str = "リンゴ,|/パイナップル,|/すいか,|/ぶどう"; | ||
| String[] fruit = str.split("/", 3); | ||
| //String[] fruit = str.split("\\|"); | ||
| System.out.println("Size: " + fruit.length); | ||
|  | ||
| int count = 0; | ||
| for(String item : fruit){ | ||
|  | ||
| System.out.println(count + "番目の要素 = :" + item); | ||
| count++; | ||
|  | ||
| } | ||
|  | ||
|  | ||
|  | ||
| String xmlstr = "<?xml version=1.0 encoding="+"UTF-8" + "standalone="+"no" + "?>" + "<HEAD></HEAD>" + "<BODY></BODY>" | ||
|  | ||
| +"<?xml version=1.0 encoding="+"UTF-8" + "standalone="+"no" + "?>" + "<BHEAD></BHEAD>" + "<BBODY></BBODY>" + "<BFOOTER></BSFOOTER>"; | ||
|  | ||
| ; | ||
|  | ||
|  | ||
|  | ||
| String[] xmlstrArray = xmlstr.split("\\<\\?xml"); | ||
|  | ||
|  | ||
| System.out.println("Size: " + xmlstrArray.length); | ||
| // 文字の分割 | ||
| xmlstrArray[0] = "<?xml"; | ||
|  | ||
|  | ||
|  | ||
| // count = 0; | ||
| // for(String item : xmlstrArray){ | ||
| // | ||
| // System.out.println(count + "番目の要素 = :" + item); | ||
| // if(count > 0){ | ||
| // System.out.println(count + "文字の結合 = :" + (xmlstrArray[0] +item)); | ||
| // } | ||
| // count++; | ||
| // | ||
| // } | ||
|  | ||
| for(int i = 1 ; i < xmlstrArray.length ; i++){ | ||
|  | ||
| System.out.println(i + "文字の結合 = :" + (xmlstrArray[0] +xmlstrArray[i])); | ||
| } | ||
|  | ||
|  | ||
|  | ||
| } | ||
|  | ||
| } |