Methods Summary |
---|
public boolean | checkConsistency()
HashSet checked = new HashSet();
HashSet current = new HashSet();
for( Enumeration tables = getTables(); tables.hasMoreElements(); ){
TableImpl currTable = (TableImpl)tables.nextElement();
if( !checkConsistencyStep(currTable,checked,current) ){
return false;
}
for(Enumeration enum = current.elements(); enum.hasMoreElements(); ){
checked.add(enum.nextElement());
}
current.clear();
}
return true;
|
private boolean | checkConsistencyStep(TableImpl table, COM.objectspace.jgl.HashSet checked, COM.objectspace.jgl.HashSet current)
if( checked.get(table) != null ){
// already checked
return true;
}
if( current.get(table) != null ){
// cycle in identifying links
return false;
}
try{
current.add(table);
for( UMLAssociationEnumeration links = table.getUMLClass().getAssociations(); links.hasMoreElements(); ){
UMLAssociation link = links.getNextUMLAssociation();
// only identifying links can cause problems
if( !link.hasProperty(getTags().linkIdentifying()) ){
continue;
}
if( link.getDest() instanceof UMLClass ){
TableImpl destTable = (TableImpl)getTable((UMLClass)link.getDest());
if( !checkConsistencyStep(destTable,checked,current) ){
return false;
}
}
}
// no problems found
checked.add(table);
return true;
}
finally{
current.remove(table);
}
|
java.lang.String | createTableName(java.lang.String className)
String result = getNameConstraints().shorten(className,getNameConstraints().getMaxTableNameLength());
result = dereserve(result);
result = getUniqueName(result,getNameConstraints().getMaxTableNameLength());
return result;
|
java.lang.String | dereserve(java.lang.String name)
String result = name;
while( getNameConstraints().isReservedWord(result) && result.length() > 1 ){
System.out.println("dereserve: "+result);
result = getNameConstraints().shorten(result,result.length()-1);
}
if( getNameConstraints().isReservedWord(result) ){
result = getNameConstraints().shorten(name+"_",getNameConstraints().getMaxTableNameLength());
}
return result;
|
public java.util.Enumeration | getCatalogs()
return new EmptyEnumeration();
|
SQLNameConstraints | getNameConstraints()
return myNameConstraints;
|
public java.util.Enumeration | getSchemas()
return new EmptyEnumeration();
|
oisoft.togetherx.scripts.SQL.SQLTable | getTable(oisoft.togetherx.scriptapi.UML.UMLClass clazz)
SQLTable result = (SQLTable)myTables.get(clazz);
if( result == null ){
result = new TableImpl(clazz,this);
myTables.put(clazz,result);
String name = result.getName();
}
return result;
|
public java.util.Enumeration | getTables()
return new TableEnumeration(myPackage.getClasses(),this);
|
SQLDiagramTags | getTags()
return myTags;
|
java.lang.String | getUniqueName(java.lang.String base, int length)
int i = 2;
String result = base;
while( isNameRegistered(result) ){
result = base+i;
result = getNameConstraints().shorten(result,length);
result = dereserve(result);
++i;
}
registerName(result);
return result;
|
boolean | isNameRegistered(java.lang.String name)
return myNameRegistry.get(name.toLowerCase()) != null;
|
void | registerName(java.lang.String name)
myNameRegistry.add(name.toLowerCase());
|