svnno****@sourc*****
svnno****@sourc*****
2009年 2月 23日 (月) 22:27:35 JST
Revision: 2721 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2721 Author: daisuke_m Date: 2009-02-23 22:27:35 +0900 (Mon, 23 Feb 2009) Log Message: ----------- 不要クラス削除。 / テスト拡充。 / refactor Modified Paths: -------------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultTokenResolver.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericReservedWords.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetDependentEntitiesProcessor.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/ProvideAttributeNameProcessor.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/sql/Operator.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/JmStringUtilTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ColumnUtilTest.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/connection/ConnectionAdapterImpl.java Added Paths: ----------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtil.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/DefaultTokenResolverTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/ListUtilTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/AttributeUtilTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ForeignKeyUtilTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/RootModelUtilTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/TableUtilTest.java Removed Paths: ------------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetDataSetProcessor.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetMappingProcessor.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/SetRecordProcessor.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtils.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -256,7 +256,6 @@ addColumnList(tokens, fkModel.getReferenceColumns(), referenceResolver); if (fkModel.getMatchType() != null) { - tokens.add(Keyword.MATCH); tokens.addAll(tokenResolver.resolve(fkModel.getMatchType())); } if (fkModel.getOnDelete() != null) { @@ -276,7 +275,6 @@ } tokens.add(Keyword.DEFERRABLE); if (deferrability.getInitiallyCheckTime() != null) { - tokens.add(Keyword.INITIALLY); tokens.addAll(tokenResolver.resolve(deferrability.getInitiallyCheckTime())); } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultTokenResolver.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultTokenResolver.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultTokenResolver.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -35,21 +35,26 @@ public class DefaultTokenResolver implements TokenResolver { public List<Token> resolve(Object value) { - List<Token> tokens = CollectionsUtil.newArrayList(1); + List<Token> tokens = CollectionsUtil.newArrayList(2); if (value instanceof InitiallyCheckTime) { InitiallyCheckTime initiallyCheckTime = (InitiallyCheckTime) value; if (initiallyCheckTime == InitiallyCheckTime.IMMEDIATE) { + tokens.add(Keyword.INITIALLY); tokens.add(Keyword.IMMEDIATE); } else if (initiallyCheckTime == InitiallyCheckTime.DEFERRED) { + tokens.add(Keyword.INITIALLY); tokens.add(Keyword.DEFERRED); } } else if (value instanceof MatchType) { MatchType matchType = (MatchType) value; if (matchType == MatchType.SIMPLE) { + tokens.add(Keyword.MATCH); tokens.add(Keyword.SIMPLE); } else if (matchType == MatchType.FULL) { + tokens.add(Keyword.MATCH); tokens.add(Keyword.FULL); } else if (matchType == MatchType.PARTIAL) { + tokens.add(Keyword.MATCH); tokens.add(Keyword.PARTIAL); } } else if (value instanceof ReferentialAction) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericReservedWords.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericReservedWords.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericReservedWords.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -18,7 +18,8 @@ */ package org.jiemamy.dialect.generic; -import org.apache.commons.lang.ArrayUtils; +import java.util.Arrays; +import java.util.List; import org.jiemamy.dialect.validator.ReservedWordsProvider; @@ -28,1061 +29,142 @@ */ public class GenericReservedWords implements ReservedWordsProvider { - private static final String[] RESERVED_WORDS = { - "ABSOLUTE", - "ACCESS", - "ACCESSIBLE", - "ACCOUNT", - "ACTION", - "ACTIVATE", - "ACTIVE", - "ADA", - "ADD", - "ADMIN", - "ADVISE", - "AFTER", - "AGGREGATE", - "ALIAS", - "ALL", - "ALL_ROWS", - "ALLOCATE", - "ALLOW", - "ALTER", - "ANALYSE", - "ANALYZE", - "AND", - "ANY", - "APPLICATION", - "ARCHIVE", - "ARCHIVELOG", - "ARE", - "ARRAY", - "AS", - "ASC", - "ASCENDING", - "ASENSITIVE", - "ASSERTION", - "ASSOCIATE", - "ASUTIME", - "ASYMMETRIC", - "AT", - "ATTACH", - "AUDIT", - "AUTHENTICATED", - "AUTHORIZATION", - "AUTO", - "AUTODDL", - "AUTOEXTEND", - "AUTOMATIC", - "AUX", - "AUXILIARY", - "AVG", - "BACKUP", - "BASE_NAME", - "BASED", - "BASENAME", - "BECOME", - "BEFORE", - "BEGIN", - "BETWEEN", - "BFILE", - "BIGINT", - "BINARY", - "BIT", - "BIT_LENGTH", - "BITMAP", - "BLOB", - "BLOBEDIT", - "BLOCK", - "BODY", - "BOOLEAN", - "BOTH", - "BOTTOM", - "BREADTH", - "BREAK", - "BROWSE", - "BUFFER", - "BUFFERPOOL", - "BULK", - "BY", - "CACHE", - "CACHE_INSTANCES", - "CALL", - "CALLED", - "CANCEL", - "CAPABILITY", - "CAPTURE", - "CARDINALITY", - "CASCADE", - "CASCADED", - "CASE", - "CAST", - "CATALOG", - "CCSID", - "CFILE", - "CHAINED", - "CHANGE", - "CHAR", - "CHAR_CONVERT", - "CHAR_CS", - "CHAR_LENGTH", - "CHARACTER", - "CHARACTER_LENGTH", - "CHECK", - "CHECK_POINT_LEN", - "CHECK_POINT_LENGTH", - "CHECKPOINT", - "CHOOSE", - "CHUNK", - "CLASS", - "CLEAR", - "CLOB", - "CLONE", - "CLOSE", - "CLOSE_CACHED_OPEN_CURSORS", - "CLUSTER", - "CLUSTERED", - "COALESCE", - "COLLATE", - "COLLATION", - "COLLECTION", - "COLLID", - "COLUMN", - "COLUMNS", - "COMMENT", - "COMMIT", - "COMMITTED", - "COMPATIBILITY", - "COMPILE", - "COMPILETIME", - "COMPLETE", - "COMPLETION", - "COMPOSITE_LIMIT", - "COMPRESS", - "COMPRESSED", - "COMPUTE", - "COMPUTED", - "CONCAT", - "CONDITION", - "CONDITIONAL", - "CONFLICT", - "CONNECT", - "CONNECT_TIME", - "CONNECTION", - "CONSTRAINT", - "CONSTRAINTS", - "CONSTRUCTOR", - "CONTAINING", - "CONTAINS", - "CONTAINSTABLE", - "CONTENTS", - "CONTINUE", - "CONTROLFILE", - "CONVERT", - "CORRESPONDING", - "COST", - "COUNT", - "COUNT_BIG", - "CPU_PER_CALL", - "CPU_PER_SESSION", - "CREATE", - "CROSS", - "CSTRING", - "CUBE", - "CURREN_USER", - "CURRENT", - "CURRENT_DATE", - "CURRENT_LC_CTYPE", - "CURRENT_PATH", - "CURRENT_ROLE", - "CURRENT_SCHEMA", - "CURRENT_SERVER", - "CURRENT_TIME", - "CURRENT_TIMESTAMP", - "CURRENT_TIMEZONE", - "CURRENT_USER", - "CURSOR", - "CYCLE", - "DANGLING", - "DATA", - "DATABASE", - "DATABASES", - "DATAFILE", - "DATAFILES", - "DATAOBJNO", - "DATE", - "DAY", - "DAY_HOUR", - "DAY_MICROSECOND", - "DAY_MINUTE", - "DAY_SECOND", - "DAYS", - "DB_KEY", - "DB2GENERAL", - "DB2GENRL", - "DB2SQL", - "DBA", - "DBCC", - "DBHIGH", - "DBINFO", - "DBLOW", - "DBMAC", - "DBSPACE", - "DEALLOCATE", - "DEBUG", - "DEC", - "DECIMAL", - "DECLARE", - "DEFAULT", - "DEFAULTS", - "DEFERRABLE", - "DEFERRED", - "DEFINITION", - "DEGREE", - "DELAYED", - "DELETE", - "DELETING", - "DENY", - "DEPTH", - "DEREF", - "DESC", - "DESCENDING", - "DESCRIBE", - "DESCRIPTOR", - "DESTROY", - "DESTRUCTOR", - "DETACH", - "DETERMINISTIC", - "DIAGNOSTICS", - "DICTIONARY", - "DIRECTORY", - "DISABLE", - "DISALLOW", - "DISCONNECT", - "DISK", - "DISMOUNT", - "DISPLAY", - "DISTINCT", - "DISTINCTROW", - "DISTRIBUTED", - "DIV", - "DML", - "DO", - "DOMAIN", - "DOUBLE", - "DROP", - "DSNHATTR", - "DSSIZE", - "DUAL", - "DUMP", - "DYNAMIC", - "EACH", - "ECHO", - "EDIT", - "EDITPROC", - "ELSE", - "ELSEIF", - "ENABLE", - "ENCLOSED", - "ENCODING", - "ENCRYPTED", - "END-EXEC", - "END-EXEC1", - "END", - "ENDEXEC", - "ENDIF", - "ENFORCE", - "ENTRY", - "ENTRY_POINT", - "EQUALS", - "ERASE", - "ERRLVL", - "ESCAPE", - "ESCAPED", - "EVENT", - "EVERY", - "EXCEPT", - "EXCEPTION", - "EXCEPTIONS", - "EXCHANGE", - "EXCLUDING", - "EXCLUSIVE", - "EXEC", - "EXECUTE", - "EXISTING", - "EXISTS", - "EXIT", - "EXPIRE", - "EXPLAIN", - "EXTENT", - "EXTENTS", - "EXTERN", - "EXTERNAL", - "EXTERNALLY", - "EXTERNLOGIN", - "EXTRACT", - "FAILED_LOGIN_ATTEMPTS", - "FALSE", - "FAST", - "FENCED", - "FETCH", - "FIELDPROC", - "FILE", - "FILLFACTOR", - "FILTER", - "FINAL", - "FIRST", - "FIRST_ROWS", - "FLAGGER", - "FLOAT", - "FLOAT4", - "FLOAT8", - "FLOB", - "FLUSH", - "FOR", - "FORCE", - "FOREIGN", - "FORTRAN", - "FORWARD", - "FOUND", - "FREE", - "FREE_IT", - "FREELIST", - "FREELISTS", - "FREETEXT", - "FREETEXTTABLE", - "FREEZE", - "FROM", - "FULL", - "FULLTEXT", - "FULLTEXTTABLE", - "FUNCTION", - "GDSCODE", - "GEN_ID", - "GENERAL", - "GENERATED", - "GENERATOR", - "GET", - "GET_CURRENT_CONNECTION", - "GLOBAL", - "GLOBAL_NAME", - "GLOBALLY", - "GO", - "GOTO", - "GRANT", - "GRAPHIC", - "GROUP", - "GROUP_COMMIT_WAIT", - "GROUP_COMMIT_WAIT_TIME", - "GROUPING", - "GROUPS", - "HANDLER", - "HASH", - "HASHKEYS", - "HAVING", - "HEADER", - "HEAP", - "HELP", - "HIGH_PRIORITY", - "HOLD", - "HOLDLOCK", - "HOST", - "HOUR", - "HOUR_MICROSECOND", - "HOUR_MINUTE", - "HOUR_SECOND", - "HOURS", - "IDENTIFIED", - "IDENTITY", - "IDENTITY_INSERT", - "IDENTITYCOL", - "IDGENERATORS", - "IDLE_TIME", - "IF", - "IGNORE", - "ILIKE", - "IMMEDIATE", - "IN", - "INACTIVE", - "INCLUDE", - "INCLUDING", - "INCREMENT", - "IND_PARTITION", - "INDEX", - "INDEX_LPAREN", - "INDEXED", - "INDEXES", - "INDEXIN", - "INDICATOR", - "INFILE", - "INHERIT", - "INIT", - "INITIAL", - "INITIALIZE", - "INITIALLY", - "INITRANS", - "INNER", - "INNERINDEX", - "INOUT", - "INPUT", - "INPUT_TYPE", - "INSENSITIVE", - "INSERT", - "INSERTING", - "INSERTINNER", - "INSTALL", - "INSTANCE", - "INSTANCES", - "INSTEAD", - "INT", - "INT1", - "INT2", - "INT3", - "INT4", - "INT8", - "INTEGER", - "INTEGRATED", - "INTEGRITY", - "INTERMEDIATE", - "INTERSECT", - "INTERSECTINSERT", - "INTERVAL", - "INTO", - "INTOINTERSECT", - "IQ", - "IS", - "ISINTO", - "ISNULL", - "ISOBID", - "ISOLATION", - "ISOLATION_LEVEL", - "ISQL", - "ITERATE", - "JAR", - "JAVA", - "JOIN", - "JOINIS", - "KEEP", - "KERBEROS", - "KEY", - "KEYJOIN", - "KEYS", - "KILL", - "KILLKEY", - "LABEL", - "LANGUAGE", - "LARGE", - "LAST", - "LATERAL", - "LAYER", - "LC_CTYPE", - "LC_MESSAGES", - "LC_TYPE", - "LEADING", - "LEAVE", - "LEFT", - "LEFTKILL", - "LENGTH", - "LESS", - "LEV", - "LEVEL", - "LIBRARY", - "LIKE", - "LIKELEFT", - "LIMIT", - "LINEAR", - "LINENOLIKE", - "LINES", - "LINK", - "LINKTYPE", - "LIST", - "LOAD", - "LOADLINENO", - "LOB", - "LOCAL", - "LOCALE", - "LOCALTIME", - "LOCALTIMESTAMP", - "LOCATOR", - "LOCATORS", - "LOCK", - "LOCKED", - "LOCKMAX", - "LOCKSIZE", - "LOG", - "LOG_BUF_SIZE", - "LOG_BUFFER_SIZE", - "LOGFILE", - "LOGGING", - "LOGICAL_READS_PER_CALL", - "LOGICAL_READS_PER_SESSION", - "LOGIN", - "LONG", - "LONGBLOB", - "LONGINT", - "LONGTEXT", - "LOOP", - "LOW_PRIORITY", - "LOWER", - "LTRIM", - "MANAGE", - "MANUAL", - "MAP", - "MASTER", - "MASTER_SSL_VERIFY_SERVER_CERT", - "MATCH", - "MAX", - "MAX_SEGMENT", - "MAXARCHLOGS", - "MAXDATAFILES", - "MAXEXTENTS", - "MAXIMUM", - "MAXIMUM_SEGMENT", - "MAXINSTANCES", - "MAXLOGFILES", - "MAXLOGHISTORY", - "MAXLOGMEMBERS", - "MAXSIZE", - "MAXTRANS", - "MAXVALUE", - "MEDIUMBLOB", - "MEDIUMINT", - "MEDIUMTEXT", - "MEMBER", - "MEMBERSHIP", - "MERGE", - "MESSAGE", - "MICROSECOND", - "MICROSECONDS", - "MIDDLEINT", - "MIN", - "MINEXTENTS", - "MINIMUM", - "MINUS", - "MINUTE", - "MINUTE_MICROSECOND", - "MINUTE_SECOND", - "MINUTES", - "MINVALUE", - "MLS_LABEL_FORMAT", - "MLSLABEL", - "MOD", - "MODE", - "MODIFIES", - "MODIFY", - "MODULE", - "MODULE_NAME", - "MONTH", - "MONTHS", - "MOUNT", - "MOVE", - "MTS_DISPATCHERS", - "MULTISET", - "NAMES", - "NATIONAL", - "NATIONALLOAD", - "NATURAL", - "NCHAR", - "NCHAR_CS", - "NCLOB", - "NEEDED", - "NESTED", - "NETWORK", - "NEW", - "NEW_TABLE", - "NEXT", - "NO", - "NO_WRITE_TO_BINLOG", - "NOARCHIVELOG", - "NOAUDIT", - "NOAUTO", - "NOCACHE", - "NOCHECKNATIONAL", - "NOCOMPRESS", - "NOCYCLE", - "NODENAME", - "NODENUMBER", - "NOFORCE", - "NOHOLDLOCK", - "NOLOGGING", - "NOMAXVALUE", - "NOMINVALUE", - "NONCLUSTEREDNOCHECK", - "NONE", - "NOORDER", - "NOOVERRIDE", - "NOPARALLEL", - "NOREVERSE", - "NORMAL", - "NOSORT", - "NOT", - "NOTHING", - "NOTIFY", - "NOTNONCLUSTERED", - "NOTNULL", - "NOWAIT", - "NULL", - "NULLIF", - "NULLIFNULL", - "NULLNOT", - "NULLS", - "NUM_LOG_BUFFERS", - "NUM_LOG_BUFS", - "NUMBER", - "NUMERIC", - "NUMPARTS", - "NVARCHAR", - "NVARCHAR2", - "OBID", - "OBJECT", - "OBJNO", - "OBJNO_REUSE", - "OCTET_LENGTH", - "OF", - "OFF", - "OFFLINE", - "OFFOF", - "OFFSET", - "OFFSETSOFF", - "OFNULLIF", - "OID", - "OIDINDEX", - "OLD", - "OLD_TABLE", - "ON", - "ONLINE", - "ONLY", - "ONOFFSETS", - "OPCODE", - "OPEN", - "OPENDATASOURCEOPEN", - "OPENON", - "OPENQUERYOPENDATASOURCE", - "OPENROWSETOPENQUERY", - "OPENXMLOPENROWSET", - "OPERATION", - "OPTIMAL", - "OPTIMIZATION", - "OPTIMIZE", - "OPTIMIZER_GOAL", - "OPTION", - "OPTIONALLY", - "OPTIONOPENXML", - "OPTIONS", - "OR", - "ORDER", - "ORDEROR", - "ORDINALITY", - "ORGANIZATION", - "OROPTION", - "OSLABEL", - "OTHERS", - "OUT", - "OUTER", - "OUTERORDER", - "OUTFILE", - "OUTPUT", - "OUTPUT_TYPE", - "OVER", - "OVERFLOW", - "OVERLAPS", - "OVEROUTER", - "OVERRIDING", - "OWN", - "PACKAGE", - "PAD", - "PAGE", - "PAGE_SIZE", - "PAGELENGTH", - "PAGES", - "PARALLEL", - "PARAMETER", - "PARAMETERS", - "PART", - "PARTIAL", - "PARTITION", - "PASCAL", - "PASSTHROUGH", - "PASSWORD", - "PASSWORD_GRACE_TIME", - "PASSWORD_LIFE_TIME", - "PASSWORD_LOCK_TIME", - "PASSWORD_REUSE_MAX", - "PASSWORD_REUSE_TIME", - "PASSWORD_VERIFY_FUNCTION", - "PATH", - "PCTFREE", - "PCTINCREASE", - "PCTTHRESHOLD", - "PCTUSED", - "PCTVERSION", - "PERCENT", - "PERCENTOVER", - "PERMANENT", - "PIECESIZE", - "PIVOTPERCENT", - "PLACING", - "PLAN", - "PLANPIVOT", - "PLANPRECISION", - "PLSQL_DEBUG", - "POSITION", - "POST_EVENT", - "POST_TRANSACTION", - "POSTFIX", - "PRECISION", - "PREFIX", - "PREORDER", - "PREPARE", - "PRESERVE", - "PRIMARY", - "PRINT", - "PRIOR", - "PRIQTY", - "PRIVATE", - "PRIVATE_SGA", - "PRIVILEGE", - "PRIVILEGES", - "PROC", - "PROCEDURE", - "PROFILE", - "PROGRAM", - "PSID", - "PUBLIC", - "PUBLICATION", - "PURGE", - "QUERYNO", - "QUEUE", - "QUIT", - "QUOTA", - "RAISERROR", - "RANGE", - "RAW", - "RAW_PARTITIONS", - "RBA", - "RDB$DB_KEY", - "READ", - "READ_ONLY", - "READ_WRITE", - "READS", - "READTEXT", - "READUP", - "REAL", - "REBUILD", - "RECONFIGURE", - "RECORD_VERSION", - "RECOVER", - "RECOVERABLE", - "RECOVERY", - "RECURSIVE", - "REF", - "REFERENCE", - "REFERENCES", - "REFERENCING", - "REFRESH", - "REGEXP", - "RELATIVE", - "RELEASE", - "REMOTE", - "REMOVE", - "RENAME", - "REORGANIZE", - "REPEAT", - "REPLACE", - "REPLICATION", - "REQUIRE", - "RESERV", - "RESERVING", - "RESET", - "RESETLOGS", - "RESIGNAL", - "RESIZE", - "RESOURCE", - "RESTART", - "RESTORE", - "RESTRICT", - "RESTRICTED", - "RESULT", - "RESULT_SET_LOCATOR", - "RETAIN", - "RETURN", - "RETURNING", - "RETURNING_VALUES", - "RETURNS", - "REUSE", - "REVERSE", - "REVERT", - "REVOKE", - "RIGHT", - "RLIKE", - "ROLE", - "ROLES", - "ROLLBACK", - "ROLLUP", - "ROUTINE", - "ROW", - "ROWCOUNT", - "ROWGUIDCOL", - "ROWID", - "ROWNUM", - "ROWS", - "RRN", - "RTRIM", - "RULE", - "RUN", - "RUNTIME", - "RUNTIMESTATISTICS", - "SAMPLE", - "SAVE", - "SAVEPOINT", - "SB4", - "SCAN_INSTANCES", - "SCHEMA", - "SCHEMAS", - "SCN", - "SCOPE", - "SCRATCHPAD", - "SCROLL", - "SD_ALL", - "SD_INHIBIT", - "SD_SHOW", - "SEARCH", - "SECOND", - "SECOND_MICROSECOND", - "SECONDS", - "SECQTY", - "SECTION", - "SECURITY", - "SECURITYAUDIT", - "SEG_BLOCK", - "SEG_FILE", - "SEGMENT", - "SELECT", - "SENSITIVE", - "SEPARATOR", - "SEQUENCE", - "SERIALIZABLE", - "SESSION", - "SESSION_CACHED_CURSORS", - "SESSION_USER", - "SESSIONS_PER_USER", - "SET", - "SETS", - "SETUSER", - "SHADOW", - "SHARE", - "SHARED", - "SHARED_POOL", - "SHELL", - "SHOW", - "SHRINK", - "SHUTDOWN", - "SIGNAL", - "SIMILAR", - "SIMPLE", - "SINGULAR", - "SIZE", - "SKIP", - "SKIP_UNUSABLE_INDEXES", - "SMALLINT", - "SNAPSHOT", - "SOME", - "SORT", - "SOURCE", - "SPACE", - "SPATIAL", - "SPECIFIC", - "SPECIFICATION", - "SPECIFICTYPE", - "SPLIT", - "SQL", - "SQL_BIG_RESULT", - "SQL_CALC_FOUND_ROWS", - "SQL_SMALL_RESULT", - "SQL_TRACE", - "SQLCA", - "SQLCODE", - "SQLERROR", - "SQLEXCEPTION", - "SQLID", - "SQLSTATE", - "SQLWARNING", - "SSL", - "STABILITY", - "STANDARD", - "STANDBY", - "START", - "STARTING", - "STARTS", - "STATE", - "STATEMENT", - "STATEMENT_ID", - "STATIC", - "STATISTICS", - "STAY", - "STOGROUP", - "STOP", - "STORAGE", - "STORE", - "STORES", - "STRAIGHT_JOIN", - "STRUCTURE", - "STYLE", - "SUB_TYPE", - "SUBPAGES", - "SUBSTR", - "SUBSTRING", - "SUBTRANS", - "SUBTRANSACTION", - "SUCCESSFUL", - "SUM", - "SUSPEND", - "SWITCH", - "SYMMETRIC", - "SYNCHRONIZE", - "SYNONYM", - "SYNTAX_ERROR", - "SYS_OP_ENFORCE_NOT_NULL$", - "SYS_OP_NTCIMG$", - "SYSDATE", - "SYSDBA", - "SYSFUN", - "SYSIBM", - "SYSOPER", - "SYSPROC", - "SYSTEM", - "SYSTEM_USER", - "SYSTIME,", - "SYSTIMESTAMP", - "TABLE", - "TABLES", - "TABLESAMPLE", - "TABLESPACE", - "TABLESPACE_NO", - "TABNO", - "TEMPORARY", - "TERMINATE", - "TERMINATED", - "TERMINATOR", - "TEXTSIZE", - "THAN", - "THE", - "THEN", - "THREAD", - "TIME", - "TIMESTAMP", - "TIMEZONE_HOUR", - "TIMEZONE_MINUTE", - "TINYBLOB", - "TINYINT", - "TINYTEXT", - "TO", - "TODAY", - "TOP", - "TOPLEVEL", - "TRACE", - "TRACING", - "TRAILING", - "TRAN", - "TRANSACTION", - "TRANSITIONAL", - "TRANSLATE", - "TRANSLATION", - "TREAT", - "TRIGGER", - "TRIGGERS", - "TRIM", - "TRUE", - "TRUNCATE", - "TSEQUAL", - "TX", - "TYPE", - "UB2", - "UBA", - "UID", - "UNARCHIVED", - "UNBOUNDED", - "UNCOMMITTED", - "UNDER", - "UNDO", - "UNION", - "UNIQUE", - "UNIQUEIDENTIFIER", - "UNKNOWN", - "UNLIMITED", - "UNLOCK", - "UNNEST", - "UNPIVOT", - "UNRECOVERABLE", - "UNSIGNED", - "UNTIL", - "UNUSABLE", - "UNUSED", - "UPDATABLE", - "UPDATE", - "UPDATETEXT", - "UPDATING", - "UPPER", - "USAGE", - "USE", - "USER", - "USING", - "UTC_DATE", - "UTC_TIME", - "UTC_TIMESTAMP", - "VALIDATE", - "VALIDATION", - "VALIDPROC", - "VALUE", - "VALUES", - "VARBINARY", - "VARBIT", - "VARCHAR", - "VARCHAR2", - "VARCHARACTER", - "VARIABLE", - "VARIANT", - "VARYING", - "VCAT", - "VERBOSE", - "VERSION", - "VIEW", - "VOLUMES", - "WAIT", - "WAITFOR", - "WEEKDAY", - "WHEN", - "WHENEVER", - "WHERE", - "WHILE", - "WINDOW", - "WITH", - "WITH_CUBE", - "WITH_LPAREN", - "WITH_ROLLUP", - "WITHIN", - "WITHOUT", - "WLM", - "WORK", - "WRITE", - "WRITEDOWN", - "WRITETEXT", - "WRITEUP", - "X509", - "XID", - "XML", - "XOR", - "YEAR", - "YEAR_MONTH", - "YEARDAY", - "YEARS", - "ZEROFILL", - "ZONE" - }; + private static final List<String> RESERVED_WORDS = + Arrays.asList("ABSOLUTE", "ACCESS", "ACCESSIBLE", "ACCOUNT", "ACTION", "ACTIVATE", "ACTIVE", "ADA", "ADD", + "ADMIN", "ADVISE", "AFTER", "AGGREGATE", "ALIAS", "ALL", "ALL_ROWS", "ALLOCATE", "ALLOW", "ALTER", + "ANALYSE", "ANALYZE", "AND", "ANY", "APPLICATION", "ARCHIVE", "ARCHIVELOG", "ARE", "ARRAY", "AS", + "ASC", "ASCENDING", "ASENSITIVE", "ASSERTION", "ASSOCIATE", "ASUTIME", "ASYMMETRIC", "AT", + "ATTACH", "AUDIT", "AUTHENTICATED", "AUTHORIZATION", "AUTO", "AUTODDL", "AUTOEXTEND", "AUTOMATIC", + "AUX", "AUXILIARY", "AVG", "BACKUP", "BASE_NAME", "BASED", "BASENAME", "BECOME", "BEFORE", "BEGIN", + "BETWEEN", "BFILE", "BIGINT", "BINARY", "BIT", "BIT_LENGTH", "BITMAP", "BLOB", "BLOBEDIT", "BLOCK", + "BODY", "BOOLEAN", "BOTH", "BOTTOM", "BREADTH", "BREAK", "BROWSE", "BUFFER", "BUFFERPOOL", "BULK", + "BY", "CACHE", "CACHE_INSTANCES", "CALL", "CALLED", "CANCEL", "CAPABILITY", "CAPTURE", + "CARDINALITY", "CASCADE", "CASCADED", "CASE", "CAST", "CATALOG", "CCSID", "CFILE", "CHAINED", + "CHANGE", "CHAR", "CHAR_CONVERT", "CHAR_CS", "CHAR_LENGTH", "CHARACTER", "CHARACTER_LENGTH", + "CHECK", "CHECK_POINT_LEN", "CHECK_POINT_LENGTH", "CHECKPOINT", "CHOOSE", "CHUNK", "CLASS", + "CLEAR", "CLOB", "CLONE", "CLOSE", "CLOSE_CACHED_OPEN_CURSORS", "CLUSTER", "CLUSTERED", "COALESCE", + "COLLATE", "COLLATION", "COLLECTION", "COLLID", "COLUMN", "COLUMNS", "COMMENT", "COMMIT", + "COMMITTED", "COMPATIBILITY", "COMPILE", "COMPILETIME", "COMPLETE", "COMPLETION", + "COMPOSITE_LIMIT", "COMPRESS", "COMPRESSED", "COMPUTE", "COMPUTED", "CONCAT", "CONDITION", + "CONDITIONAL", "CONFLICT", "CONNECT", "CONNECT_TIME", "CONNECTION", "CONSTRAINT", "CONSTRAINTS", + "CONSTRUCTOR", "CONTAINING", "CONTAINS", "CONTAINSTABLE", "CONTENTS", "CONTINUE", "CONTROLFILE", + "CONVERT", "CORRESPONDING", "COST", "COUNT", "COUNT_BIG", "CPU_PER_CALL", "CPU_PER_SESSION", + "CREATE", "CROSS", "CSTRING", "CUBE", "CURREN_USER", "CURRENT", "CURRENT_DATE", "CURRENT_LC_CTYPE", + "CURRENT_PATH", "CURRENT_ROLE", "CURRENT_SCHEMA", "CURRENT_SERVER", "CURRENT_TIME", + "CURRENT_TIMESTAMP", "CURRENT_TIMEZONE", "CURRENT_USER", "CURSOR", "CYCLE", "DANGLING", "DATA", + "DATABASE", "DATABASES", "DATAFILE", "DATAFILES", "DATAOBJNO", "DATE", "DAY", "DAY_HOUR", + "DAY_MICROSECOND", "DAY_MINUTE", "DAY_SECOND", "DAYS", "DB_KEY", "DB2GENERAL", "DB2GENRL", + "DB2SQL", "DBA", "DBCC", "DBHIGH", "DBINFO", "DBLOW", "DBMAC", "DBSPACE", "DEALLOCATE", "DEBUG", + "DEC", "DECIMAL", "DECLARE", "DEFAULT", "DEFAULTS", "DEFERRABLE", "DEFERRED", "DEFINITION", + "DEGREE", "DELAYED", "DELETE", "DELETING", "DENY", "DEPTH", "DEREF", "DESC", "DESCENDING", + "DESCRIBE", "DESCRIPTOR", "DESTROY", "DESTRUCTOR", "DETACH", "DETERMINISTIC", "DIAGNOSTICS", + "DICTIONARY", "DIRECTORY", "DISABLE", "DISALLOW", "DISCONNECT", "DISK", "DISMOUNT", "DISPLAY", + "DISTINCT", "DISTINCTROW", "DISTRIBUTED", "DIV", "DML", "DO", "DOMAIN", "DOUBLE", "DROP", + "DSNHATTR", "DSSIZE", "DUAL", "DUMP", "DYNAMIC", "EACH", "ECHO", "EDIT", "EDITPROC", "ELSE", + "ELSEIF", "ENABLE", "ENCLOSED", "ENCODING", "ENCRYPTED", "END-EXEC", "END-EXEC1", "END", "ENDEXEC", + "ENDIF", "ENFORCE", "ENTRY", "ENTRY_POINT", "EQUALS", "ERASE", "ERRLVL", "ESCAPE", "ESCAPED", + "EVENT", "EVERY", "EXCEPT", "EXCEPTION", "EXCEPTIONS", "EXCHANGE", "EXCLUDING", "EXCLUSIVE", + "EXEC", "EXECUTE", "EXISTING", "EXISTS", "EXIT", "EXPIRE", "EXPLAIN", "EXTENT", "EXTENTS", + "EXTERN", "EXTERNAL", "EXTERNALLY", "EXTERNLOGIN", "EXTRACT", "FAILED_LOGIN_ATTEMPTS", "FALSE", + "FAST", "FENCED", "FETCH", "FIELDPROC", "FILE", "FILLFACTOR", "FILTER", "FINAL", "FIRST", + "FIRST_ROWS", "FLAGGER", "FLOAT", "FLOAT4", "FLOAT8", "FLOB", "FLUSH", "FOR", "FORCE", "FOREIGN", + "FORTRAN", "FORWARD", "FOUND", "FREE", "FREE_IT", "FREELIST", "FREELISTS", "FREETEXT", + "FREETEXTTABLE", "FREEZE", "FROM", "FULL", "FULLTEXT", "FULLTEXTTABLE", "FUNCTION", "GDSCODE", + "GEN_ID", "GENERAL", "GENERATED", "GENERATOR", "GET", "GET_CURRENT_CONNECTION", "GLOBAL", + "GLOBAL_NAME", "GLOBALLY", "GO", "GOTO", "GRANT", "GRAPHIC", "GROUP", "GROUP_COMMIT_WAIT", + "GROUP_COMMIT_WAIT_TIME", "GROUPING", "GROUPS", "HANDLER", "HASH", "HASHKEYS", "HAVING", "HEADER", + "HEAP", "HELP", "HIGH_PRIORITY", "HOLD", "HOLDLOCK", "HOST", "HOUR", "HOUR_MICROSECOND", + "HOUR_MINUTE", "HOUR_SECOND", "HOURS", "IDENTIFIED", "IDENTITY", "IDENTITY_INSERT", "IDENTITYCOL", + "IDGENERATORS", "IDLE_TIME", "IF", "IGNORE", "ILIKE", "IMMEDIATE", "IN", "INACTIVE", "INCLUDE", + "INCLUDING", "INCREMENT", "IND_PARTITION", "INDEX", "INDEX_LPAREN", "INDEXED", "INDEXES", + "INDEXIN", "INDICATOR", "INFILE", "INHERIT", "INIT", "INITIAL", "INITIALIZE", "INITIALLY", + "INITRANS", "INNER", "INNERINDEX", "INOUT", "INPUT", "INPUT_TYPE", "INSENSITIVE", "INSERT", + "INSERTING", "INSERTINNER", "INSTALL", "INSTANCE", "INSTANCES", "INSTEAD", "INT", "INT1", "INT2", + "INT3", "INT4", "INT8", "INTEGER", "INTEGRATED", "INTEGRITY", "INTERMEDIATE", "INTERSECT", + "INTERSECTINSERT", "INTERVAL", "INTO", "INTOINTERSECT", "IQ", "IS", "ISINTO", "ISNULL", "ISOBID", + "ISOLATION", "ISOLATION_LEVEL", "ISQL", "ITERATE", "JAR", "JAVA", "JOIN", "JOINIS", "KEEP", + "KERBEROS", "KEY", "KEYJOIN", "KEYS", "KILL", "KILLKEY", "LABEL", "LANGUAGE", "LARGE", "LAST", + "LATERAL", "LAYER", "LC_CTYPE", "LC_MESSAGES", "LC_TYPE", "LEADING", "LEAVE", "LEFT", "LEFTKILL", + "LENGTH", "LESS", "LEV", "LEVEL", "LIBRARY", "LIKE", "LIKELEFT", "LIMIT", "LINEAR", "LINENOLIKE", + "LINES", "LINK", "LINKTYPE", "LIST", "LOAD", "LOADLINENO", "LOB", "LOCAL", "LOCALE", "LOCALTIME", + "LOCALTIMESTAMP", "LOCATOR", "LOCATORS", "LOCK", "LOCKED", "LOCKMAX", "LOCKSIZE", "LOG", + "LOG_BUF_SIZE", "LOG_BUFFER_SIZE", "LOGFILE", "LOGGING", "LOGICAL_READS_PER_CALL", + "LOGICAL_READS_PER_SESSION", "LOGIN", "LONG", "LONGBLOB", "LONGINT", "LONGTEXT", "LOOP", + "LOW_PRIORITY", "LOWER", "LTRIM", "MANAGE", "MANUAL", "MAP", "MASTER", + "MASTER_SSL_VERIFY_SERVER_CERT", "MATCH", "MAX", "MAX_SEGMENT", "MAXARCHLOGS", "MAXDATAFILES", + "MAXEXTENTS", "MAXIMUM", "MAXIMUM_SEGMENT", "MAXINSTANCES", "MAXLOGFILES", "MAXLOGHISTORY", + "MAXLOGMEMBERS", "MAXSIZE", "MAXTRANS", "MAXVALUE", "MEDIUMBLOB", "MEDIUMINT", "MEDIUMTEXT", + "MEMBER", "MEMBERSHIP", "MERGE", "MESSAGE", "MICROSECOND", "MICROSECONDS", "MIDDLEINT", "MIN", + "MINEXTENTS", "MINIMUM", "MINUS", "MINUTE", "MINUTE_MICROSECOND", "MINUTE_SECOND", "MINUTES", + "MINVALUE", "MLS_LABEL_FORMAT", "MLSLABEL", "MOD", "MODE", "MODIFIES", "MODIFY", "MODULE", + "MODULE_NAME", "MONTH", "MONTHS", "MOUNT", "MOVE", "MTS_DISPATCHERS", "MULTISET", "NAMES", + "NATIONAL", "NATIONALLOAD", "NATURAL", "NCHAR", "NCHAR_CS", "NCLOB", "NEEDED", "NESTED", "NETWORK", + "NEW", "NEW_TABLE", "NEXT", "NO", "NO_WRITE_TO_BINLOG", "NOARCHIVELOG", "NOAUDIT", "NOAUTO", + "NOCACHE", "NOCHECKNATIONAL", "NOCOMPRESS", "NOCYCLE", "NODENAME", "NODENUMBER", "NOFORCE", + "NOHOLDLOCK", "NOLOGGING", "NOMAXVALUE", "NOMINVALUE", "NONCLUSTEREDNOCHECK", "NONE", "NOORDER", + "NOOVERRIDE", "NOPARALLEL", "NOREVERSE", "NORMAL", "NOSORT", "NOT", "NOTHING", "NOTIFY", + "NOTNONCLUSTERED", "NOTNULL", "NOWAIT", "NULL", "NULLIF", "NULLIFNULL", "NULLNOT", "NULLS", + "NUM_LOG_BUFFERS", "NUM_LOG_BUFS", "NUMBER", "NUMERIC", "NUMPARTS", "NVARCHAR", "NVARCHAR2", + "OBID", "OBJECT", "OBJNO", "OBJNO_REUSE", "OCTET_LENGTH", "OF", "OFF", "OFFLINE", "OFFOF", + "OFFSET", "OFFSETSOFF", "OFNULLIF", "OID", "OIDINDEX", "OLD", "OLD_TABLE", "ON", "ONLINE", "ONLY", + "ONOFFSETS", "OPCODE", "OPEN", "OPENDATASOURCEOPEN", "OPENON", "OPENQUERYOPENDATASOURCE", + "OPENROWSETOPENQUERY", "OPENXMLOPENROWSET", "OPERATION", "OPTIMAL", "OPTIMIZATION", "OPTIMIZE", + "OPTIMIZER_GOAL", "OPTION", "OPTIONALLY", "OPTIONOPENXML", "OPTIONS", "OR", "ORDER", "ORDEROR", + "ORDINALITY", "ORGANIZATION", "OROPTION", "OSLABEL", "OTHERS", "OUT", "OUTER", "OUTERORDER", + "OUTFILE", "OUTPUT", "OUTPUT_TYPE", "OVER", "OVERFLOW", "OVERLAPS", "OVEROUTER", "OVERRIDING", + "OWN", "PACKAGE", "PAD", "PAGE", "PAGE_SIZE", "PAGELENGTH", "PAGES", "PARALLEL", "PARAMETER", + "PARAMETERS", "PART", "PARTIAL", "PARTITION", "PASCAL", "PASSTHROUGH", "PASSWORD", + "PASSWORD_GRACE_TIME", "PASSWORD_LIFE_TIME", "PASSWORD_LOCK_TIME", "PASSWORD_REUSE_MAX", + "PASSWORD_REUSE_TIME", "PASSWORD_VERIFY_FUNCTION", "PATH", "PCTFREE", "PCTINCREASE", + "PCTTHRESHOLD", "PCTUSED", "PCTVERSION", "PERCENT", "PERCENTOVER", "PERMANENT", "PIECESIZE", + "PIVOTPERCENT", "PLACING", "PLAN", "PLANPIVOT", "PLANPRECISION", "PLSQL_DEBUG", "POSITION", + "POST_EVENT", "POST_TRANSACTION", "POSTFIX", "PRECISION", "PREFIX", "PREORDER", "PREPARE", + "PRESERVE", "PRIMARY", "PRINT", "PRIOR", "PRIQTY", "PRIVATE", "PRIVATE_SGA", "PRIVILEGE", + "PRIVILEGES", "PROC", "PROCEDURE", "PROFILE", "PROGRAM", "PSID", "PUBLIC", "PUBLICATION", "PURGE", + "QUERYNO", "QUEUE", "QUIT", "QUOTA", "RAISERROR", "RANGE", "RAW", "RAW_PARTITIONS", "RBA", + "RDB$DB_KEY", "READ", "READ_ONLY", "READ_WRITE", "READS", "READTEXT", "READUP", "REAL", "REBUILD", + "RECONFIGURE", "RECORD_VERSION", "RECOVER", "RECOVERABLE", "RECOVERY", "RECURSIVE", "REF", + "REFERENCE", "REFERENCES", "REFERENCING", "REFRESH", "REGEXP", "RELATIVE", "RELEASE", "REMOTE", + "REMOVE", "RENAME", "REORGANIZE", "REPEAT", "REPLACE", "REPLICATION", "REQUIRE", "RESERV", + "RESERVING", "RESET", "RESETLOGS", "RESIGNAL", "RESIZE", "RESOURCE", "RESTART", "RESTORE", + "RESTRICT", "RESTRICTED", "RESULT", "RESULT_SET_LOCATOR", "RETAIN", "RETURN", "RETURNING", + "RETURNING_VALUES", "RETURNS", "REUSE", "REVERSE", "REVERT", "REVOKE", "RIGHT", "RLIKE", "ROLE", + "ROLES", "ROLLBACK", "ROLLUP", "ROUTINE", "ROW", "ROWCOUNT", "ROWGUIDCOL", "ROWID", "ROWNUM", + "ROWS", "RRN", "RTRIM", "RULE", "RUN", "RUNTIME", "RUNTIMESTATISTICS", "SAMPLE", "SAVE", + "SAVEPOINT", "SB4", "SCAN_INSTANCES", "SCHEMA", "SCHEMAS", "SCN", "SCOPE", "SCRATCHPAD", "SCROLL", + "SD_ALL", "SD_INHIBIT", "SD_SHOW", "SEARCH", "SECOND", "SECOND_MICROSECOND", "SECONDS", "SECQTY", + "SECTION", "SECURITY", "SECURITYAUDIT", "SEG_BLOCK", "SEG_FILE", "SEGMENT", "SELECT", "SENSITIVE", + "SEPARATOR", "SEQUENCE", "SERIALIZABLE", "SESSION", "SESSION_CACHED_CURSORS", "SESSION_USER", + "SESSIONS_PER_USER", "SET", "SETS", "SETUSER", "SHADOW", "SHARE", "SHARED", "SHARED_POOL", "SHELL", + "SHOW", "SHRINK", "SHUTDOWN", "SIGNAL", "SIMILAR", "SIMPLE", "SINGULAR", "SIZE", "SKIP", + "SKIP_UNUSABLE_INDEXES", "SMALLINT", "SNAPSHOT", "SOME", "SORT", "SOURCE", "SPACE", "SPATIAL", + "SPECIFIC", "SPECIFICATION", "SPECIFICTYPE", "SPLIT", "SQL", "SQL_BIG_RESULT", + "SQL_CALC_FOUND_ROWS", "SQL_SMALL_RESULT", "SQL_TRACE", "SQLCA", "SQLCODE", "SQLERROR", + "SQLEXCEPTION", "SQLID", "SQLSTATE", "SQLWARNING", "SSL", "STABILITY", "STANDARD", "STANDBY", + "START", "STARTING", "STARTS", "STATE", "STATEMENT", "STATEMENT_ID", "STATIC", "STATISTICS", + "STAY", "STOGROUP", "STOP", "STORAGE", "STORE", "STORES", "STRAIGHT_JOIN", "STRUCTURE", "STYLE", + "SUB_TYPE", "SUBPAGES", "SUBSTR", "SUBSTRING", "SUBTRANS", "SUBTRANSACTION", "SUCCESSFUL", "SUM", + "SUSPEND", "SWITCH", "SYMMETRIC", "SYNCHRONIZE", "SYNONYM", "SYNTAX_ERROR", + "SYS_OP_ENFORCE_NOT_NULL$", "SYS_OP_NTCIMG$", "SYSDATE", "SYSDBA", "SYSFUN", "SYSIBM", "SYSOPER", + "SYSPROC", "SYSTEM", "SYSTEM_USER", "SYSTIME,", "SYSTIMESTAMP", "TABLE", "TABLES", "TABLESAMPLE", + "TABLESPACE", "TABLESPACE_NO", "TABNO", "TEMPORARY", "TERMINATE", "TERMINATED", "TERMINATOR", + "TEXTSIZE", "THAN", "THE", "THEN", "THREAD", "TIME", "TIMESTAMP", "TIMEZONE_HOUR", + "TIMEZONE_MINUTE", "TINYBLOB", "TINYINT", "TINYTEXT", "TO", "TODAY", "TOP", "TOPLEVEL", "TRACE", + "TRACING", "TRAILING", "TRAN", "TRANSACTION", "TRANSITIONAL", "TRANSLATE", "TRANSLATION", "TREAT", + "TRIGGER", "TRIGGERS", "TRIM", "TRUE", "TRUNCATE", "TSEQUAL", "TX", "TYPE", "UB2", "UBA", "UID", + "UNARCHIVED", "UNBOUNDED", "UNCOMMITTED", "UNDER", "UNDO", "UNION", "UNIQUE", "UNIQUEIDENTIFIER", + "UNKNOWN", "UNLIMITED", "UNLOCK", "UNNEST", "UNPIVOT", "UNRECOVERABLE", "UNSIGNED", "UNTIL", + "UNUSABLE", "UNUSED", "UPDATABLE", "UPDATE", "UPDATETEXT", "UPDATING", "UPPER", "USAGE", "USE", + "USER", "USING", "UTC_DATE", "UTC_TIME", "UTC_TIMESTAMP", "VALIDATE", "VALIDATION", "VALIDPROC", + "VALUE", "VALUES", "VARBINARY", "VARBIT", "VARCHAR", "VARCHAR2", "VARCHARACTER", "VARIABLE", + "VARIANT", "VARYING", "VCAT", "VERBOSE", "VERSION", "VIEW", "VOLUMES", "WAIT", "WAITFOR", + "WEEKDAY", "WHEN", "WHENEVER", "WHERE", "WHILE", "WINDOW", "WITH", "WITH_CUBE", "WITH_LPAREN", + "WITH_ROLLUP", "WITHIN", "WITHOUT", "WLM", "WORK", "WRITE", "WRITEDOWN", "WRITETEXT", "WRITEUP", + "X509", "XID", "XML", "XOR", "YEAR", "YEAR_MONTH", "YEARDAY", "YEARS", "ZEROFILL", "ZONE"); public boolean isReserved(String name) { - return ArrayUtils.contains(RESERVED_WORDS, name); + return RESERVED_WORDS.contains(name); } } Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetDataSetProcessor.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetDataSetProcessor.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetDataSetProcessor.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -1,61 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/01 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.internal.processor; - -import java.util.List; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.model.RootModel; -import org.jiemamy.model.dataset.RecordModel; -import org.jiemamy.model.entity.EntityModel; - -/** - * エンティティに設定されたデータセットを取得する。 - * - * @author daisuke - */ -public class GetDataSetProcessor extends AbstractProcessor<RootModel, List<RecordModel>, RuntimeException> { - - /** データセットのインデックス番号 */ - private int index; - - /** 対象エンティティ */ - private EntityModel entity; - - - /** - * インスタンスを生成する。 - * - * @param index データセットのインデックス番号 - * @param entity 対象エンティティ - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public GetDataSetProcessor(int index, EntityModel entity) { - Validate.notNull(entity); - this.index = index; - this.entity = entity; - } - - public List<RecordModel> process(RootModel rootModel) { - Validate.notNull(rootModel); - return rootModel.getDataSets().get(index).getRecords().get(entity); - } - -} Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetDependentEntitiesProcessor.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetDependentEntitiesProcessor.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetDependentEntitiesProcessor.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -33,7 +33,7 @@ import org.jiemamy.model.entity.TableModel; import org.jiemamy.model.entity.ViewModel; import org.jiemamy.utils.CollectionsUtil; -import org.jiemamy.utils.model.ColumnUtil; +import org.jiemamy.utils.model.AttributeUtil; import org.jiemamy.utils.model.TableUtil; /** @@ -82,7 +82,7 @@ } ColumnRef columnRef = fkModel.getReferenceColumns().get(0); ColumnModel columnModel = resolver.resolve(columnRef); - TableModel referenceTableModel = ColumnUtil.getDefinedTable(columnModel); + TableModel referenceTableModel = AttributeUtil.getDefinedTable(columnModel); if (referenceTableModel.getId().equals(standardEntity.getId())) { dependents.add(dependentTableModel); } Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetMappingProcessor.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetMappingProcessor.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/GetMappingProcessor.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -1,54 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/03 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.internal.processor; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.ReferenceResolver; -import org.jiemamy.model.attribute.ColumnModel; -import org.jiemamy.model.attribute.constraint.ForeignKeyModel; - -/** - * 指定した主キーに対するマッピング情報を取得するプロセッサ。 - * - * @author daisuke - */ -public class GetMappingProcessor extends AbstractProcessor<ForeignKeyModel, ColumnModel, RuntimeException> { - - private ColumnModel referenceColumn; - - - /** - * インスタンスを生成する。 - * - * @param referenceColumn - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public GetMappingProcessor(ColumnModel referenceColumn) { - Validate.notNull(referenceColumn); - this.referenceColumn = referenceColumn; - } - - public ColumnModel process(ForeignKeyModel fkModel) { - int index = fkModel.getReferenceColumns().indexOf(referenceColumn); - ReferenceResolver resolver = referenceColumn.getJiemamy().getReferenceResolver(); - return resolver.resolve(fkModel.getKeyColumns().get(index)); - } - -} Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/ProvideAttributeNameProcessor.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/ProvideAttributeNameProcessor.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/ProvideAttributeNameProcessor.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -58,7 +58,7 @@ ReferenceResolver resolver = rootModel.getJiemamy().getReferenceResolver(); - TableModel tableModel = AttributeUtil.getBelongingTable(attributeModel); + TableModel tableModel = AttributeUtil.getDefinedTable(attributeModel); StringBuilder sb = new StringBuilder(); if (attributeModel instanceof ColumnModel) { Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/SetRecordProcessor.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/SetRecordProcessor.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/processor/SetRecordProcessor.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -1,59 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/02 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.internal.processor; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.model.attribute.ColumnRef; -import org.jiemamy.model.dataset.RecordModel; - -/** - * カラムに対して値を設定する。 - * - * @author daisuke - */ -class SetRecordProcessor extends AbstractProcessor<RecordModel, Void, RuntimeException> { - - /** カラム */ - private ColumnRef column; - - /** 値 */ - private String value; - - - /** - * インスタンスを生成する。 - * - * @param column カラム - * @param value 値 - * @throws IllegalArgumentException 引数columnに{@code null}を与えた場合 - */ - public SetRecordProcessor(ColumnRef column, String value) { - Validate.notNull(column); - this.column = column; - this.value = value; - } - - public Void process(RecordModel recordModel) { - Validate.notNull(recordModel); - recordModel.getValues().put(column, value); - return null; - } - -} Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/sql/Operator.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/sql/Operator.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/sql/Operator.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -27,13 +27,13 @@ * * @author daisuke */ -public class Operator implements Token { +public enum Operator implements Token { /** IS 演算子 */ - public static final Operator IS = new Operator("IS"); - + IS("IS"), + /** NOT 演算子 */ - public static final Operator NOT = new Operator("NOT"); + NOT("NOT"); /** 演算子をあらわす文字列 */ private final String string; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -24,8 +24,11 @@ import java.util.Map; import java.util.UUID; +import org.jiemamy.Artemis; +import org.jiemamy.InstanceProvider; import org.jiemamy.Jiemamy; import org.jiemamy.JiemamyFactory; +import org.jiemamy.dialect.Dialect; import org.jiemamy.exception.JiemamyRuntimeException; import org.jiemamy.model.RootModel; import org.jiemamy.model.attribute.ColumnModel; @@ -160,6 +163,14 @@ /** * インスタンスを生成する。 + * @param dialectProvider + */ + public TestModelBuilder(InstanceProvider<Dialect> dialectProvider) { + this(UuidStrategy.FIXED, new Instruction(), Jiemamy.newInstance(new Artemis(), dialectProvider)); + } + + /** + * インスタンスを生成する。 * * @param instruction */ Copied: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtil.java (from rev 2718, artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtils.java) =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtil.java (rev 0) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtil.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -0,0 +1,82 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/10 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.utils; + +import java.util.Collections; +import java.util.List; + +import org.apache.commons.lang.Validate; + +/** + * {@link List}を扱うユーティリティクラス。 + * + * @author daisuke + */ +public class ListUtil { + + /** + * リストの指定したindexの要素を、次の要素と入れ替える。 + * + * @param list 対象リスト + * @param index インデックス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @throws IllegalArgumentException indexが負の数の場合 + * @throws IndexOutOfBoundsException + */ + public static void moveDown(List<?> list, int index) { + Validate.notNull(list); + Validate.isTrue(index >= 0); + Collections.swap(list, index, index + 1); + } + + /** + * リストの指定したindexの要素を、前の要素と入れ替える。 + * + * @param list 対象リスト + * @param index インデックス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @throws IllegalArgumentException indexが負の数の場合 + * @throws IndexOutOfBoundsException + */ + public static void moveUp(List<?> list, int index) { + Validate.notNull(list); + Validate.isTrue(index >= 0); + Collections.swap(list, index, index - 1); + } + + /** + * リストの順序を反転させる。 + * + * @param list 対象リスト + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + */ + public static void reverse(List<?> list) { + Validate.notNull(list); + int center = list.size() / 2; + int end = list.size() - 1; + + for (int i = 0; i < center; i++) { + Collections.swap(list, i, end - i); + } + } + + private ListUtil() { + } + +} Property changes on: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtil.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtils.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtils.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ListUtils.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -1,68 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2009/02/10 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.utils; - -import java.util.Collections; -import java.util.List; - -/** - * {@link List}を扱うユーティリティクラス。 - * - * @author daisuke - */ -public class ListUtils { - - /** - * リストの指定したindexの要素を、次の要素と入れ替える。 - * - * @param list 対象リスト - * @param index インデックス - */ - public static void moveDown(List<?> list, int index) { - Collections.swap(list, index, index + 1); - } - - /** - * リストの指定したindexの要素を、前の要素と入れ替える。 - * - * @param list 対象リスト - * @param index インデックス - */ - public static void moveUp(List<?> list, int index) { - Collections.swap(list, index, index - 1); - } - - /** - * リストの順序を反転させる。 - * - * @param list 対象リスト - */ - public static void reverse(List<?> list) { - int center = list.size() / 2; - int end = list.size() - 1; - - for (int i = 0; i < center; i++) { - Collections.swap(list, i, end - i); - } - } - - private ListUtils() { - } - -} Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -50,7 +50,7 @@ * @return この属性が所属するテーブル * @throws ModelConsistenceException */ - public static TableModel getBelongingTable(AttributeModel attribute) { + public static TableModel getDefinedTable(AttributeModel attribute) { Jiemamy jiemamy = attribute.getJiemamy(); RootModel rootModel = jiemamy.getFactory().getRootModel(); for (TableModel tableModel : RootModelUtil.getEntities(rootModel, TableModel.class)) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -21,7 +21,7 @@ import java.util.List; import org.jiemamy.JiemamyFactory; -import org.jiemamy.model.RootModel; +import org.jiemamy.exception.ElementNotFoundException; import org.jiemamy.model.attribute.ColumnModel; import org.jiemamy.model.attribute.ColumnRef; import org.jiemamy.model.attribute.constraint.PrimaryKeyModel; @@ -37,30 +37,42 @@ public final class ColumnUtil { /** - * このカラムが定義されているテーブルを取得する。 + * カラムが主キー制約を構成するカラムであるかどうか調べる。 * * @param columnModel 対象カラム - * @return 定義されているテーブル。見つからなかった場合は{@code null} + * @return 主キー制約構成カラムである場合{@code true} */ - public static TableModel getDefinedTable(ColumnModel columnModel) { - RootModel rootModel = columnModel.getJiemamy().getFactory().getRootModel(); - for (TableModel tableModel : RootModelUtil.getEntities(rootModel, TableModel.class)) { - if (tableModel.getAttributes().contains(columnModel)) { - return tableModel; - } - } - return null; + public static boolean isPartOfPrimaryKeyColumns(ColumnModel columnModel) { + return isPartOfPrimaryKeyColumns(columnModel, true); } /** + * カラムにドメイン型をデータ型として設定する。 + * + * @param columnModel 対象カラム + * @param domainModel 設定するドメイン型 + */ + public static void setDataType(ColumnModel columnModel, DomainModel domainModel) { + JiemamyFactory factory = domainModel.getJiemamy().getFactory(); + DomainRef ref = factory.newReference(domainModel); + columnModel.setDataType(ref); + } + + /** * カラムが主キー制約を構成するカラムであるかどうか調べる。 * * @param columnModel 対象カラム + * @param columnAttr * @return 主キー制約構成カラムである場合{@code true} */ - public static boolean isPartOfPrimaryKeyColumns(ColumnModel columnModel) { - TableModel tableModel = getDefinedTable(columnModel); - PrimaryKeyModel primaryKey = TableUtil.getPrimaryKey(tableModel); + private static boolean isPartOfPrimaryKeyColumns(ColumnModel columnModel, boolean columnAttr) { + TableModel tableModel = AttributeUtil.getDefinedTable(columnModel); + PrimaryKeyModel primaryKey; + try { + primaryKey = TableUtil.getAttribute(tableModel, PrimaryKeyModel.class, columnAttr); + } catch (ElementNotFoundException e) { + return false; + } List<ColumnRef> keyColumns = primaryKey.getKeyColumns(); for (ColumnRef columnRef : keyColumns) { if (columnRef.getReferenceId().equals(columnModel.getId())) { @@ -70,18 +82,6 @@ return false; } - /** - * カラムにドメイン型をデータ型として設定する。 - * - * @param columnModel 対象カラム - * @param domainModel 設定するドメイン型 - */ - public static void setDataType(ColumnModel columnModel, DomainModel domainModel) { - JiemamyFactory factory = domainModel.getJiemamy().getFactory(); - DomainRef ref = factory.newReference(domainModel); - columnModel.setDataType(ref); - } - private ColumnUtil() { } } Added: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/DefaultTokenResolverTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/DefaultTokenResolverTest.java (rev 0) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/DefaultTokenResolverTest.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -0,0 +1,90 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/23 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.dialect; + +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.hasItems; +import static org.junit.Assert.assertThat; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import org.jiemamy.model.attribute.constraint.Deferrability.InitiallyCheckTime; +import org.jiemamy.model.attribute.constraint.ForeignKeyModel.MatchType; +import org.jiemamy.model.attribute.constraint.ForeignKeyModel.ReferentialAction; +import org.jiemamy.model.sql.Keyword; +import org.jiemamy.model.sql.Token; + +/** + * {@link DefaultTokenResolver}のテストクラス。 + * + * @author daisuke + */ +public class DefaultTokenResolverTest { + + private DefaultTokenResolver defaultTokenResolver; + + + /** + * setup + * + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + defaultTokenResolver = new DefaultTokenResolver(); + } + + /** + * teardown + * + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + defaultTokenResolver = null; + } + + /** + * 各enumで表される定数をトークン列に変換できる。 + * + * @throws Exception + */ + @Test + public void test01_各enumで表される定数をトークン列に変換できる() throws Exception { + assertThat(defaultTokenResolver.resolve(InitiallyCheckTime.IMMEDIATE), hasItems((Token) Keyword.INITIALLY, + Keyword.IMMEDIATE)); + assertThat(defaultTokenResolver.resolve(InitiallyCheckTime.DEFERRED), hasItems((Token) Keyword.INITIALLY, + Keyword.DEFERRED)); + + assertThat(defaultTokenResolver.resolve(ReferentialAction.NO_ACTION), hasItems((Token) Keyword.NO, + Keyword.ACTION)); + assertThat(defaultTokenResolver.resolve(ReferentialAction.CASCADE), hasItem((Token) Keyword.CASCADE)); + assertThat(defaultTokenResolver.resolve(ReferentialAction.RESTRICT), hasItem((Token) Keyword.RESTRICT)); + assertThat(defaultTokenResolver.resolve(ReferentialAction.SET_DEFAULT), hasItems((Token) Keyword.SET, + Keyword.DEFAULT)); + assertThat(defaultTokenResolver.resolve(ReferentialAction.SET_NULL), + hasItems((Token) Keyword.SET, Keyword.NULL)); + + assertThat(defaultTokenResolver.resolve(MatchType.SIMPLE), hasItems((Token) Keyword.MATCH, Keyword.SIMPLE)); + assertThat(defaultTokenResolver.resolve(MatchType.PARTIAL), hasItems((Token) Keyword.MATCH, Keyword.PARTIAL)); + assertThat(defaultTokenResolver.resolve(MatchType.FULL), hasItems((Token) Keyword.MATCH, Keyword.FULL)); + } +} Property changes on: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/DefaultTokenResolverTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/JmStringUtilTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/JmStringUtilTest.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/JmStringUtilTest.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -37,6 +37,7 @@ /** * setup + * * @throws Exception */ @Before @@ -50,6 +51,7 @@ /** * teardown + * * @throws Exception */ @After Added: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/ListUtilTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/ListUtilTest.java (rev 0) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/ListUtilTest.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -0,0 +1,134 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/23 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.utils; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public class ListUtilTest { + + private List<String> list; + + + /** + * setup + * + * @throws Exception + */ + @Before + public void setUp() throws Exception { + list = new ArrayList<String>(); + list.add("foo"); + list.add("bar"); + list.add("baz"); + } + + /** + * teardown + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + list = null; + } + + /** + * {@link ListUtil#moveDown(List, int)}のテスト。 + * + * @throws Exception + */ + @Test + public void test01_moveDown() throws Exception { + try { + ListUtil.moveDown(null, 0); + fail(); + } catch (IllegalArgumentException e) { + // success + } + + ListUtil.moveDown(list, 0); + assertThat(list.get(0), is("bar")); + assertThat(list.get(1), is("foo")); + assertThat(list.get(2), is("baz")); + + ListUtil.moveDown(list, 1); + assertThat(list.get(0), is("bar")); + assertThat(list.get(1), is("baz")); + assertThat(list.get(2), is("foo")); + } + + /** + * {@link ListUtil#moveUp(List, int)}のテスト。 + * + * @throws Exception + */ + @Test + public void test02_moveUp() throws Exception { + try { + ListUtil.moveUp(list, -1); + fail(); + } catch (IllegalArgumentException e) { + // success + } + + ListUtil.moveUp(list, 1); + assertThat(list.get(0), is("bar")); + assertThat(list.get(1), is("foo")); + assertThat(list.get(2), is("baz")); + + ListUtil.moveUp(list, 2); + assertThat(list.get(0), is("bar")); + assertThat(list.get(1), is("baz")); + assertThat(list.get(2), is("foo")); + } + + /** + * {@link ListUtil#reverse(List)}のテスト。 + * + * @throws Exception + */ + @Test + public void test03_reverse() throws Exception { + try { + ListUtil.reverse(null); + fail(); + } catch (IllegalArgumentException e) { + // success + } + + ListUtil.reverse(list); + assertThat(list.get(0), is("baz")); + assertThat(list.get(1), is("bar")); + assertThat(list.get(2), is("foo")); + } +} Property changes on: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/ListUtilTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/AttributeUtilTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/AttributeUtilTest.java (rev 0) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/AttributeUtilTest.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -0,0 +1,89 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/23 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.utils.model; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import java.util.List; +import java.util.SortedSet; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import org.jiemamy.model.RootModel; +import org.jiemamy.model.attribute.AttributeModel; +import org.jiemamy.model.entity.EntityModel; +import org.jiemamy.model.entity.TableModel; +import org.jiemamy.test.TestModelBuilder; + +/** + * {@link AttributeUtil}のテストクラス。 + * + * @author daisuke + */ +public class AttributeUtilTest { + + private TestModelBuilder mb; + + + /** + * setup + * + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + mb = new TestModelBuilder(); + mb.build(); + } + + /** + * teardown + * + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + mb = null; + } + + /** + * {@link AttributeUtil#getDefinedTable(AttributeModel)}のテスト。 + * + * @throws Exception + */ + @Test + public void test01_getDefinedTable() throws Exception { + RootModel rootModel = mb.getJiemamy().getFactory().getRootModel(); + SortedSet<EntityModel> entities = rootModel.getEntities(); + for (EntityModel entityModel : entities) { + if (entityModel instanceof TableModel) { + TableModel tableModel = (TableModel) entityModel; + + List<AttributeModel> attributes = tableModel.getAttributes(); + for (AttributeModel attributeModel : attributes) { + assertThat(AttributeUtil.getDefinedTable(attributeModel), is(tableModel)); + } + + } + } + } +} Property changes on: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/AttributeUtilTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ColumnUtilTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ColumnUtilTest.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ColumnUtilTest.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -19,14 +19,13 @@ package org.jiemamy.utils.model; import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.nullValue; import static org.junit.Assert.assertThat; -import java.util.Arrays; - +import org.junit.After; +import org.junit.Before; import org.junit.Test; -import org.jiemamy.model.attribute.ColumnModel; import org.jiemamy.test.TestModelBuilder; /** @@ -36,23 +35,63 @@ */ public class ColumnUtilTest { + private TestModelBuilder mb; + + /** - * {@link ColumnUtil#getDefinedTable(ColumnModel)} + * setup * * @throws Exception */ + @Before + public void setUp() throws Exception { + mb = new TestModelBuilder(); + mb.build(); + } + + /** + * teardown + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + mb = null; + } + + /** + * {@link ColumnUtil#isPartOfPrimaryKeyColumns(org.jiemamy.model.attribute.ColumnModel)}のテスト。 + * + * @throws Exception + */ @Test - public void test01_getDefinedTable() throws Exception { - TestModelBuilder mb = new TestModelBuilder(); - mb.build(); + public void test01_isPartOfPrimaryKeyColumns() throws Exception { + assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.deptId), is(true)); + assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.deptDeptName), is(false)); + assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.deptDeptNo), is(false)); - for (ColumnModel col : Arrays.asList(mb.deptId, mb.deptDeptName, mb.deptLoc)) { - assertThat(ColumnUtil.getDefinedTable(col), is(mb.tableDept)); - assertThat(ColumnUtil.getDefinedTable(col), is(not(mb.tableEmp))); - } - for (ColumnModel col : Arrays.asList(mb.empId, mb.empEmpName, mb.empDeptId, mb.empMgrId)) { - assertThat(ColumnUtil.getDefinedTable(col), is(mb.tableEmp)); - assertThat(ColumnUtil.getDefinedTable(col), is(not(mb.tableDept))); - } + // empIdはPKである + assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(true)); + + // PKを外すと + assertThat(mb.tableEmp.getAttributes().remove(mb.empPk), is(true)); + + // empIdはPKではなくなる + assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(false)); + + // カラムに対してPKは設定されていない + assertThat(mb.empId.getPrimaryKey(), is(nullValue())); + + // そこにPKを設定する + mb.empId.setPrimaryKey(mb.empPk); + + // そするとPK扱いとなる + assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(true)); + + // しかし、テーブルのattributesには含まれていない + assertThat(mb.tableEmp.getAttributes().contains(mb.empPk), is(false)); + + // カラムに対するgetPrimaryKeyでPKが取れる + assertThat(mb.empId.getPrimaryKey(), is(mb.empPk)); } } Added: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ForeignKeyUtilTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ForeignKeyUtilTest.java (rev 0) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ForeignKeyUtilTest.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -0,0 +1,64 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/23 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.utils.model; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import org.jiemamy.test.ReflectionDialectProvider; +import org.jiemamy.test.TestModelBuilder; + +/** + * {@link ForeignKeyUtil}のテストクラス。 + * + * @author daisuke + */ +public class ForeignKeyUtilTest { + + private TestModelBuilder mb; + + + /** + * setup + * + * @throws Exception + */ + @Before + public void setUp() throws Exception { + mb = new TestModelBuilder(new ReflectionDialectProvider()); + mb.build(); + } + + /** + * teardown + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + mb = null; + } + + @Test + public void test01_() throws Exception { + // TODO + } + +} Property changes on: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ForeignKeyUtilTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/RootModelUtilTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/RootModelUtilTest.java (rev 0) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/RootModelUtilTest.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -0,0 +1,134 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/23 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.utils.model; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.junit.Assert.assertThat; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import org.jiemamy.dialect.Dialect; +import org.jiemamy.dialect.generic.GenericDialect; +import org.jiemamy.model.RootModel; +import org.jiemamy.test.ReflectionDialectProvider; +import org.jiemamy.test.TestModelBuilder; + +/** + * {@link RootModelUtil}のテストクラス。 + * + * @author daisuke + */ +public class RootModelUtilTest { + + private TestModelBuilder mb; + + + /** + * setup + * + * @throws Exception + */ + @Before + public void setUp() throws Exception { + mb = new TestModelBuilder(new ReflectionDialectProvider()); + mb.build(); + } + + /** + * teardown + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + mb = null; + } + + /** + * {@link RootModelUtil#getDialect(org.jiemamy.model.RootModel)}のテスト。 + * + * @throws Exception + */ + @Test + public void test01_getDialect() throws Exception { + Dialect dialect = RootModelUtil.getDialect(mb.rootModel); + assertThat(dialect, is(notNullValue())); + assertThat(dialect.toString(), is(mb.rootModel.getDialectClassName())); + } + + /** + * TODO for daisuke + * + * @throws Exception + */ + @Test + public void test02_setDialect() throws Exception { + RootModel rootModel = mb.rootModel; + + RootModelUtil.setDialect(rootModel, GenericDialect.class); + assertThat(rootModel.getDialectClassName(), is(GenericDialect.class.getName())); + + rootModel.setDialectClassName("hoge"); + assertThat(rootModel.getDialectClassName(), is("hoge")); + + RootModelUtil.setDialect(rootModel, new GenericDialect()); + assertThat(rootModel.getDialectClassName(), is(GenericDialect.class.getName())); + } + + /** + * {@link RootModelUtil#normalize(org.jiemamy.model.RootModel)}のテスト。 + * + * @throws Exception + */ + @Test + public void test03_normalize() throws Exception { + // empIdはPKである + assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(true)); + + // PKを外すと + assertThat(mb.tableEmp.getAttributes().remove(mb.empPk), is(true)); + + // empIdはPKではなくなる + assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(false)); + + // カラムに対してPKは設定されていない + assertThat(mb.empId.getPrimaryKey(), is(nullValue())); + + // そこにPKを設定する + mb.empId.setPrimaryKey(mb.empPk); + + // そするとPK扱いとなる + assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(true)); + + // カラムに対するgetPrimaryKeyでそれが取れる + assertThat(mb.empId.getPrimaryKey(), is(mb.empPk)); + + // ここでノーマライズすると + RootModelUtil.normalize(mb.rootModel); + + // カラムに設定されたPKは、テーブルに対するPKに戻る。 + assertThat(mb.empId.getPrimaryKey(), is(nullValue())); + assertThat(mb.tableEmp.getAttributes().contains(mb.empPk), is(true)); + assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(true)); + } +} Property changes on: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/RootModelUtilTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/TableUtilTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/TableUtilTest.java (rev 0) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/TableUtilTest.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -0,0 +1,64 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/23 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.utils.model; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import org.jiemamy.test.ReflectionDialectProvider; +import org.jiemamy.test.TestModelBuilder; + +/** + * {@link TableUtil}のテストクラス。 + * + * @author daisuke + */ +public class TableUtilTest { + + private TestModelBuilder mb; + + + /** + * setup + * + * @throws Exception + */ + @Before + public void setUp() throws Exception { + mb = new TestModelBuilder(new ReflectionDialectProvider()); + mb.build(); + } + + /** + * teardown + * + * @throws Exception + */ + @After + public void tearDown() throws Exception { + mb = null; + } + + @Test + public void test01_() throws Exception { + // TODO + } + +} Property changes on: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/TableUtilTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/connection/ConnectionAdapterImpl.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/connection/ConnectionAdapterImpl.java 2009-02-23 11:51:02 UTC (rev 2720) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/connection/ConnectionAdapterImpl.java 2009-02-23 13:27:35 UTC (rev 2721) @@ -29,7 +29,7 @@ import org.jiemamy.model.attribute.constraint.ForeignKeyModel; import org.jiemamy.model.node.NodeAdapter; import org.jiemamy.utils.ProcessorUtil; -import org.jiemamy.utils.model.ColumnUtil; +import org.jiemamy.utils.model.AttributeUtil; /** * コネクション(FKと継承等)の抽象クラス。 @@ -58,7 +58,7 @@ } ColumnRef columnRef = foreignKeyColumns.get(0); ColumnModel columnModel = columnRef.getJiemamy().getReferenceResolver().resolve(columnRef); - return ColumnUtil.getDefinedTable(columnModel).getAdapter(NodeAdapter.class); + return AttributeUtil.getDefinedTable(columnModel).getAdapter(NodeAdapter.class); } public NodeAdapter getTarget() { @@ -68,7 +68,7 @@ } ColumnRef columnRef = keyColumns.get(0); ColumnModel columnModel = columnRef.getJiemamy().getReferenceResolver().resolve(columnRef); - return ColumnUtil.getDefinedTable(columnModel).getAdapter(NodeAdapter.class); + return AttributeUtil.getDefinedTable(columnModel).getAdapter(NodeAdapter.class); } public boolean isSelfConnection() {