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.query;
017
018 import org.opengion.hayabusa.common.HybsSystem;
019 import org.opengion.hayabusa.db.DBConstValue;
020
021 /**
022 * ãƒ??タベã?ス登録時ã«ã€å›ºå®šå?カラãƒ??è¨å®šã‚’è¡Œã†æƒ??を管ç?™ã‚‹ã‚¯ãƒ©ã‚¹ã§ã™ã?
023 * ã“ã?クラスã¯ã€MISシスãƒ?ƒ 共通ã?管ç?‚¯ãƒ©ã‚¹ã§ã™ã?
024 * 具体的ã«ã¯ã€?
025 * 更新フラグ FGJ
026 * 作æ?æ—¥æ™? DYSET
027 * 作æ??°?§ PGSET
028 * 作æ?親?°?§ PGPSET
029 * 作æ?社員 USRSET
030 * 更新日� DYUPD
031 * æ›´æ–°?°?§ PGUPD
032 * 更新親?°?§ PGPUPD
033 * 更新社員 USRUPD
034 * ãªã©ã®æƒ??ã‚’ã?INSERTã€UPDATE ã®çжæ³ã«å¿œã˜ã¦æä¾›ã—ã¾ã™ã?
035 * INSERT ã«ã¯ã€ã™ã¹ã¦ã®æƒ??(XXUPD)ã«ã‚‚å?ã‚’ã‚»ãƒ?ƒˆã—ã¾ã™ã?
036 * ã“れã¯ã€UPDATE ã•ã‚ŒãŸæ—¥ä»˜ã‚„時刻ã§ã€ä¸?¦§æ¤œç´¢ã§ãるよã†ã«ã™ã‚‹ç‚ºã§ã€?
037 * null ã«ã—ã¦ãŠãã¨ã€IS NULL ã§å•ã„åˆã‚ã›ã‚‹å¿?¦ãŒã‚りã¾ã™ã?
038 * INSERT ãƒ??ã‚¿ã?‘å–å?ã™å?åˆã?ã€WHERE DYSET = DYUPD ã¨ã—ã¾ã™ã?
039 *
040 * コンストラクターã§ã¯ã€ãƒ†ãƒ¼ãƒ–ルåã?ユーザーID,ç”»é¢ID ã‚’å—ã‘å–りã¾ã™ã?
041 * 登録時刻ã¯ã€ã“ã®ã‚ªãƒ–ジェクトãŒç”Ÿæ?ã•ã‚ŒãŸæ™‚間を通常ã¯ä½¿ç”¨ã—ã¾ã™ã?
042 * ãƒ??ブルåを渡ã™ã?ã¯ã€ãƒ¯ãƒ¼ã‚¯ãªã©ã€ãƒ†ãƒ¼ãƒ–ルå˜ä½ã«å‡¦ç?™ã‚‹ã‚«ãƒ©ãƒ?Œ
043 * ç•°ãªã‚‹ã?ã§ã€ãれã¸ã®å¯¾å¿œã§ã™ã?
044 * 処ç?Œç°¡ç´?Œ–ã§ãるよã†ã«ã€ãƒ«ãƒ¼ãƒ«ã‚’è¦å®šã™ã¹ãã§ã™ã?
045 *
046 * @og.rev 4.3.7.5 (2009/07/08) æ–°è¦è¿½åŠ?
047 * @og.group �?タ登録
048 *
049 * @version 4.0
050 * @author Kazuhiko Hasegawa
051 * @since JDK5.0,
052 */
053 public class DBConstValue_GF implements DBConstValue {
054 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */
055 private static final String VERSION = "4.3.7.5 (2009/07/08)" ;
056
057 private static final String[] MSTR_INSKEYS =
058 new String[] { "FGJ","DYSET","DYUPD","USRSET","USRUPD","PGSET","PGUPD","PGPSET","PGPUPD" };
059
060 private static final String[] MSTR_UPDKEYS =
061 new String[] { "FGJ","DYUPD","USRUPD","PGUPD","PGPUPD" };
062
063 private static final String[] MSTR_LOGDELKEYS = // 4.3.7.0 (2009/06/01)
064 new String[] { "FGJ","DYUPD","USRUPD","PGUPD","PGPUPD" };
065
066 private static final String[] ZERO = new String[0] ;
067
068 private String[] insKeys = ZERO;
069 private String[] insVals = ZERO;
070
071 private String[] updKeys = ZERO;
072 private String[] updVals = ZERO;
073
074 private String[] logDelKeys = ZERO; // 4.3.7.0 (2009/06/01)
075 private String[] logDelVals = ZERO; // 4.3.7.0 (2009/06/01)
076
077 /**
078 * åˆæœŸåŒ–æƒ…å ±ã‚’è¨å®šã—ã¾ã™ã?
079 *
080 * @param table ãƒ??ブルå?
081 * @param user ユーザーID
082 * @param gamen ç”»é¢ID
083 */
084 public void init( final String table, final String user, final String gamen ) {
085 init( table, user, gamen, "" );
086 }
087
088 /**
089 * åˆæœŸåŒ–æƒ…å ±ã‚’è¨å®šã—ã¾ã™ã?
090 *
091 * @param table ãƒ??ブルå?
092 * @param user ユーザーID
093 * @param gamen ç”»é¢ID
094 * @param pgamen 親画é¢ID
095 */
096 public void init( final String table, final String user, final String gamen, final String pgamen ) {
097 if( isUseClm( table ) ) {
098 String userID = "'" + user + "'";
099 String gamenID = "'" + gamen + "'";
100 String pgamenID = "'" + pgamen + "'";
101 String timestamp = "'" + HybsSystem.getDate( "yyyyMMddHHmmss" ) + "'" ;
102
103 insKeys = MSTR_INSKEYS;
104 insVals = new String[] {
105 "'1'" // FGJ
106 ,timestamp // DYSET
107 ,timestamp // DYUPD
108 ,userID // USRSET
109 ,userID // USRUPD
110 ,gamenID // PGSET
111 ,gamenID // PGUPD
112 ,pgamenID // PGPSET
113 ,pgamenID // PGPUPD
114 };
115
116 updKeys = MSTR_UPDKEYS;
117 updVals = new String[] {
118 "'1'" // FGJ
119 ,timestamp // DYUPD
120 ,userID // USRUPD
121 ,gamenID // PGUPD
122 ,pgamenID // PGPUPD
123 };
124
125 // 4.3.7.0 (2009/06/01)
126 logDelKeys = MSTR_LOGDELKEYS;
127 logDelVals = new String[] {
128 "'9'" // FGJ
129 ,timestamp // DYUPD
130 ,userID // USRUPD
131 ,gamenID // PGUPD
132 ,pgamenID // PGPUPD
133 };
134 }
135 }
136
137 /**
138 * インサートã™ã‚‹å?åˆã?ã‚ーé…å?ã‚’è¿”ã—ã¾ã™ã?
139 *
140 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
141 *
142 * @og.rev 4.3.1.1 (2008/08/23) 変更å¯èƒ½ãªã‚ªãƒ–ジェクトã?å‚ç?を直接返ã•ãªã?‚ˆã?«ã—ã¾ã™ã?
143 *
144 * @return インサートã™ã‚‹å?åˆã?値é…å?(éžnull)
145 */
146 public String[] getInsertKeys() {
147 // return insKeys ;
148 return insKeys.clone();
149 }
150
151 /**
152 * インサートã™ã‚‹å?åˆã?値é…å?ã‚’è¿”ã—ã¾ã™ã?
153 *
154 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
155 *
156 * @og.rev 4.3.1.1 (2008/08/23) 変更å¯èƒ½ãªã‚ªãƒ–ジェクトã?å‚ç?を直接返ã•ãªã?‚ˆã?«ã—ã¾ã™ã?
157 *
158 * @return インサートã™ã‚‹å?åˆã?値é…å?(éžnull)
159 */
160 public String[] getInsertVals() {
161 // return insVals ;
162 return insVals.clone();
163 }
164
165 /**
166 *ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?ã‚ーé…å?ã‚’è¿”ã—ã¾ã™ã?
167 *
168 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
169 *
170 * @og.rev 4.3.1.1 (2008/08/23) 変更å¯èƒ½ãªã‚ªãƒ–ジェクトã?å‚ç?を直接返ã•ãªã?‚ˆã?«ã—ã¾ã™ã?
171 *
172 * @return ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
173 */
174 public String[] getUpdateKeys() {
175 // return updKeys ;
176 return updKeys.clone();
177 }
178
179 /**
180 * ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?値é…å?ã‚’è¿”ã—ã¾ã™ã?
181 *
182 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
183 *
184 * @og.rev 4.3.1.1 (2008/08/23) 変更å¯èƒ½ãªã‚ªãƒ–ジェクトã?å‚ç?を直接返ã•ãªã?‚ˆã?«ã—ã¾ã™ã?
185 *
186 * @return ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
187 */
188 public String[] getUpdateVals() {
189 // return updVals ;
190 return updVals.clone();
191 }
192
193 /**
194 * ãƒ?ƒªãƒ¼ãƒ?è«–ç†å‰Šé™¤) ã™ã‚‹å ´åˆã?ã‚ーé…å?ã‚’è¿”ã—ã¾ã™ã?
195 *
196 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
197 *
198 * @og.rev 4.3.7.0 (2009/06/01) æ–°è¦ä½œæ?
199 *
200 * @return ãƒ?ƒªãƒ¼ãƒˆã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
201 */
202 public String[] getLogicalDeleteKeys() {
203 return logDelKeys.clone();
204 }
205
206 /**
207 * ãƒ?ƒªãƒ¼ãƒ?è«–ç†å‰Šé™¤) ã™ã‚‹å ´åˆã?値é…å?ã‚’è¿”ã—ã¾ã™ã?
208 *
209 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
210 *
211 * @og.rev 4.3.7.0 (2009/06/01) æ–°è¦ä½œæ?
212 *
213 * @return ãƒ?ƒªãƒ¼ãƒˆã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
214 */
215 public String[] getLogicalDeleteVals() {
216 // return updVals ;
217 return logDelVals.clone();
218 }
219
220 /**
221 * カラãƒ?‚’è¿”ã™ã‹ã©ã?‹ã‚’決ã‚ã‚‹ãƒã‚¸ãƒ?‚¯
222 *
223 * ãƒ??ブルåよりã?ãƒã‚¸ãƒ?‚¯çš?«å°Žã出ã—ã¾ã™ã?
224 *
225 * @param table ãƒ??ブルå?
226 *
227 * @return カラãƒ?‚’è¿”ã™ã‹ã©ã?‹(true:カラãƒ?‚’生æ?/false:カラãƒ??生æ?ã—ãªã?
228 */
229 private boolean isUseClm( final String table ) {
230 boolean flag = ( table != null ) ;
231
232 return flag ;
233 }
234 }