Challenge Overview
1.1 Overview
There is an existing migration mapping application that is expected to be converted to be able to run on Windows and OS X.
This project performs migration of the application to Java. This project will be a standalone application that will assist users in mapping source/target fields across different types of data sources (CSV, SQL Server, Salesforce.com).
This assembly provides models, exceptions, services of the application with GUI integration and provides fully working application.
1.2 Submission Deliverables
A complete list of deliverables can be found in the TopCoder Assembly competition tutorials at:
http://apps.topcoder.com/wiki/display/tc/Assembly+Competition+Tutorials
The assembly:
o Provides models
o Provides exceptions
o Provides services and all implementations (all class diagrams in scope)
o Integrates all services into GUI and provide complete working application
The implementation notes are provided in “Documentation” tab of TCUML. Refer to ADS 1.2 for various application management details. Provided below are additional considerations for GUI integration. For all lengthy operations (like connecting to Salesforce, SQL Server, reading CSV file) progress dialog should be shown.
Model/exception/service implementation is elaborated in ‘Documentation’ tab of TCUML. Provided below are GUI guidelines.
1.2.1 General updates
The MainShell should add namesake fields and expose getters for all service implementations defined in the project. In constructor, all fields should be initialized using parameterless constructor. The class should also expose getter for current working project. When stated below ‘refresh shell’ it is meant to update all views (source/target trees and mappings) for the current application project.
1.2.2 File menu
1.2.2.1 File -> New
GUI reference: Top menu “File”, submenu “New”
Code reference: MainShell.java, lines 278-289
Implementation: Should create new project. This is already handled in prototype code. Nothing is required to be updated
1.2.2.2 File -> Open
GUI reference: Top menu “File”, submenu “Open”
Code reference: MainShell.java, lines 291-303
Implementation: Should create open existing project. After name and validated in line 313, current project should be read with ProjectService:
proj = projectService.open(name);
1.2.2.3 File -> Save
GUI reference: Top menu “File”, submenu “Save”
Code reference: MainShell.java, lines 305-317
Implementation: Should save current project. Additional field currentProjectLocation:String should be added to MainShell.java. If the field is null, file chooser should be opened. After file name is selected and validated in line 314, current project should be saved with ProjectService and currentProjectLocation should be updated:
projectService.save(proj, name);
If currentProjectLocation is not null, save the project to it.
1.2.2.4 File -> Save As
GUI reference: Top menu “File”, submenu “Save as”
Code reference: MainShell.java, lines 319-331
Implementation: Should save current project to given location. After name is selected and validated in line 328, current project should be saved with ProjectService and currentProjectLocation should be updated (see above)
1.2.2.5 File -> Import and Merge
GUI reference: Top menu “File”, submenu “Import and Merge”
Code reference: MainShell.java, lines 333-345
Implementation: Should create open existing project and merge with currently opened project. After name and validated in line 342, current project should be read with ProjectService:
Project mergeProject = projectService.open(name);
proj.setMappings(proj.getMappings().addAll(mergeProject.getMappings());
proj.setSourceFields(
proj.getSourceFields().addAll(mergeProject.getSourceFields());
proj.setTargetFields(
proj.getTargetFields().addAll(mergeProject.getTargetFields());
1.2.2.6 File -> Exit
GUI reference: Top menu “File”, submenu “Exit”
Code reference: MainShell.java, lines 349-356
Implementation: Should exit from the application. If there is an unsaved project or project with pending changes it should be prompted to save. MainShell.java should be updated to include a flag whether current project is modified. It is by default set to false, if any action occurs with model it is set to true, if project is saved (see 1.2.2.3 and 1.2.2.4) it is to false. After line 352 in MainShell.java if the flag is set to true, a call to save project as in 1.2.2.4 should be done.
1.2.3 Output menu
1.2.3.1 Output -> To Clipboard
GUI reference: Top menu “Output”, submenu “To Clipboard…”
Code reference: ExporterDialog.java
Implementation: Should export contents to clipboard. When button processing starts in line 437 set all fields to configuration mapping for the service and call following code:
Map<String, Object> options = new HashMap<String, Object>();
// put all fields data to options, e.g.
options.put(“exportMappings”, btnMappings.getSelection());
String clipboardText = getParent().getExportService()
.export(getParent().getProject(), options);
StringSelection selection = new StringSelection(text);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Clipboard.setContents(selection, null);
If the preview option is set in line 442, then set the text in textDialog:
if (btnCheckPreviewOutput.getSelection()) {
BigTextDialog textDialog = new BigTextDialog(shlExportSettings);
textDialog.setText(clipboardText);
textDialog.open();
}
1.2.4 Actions menu
1.2.4.1 Actions -> Auto-Map Fields
GUI reference: Top menu “Actions”, submenu “Auto-Map Fields…”
Code reference: AutoMapFieldConfig.java
Implementation: Should add auto-mapping of fields for project. When button processing starts in line 296 set all fields to configuration mapping for the service and call following code:
Map<String, Object> options = new HashMap<String, Object>();
// put all fields data to options, e.g.
options.put(“processAllFields”, btnProcessAllFields.getSelection());
getParent().getAutoMappingService()
.createAutoMapping(getParent().getProject(), options);
Refresh view of parent shell.
1.2.4.2 Actions -> Delete All Mappings
GUI reference: Top menu “Actions”, submenu “Delete All Mappings”
Code reference: MainShell.java, lines 390-401
Implementation: Should delete all mappings for project. When button processing starts in line 393 call following code:
proj.getMappings().clear();
Refresh view of shell.
1.2.4.3 Actions -> Refresh Display
GUI reference: Top menu “Actions”, submenu “Refresh Display”
Code reference: MainShell.java, lines 403-404
Implementation: Refresh data view of shell.
1.2.4.4 Actions -> Populate with Sample Data
GUI reference: Top menu “Actions”, submenu “Populate with Sample Data”
Code reference: MainShell.java, lines 408-421
Implementation: Should populate project with sample data. This is already handled in prototype code. Nothing is required to be updated
1.2.5 Preferences menu
1.2.5.1 Preferences -> Edit Preferences
GUI reference: Top menu “Preferences”, submenu “Edit Preferences …”
Code reference: PrefsDialog.java
Implementation: Should edit preferences of project. The following “OK” button handling should be added after line 174:
btnOK.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Preferences preferences = new Preferences();
preferences.setSourcePreferences(
(btnShowFieldNamesSource.getSelection() ?
PrefencesViewType.SHOW_FIELD_NAMES :
(btnShowFieldLabelsSource.getSelection() ?
PrefencesViewType.SHOW_FIELD_NAMES :
PrefencesViewType.SHOW_BOTH)));
preferences.setTargetPreferences(
(btnShowFieldNamesTarget.getSelection() ?
PrefencesViewType.SHOW_FIELD_NAMES :
(btnShowFieldLabelsTarget.getSelection() ?
PrefencesViewType.SHOW_FIELD_NAMES :
PrefencesViewType.SHOW_BOTH)));
getParent().getProject().setPreferences(preferences);
shlPreferences.dispose();
}
});
Refresh view of parent shell.
1.2.5.2 Preferences -> About MigrationMapper
GUI reference: Top menu “Preferences”, submenu “About MigrationMapper…”
Code reference: AboutDialog.java
Implementation: Shows application information. This is already handled in prototype code. Nothing is required to be updated
1.2.6 Main mapping area fields management
The managing of source/target fields is explained below. The source fields can be obtained as proj.getSourceFields() and proj.getTargetFields() in MainShell.java. We will reference as fields:Vector<Field> any of the source/target fields vector below. The code will call implementation of DataStorageService method getFields(). After calling this method, append all fields to project source/target fields.
1.2.6.1 Adding fields -> Manual entry
GUI reference: Source/Target “Add” link, top “Add Fields” tab, “Manual entry” subtab
Code reference: FieldAddDialog.java, lines 501-564
Implementation: Should manually add field data to project. The following “OK” button handling should be added after line 558:
btnManualEntryImport.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Map<String, Object> configuration = new HashMap<String,Object>();
// put all fields data to configuration, e.g.
configuration.put(“tableName”,
textManualEntryTableName.getText());
Vector<Field> fields = getParent().getManualDataStorageService()
.getFields(configuration);
// Add fields vector to source/target vector of fields in project
}
});
1.2.6.2 Adding fields -> Salesforce
GUI reference: Source/Target “Add” link, top “Add Fields” tab, “Salesforce” subtab
Code reference: FieldAddDialog.java, lines 556-669
Implementation: Should login to Salesforce to retrieve object data and add selected field data to project. The following “Login” button handling should be updated after line 618:
Map<String, Object> configuration = new HashMap<String,Object>();
// put all fields data to configuration, e.g.
configuration.put(“username”, textSalesforceUsername.getText());
Vector<Field> fields = getParent().getSalesforceDataStorageService()
.getFields(configuration);
After all the fields are retrieved, object dropdown should be populated with distinct values of field.getTableName(). Each individual field should be put in the table after clicking “List Fields” with checkbox being the first column specifying whether field is selected or not (refer to original application)
The “Import” button should add fields to source/target fields based on the checkbox selection.
1.2.6.3 Adding fields -> SQL Server
GUI reference: Source/Target “Add” link, top “Add Fields” tab, “SQL Server” subtab
Code reference: FieldAddDialog.java, lines 671-765
Implementation: Should login to SQL Server to retrieve table metadata data and add selected field data to project. The following “Connect” button handling should be updated after line 737:
Map<String, Object> configuration = new HashMap<String,Object>();
// put all fields data to configuration, e.g.
configuration.put(“username”, textSqlServerUsername.getText());
Vector<Field> fields = getParent().getSqlServerDataStorageService()
.getFields(configuration);
After all the fields are retrieved, table dropdown should be populated with distinct values of field.getTableName(). Each individual field should be put in the table after selecting the table with checkbox being the first column specifying whether field is selected or not (refer to original application)
The “Import” button should add fields to source/target fields based on the checkbox selection.
1.2.6.4 Adding fields -> CSV Data File
GUI reference: Source/Target “Add” link, top “Add Fields” tab, “CSV Data File” subtab
Code reference: FieldAddDialog.java, lines 833-864
Implementation: When file is selected and “Preview File” is clicked, contents of file should be loaded into the text area. When “Import” button is selected the CsvDataStorageService processing should be performed after line 864 when handling the button:
Map<String, Object> configuration = new HashMap<String,Object>();
// put all fields data to configuration, e.g.
configuration.put(“tableName”, textCsvDataFileDefaultTable.getText());
Vector<Field> fields = getParent().getCsvDataStorageService()
.getFields(configuration);
The fields should be added to the parent shell project fields.
1.2.6.5 Adding fields -> Paste-in
GUI reference: Source/Target “Add” link, top “Add Fields” tab, “Paste-In” subtab
Code reference: FieldAddDialog.java, lines 866-917
Implementation: When “Import” button is selected the PasteInDataStorageService processing should be performed after line 917 when handling the button:
Map<String, Object> configuration = new HashMap<String,Object>();
// put all fields data to configuration, e.g.
configuration.put(“tableName”, textTablenamePaste.getText());
Vector<Field> fields = getParent().getPasteInStorageService()
.getFields(configuration);
The fields should be added to the parent shell project fields.
1.2.6.6 Adding fields -> MigMapper File
GUI reference: Source/Target “Add” link, top “Add Fields” tab, “MigMapper File” subtab
Code reference: FieldAddDialog.java, lines 919-998
Implementation: When “Open Mapproj file” is selected the fields should be reloaded using ProjectService after line 953. It should also allow opening .xml files. The buttons btnShowTheSource, btnShowTheTarget should show project.getSourceFields() and project.getTargetFields() of the loaded project. “Select All” should select/unselect all loaded fields in main area, “Sort Alphabetically” should reorder all fields and sort them based on field.getName(). When “Import” button is selected the PasteInDataStorageService processing should be performed after line 998 when handling the button and all selected source/target fields should be added to the project.
1.2.6.7 Manage Fields -> MigMapper File
GUI reference: Source/Target “Manage” link, top “Manage Fields” tab
Code reference: FieldEditDialog.java
Implementation: The implementation should update all loaded source/target fields of parent shell project. The update should be done after clicking “OK – Keep Changes”
All “Move Rows” buttons are already handled in prototype code. Nothing is required to be updated.
“Delete Selected” should remove selected rows specifying the fields and remove them from project fields.
“Change Tablename of Selected” should call field.setTableName() for all selected fields in the grid.
“Remove duplicates” should remove all non-first entries having the same field.getTableName() and field.getName() for all fields in the grid.
“Sort alphabetical” should sort all fields based on field.getName() (note, similar logic is already handled by clicking on “Field name” as sort column)
“Clear All Flags” should call field.clearFlags() for all fields.
“Clear All Questions” should call field.setQuestion(“”) for all fields.
After double clicking on the row, if user changes any data of field in should be updated after clicking “OK” button
1.2.7 Main working area
GUI reference: Two main field trees on left/right for source/target fields, controls for adding mapping
Code reference: MainShell.java
Implementation: The implementation should load left tree for proj.getSourceFields() and right tree for proj.getTargetFields(). The leaf value to write should check the proj.getPreferences().getSourcePreferences() and proj.getPreferences().getTargetPreferences() values of current proj. If SHOW_FIELD_NAMES is set, use field.getName() to display, for SHOW_FIELD_LABELS is use field.getLabel() and for SHOW_BOTH use field.getName() + “ – “ field.getLabel()
When clicking on “Add mapping” new Mapping model should be created, sourceFields set to selected source fields, target fields set to selected target fields and transformation/comment text set to the values in respective text boxes. For all fields that were either in sourceFields or originalFields flag mapped should be set to true. The mapping should appear in bottom grid of mappings.
1.2.8 Bottom working area
GUI reference: Bottom grid of mappings
Code reference: MainShell.java
Implementation: The grid should contain all mappings from the project. [System Use] column should be removed. The implementation should manage mappings for the project. “Redraw Grid” should refresh grid, all “Move Up”, “Down”, “Top”, “Bottom” buttons are already handled in prototype code. Nothing is required to be updated. “Recall Selected for Edit / Delete” should remove the mapping from project and all mapping data (source/target fields, transformation, comment) to the working area above (see section 1.2.7). For all fields in mappings, if field is not used in any other project mapping the flag mapped should be set to false.
1.3 Technology overview
· Java 6
· OpenCSV 2.3
· SWT
1.4 Existing Documents
· Assembly Diagram
· Class Diagrams
· Sequence Diagrams
· Application Design Specification
· Assembly Specifications
Final Submission Guidelines
- Source Code
- Test Data
- Deployment Guide