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.hayabusa.db;
017    
018    /**
019     * ファイルãƒ?‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰ã‚¢ã‚¤ã‚³ãƒ³å‡¦ç?«å¿?¦ãªæƒ??ã‚’æ?ç´ã—ã¦ãŠã
020     * ãƒ??タ管ç?‚¯ãƒ©ã‚¹ã§ã™ã?
021     * fileUD ã‚¿ã‚°ã‹ã‚‰ã€common/fileDownload.jsp ã«å‡¦ç?Œé·ç§»ã—ã¾ã™ãŒã€?
022     * ãã?é–“ã?DBTableModel ãŒæŒ‡å®šã?ç”»é¢ã§ä½œæ?ã•れãŸã‹ã€ã¾ãŸã?view ã§
023     * æŒ?®šã•れãŸã‚«ãƒ©ãƒ??ã¿ã‚’抜ãå?ã—ã¦ã?‚‹ã‹ã?スコープã?ã€ãªã©ã®
024     * ãƒã‚§ãƒ?‚¯ã‚’行ã„ã¾ã™ã?
025     *
026     * @og.rev 4.3.0.0 (2008/07/04) æ–°è¦è¿½åŠ?
027     *
028     * @version  4.0
029     * @author   Kazuhiko Hasegawa
030     * @since    JDK5.0,
031     */
032    public class DBLastSql  {
033            private String  scope   = null;
034            private final String  guikey ;          // 4.3.1.1 (2008/08/23) final�
035            private final boolean overflow ;        // 4.3.1.1 (2008/08/23) final�
036            private String  tableId = null;
037            private String  clmNames= null;
038            private String  viewClmNames= null;     // 5.1.6.0 (2010/05/01) ç”»é¢é ?›®ä¸¦ã¹æ›¿ãˆå¯¾å¿?
039    
040    //      private boolean isViewEditable  =       true;   // 5.1.6.0 (2010/05/01) ç”»é¢é ?›®ä¸¦ã¹æ›¿ãˆå¯¾å¿?
041            private boolean useViewEditable =       true;   // 5.1.6.0 (2010/05/01) ç”»é¢é ?›®ä¸¦ã¹æ›¿ãˆå¯¾å¿?(変数å変更)
042    
043            /**
044             * åˆæœŸæƒ??ã‚’å«ã‚“ã æ–°è¦ã‚ªãƒ–ジェクトを作æ?ã—ã¾ã™ã?
045             *
046             * @param    scope     スコー�[session/request]
047             * @param    guikey    ç”»é¢ID
048             * @param    overflow  検索時ã«ã‚ªãƒ¼ãƒã?フローã—ãŸã‹ã©ã?‹
049             * @param    tableId   ãƒ??ブルID(DBTableModelã®æ ¼ç´ã‚­ãƒ¼)
050             */
051            public DBLastSql( final String scope,
052                                                    final String guikey,
053                                                    final boolean overflow,
054                                                    final String tableId ) {
055                    this.scope              = scope;
056                    this.guikey             = guikey;
057                    this.overflow   = overflow;
058                    this.tableId    = tableId;
059            }
060    
061            /**
062             * DBTableModel ã‚’å?力ã™ã‚‹ã¨ãã?カラãƒ?(CSVå½¢å¼?ã‚’ã‚»ãƒ?ƒˆã—ã¾ã™ã?
063             *
064             * ファイルãƒ?‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰æ™‚ã«ã€view ã§è¡¨ç¤ºã—ãŸåˆ? ã‘抜ãå?ã™å?åˆã?ã€?
065             * ã“ã?カラãƒ?を指定ã—ã¾ã™ã?
066             *
067             * @param    clmNames カラ�(CSV形�
068             */
069            public void setClmNames( final String clmNames ) {
070                    this.clmNames = clmNames;
071            }
072    
073            /**
074             *  DBTableModel ã‚’å?力ã™ã‚‹ã¨ãã?カラãƒ?(CSVå½¢å¼?ã‚’è¿”ã—ã¾ã™ã?
075             *
076             * ファイルãƒ?‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰æ™‚ã«ã€view ã§è¡¨ç¤ºã—ãŸåˆ? ã‘抜ãå?ã™å?åˆã?ã€?
077             * ã“ã?カラãƒ?を指定ã—ã¾ã™ã?
078             *
079             * @return      カラ�(CSV形�
080             */
081            public String getClmNames() { return clmNames; }
082    
083            /**
084             * スコーãƒ?session/request)ã‚’ã‚»ãƒ?ƒˆã—ã¾ã™ã?
085             *
086             * @param scope スコー�[session/request]
087             */
088            public void setScope( final String scope ) { this.scope = scope; }
089    
090            /**
091             * スコーãƒ?session/request)ã‚’è¿”ã—ã¾ã™ã?
092             *
093             * @og.rev 5.3.6.0 (2011/06/01) æ–°è¦ä½œæ?
094             *
095             * @return      スコー�session/request)
096             */
097            public String getScope() { return scope; }
098    
099            /**
100             * スコーãƒ?session/request)ãŒã?requestã‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
101             *
102             * scope=="request" ã®å ´åˆã?ã€DBTableModel ã¯
103             * ãƒ¡ãƒ¢ãƒªã«æ®‹ã£ã¦ã?¾ã›ã‚“ã®ã§ã€?
104             * ?‘.抜出アイコンを表示ã—ãªã??
105             * ?’.lastSql を利用ã—ã¦ãƒ•ルã®DBTableModelを作æ?ã—ãªãŠã™ã€?
106             * 方法ãŒè€?ˆã‚‰ã‚Œã¾ã™ã?
107             *
108             * @return      スコープãŒã€requestãªã‚‰ã?true
109             */
110            public boolean isRequest() { return "request".equals( scope ); }
111    
112            /**
113             * ç”»é¢IDã‚’è¿”ã—ã¾ã™ã?
114             *
115             * ã“ã?ç”»é¢IDã¯ã€ãƒ•ァイルãƒ?‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰ã‚¢ã‚¤ã‚³ãƒ³ã®å­˜åœ¨ã—ã¦ã?‚‹
116             * ç”»é¢ã¨åŒã˜ç®?‰€ã§ã€ä½œæ?ã•れãŸã‹ã‚’ãƒã‚§ãƒ?‚¯ã™ã‚‹ç‚ºã«ä½¿ç”¨ã•れã¾ã™ã?
117             *
118             * @return      ç”»é¢ID
119             */
120            public String getGuiKey() { return guikey; }
121    
122            /**
123             * å†?ƒ¨ç”»é¢IDã¨ç­‰ã—ã?‹åˆ¤å®šã—ã¾ã™ã?
124             *
125             * gamenId != null && gamenId.equals( lastSql.getGuikey() )
126             * 処ç?¨åŒç­‰ã§ã™ã?
127             *
128             * @param  gamenId ç”»é¢ID
129             *
130             * @return      引数ã?null ã§ãªãã?且ã¤å†?ƒ¨ç”»é¢ã‚­ãƒ¼ã¨åŒã˜å ´åˆã?ã€true
131             */
132            public boolean isGuiMatch( final String gamenId ) {
133                    return ( gamenId != null && gamenId.equals( guikey ) );
134            }
135    
136            /**
137             * 検索時ã«ã‚ªãƒ¼ãƒã?フローã—ãŸã‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
138             *
139             * 検索時ã«ã‚ªãƒ¼ãƒã?フローã—ãŸå ´åˆã?ファイルãƒ?‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰ã¨ã—ã¦ã€?
140             * ?‘.ãã®ã¾ã¾ã€DBTableModel ã®åˆ? ã‘を抜ã出ã™ã?
141             * ?’.lastSql を利用ã—ã¦ãƒ•ルã®DBTableModelを作æ?ã—ãªãŠã™ã€?
142             * 方法ãŒè€?ˆã‚‰ã‚Œã¾ã™ã?
143             *
144             * @return  オーãƒã?フローã—ãŸã‹ã©ã?‹
145             */
146            public boolean isOverflow() { return overflow; }
147    
148            /**
149             *  ãƒ??ブルID(DBTableModelã®æ ¼ç´ã‚­ãƒ¼)ã‚’ã‚»ãƒ?ƒˆã—ã¾ã™ã?
150             *
151             * DBTableModel ã‚’å–りå?ã™ã¨ãã«ä½¿ç”¨ã—ã¾ã™ã?
152             *
153             * @param       tableId ãƒ??ブルID(DBTableModelã®æ ¼ç´ã‚­ãƒ¼)
154             */
155            public void setTableId( final String tableId ) { this.tableId = tableId; }
156    
157            /**
158             *  ãƒ??ブルID(DBTableModelã®æ ¼ç´ã‚­ãƒ¼)ã‚’è¿”ã—ã¾ã™ã?
159             *
160             * DBTableModel ã‚’å–りå?ã™ã¨ãã«ä½¿ç”¨ã—ã¾ã™ã?
161             *
162             * @return      ãƒ??ブルID(DBTableModelã®æ ¼ç´ã‚­ãƒ¼)
163             */
164            public String getTableId() { return tableId; }
165    
166            /**
167             * å†?ƒ¨ãƒ??ブルIDã€ã‚¹ã‚³ãƒ¼ãƒ—ã¨ç­‰ã—ã?‹åˆ¤å®šã—ã¾ã™ã?
168             *
169             * tableId != null && tableId.equals( lastSql.getTableId() ) &&
170             * scope   != null && scope.equals( lastSql.scope )
171             * 処ç?¨åŒç­‰ã§ã™ã?
172             *
173             * @param  tableId ç”»é¢ID
174             * @param  scope   スコー�
175             *
176             * @return      引数ã?null ã§ãªãã?且ã¤å†?ƒ¨ãƒ??ブルIDã€ã‚¹ã‚³ãƒ¼ãƒ—ã¨åŒã˜å ´åˆã?ã€true
177             */
178            public boolean isTableMatch( final String tableId, final String scope ) {
179                    return ( tableId != null && tableId.equals( this.tableId ) ) &&
180                                    ( scope != null && scope.equals( this.scope ) );
181            }
182    
183            /**
184             * DBTableModel ã‚’å?力ã™ã‚‹ã¨ãã?カラãƒ?(CSVå½¢å¼?ã‚’ã‚»ãƒ?ƒˆã—ã¾ã™ã?
185             *
186             * ç”»é¢é ?›®ä¸¦ã³æ›¿ãˆæ™‚ã«ã€view ã§è¡¨ç¤ºã—ãŸåˆ? ã‘抜ãå?ã™å?åˆã?ã€?
187             * ã“ã?カラãƒ?を指定ã—ã¾ã™ã?
188             *
189             * å·¦å³åˆ?‰²ãªã©ã§ViewãŒè¤?•°å­˜åœ¨ã™ã‚‹å ´åˆã?ã€?|'を区åˆ?‚Šæ–?­—ã¨ã—ã¦ãれãžã‚Œã®Viewã®
190             * カラãƒ?¸?¦§ãŒã‚»ãƒ?ƒˆã—ã¾ã™ã?
191             *  ä¾? AAA,BBB,CCC|DDD,EEE
192             *
193             * @og.rev 5.1.6.0 (2010/05/01) æ–°è¦ä½œæ?
194             *
195             * @param    clmNames カラ�(CSV形�|)
196             */
197            public void setViewClmNames( final String clmNames ) {
198                    this.viewClmNames = clmNames;
199            }
200    
201            /**
202             *  DBTableModel ã‚’å?力ã™ã‚‹ã¨ãã?カラãƒ?(CSVå½¢å¼?ã‚’è¿”ã—ã¾ã™ã?
203             *
204             * ç”»é¢é ?›®ä¸¦ã³æ›¿ãˆæ™‚ã«ã€view ã§è¡¨ç¤ºã—ãŸåˆ? ã‘抜ãå?ã™å?åˆã?ã€?
205             * ã“ã?カラãƒ?を指定ã—ã¾ã™ã?
206             *
207             * å·¦å³åˆ?‰²ãªã©ã§ViewãŒè¤?•°å­˜åœ¨ã™ã‚‹å ´åˆã?ã€?|'を区åˆ?‚Šæ–?­—ã¨ã—ã¦ãれãžã‚Œã®Viewã®
208             * カラãƒ?¸?¦§ãŒã‚»ãƒ?ƒˆã•れã¦ã?¾ã™ã?
209             *  ä¾? AAA,BBB,CCC|DDD,EEE
210             *
211             * @og.rev 5.1.6.0 (2010/05/01) æ–°è¦ä½œæ?
212             *
213             * @return      カラ�(CSV形�|)
214             */
215            public String getViewClmNames() { return viewClmNames; }
216    
217            /**
218             * ユーザーã«ã‚ˆã‚‹ç”»é¢é ?›®ã®ä¸¦ã³æ›¿ãˆã‚’ç¦æ­¢ã—ã¾ã™ã?
219             */
220            public void setViewNotEditable() { this.useViewEditable = false; }
221    
222            /**
223             * ユーザーã«ã‚ˆã‚‹ç”»é¢é ?›®ã®ä¸¦ã³æ›¿ãˆã‚’ãŒç¦æ­¢ã•れã¦ã?‚‹ã‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
224             *
225             * @return      ユーザーã«ã‚ˆã‚‹ç”»é¢é ?›®ã®ä¸¦ã³æ›¿ãˆã‚’ãŒç¦æ­¢ã•れã¦ã?‚‹ã‹ã©ã?‹
226             */
227            public boolean isViewEditable() { return useViewEditable; }
228    }