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 * ã“ã?クラスã¯ã€GrowingMIS Ver6用ã®ç®¡ç?‚¯ãƒ©ã‚¹ã§ã™ã?
024 * 具体的ã«ã¯ã€?
025 * 物ç?EQ SEQxxxx (xxxxã¯ãƒ??ブルå?
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 * ã¾ãŸã? 物ç?EQã¯ã€SEQxxxx(xxxxã¯ãƒ??ブルå?å½¢å¼ã?カラãƒ?ã¨ã—ã?
040 * 値ã¯ã€SEQxxxxS01.NEXTVAL ã¨ã—ã¾ã™ã?
041 *
042 * コンストラクターã§ã¯ã€ãƒ†ãƒ¼ãƒ–ルåã?ユーザーID,ç”»é¢ID ã‚’å—ã‘å–りã¾ã™ã?
043 * 登録時刻ã¯ã€ã“ã®ã‚ªãƒ–ジェクトãŒç”Ÿæ?ã•ã‚ŒãŸæ™‚間を通常ã¯ä½¿ç”¨ã—ã¾ã™ã?
044 * ãƒ??ブルåを渡ã™ã?ã¯ã€ãƒ¯ãƒ¼ã‚¯ãªã©ã€ãƒ†ãƒ¼ãƒ–ルå˜ä½ã«å‡¦ç?™ã‚‹ã‚«ãƒ©ãƒ?Œ
045 * ç•°ãªã‚‹ã?ã§ã€ãれã¸ã®å¯¾å¿œã§ã™ã?
046 * 処ç?Œç°¡ç´?Œ–ã§ãるよã†ã«ã€ãƒ«ãƒ¼ãƒ«ã‚’è¦å®šã™ã¹ãã§ã™ã?
047 *
048 * @og.rev 5.5.1.8 (2012/04/17) æ–°è¦è¿½åŠ?
049 * @og.group �?タ登録
050 *
051 * @version 5.5
052 * @author Kazuhiko Hasegawa
053 * @since JDK7.0,
054 */
055 public class DBConstValue_VV implements DBConstValue {
056 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */
057 private static final String VERSION = "5.5.1.8 (2012/04/17)" ;
058
059 // private static final String[] MSTR_INSKEYS =
060 // new String[] { "DYSET","PGSET","PGPSET","USRSET","DYUPD","PGUPD","PGPUPD","USRUPD" };
061
062 private static final String[] MSTR_UPDKEYS =
063 new String[] { "DYUPD","PGUPD","PGPUPD","USRUPD" };
064
065 private static final String[] ZERO = new String[0] ;
066
067 private String[] insKeys = ZERO;
068 private String[] insVals = ZERO;
069
070 private String[] updKeys = ZERO;
071 private String[] updVals = ZERO;
072
073 /**
074 * åˆæœŸåŒ–æƒ…å ±ã‚’è¨å®šã—ã¾ã™ã?
075 *
076 * @param table ãƒ??ブルå?
077 * @param user ユーザーID
078 * @param gamen ç”»é¢ID
079 */
080 public void init( final String table, final String user, final String gamen ) {
081 if( isUseClm( table ) ) {
082 String userID = "'" + user + "'";
083 String gamenID = "'" + gamen + "'";
084 String timestamp = "'" + HybsSystem.getDate( "yyyyMMddHHmmss" ) + "'" ;
085 String seqID = "SEQ" + table ;
086 String seqFanc = "SEQ" + table + "S01.NEXTVAL" ;
087
088 // insKeys = MSTR_INSKEYS;
089 insKeys = new String[] { seqID, "DYSET","PGSET","PGPSET","USRSET","DYUPD","PGUPD","PGPUPD","USRUPD" };
090 insVals = new String[] {
091 seqFanc // SEQé ˜åŸŸã®é–¢æ•°
092 ,timestamp // DYSET
093 ,gamenID // PGSET
094 ,gamenID // PGPSET
095 ,userID // USRSET
096 ,timestamp // DYUPD
097 ,gamenID // PGUPD
098 ,gamenID // PGPUPD
099 ,userID // USRUPD
100 };
101
102 updKeys = MSTR_UPDKEYS;
103 updVals = new String[] {
104 timestamp // DYUPD
105 ,gamenID // PGUPD
106 ,gamenID // PGPUPD
107 ,userID // USRUPD
108 };
109 }
110 }
111
112 /**
113 * インサートã™ã‚‹å?åˆã?ã‚ーé…å?ã‚’è¿”ã—ã¾ã™ã?
114 *
115 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
116 *
117 * @return インサートã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
118 */
119 public String[] getInsertKeys() {
120 return insKeys.clone();
121 }
122
123 /**
124 * インサートã™ã‚‹å?åˆã?値é…å?ã‚’è¿”ã—ã¾ã™ã?
125 *
126 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
127 *
128 * @return インサートã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
129 */
130 public String[] getInsertVals() {
131 return insVals.clone();
132 }
133
134 /**
135 * ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?ã‚ーé…å?ã‚’è¿”ã—ã¾ã™ã?
136 *
137 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
138 *
139 * @return ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
140 */
141 public String[] getUpdateKeys() {
142 return updKeys.clone();
143 }
144
145 /**
146 * ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?値é…å?ã‚’è¿”ã—ã¾ã™ã?
147 *
148 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
149 *
150 * @return ã‚¢ãƒ??ãƒ??トã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
151 */
152 public String[] getUpdateVals() {
153 return updVals.clone();
154 }
155
156 /**
157 * ãƒ?ƒªãƒ¼ãƒ?è«–ç†å‰Šé™¤) ã™ã‚‹å ´åˆã?ã‚ーé…å?ã‚’è¿”ã—ã¾ã™ã?
158 *
159 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
160 *
161 * @return ãƒ?ƒªãƒ¼ãƒˆã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
162 */
163 public String[] getLogicalDeleteKeys() {
164 return ZERO;
165 }
166
167 /**
168 * ãƒ?ƒªãƒ¼ãƒ?è«–ç†å‰Šé™¤) ã™ã‚‹å ´åˆã?値é…å?ã‚’è¿”ã—ã¾ã™ã?
169 *
170 * æŒ?®šã?値ãŒãªã‘れã°ã€?•·ã•ゼãƒé…å?ã‚’è¿”ã—ã¾ã™ã?
171 *
172 * @return ãƒ?ƒªãƒ¼ãƒˆã™ã‚‹å?åˆã?ã‚ーé…å?(éžnull)
173 */
174 public String[] getLogicalDeleteVals() {
175 return ZERO;
176 }
177
178 /**
179 * カラãƒ?‚’è¿”ã™ã‹ã©ã?‹ã‚’決ã‚ã‚‹ãƒã‚¸ãƒ?‚¯
180 *
181 * ãƒ??ブルåãŒå˜åœ¨ã—ã¦ã?‚Œã°ã€åˆ©ç”¨å¯èƒ½ã¨åˆ¤æ–ã—ã¾ã™ã?
182 * ã“れã¯ã€å±¥æ´ãƒ??ブルãªã©ã€ã“ã®å‡¦ç?‚’使ã‚ãªã??åˆã«ã€?
183 * ãƒ??ブルåã‹ã‚‰åˆ¤å®šã™ã‚‹å?åˆã«ä½¿ã?¾ã™ã?ç¾æ™‚点ã§ã¯ã€å±¥æ´ãƒ??ブルã¯
184 * フレーãƒ?ƒ¯ãƒ¼ã‚¯å´ã§å¤‰æ›´ã™ã‚‹ã®ã§ã¯ãªãã?トリガç‰ã«ã‚ˆã‚‹è‡ªå‹•åŽé›?¨
185 * ã—ã¾ã™ã?ã§ã€åˆ¤å®šå¯¾è±¡ã¨ã—ã¦ã?¾ã›ã‚“ã€?
186 *
187 * @param table ãƒ??ブルå?
188 *
189 * @return カラãƒ?‚’è¿”ã™ã‹ã©ã?‹(true:カラãƒ?‚’生æ?/false:カラãƒ??生æ?ã—ãªã?
190 */
191 private boolean isUseClm( final String table ) {
192 boolean flag = ( table != null && table.length() > 0 ) ;
193
194 return flag ;
195 }
196 }