Bug 243226 - Creating New Modules while creating EAR Project does not work correctly
Summary: Creating New Modules while creating EAR Project does not work correctly
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Ian Tewksbury CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard: PMC_approved
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-08-05 15:54 EDT by Ian Tewksbury CLA
Modified: 2008-08-07 10:10 EDT (History)
3 users (show)

See Also:
david_williams: pmc_approved+
cbridgha: pmc_approved? (raghunathan.srinivasan)
cbridgha: pmc_approved? (naci.dai)
deboer: pmc_approved+
cbridgha: pmc_approved? (neil.hauge)
cbridgha: pmc_approved? (kaloyan)
cbridgha: review+


Attachments
Partial Fix Patch (2.95 KB, patch)
2008-08-05 16:08 EDT, Ian Tewksbury CLA
no flags Details | Diff
Full Fix Patch (6.46 KB, patch)
2008-08-06 11:52 EDT, Ian Tewksbury CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Tewksbury CLA 2008-08-05 15:54:56 EDT
STEPS:
Start EAR Project creation wizard
On second page choose, "New Module..."
Un-select "Create Default Modules"

RESULTS:
Any module you create from this dialog on will have two issues:
1: the data model is not in sync with the wizard
2: when you finish the wizard to create the module an EAR will be created as if you had chosen the grayed out option to create an EAR with the module.
Comment 1 Ian Tewksbury CLA 2008-08-05 16:08:19 EDT
Created attachment 109213 [details]
Partial Fix Patch

This patch fixes the first problem by not allowing the DataModelFacetCreationWizardpage to set its FactedProjectWorkingCopy until after the page has been associated with a parent wizard, in this way the page gets the WorkingCopy from the parent wizard who in turn got it from the model associated with the wizard.
Comment 2 Ian Tewksbury CLA 2008-08-06 11:52:51 EDT
Created attachment 109327 [details]
Full Fix Patch

The root of this problem is that the IFacetedProjectWorkingCopy does not seem to be automaticly kept in sync with the IDataModel it is a property of.  Therefor when properties were changed on the IDataModel they were not changed on the IFacetedProjectWorkingCopy and at the end of the wizard the IFacetedProjectWorkingCopy is used to actually create the projects.

The fixes are as follows:

NewJ2EEComponentSelectionPage:
createChildWizard() - this method copys the properties from the local model for any of the four possible created module types to the model automaticly created by creating a new wizard.  Because this is changing the properties of the model used by the wizard the IFacetedProjectWorkingCopy for that model also has to be updated.  This fixes the bulk of the issues associated with this bug, making the project version selection box function correctly and makeing it so a secondary EAR is not created.

DefaultJ2EEComponentCreationDataModelProvider:
setNestedJ2EEVersion() - this method updates the default facet versions used for the different module types based on the current facet version of the EAR. Again because it is updating the models the associated IFacetedProjectWorkingCopy need to be updated.  This fixes a problem that apeared from fixing the orginal issue which was that when the module wizard was first loaded the second page of the wizard (where you select weather to have a DD or not in the case of EE 5) was not in sync with the IDataModel in use with the rest of the wizard because this second page was relaying on the IFacetedProjectWorkingCopy which was not updated, Though this would be updated if the user changed the default project version on the first page of the wizard it is important all the pages are in sync as soon as the wizard loads.

Testing:
I have tested creating all project types with pre and post Java EE 5 versions both as "New Modules" of an EAR and as projects by them selves.  All appears to be working correctly now without any regressions.
Comment 3 Chuck Bridgham CLA 2008-08-06 12:42:00 EDT
Approve - Bad issue that needs fixing.
Comment 4 Carl Anderson CLA 2008-08-07 06:19:45 EDT
Released to R3_0_maintenance for 3.0.1