001 /*
002 * Copyright (c) 2009 The openGion Project.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied. See the License for the specific language
014 * governing permissions and limitations under the License.
015 */
016 package org.opengion.plugin.calendar;
017
018 import org.opengion.hayabusa.resource.CalendarQuery;
019 import org.opengion.hayabusa.common.HybsSystemException;
020
021 /**
022 * カレンãƒ?¼¤?¢(TP637)の検索QUERYを定義したクラスですã?
023 *
024 * QUERY は、このオブジェクトを、toString() して求めることとしますã?
025 * 本来は、これらのクラスの共通インターフェースを作æ?して、getQuery() などのメソãƒ?ƒ‰ã‚?
026 * 介して取得すべきですが、Object の共通クラスを利用することとしますã?
027 *
028 * @og.rev 3.6.0.0 (2004/09/17) 新規作æ?
029 * @og.group リソース管ç�?
030 *
031 * @version 4.0
032 * @author Kazuhiko Hasegawa
033 * @since JDK5.0,
034 */
035 public final class CalendarQuery_TP637 implements CalendarQuery {
036 //* こã?プログラãƒ??VERSIONæ–?—å?を設定しますã? {@value} */
037 private static final String VERSION = "4.0.0.0 (2005/08/31)" ;
038
039 /** カレンãƒ?¼¤?¢の読み込みのクエリー(TP637) */
040 public static final String QUERY =
041 "select YM,DAY1,DAY2,DAY3,DAY4,DAY5,DAY6,DAY7,DAY8,DAY9,DAY10,"
042 + "DAY11,DAY12,DAY13,DAY14,DAY15,DAY16,DAY17,DAY18,DAY19,DAY20,"
043 + "DAY21,DAY22,DAY23,DAY24,DAY25,DAY26,DAY27,DAY28,DAY29,DAY30,DAY31"
044 + " from TP637 where CDK=? and WC=? and WS=? and KBCAL=? and KBREC='1'"
045 + " order by YM" ;
046
047 /**
048 * ?”つの引数を受け取りã?整合æ?チェãƒ?‚¯を行いますã?
049 * 引数は、各クラスによって使用するカラãƒ?��(意味)が異なりますã?
050 * またã?すべての引数をチェãƒ?‚¯するのではなくã?クラス毎に、チェãƒ?‚¯する
051 * カラãƒ??数は、異なりますã?
052 * 引数が正しくなã�??合ã?、HybsSystemException を発行しますã?
053 *
054 * @param arg1 ãƒ??タベã?ス検索時ã?第?‘引数(CDK:生産工場)
055 * @param arg2 ãƒ??タベã?ス検索時ã?第?’引数(WC:?·?£)
056 * @param arg3 ãƒ??タベã?ス検索時ã?第?“引数(WS:構æ?)
057 * @param arg4 ãƒ??タベã?ス検索時ã?第?”引数(KBCAL:カレンãƒ?Œºåˆ?
058 *
059 * @return 入力パラメータに応じたé?列文字å?(cdk,wc,ws,kbcal)
060 * @throws HybsSystemException CLNBK(カレンãƒ?Œºåˆ? が設定されてã�?�ªã�??合ã?
061 */
062 public String[] checkArgment( final String arg1,final String arg2,final String arg3,final String arg4 ) {
063 String cdk = arg1 ;
064 String wc = arg2 ;
065 String ws = arg3 ;
066 String kbcal = arg4 ;
067
068 if( kbcal == null || kbcal.length() == 0 ) {
069 String errMsg = "CalendarQuery_TP637 クラスの第?”引数 "
070 + "KBCAL(カレンãƒ?Œºåˆ?が指定されてã�?�¾せんã€?
071 + "CDK=" + cdk + ", WC=" + wc + ", WS=" + ws + ", KBCAL=" + kbcal ;
072 throw new HybsSystemException( errMsg );
073 }
074
075 // TP637 ?¤?¢定義書 参ç?
076 switch( kbcal.charAt(0) ) {
077 case '1': wc = cdk; ws = cdk ; break ;
078 case '2': wc = cdk; ws = wc ; break ;
079 default : break ;
080 }
081
082 if( cdk == null || cdk.length() == 0 ||
083 wc == null || wc.length() == 0 ||
084 ws == null || ws.length() == 0 ) {
085 String errMsg = "CalendarQuery_TP637 クラスの引数キーのã€?
086 + "CDK,WC,WS がã?設定されてã�?�¾せんã€?
087 + "CDK=" + cdk + ", WC=" + wc + ", WS=" + ws + ", KBCAL=" + kbcal ;
088 throw new HybsSystemException( errMsg );
089 }
090
091 return new String[] { cdk,wc,ws,kbcal } ;
092 }
093
094 /**
095 * ãƒ??タベã?ス検索の為の Select æ–?‚’返しますã?
096 * 引数リストとともに、使用しますã?
097 *
098 * @return ãƒ??タベã?ス検索の為の Select æ–?
099 *
100 */
101 public String getQuery() {
102 return QUERY;
103 }
104
105 /**
106 * ãƒ??タベã?スの持ち方を指定しますã?
107 * 持ち方がフラãƒ?ƒˆ(横持ち=1??1の日付をカラãƒ?�§持つ)の場合ã?trueを返しますã?
108 * 縦持ち(日付単位で、行情報として持つ)場合ã?、false ですã?
109 *
110 * @return DBの持ち方がフラãƒ?ƒˆ(横持ち=1??1の日付をカラãƒ?�§持つ)の場合ã?true
111 *
112 */
113 public boolean isFlatTable() {
114 return true;
115 }
116 }