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_UA 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 if( isUseClm( table ) ) {
086 String userID = "'" + user + "'";
087 String gamenID = "'" + gamen + "'";
088 String timestamp = "'" + HybsSystem.getDate( "yyyyMMddHHmmss" ) + "'" ;
089
090 insKeys = MSTR_INSKEYS;
091 insVals = new String[] {
092 "'1'" // FGJ
093 ,timestamp // DYSET
094 ,timestamp // DYUPD
095 ,userID // USRSET
096 ,userID // USRUPD
097 ,gamenID // PGSET
098 ,gamenID // PGUPD
099 ,gamenID // PGPSET
100 ,gamenID // PGPUPD
101 };
102
103 updKeys = MSTR_UPDKEYS;
104 updVals = new String[] {
105 "'1'" // FGJ
106 ,timestamp // DYUPD
107 ,userID // USRUPD
108 ,gamenID // PGUPD
109 ,gamenID // PGPUPD
110 };
111
112 // 4.3.7.0 (2009/06/01)
113 logDelKeys = MSTR_LOGDELKEYS;
114 logDelVals = new String[] {
115 "'9'" // FGJ
116 ,timestamp // DYUPD
117 ,userID // USRUPD
118 ,gamenID // PGUPD
119 ,gamenID // PGPUPD
120 };
121 }
122 }
123
124 /**
125 * インサートã™ã‚‹å?åˆã?ã‚ーé…å?ã‚’è¿”ã—ã¾ã™ã?
126 *
127 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
128 *
129 * @og.rev 4.3.1.1 (2008/08/23) 変更å¯èƒ½ãªã‚ªãƒ–ジェクトã?å‚ç?を直接返ã•ãªã?‚ˆã?«ã—ã¾ã™ã?
130 *
131 * @return インサートã™ã‚‹å?åˆã?値é…å?(éžnull)
132 */
133 public String[] getInsertKeys() {
134 // return insKeys ;
135 return insKeys.clone();
136 }
137
138 /**
139 * インサートã™ã‚‹å?åˆã?値é…å?ã‚’è¿”ã—ã¾ã™ã?
140 *
141 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
142 *
143 * @og.rev 4.3.1.1 (2008/08/23) 変更å¯èƒ½ãªã‚ªãƒ–ジェクトã?å‚ç?を直接返ã•ãªã?‚ˆã?«ã—ã¾ã™ã?
144 *
145 * @return インサートã™ã‚‹å?åˆã?値é…å?(éžnull)
146 */
147 public String[] getInsertVals() {
148 // return insVals ;
149 return insVals.clone();
150 }
151
152 /**
153 * ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?ã‚ーé…å?ã‚’è¿”ã—ã¾ã™ã?
154 *
155 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
156 *
157 * @og.rev 4.3.1.1 (2008/08/23) 変更å¯èƒ½ãªã‚ªãƒ–ジェクトã?å‚ç?を直接返ã•ãªã?‚ˆã?«ã—ã¾ã™ã?
158 *
159 * @return ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
160 */
161 public String[] getUpdateKeys() {
162 // return updKeys ;
163 return updKeys.clone();
164 }
165
166 /**
167 * ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?値é…å?ã‚’è¿”ã—ã¾ã™ã?
168 *
169 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
170 *
171 * @og.rev 4.3.1.1 (2008/08/23) 変更å¯èƒ½ãªã‚ªãƒ–ジェクトã?å‚ç?を直接返ã•ãªã?‚ˆã?«ã—ã¾ã™ã?
172 *
173 * @return ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
174 */
175 public String[] getUpdateVals() {
176 // return updVals ;
177 return updVals.clone();
178 }
179
180 /**
181 * ãƒ?ƒªãƒ¼ãƒ?è«–ç†å‰Šé™¤) ã™ã‚‹å ´åˆã?ã‚ーé…å?ã‚’è¿”ã—ã¾ã™ã?
182 *
183 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
184 *
185 * @og.rev 4.3.7.0 (2009/06/01) æ–°è¦ä½œæ?
186 *
187 * @return ãƒ?ƒªãƒ¼ãƒˆã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
188 */
189 public String[] getLogicalDeleteKeys() {
190 return logDelKeys.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[] getLogicalDeleteVals() {
203 // return updVals ;
204 return logDelVals.clone();
205 }
206
207 /**
208 * カラãƒ?‚’è¿”ã™ã‹ã©ã?‹ã‚’決ã‚ã‚‹ãƒã‚¸ãƒ?‚¯
209 *
210 * ãƒ??ブルåよりã?ãƒã‚¸ãƒ?‚¯çš?«å°Žã出ã—ã¾ã™ã?
211 *
212 * @param table ãƒ??ブルå?
213 *
214 * @return カラãƒ?‚’è¿”ã™ã‹ã©ã?‹(true:カラãƒ?‚’生æ?/false:カラãƒ??生æ?ã—ãªã?
215 */
216 private boolean isUseClm( final String table ) {
217 boolean flag = ( table != null &&
218 table.startsWith( "UA" ) ) ;
219
220 return flag ;
221 }
222 }