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    }