📄 modelentitychecker.java
字号:
ModelRelation relation = entity.getRelation(r); if (!entityNames.contains(relation.getRelEntityName())) { warningList.add("[RelatedEntityNotFound] Related entity " + relation.getRelEntityName() + " of entity " + entity.getEntityName() + " not found."); } if (relations.contains(relation.getTitle() + relation.getRelEntityName())) { warningList.add("[RelationNameNotUnique] Relation " + relation.getTitle() + relation.getRelEntityName() + " of entity "+ entity.getEntityName() + " is not unique for that entity."); } else { relations.add(relation.getTitle() + relation.getRelEntityName()); } if (relation.getFkName().length() > 0) { if (fkNames.contains(relation.getFkName())) { warningList.add("[RelationFkDuplicate] Relation to "+ relation.getRelEntityName() + " from entity " + entity.getEntityName() + " has a duplicate fk-name \"" + relation.getFkName() + "\"."); } else { fkNames.add(relation.getFkName()); } if (tableNames.contains(relation.getFkName())) { warningList.add("[RelationFkTableDup] Relation to " + relation.getRelEntityName() + " from entity " + entity.getEntityName() + " has an fk-name \"" + relation.getFkName() + "\" that is also being used as a table name."); } if (indexNames.contains(relation.getFkName())) { warningList.add("[RelationFkTableDup] Relation to " + relation.getRelEntityName() + " from entity " + entity.getEntityName() + " has an fk-name \"" + relation.getFkName() + "\" that is also being used as an index name."); } } // make sure all FK names are <= 18 characters if (relation.getFkName().length() > 18) { warningList.add("[RelFKNameGT18] The foregn key name (length:" + relation.getFkName().length() + ") was greater than 18 characters in length for relation " + relation.getTitle() + relation.getRelEntityName() + " of entity " + entity.getEntityName() + "."); } ModelEntity relatedEntity = null; try { relatedEntity = reader.getModelEntity(relation.getRelEntityName()); } catch (GenericEntityException e) { Debug.log("Entity referred to in relation is not defined: " + relation.getRelEntityName()); } if (relatedEntity != null) { //if relation is of type one, make sure keyMaps // match the PK of the relatedEntity if ("one".equals(relation.getType()) || "one-nofk".equals(relation.getType())) { if (relatedEntity.getPksSize() != relation.getKeyMapsSize()) warningList.add("[RelatedOneKeyMapsWrongSize] The number of primary keys (" + relatedEntity.getPksSize() + ") of related entity " + relation.getRelEntityName() + " does not match the number of keymaps (" + relation.getKeyMapsSize() + ") for relation of type one \"" + relation.getTitle() + relation.getRelEntityName() + "\" of entity " + entity.getEntityName() + "."); Iterator pksIter = relatedEntity.getPksIterator(); while (pksIter.hasNext()) { ModelField pk = (ModelField) pksIter.next(); if (relation.findKeyMapByRelated(pk.getName()) == null) { warningList.add("[RelationOneRelatedPrimaryKeyMissing] The primary key \"" + pk.getName() + "\" of related entity " + relation.getRelEntityName() + " is missing in the keymaps for relation of type one " + relation.getTitle() + relation.getRelEntityName() + " of entity " + entity.getEntityName() + "."); } } } } //make sure all keyMap 'fieldName's match fields of // this entity //make sure all keyMap 'relFieldName's match fields of // the relatedEntity for (int rkm = 0; rkm < relation.getKeyMapsSize(); rkm++) { ModelKeyMap keyMap = (ModelKeyMap) relation.getKeyMap(rkm); ModelField field = entity.getField(keyMap.getFieldName()); ModelField rfield = null; if (relatedEntity != null) { rfield = relatedEntity.getField(keyMap.getRelFieldName()); } if (rfield == null) { warningList.add("[RelationRelatedFieldNotFound] The field \"" + keyMap.getRelFieldName() + "\" of related entity " + relation.getRelEntityName() + " was specified in the keymaps but is not found for relation " + relation.getTitle() + relation.getRelEntityName() + " of entity " + entity.getEntityName() + "."); } if (field == null) { warningList.add("[RelationFieldNotFound] The field " + keyMap.getFieldName() + " was specified in the keymaps but is not found for relation " + relation.getTitle() + relation.getRelEntityName() + " of entity " + entity.getEntityName() + "."); } if (field != null && rfield != null) { //this was the old check, now more constrained // to keep things cleaner: // if(!field.getType().equals(rfield.getType()) // && // !field.getType().startsWith(rfield.getType()) // && // !rfield.getType().startsWith(field.getType())) // { if (!field.getType().equals(rfield.getType()) && !field.getType().equals(rfield.getType() + "-ne") && !rfield.getType().equals(field.getType() + "-ne")) { warningList.add("[RelationFieldTypesDifferent] The field type ("+ field.getType() + ") of " + field.getName() + " of entity " + entity.getEntityName() + " is not the same as field type (" + rfield.getType() + ") of " + rfield.getName() + " of entity " + relation.getRelEntityName() + " for relation " + relation.getTitle() + relation.getRelEntityName() + "."); } } } } } numberShowed++; } } } public static final String[] rwArray = { "ABORT", "ABS", "ABSOLUTE", "ACCEPT", "ACCES", "ACS", "ACTION", "ACTIVATE", "ADD", "ADDFORM", "ADMIN", "AFTER", "AGGREGATE", "ALIAS", "ALL", "ALLOCATE", "ALTER", "ANALYZE", "AND", "ANDFILENAME", "ANY", "ANYFINISH", "APPEND", "ARCHIVE", "ARE", "ARRAY", "AS", "ASC", "ASCENDING", "ASCII", "ASSERT", "ASSERTION", "ASSIGN", "AT", "ATTRIBUTE", "ATTRIBUTES", "AUDIT", "AUTHID", "AUTHORIZATION", "AUTONEXT", "AUTO_INCREMENT", "AVERAGE", "AVG", "AVGU", "AVG_ROW_LENGTH", "BACKOUT", "BACKUP", "BEFORE", "BEGIN", "BEGINLOAD", "BEGINMODIFY", "BEGINNING", "BEGWORK", "BETWEEN", "BETWEENBY", "BINARY", "BINARY_INTEGER", "BIT", "BIT_LENGTH", "BLOB", "BODY", "BOOLEAN", "BORDER", "BOTH", "BOTTOM", "BREADTH", "BREAK", "BREAKDISPLAY", "BROWSE", "BUFERED", "BUFFER", "BUFFERED", "BULK", "BY", "BYTE", "CALL", "CANCEL", "CASCADE", "CASCADED", "CASE", "CAST", "CATALOG", "CHANGE", "CHAR", "CHAR_LENGTH", "CHAR_BASE", "CHARACTER", "CHARACTER_LENGTH", "CHAR_CONVERT", "CHECK", "CHECKPOINT", "CHECKSUM", "CHR2FL", "CHR2FLO", "CHR2FLOA", "CHR2FLOAT", "CHR2INT", "CLASS", "CLEAR", "CLEARROW", "CLIPPED", "CLOB", "CLOSE", "CLUSTER", "CLUSTERED", "CLUSTERING", "COALESCE", "COBOL", "COLD", "COLLATE", "COLLATION", "COLLECT", "COLUMN", "COLUMNS", "COMMAND", "COMMENT", "COMMIT", "COMMITTED", "COMPLETION", "COMPRESS", "COMPUTE", "CONCAT", "COND", "CONDITION", "CONFIG", "CONFIRM", "CONNECT", "CONNECTION", "CONSTANT", "CONSTRAINT", "CONSTRAINTS", "CONSTRUCT", "CONSTRUCTOR", "CONTAIN", "CONTAINS", "CONTAINSTABLE", "CONTINUE", "CONTROLROW", "CONVERT", "COPY", "CORRESPONDING", "COUNT", "COUNTU", "COUNTUCREATE", "CRASH", "CREATE", "CROSS", "CUBE", "CURRENT", "CURRENT_DATE", "CURRENT_PATH", "CURRENT_ROLE", "CURRENT_SESSION", "CURRENT_TIME", "CURRENT_TIMESTAMP", "CURRENT_USER", "CURSOR", "CURVAL", "CYCLE", "DATA", "DATALINK", "DATABASE", "DATABASES", "DATAPAGES", "DATA_PGS", "DATE", "DATETIME", "DAY", "DAY_HOUR", "DAY_MINUTE", "DAY_SECOND", "DAYNUM", "DAYOFMONTH", "DAYOFWEEK", "DAYOFYEAR", "DBA", "DBCC", "DBE", "DBEFILE", "DBEFILEO", "DBEFILESET", "DBSPACE", "DBYTE", "DEALLOCATE", "DEC", "DECENDING", "DECIMAL", "DECLARE", "DEFAULT", "DEFAULTS", "DEFER", "DEFERRABLE", "DEFINE", "DEFINITION", "DELAY_KEY_WRITE", "DELAYED", "DELETE", "DELETEROW", "DENY", "DEPTH", "DEREF", "DESC", "DESCENDING", "DESCENDNG", "DESCRIBE", "DESCRIPTOR", "DESTPOS", "DESTROY", "DEVICE", "DEVSPACE", "DIAGNOSTICS", "DICTIONARY", "DIRECT", "DIRTY", "DISCONNECT", "DISK", "DISPLACE", "DISPLAY", "DISTINCT", "DISTINCTROW", "DISTRIBUTED", "DISTRIBUTION", "DIV", "DO", "DOES", "DOMAIN", "DOUBLE", "DOWN", "DROP", "DUAL", "DUMMY", "DUMP", "DUPLICATES", "EACH", "EBCDIC", "EDITADD", "EDITUPDATE", "ED_STRING", "ELSE", "ELSEIF", "ELSIF", "ENCLOSED", "END", "ENDDATA", "ENDDISPLAY", "ENDFORMS", "ENDIF", "ENDING", "ENDLOAD", "ENDLOOP", "ENDMODIFY", "ENDPOS", "ENDRETRIEVE", "ENDSELECT", "ENDWHILE", "END_ERROR", "END_EXEC", "END_FETCH", "END_FOR", "END_GET", "END_MODIFY", "END_PLACE", "END_SEGMENT_S", "END_SEGMENT_STRING", "END_STORE", "END_STREAM", "ENUM", "EQ", "EQUALS", "ERASE", "ERROR", "ERRLVL", "ERROREXIT", "ESCAPE", "ESCAPED", "EVALUATE", "EVALUATING", "EVERY", "EXCEPT", "EXCEPTION", "EXCLUSIVE", "EXEC", "EXECUTE", "EXISTS", "EXIT", "EXPAND", "EXPANDING", "EXPLAIN", "EXPLICIT",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -