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 */ 016package org.opengion.plugin.calendar; 017 018import org.opengion.hayabusa.resource.CalendarQuery; 019import org.opengion.hayabusa.common.HybsSystemException; 020 021/** 022 * カレンダDB(ZY01)の検索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 */ 035public final class CalendarQuery_ZY01 implements CalendarQuery { 036 //* このプログラムのVERSION文字列を設定します。 {@value} */ 037 private static final String VERSION = "4.0.0.0 (2005/08/31)" ; 038 039 /** カレンダDBの読み込みのクエリー(ZY01) {@value} */ 040 public static final String QUERY = 041 "select YYYYMM,DY1,DY2,DY3,DY4,DY5,DY6,DY7,DY8,DY9,DY10," 042 + "DY11,DY12,DY13,DY14,DY15,DY16,DY17,DY18,DY19,DY20," 043 + "DY21,DY22,DY23,DY24,DY25,DY26,DY27,DY28,DY29,DY30,DY31" 044 + " from ZY01 where CDJGS=?" 045 + " order by YYYYMM" ; 046 047 /** 048 * 4つの引数を受け取り、整合性チェックを行います。 049 * 引数は、各クラスによって使用するカラム名(意味)が異なります。 050 * また、すべての引数をチェックするのではなく、クラス毎に、チェックする 051 * カラムの数は、異なります。 052 * 引数が正しくない場合は、HybsSystemException を発行します。 053 * 054 * @param arg1 データベース検索時の第1引数(CDJGS:事業所コード) 055 * @param arg2 データベース検索時の第2引数(未使用) 056 * @param arg3 データベース検索時の第3引数(未使用) 057 * @param arg4 データベース検索時の第4引数(未使用) 058 * 059 * @return 入力パラメータに応じた配列文字列(cdjgs) 060 * @throws HybsSystemException CDJGS(事業所コード) が設定されていない場合。 061 */ 062 public String[] checkArgment( final String arg1,final String arg2,final String arg3,final String arg4 ) { 063 String cdjgs = arg1; 064 065 if( cdjgs == null || cdjgs.length() == 0 ) { 066 String errMsg = "CalendarQuery_ZY01 クラスは、唯一の引数 " 067 + "CDJGS(事業所コード)を指定して、初期化下さい。" ; 068 throw new HybsSystemException( errMsg ); 069 } 070 return new String[] { cdjgs } ; 071 } 072 073 /** 074 * データベース検索の為の Select 文を返します。 075 * 引数リストとともに、使用します。 076 * 077 * @return データベース検索の為の Select 文 078 * 079 */ 080 public String getQuery() { 081 return QUERY; 082 } 083 084 /** 085 * データベースの持ち方を指定します。 086 * 持ち方がフラット(横持ち=1~31の日付をカラムで持つ)の場合、trueを返します。 087 * 縦持ち(日付単位で、行情報として持つ)場合は、false です。 088 * 089 * @return DBの持ち方がフラット(横持ち=1~31の日付をカラムで持つ)の場合、true 090 * 091 */ 092 public boolean isFlatTable() { 093 return true; 094 } 095}