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 */ 016package 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 */ 032public 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 useViewEditable = true; // 5.1.6.0 (2010/05/01) 画面項目並べ替え対応 (変数名変更) 041 042 /** 043 * 初期情報を含んだ新規オブジェクトを作成します。 044 * 045 * @param scope スコープ [session/request] 046 * @param guikey 画面ID 047 * @param overflow 検索時にオーバーフローしたかどうか 048 * @param tableId テーブルID(DBTableModelの格納キー) 049 */ 050 public DBLastSql( final String scope, 051 final String guikey, 052 final boolean overflow, 053 final String tableId ) { 054 this.scope = scope; 055 this.guikey = guikey; 056 this.overflow = overflow; 057 this.tableId = tableId; 058 } 059 060 /** 061 * DBTableModel を出力するときのカラム名(CSV形式)をセットします。 062 * 063 * ファイルダウンロード時に、view で表示した分だけ抜き出す場合は、 064 * このカラム名を指定します。 065 * 066 * @param clmNames カラム名(CSV形式) 067 */ 068 public void setClmNames( final String clmNames ) { 069 this.clmNames = clmNames; 070 } 071 072 /** 073 * DBTableModel を出力するときのカラム名(CSV形式)を返します。 074 * 075 * ファイルダウンロード時に、view で表示した分だけ抜き出す場合は、 076 * このカラム名を指定します。 077 * 078 * @return カラム名(CSV形式) 079 */ 080 public String getClmNames() { return clmNames; } 081 082 /** 083 * スコープ(session/request)をセットします。 084 * 085 * @param scope スコープ [session/request] 086 */ 087 public void setScope( final String scope ) { this.scope = scope; } 088 089 /** 090 * スコープ(session/request)を返します。 091 * 092 * @og.rev 5.3.6.0 (2011/06/01) 新規作成 093 * 094 * @return スコープ(session/request) 095 */ 096 public String getScope() { return scope; } 097 098 /** 099 * スコープ(session/request)が、requestかどうかを返します。 100 * 101 * scope=="request" の場合は、DBTableModel は 102 * メモリに残っていませんので、 103 * 1.抜出アイコンを表示しない。 104 * 2.lastSql を利用してフルのDBTableModelを作成しなおす。 105 * 方法が考えられます。 106 * 107 * @return スコープが、requestなら、true 108 */ 109 public boolean isRequest() { return "request".equals( scope ); } 110 111 /** 112 * 画面IDを返します。 113 * 114 * この画面IDは、ファイルダウンロードアイコンの存在している 115 * 画面と同じ箇所で、作成されたかをチェックする為に使用されます。 116 * 117 * @return 画面ID 118 */ 119 public String getGuiKey() { return guikey; } 120 121 /** 122 * 内部画面IDと等しいか判定します。 123 * 124 * gamenId != null && gamenId.equals( lastSql.getGuikey() ) 125 * 処理と同等です。 126 * 127 * @param gamenId 画面ID 128 * 129 * @return 引数が null でなく、且つ内部画面キーと同じ場合は、true 130 */ 131 public boolean isGuiMatch( final String gamenId ) { 132 return gamenId != null && gamenId.equals( guikey ) ; 133 } 134 135 /** 136 * 検索時にオーバーフローしたかどうかを返します。 137 * 138 * 検索時にオーバーフローした場合、ファイルダウンロードとして、 139 * 1.そのまま、DBTableModel の分だけを抜き出す。 140 * 2.lastSql を利用してフルのDBTableModelを作成しなおす。 141 * 方法が考えられます。 142 * 143 * @return オーバーフローしたかどうか 144 */ 145 public boolean isOverflow() { return overflow; } 146 147 /** 148 * テーブルID(DBTableModelの格納キー)をセットします。 149 * 150 * DBTableModel を取り出すときに使用します。 151 * 152 * @param tableId テーブルID(DBTableModelの格納キー) 153 */ 154 public void setTableId( final String tableId ) { this.tableId = tableId; } 155 156 /** 157 * テーブルID(DBTableModelの格納キー)を返します。 158 * 159 * DBTableModel を取り出すときに使用します。 160 * 161 * @return テーブルID(DBTableModelの格納キー) 162 */ 163 public String getTableId() { return tableId; } 164 165 /** 166 * 内部テーブルID、スコープと等しいか判定します。 167 * 168 * tableId != null && tableId.equals( lastSql.getTableId() ) && 169 * scope != null && scope.equals( lastSql.scope ) 170 * 処理と同等です。 171 * 172 * @param tableId 画面ID 173 * @param scope スコープ 174 * 175 * @return 引数が null でなく、且つ内部テーブルID、スコープと同じ場合は、true 176 */ 177 public boolean isTableMatch( final String tableId, final String scope ) { 178 return tableId != null && tableId.equals( this.tableId ) 179 && scope != null && scope.equals( this.scope ) ; 180 } 181 182 /** 183 * DBTableModel を出力するときのカラム名(CSV形式)をセットします。 184 * 185 * 画面項目並び替え時に、view で表示した分だけ抜き出す場合は、 186 * このカラム名を指定します。 187 * 188 * 左右分割などでViewが複数存在する場合は、'|'を区切り文字としてそれぞれのViewの 189 * カラム一覧がセットします。 190 * 例) AAA,BBB,CCC|DDD,EEE 191 * 192 * @og.rev 5.1.6.0 (2010/05/01) 新規作成 193 * 194 * @param clmNames カラム名(CSV形式+|) 195 */ 196 public void setViewClmNames( final String clmNames ) { 197 this.viewClmNames = clmNames; 198 } 199 200 /** 201 * DBTableModel を出力するときのカラム名(CSV形式)を返します。 202 * 203 * 画面項目並び替え時に、view で表示した分だけ抜き出す場合は、 204 * このカラム名を指定します。 205 * 206 * 左右分割などでViewが複数存在する場合は、'|'を区切り文字としてそれぞれのViewの 207 * カラム一覧がセットされています。 208 * 例) AAA,BBB,CCC|DDD,EEE 209 * 210 * @og.rev 5.1.6.0 (2010/05/01) 新規作成 211 * 212 * @return カラム名(CSV形式+|) 213 */ 214 public String getViewClmNames() { return viewClmNames; } 215 216 /** 217 * ユーザーによる画面項目の並び替えを禁止します。 218 */ 219 public void setViewNotEditable() { this.useViewEditable = false; } 220 221 /** 222 * ユーザーによる画面項目の並び替えをが禁止されているかどうかを返します。 223 * 224 * @return ユーザーによる画面項目の並び替えをが禁止されているかどうか 225 */ 226 public boolean isViewEditable() { return useViewEditable; } 227}