MapEnumerator.reset Method
Moves the enumerator to point to immediately before the first element in the map.
public void reset()
The following example reverse engineers the table definitions of all the tables in a project, and creates a UML class for each one. The tables in the project are contained in the projectTables map. The tables that are used by the tables in the project and the tables that use the tables in the project are also reverse engineered, and contained in the nonProjectTables map.
The MapEnumerator.reset method is used several times to reset the enumerators for the two maps, so that different information can be generated.
// Reverse engineer all Axapta table definitions as UML classes
private void reverseEngineerTables()
{
Map projectTables;
MapEnumerator projectTableEnumerator;
MapEnumerator nonProjectTableEnumerator;
Map nonProjectTables;
Map umlTables = new Map( Types::String, Types::Class );
str packageID;
TableGroup tableGroup;
//Table and table Id for iterating though tables
DictTable table;
;
// Set progress bar
progressControl.setText( "@SYS86145" );
// Get tables in project and reverse engineer
projectTables = this.getProjectTables();
projectTableEnumerator = projectTables.getEnumerator();
while( projectTableEnumerator.moveNext() )
{
table = projectTableEnumerator.currentValue();
tableGroup = table.tableGroup();
packageID = tableGroups.lookup( enum2str( tableGroup ) );
if ( !packageID )
{
packageID = subSystemID;
}
this.reverseEngineerTable( table, umlTables, packageID );
}
// Get non-project related tables and reverse engineer
nonProjectTables = this.getExternalTables( projectTables );
nonProjectTableEnumerator = nonProjectTables.getEnumerator();
while( nonProjectTableEnumerator.moveNext() )
{
table = nonProjectTableEnumerator.currentValue();
this.reverseEngineerTable( table, umlTables, externalPackageID );
}
// Iterate through tables to create associations
projectTableEnumerator.reset();
while( projectTableEnumerator.moveNext() )
{
table = projectTableEnumerator.currentValue();
this.reverseEngineerValidatingRelations(
table,
projectTables,
umlTables );
this.reverseEngineerDeleteActions(
table,
projectTables,
umlTables );
}
nonProjectTableEnumerator.reset();
while( nonProjectTableEnumerator.moveNext() )
{
table = nonProjectTableEnumerator.currentValue();
this.reverseEngineerValidatingRelations(
table,
projectTables,
umlTables );
this.reverseEngineerDeleteActions(
table,
projectTables,
umlTables );
}
// Iterate through project to create extended data type
// associations
projectTableEnumerator.reset();
while( projectTableEnumerator.moveNext() )
{
table = projectTableEnumerator.currentValue();
this.reverseEngineerExtendedDataTypeRelations(
table,
projectTables,
umlTables );
}
nonProjectTableEnumerator.reset();
while( nonProjectTableEnumerator.moveNext() )
{
table = nonProjectTableEnumerator.currentValue();
this.reverseEngineerExtendedDataTypeRelations(
table,
projectTables,
umlTables );
}
}