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            private String  orgClmNames = null; // 5.8.2.0 (2014/12/05) 
040    
041    //      private boolean isViewEditable  =       true;   // 5.1.6.0 (2010/05/01) 画面é ?›®並べ替え対å¿?
042            private boolean useViewEditable =       true;   // 5.1.6.0 (2010/05/01) 画面é ?›®並べ替え対å¿?(変数名変更)
043    
044            /**
045             * 初期æƒ??を含んだ新規オブジェクトを作æ?しますã?
046             *
047             * @param    scope     スコーãƒ?[session/request]
048             * @param    guikey    画面ID
049             * @param    overflow  検索時にオーバã?フローしたかどã�?�‹
050             * @param    tableId   ãƒ??ブルID(DBTableModelの格納キー)
051             */
052            public DBLastSql( final String scope,
053                                                    final String guikey,
054                                                    final boolean overflow,
055                                                    final String tableId ) {
056                    this.scope              = scope;
057                    this.guikey             = guikey;
058                    this.overflow   = overflow;
059                    this.tableId    = tableId;
060            }
061    
062            /**
063             * DBTableModel をå?力するときã?カラãƒ?��(CSV形å¼?をセãƒ?ƒˆしますã?
064             *
065             * ファイルãƒ?‚¦ンロード時に、view で表示したåˆ?� け抜きå?すå?合ã?ã€?
066             * こã?カラãƒ?��を指定しますã?
067             *
068             * @param    clmNames カラãƒ?��(CSV形å¼?
069             */
070            public void setClmNames( final String clmNames ) {
071                    this.clmNames = clmNames;
072            }
073    
074            /**
075             *  DBTableModel をå?力するときã?カラãƒ?��(CSV形å¼?を返しますã?
076             *
077             * ファイルãƒ?‚¦ンロード時に、view で表示したåˆ?� け抜きå?すå?合ã?ã€?
078             * こã?カラãƒ?��を指定しますã?
079             *
080             * @return      カラãƒ?��(CSV形å¼?
081             */
082            public String getClmNames() { return clmNames; }
083    
084            /**
085             * スコーãƒ?session/request)をセãƒ?ƒˆしますã?
086             *
087             * @param scope スコーãƒ?[session/request]
088             */
089            public void setScope( final String scope ) { this.scope = scope; }
090    
091            /**
092             * スコーãƒ?session/request)を返しますã?
093             *
094             * @og.rev 5.3.6.0 (2011/06/01) 新規作æ?
095             *
096             * @return      スコーãƒ?session/request)
097             */
098            public String getScope() { return scope; }
099    
100            /**
101             * スコーãƒ?session/request)がã?requestかどã�?�‹を返しますã?
102             *
103             * scope=="request" の場合ã?、DBTableModel は
104             * メモリに残ってã�?�¾せんのでã€?
105             * ?‘.抜出アイコンを表示しなã�??
106             * ?’.lastSql を利用してフルのDBTableModelを作æ?しなおすã€?
107             * 方法がè€?�ˆられますã?
108             *
109             * @return      スコープが、requestならã?true
110             */
111            public boolean isRequest() { return "request".equals( scope ); }
112    
113            /**
114             * 画面IDを返しますã?
115             *
116             * こã?画面IDは、ファイルãƒ?‚¦ンロードアイコンの存在してã�?‚‹
117             * 画面と同じç®?‰€で、作æ?されたかをチェãƒ?‚¯する為に使用されますã?
118             *
119             * @return      画面ID
120             */
121            public String getGuiKey() { return guikey; }
122    
123            /**
124             * å†?ƒ¨画面IDと等しã�?�‹判定しますã?
125             *
126             * gamenId != null && gamenId.equals( lastSql.getGuikey() )
127             * 処ç�?�¨同等ですã?
128             *
129             * @param  gamenId 画面ID
130             *
131             * @return      引数ã�?null でなくã?且つå†?ƒ¨画面キーと同じ場合ã?、true
132             */
133            public boolean isGuiMatch( final String gamenId ) {
134                    return ( gamenId != null && gamenId.equals( guikey ) );
135            }
136    
137            /**
138             * 検索時にオーバã?フローしたかどã�?�‹を返しますã?
139             *
140             * 検索時にオーバã?フローした場合ã?ファイルãƒ?‚¦ンロードとしてã€?
141             * ?‘.そのまま、DBTableModel のåˆ?� けを抜き出すã?
142             * ?’.lastSql を利用してフルのDBTableModelを作æ?しなおすã€?
143             * 方法がè€?�ˆられますã?
144             *
145             * @return  オーバã?フローしたかどã�?�‹
146             */
147            public boolean isOverflow() { return overflow; }
148    
149            /**
150             *  ãƒ??ブルID(DBTableModelの格納キー)をセãƒ?ƒˆしますã?
151             *
152             * DBTableModel を取りå?すときに使用しますã?
153             *
154             * @param       tableId ãƒ??ブルID(DBTableModelの格納キー)
155             */
156            public void setTableId( final String tableId ) { this.tableId = tableId; }
157    
158            /**
159             *  ãƒ??ブルID(DBTableModelの格納キー)を返しますã?
160             *
161             * DBTableModel を取りå?すときに使用しますã?
162             *
163             * @return      ãƒ??ブルID(DBTableModelの格納キー)
164             */
165            public String getTableId() { return tableId; }
166    
167            /**
168             * å†?ƒ¨ãƒ??ブルID、スコープと等しã�?�‹判定しますã?
169             *
170             * tableId != null && tableId.equals( lastSql.getTableId() ) &&
171             * scope   != null && scope.equals( lastSql.scope )
172             * 処ç�?�¨同等ですã?
173             *
174             * @param  tableId 画面ID
175             * @param  scope   スコーãƒ?
176             *
177             * @return      引数ã�?null でなくã?且つå†?ƒ¨ãƒ??ブルID、スコープと同じ場合ã?、true
178             */
179            public boolean isTableMatch( final String tableId, final String scope ) {
180                    return ( tableId != null && tableId.equals( this.tableId ) ) &&
181                                    ( scope != null && scope.equals( this.scope ) );
182            }
183    
184            /**
185             * DBTableModel をå?力するときã?カラãƒ?��(CSV形å¼?をセãƒ?ƒˆしますã?
186             *
187             * 画面é ?›®並び替え時に、view で表示したåˆ?� け抜きå?すå?合ã?ã€?
188             * こã?カラãƒ?��を指定しますã?
189             *
190             * 左右åˆ?‰²などでViewがè¤?•°存在する場合ã?ã€?|'を区åˆ?‚Šæ–?­—としてそれぞれのViewの
191             * カラãƒ?¸?¦§がセãƒ?ƒˆしますã?
192             *  ä¾? AAA,BBB,CCC|DDD,EEE
193             *
194             * @og.rev 5.1.6.0 (2010/05/01) 新規作æ?
195             *
196             * @param    clmNames カラãƒ?��(CSV形å¼?|)
197             */
198            public void setViewClmNames( final String clmNames ) {
199                    this.viewClmNames = clmNames;
200            }
201    
202            /**
203             *  DBTableModel をå?力するときã?カラãƒ?��(CSV形å¼?を返しますã?
204             *
205             * 画面é ?›®並び替え時に、view で表示したåˆ?� け抜きå?すå?合ã?ã€?
206             * こã?カラãƒ?��を指定しますã?
207             *
208             * 左右åˆ?‰²などでViewがè¤?•°存在する場合ã?ã€?|'を区åˆ?‚Šæ–?­—としてそれぞれのViewの
209             * カラãƒ?¸?¦§がセãƒ?ƒˆされてã�?�¾すã?
210             *  ä¾? AAA,BBB,CCC|DDD,EEE
211             *
212             * @og.rev 5.1.6.0 (2010/05/01) 新規作æ?
213             *
214             * @return      カラãƒ?��(CSV形å¼?|)
215             */
216            public String getViewClmNames() { return viewClmNames; }
217    
218            /**
219             * DBTableModel をå?力するときã?オリジナルのカラãƒ?��(CSV形å¼?をセãƒ?ƒˆしますã?
220             *
221             * 画面é ?›®並び替え時に、view で表示したåˆ?� け抜きå?すカラãƒ?�¨比è¼?�™ることでã€?
222             * カラãƒ??変動をチェãƒ?‚¯できますã?
223             *
224             * 書式ã?ã€?!)ã‚??(|)を含まなã�??カラãƒ??CSV形式ですã?
225             *
226             * @og.rev 5.8.2.0 (2014/12/05)
227             *
228             * @param       clmNames オリジナルのカラãƒ?��(CSV形å¼?
229             * @see         #getOrgClmNames()
230             */
231            public void setOrgClmNames( final String clmNames ) {
232                    this.orgClmNames = clmNames;
233            }
234    
235            /**
236             *  DBTableModel をå?力するときã?オリジナルのカラãƒ?��(CSV形å¼?を返しますã?
237             *
238             * 画面é ?›®並び替え時に、view で表示したåˆ?� け抜きå?すカラãƒ?�¨比è¼?�™ることでã€?
239             * カラãƒ??変動をチェãƒ?‚¯できますã?
240             *
241             * 書式ã?ã€?!)ã‚??(|)を含まなã�??カラãƒ??CSV形式ですã?
242             *
243             * @og.rev 5.8.2.0 (2014/12/05)
244             *
245             * @return      オリジナルのカラãƒ?��(CSV形å¼?
246             * @see         #setOrgClmNames( String )
247             */
248            public String getOrgClmNames() { return orgClmNames; }
249            
250            /**
251             * ユーザーによる画面é ?›®の並び替えを禁止しますã?
252             */
253            public void setViewNotEditable() { this.useViewEditable = false; }
254    
255            /**
256             * ユーザーによる画面é ?›®の並び替えをが禁止されてã�?‚‹かどã�?�‹を返しますã?
257             *
258             * @return      ユーザーによる画面é ?›®の並び替えをが禁止されてã�?‚‹かどã�?�‹
259             */
260            public boolean isViewEditable() { return useViewEditable; }
261    }