File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Mappings.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Mappings.java | |||
Method name: String getPhysicalColumnName(String, Table)
|
Method name: String getLogicalColumnName(String, Table)
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | logicalName = logicalName.toLowerCase();↵ | 1 | String logical↵ | |
2 | String finalName = null;↵ | 2 | = null;↵ | |
3 | Table currentTable = table;↵ | 3 | Table currentTable = table;↵ | |
4 | ↵ | 4 | TableDescription description = null;↵ | |
5 | do {↵ | 5 | do {↵ | |
6 | ColumnNames binding = (ColumnNames) columnNameBindingPerTable.get(currentTable);↵ | 6 | ColumnNames binding = (ColumnNames) columnNameBindingPerTable.get(currentTable);↵ | |
7 | if (binding != null) {↵ | 7 | if (binding != null) {↵ | |
8 | finalName = (String) binding.logicalToPhysical.get( logicalName );↵ | 8 | logical = (String) binding.physicalToLogical.get( physicalName );↵ | |
9 | }↵ | 9 | }↵ | |
10 | String key = buildTableNameKey( currentTable.getSchema(), currentTable.getCatalog(), currentTable.getName() );↵ | 10 | String key = buildTableNameKey( currentTable.getSchema(), currentTable.getCatalog(), currentTable.getName() );↵ | |
11 | TableDescription description = (TableDescription) tableNameBinding.get(key);↵ | 11 | description = (TableDescription) tableNameBinding.get(key);↵ | |
12 | if (description != null) currentTable = description.denormalizedSupertable;↵ | 12 | if (description != null) currentTable = description.denormalizedSupertable;↵ | |
13 | }↵ | 13 | }↵ | |
14 | while (finalName == null && currentTable != null);↵ | 14 | while (logical == null && currentTable != null↵ | |
15 | if (finalName↵ | 15 | && description != null);↵ | |
16 | == null) {↵ | 16 | if (logical == null) {↵ | |
17 | throw new MappingException( "Unable to find column with logical name "↵ | 17 | throw new MappingException( "Unable to find logical column name from physical name "↵ | |
18 | + logicalName + " in table " + table.getName() );↵ | 18 | + physicalName + " in table " + table.getName() );↵ | |
19 | }↵ | 19 | }↵ | |
20 | return finalName; | 20 | return logical; | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 23 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | ColumnNames binding = (ColumnNames)columnNameBindingPerTable.get(currentTable); | 4 | ColumnNames binding = (ColumnNames)columnNameBindingPerTable.get(currentTable); | |||||||||||||||||||
5 | if (binding != null) | 5 | if (binding != null) | |||||||||||||||||||
6 | finalName = (String)binding.logicalToPhysical.get(logicalName); |
| 6 | logical = (String)binding.physicalToLogical.get(physicalName); | ||||||||||||||||||
7 | String key = buildTableNameKey(currentTable.getSchema(), currentTable.getCatalog(), currentTable.getName()); | 7 | String key = buildTableNameKey(currentTable.getSchema(), currentTable.getCatalog(), currentTable.getName()); | |||||||||||||||||||
|
| 8 | description = (TableDescription)tableNameBinding.get(key); | |||||||||||||||||||
8 | TableDescription description = (TableDescription)tableNameBinding.get(key); |
| | |||||||||||||||||||
9 | if (description != null) | 9 | if (description != null) | |||||||||||||||||||
10 | currentTable = description.denormalizedSupertable; | 10 | currentTable = description.denormalizedSupertable; |
Row | Violation |
---|---|
1 | Expression binding.logicalToPhysical cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression binding.physicalToLogical cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement description=(TableDescription)tableNameBinding.get(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement TableDescription description=(TableDescription)tableNameBinding.get(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Clone fragment #1 returns variables key, finalName, currentTable , while Clone fragment #2 returns variables key, logical, currentTable |