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.plugin.table; 017 018import org.opengion.fukurou.system.OgBuilder ; // 6.4.4.1 (2016/03/18) 019 020/** 021 * TableFilter_SEQUENCE_POSTGRES は、TableUpda インターフェースを継承した、DBTableModel 処理用の 022 * 実装クラスです。 023 * 024 * ここでは、シーケンス一覧の検索結果より、GF09 のシーケンス定義テーブルから 025 * 必要な情報を取得し、シーケンス作成スクリプトを作成します。 026 * 027 * この処理を実行するには、DBTableModelのカラムとして、 028 * SEQNAME,INCREBY,STARTVAL,MINVAL,MAXVAL,FGCYCLE,SUCACHE 029 * が必要です。 030 * 031 * ※PostgreSQLに対して生成されるスクリプトでは、SUCACHEは無視されます。 032 * 033 * @og.rev 5.1.9.0 (2010/08/01) DB定義DB・シーケンス定義追加 034 * @og.rev 6.5.0.0 (2016/09/30) クラス名変更(TableFilter_SEQUENCE_POSGRE → TableFilter_SEQUENCE_POSTGRES) 035 * 036 * @version 6.5.0 2000/10/17 037 * @author Kazuhiko Hasegawa 038 * @since JDK1.8, 039 */ 040public class TableFilter_SEQUENCE_POSTGRES extends TableFilter_SEQUENCE { 041 /** このプログラムのVERSION文字列を設定します。 {@value} */ 042 private static final String VERSION = "6.5.0.0 (2016/09/30)" ; 043 044 /** 045 * デフォルトコンストラクター 046 * 047 * @og.rev 6.4.2.0 (2016/01/29) PMD refactoring. Each class should declare at least one constructor. 048 * @og.rev 6.5.0.0 (2016/09/30) クラス名変更(TableFilter_SEQUENCE_POSGRE → TableFilter_SEQUENCE_POSTGRES) 049 */ 050 public TableFilter_SEQUENCE_POSTGRES() { super(); } // これも、自動的に呼ばれるが、空のメソッドを作成すると警告されるので、明示的にしておきます。 051 052 /** 053 * シーケンス作成の処理を実行します。 054 * 055 * @og.rev 6.0.2.3 (2014/10/10) isXml で、CR + EXEC_END_TAG のキャッシュ(execEndTag)を利用します。 056 * @og.rev 6.4.4.1 (2016/03/18) StringBuilderの代わりに、OgBuilderを使用する。 057 * 058 * @param clmNo カラム番号配列 059 * @param data 1行分のデータ配列 060 * 061 * @return シーケンス作成 062 * @og.rtnNotNull 063 */ 064 @Override 065 protected String makeLineList( final int[] clmNo,final String[] data ) { 066 return new OgBuilder() 067 .appendIfCR( isXml , EXEC_START_TAG ) 068 .appendCR( "CREATE SEQUENCE " , data[clmNo[SEQNAME]] ) 069 .append( " INCREMENT " , data[clmNo[INCREBY]] ) 070 .append( " MINVALUE " , data[clmNo[MINVAL]] ) 071 .append( " MAXVALUE " , data[clmNo[MAXVAL]] ) 072 .append( " START " , data[clmNo[STARTVAL]] ) 073 .appendIf( "1".equals( data[clmNo[FGCYCLE]] ) , " CYCLE" ) 074 .append( execEndTag ) 075 .toString(); 076 } 077}