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.plugin.column;
017
018 import org.opengion.hayabusa.db.AbstractEditor;
019 import org.opengion.hayabusa.db.CellEditor;
020 import org.opengion.hayabusa.db.DBColumn;
021 import org.opengion.fukurou.util.XHTMLTag;
022 import org.opengion.fukurou.security.HybsCryptography ;
023
024 /**
025 * パスワード情報など?要な??の暗号化された??を編?る?合に使用するクラスです?
026 *
027 * こ?クラスの暗号化?秘?ーによる可?換なので、変換方式と秘?ーが判ると
028 * ?戻すことが可能です?それでも?何もしな?り?はるかにましです?
029 * ??タベ?ス等へ登録した暗号化された??タを編?る?合に、使用します?
030 *
031 * @og.rev 4.0.0.0 (2005/08/31) 新規作?
032 * @og.group ??タ編?
033 *
034 * @version 4.0
035 * @author Kazuhiko Hasegawa
036 * @since JDK5.0,
037 */
038 public class Editor_CRYPT extends AbstractEditor {
039 //* こ?プログラ??VERSION??を設定します? {@value} */
040 private static final String VERSION = "4.0.0.0 (2005/08/31)" ;
041
042 private final HybsCryptography licence = new HybsCryptography() ;
043
044 /**
045 * ?ォルトコンストラクター?
046 * こ?コンストラクターで、基本オブジェクトを作?します?
047 *
048 * @og.rev 3.1.1.1 (2003/04/03) ?ブジェクトから???インスタンスを返すファクトリメソ?を追??
049 *
050 */
051 public Editor_CRYPT() {
052 // 4.3.4.4 (2009/01/01)
053 // super();
054 }
055
056 /**
057 * コンストラクター?
058 *
059 * @param clm DBColumnオブジェク?
060 */
061 private Editor_CRYPT( final DBColumn clm ) {
062 super( clm );
063 tagBuffer.add( XHTMLTag.inputAttri( attributes ) );
064 }
065
066 /**
067 * ?ブジェクトから???インスタンスを返します?
068 * 自??身をキャ?ュするのか?新たに作?するのか?、各サブクラスの実?
069 * まかされます?
070 *
071 * @param clm DBColumnオブジェク?
072 *
073 * @return CellEditorオブジェク?
074 */
075 public CellEditor newInstance( final DBColumn clm ) {
076 return new Editor_CRYPT( clm );
077 }
078
079 /**
080 * ??タの編???を返します?
081 *
082 * @param value 入力?
083 *
084 * @return ??タの編???
085 */
086 @Override
087 public String getValue( final String value ) {
088 return super.getValue( licence.decrypt( value ) );
089 }
090
091 /**
092 * name属?を変えた???タ表示/編?のHTML??を作?します?
093 * ??ブル上? name に 行番号を付加して、名前_行番号 で登録するキーを作??
094 * リクエスト情報を1つ毎?フィールドで処?きます?
095 *
096 * @param row 行番号
097 * @param value 入力?
098 *
099 * @return ??タ表示/編?の??
100 */
101 @Override
102 public String getValue( final int row,final String value ) {
103 return super.getValue( row,licence.decrypt( value ) );
104 }
105 }