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.fukurou.util.ErrorMessage; 019 import org.opengion.hayabusa.db.AbstractDBType; 020 import org.opengion.hayabusa.db.DBTypeCheckUtil; 021 022 /** 023 * åŠè§?全角混在ã®ä¸?ˆ¬çš?ªåˆ¶é™ã?ãªã?Šè§’優先文å—å?を扱ã?‚ºã®ã€ã‚«ãƒ©ãƒ?±žæ?を定義ã—ã¾ã™ã? 024 * 025 * DBType_ALL ã¨ã®é•ã„ã¯ã€valueCheck ã§ã€ã‚¯ãƒã‚¹ã‚µã‚¤ãƒˆã‚¹ã‚¯ãƒªãƒ—ティングãƒã‚§ãƒ?‚¯ã‚? 026 * 行ã†ç‚ºã€?<', '>'ãªã©ã®ãƒ??ã‚¿ã¯ç™»éŒ²ã§ãã¾ã›ã‚“ã€? 027 * DBType_KX ã¨ã®é•ã„ã¯ã€ãƒ‡ãƒ•ォルト㧠IME(仮忼¢å—変æ›)㯠OFF ã«ãªã‚Šã¾ã™ã? 028 * 029 * タイプãƒã‚§ãƒ?‚¯ã¨ã—ã¦ã€ä»¥ä¸‹ã?æ¡ä»¶ã‚’判定ã—ã¾ã™ã? 030 * ・æ–?—å?é•·ã¯ã€Byteæ›ç®—ã§ã®æ–?—æ•°ã¨ã®æ¯”è¼? 031 * ・æ–?—パラメータ㮠æ£è¦è¡¨ç¾ãƒã‚§ãƒ?‚¯ 032 * ・クãƒã‚¹ã‚µã‚¤ãƒˆã‚¹ã‚¯ãƒªãƒ—ティングãƒã‚§ãƒ?‚¯ 033 * 034 * @og.group ãƒ??タ属æ? 035 * 036 * @version 4.0 037 * @author Kazuhiko Hasegawa 038 * @since JDK5.0, 039 */ 040 public class DBType_XK extends AbstractDBType { 041 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */ 042 private static final String VERSION = "5.2.2.0 (2010/11/01)" ; 043 044 /** 045 * ãƒ??ã‚¿ãŒç™»éŒ²å¯èƒ½ã‹ã©ã?‹ã‚’ãƒã‚§ãƒ?‚¯ã—ã¾ã™ã? 046 * ãƒ??ã‚¿ãŒã‚¨ãƒ©ãƒ¼ã®å ´åˆã?ã€ãã®ã‚¨ãƒ©ãƒ¼å†?®¹ã‚’è¿”ã—ã¾ã™ã? 047 * 048 * @og.rev 3.0.1.3 (2003/03/11) DBTypeCheckUtilクラスを利用ã™ã‚‹ã‚ˆã†ã«ä¿®æ£ 049 * @og.rev 3.6.0.0 (2004/09/22) dbType パラメータを引数ã«è¿½åŠ? 050 * @og.rev 5.2.2.0 (2010/11/01) 厳å¯?«ãƒã‚§ãƒ?‚¯(isStrict=true)ã™ã‚‹ãƒ•ラグを追åŠ? 051 * 052 * @param key ã‚ー 053 * @param value 値 054 * @param sizeX 整数部åˆ??æ–?—å?ã®é•·ã? 055 * @param sizeY 少数部åˆ??æ–?—å?ã®é•·ã? 056 * @param typeParam dbType パラメータ 057 * @param isStrict 厳å¯?«ãƒã‚§ãƒ?‚¯ã™ã‚‹ã‹ã©ã?‹[true:ã™ã‚‹/false:標準的] 058 * 059 * @return エラーå†?®¹ 060 */ 061 // public ErrorMessage valueCheck( final String key ,final String value , 062 // final int sizeX ,final int sizeY ,final String param ) { 063 @Override 064 public ErrorMessage valueCheck( final String key ,final String value , 065 final int sizeX ,final int sizeY ,final String typeParam ,final boolean isStrict) { 066 067 ErrorMessage msg = new ErrorMessage(); 068 if( value == null || value.length() == 0 ) { return msg; } 069 070 int len = (sizeY == 0) ? sizeX : sizeX + sizeY + 1; 071 String check = DBTypeCheckUtil.byteLengthCheck( value,len ); 072 if( check != null ) { 073 // æ–?—å?ã®é•·ã•ãŒæŒ?®šã?é•·ã•よりも長ã?§ã™ã? 074 msg.addMessage( 0,ErrorMessage.NG,"ERR0006",key,value,check,String.valueOf( len ) ); 075 } 076 077 // 3.6.0.0 (2004/09/22) dbType パラメータを使用ã—ãŸãƒžãƒƒãƒãƒã‚§ãƒ?‚¯ 078 check = DBTypeCheckUtil.matcheCheck( value,typeParam ); 079 if( check != null ) { 080 // æŒ?®šã?æ–?—以外ã?æ–?—ãŒä½¿ã‚れã¦ã?¾ã™ã? 081 msg.addMessage( 0,ErrorMessage.NG,"ERR0009", key,check ); 082 } 083 084 // クãƒã‚¹ã‚µã‚¤ãƒˆã‚¹ã‚¯ãƒªãƒ—ティング対ç–ï¼?<', '>' ã¯ç™»éŒ²ã•ã›ãªã?? 085 msg = xssCheck( key ,value, msg ); 086 return msg; 087 } 088 }