Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366621

Summary: ADD_TO_EAR property is blocking the EJB Client Jar generation
Product: [WebTools] WTP EJB Tools Reporter: Roberto Sanchez Herrera <shr31223>
Component: jst.ejbAssignee: Carl Anderson <ccc>
Status: RESOLVED FIXED QA Contact: Kaloyan Raev <kaloyan>
Severity: enhancement    
Priority: P3 CC: cbridgha, ccc, makandre, shr31223, zina
Version: 3.2Flags: ccc: review+
Target Milestone: 3.2.5 P   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 365653    
Bug Blocks:    
Attachments:
Description Flags
Proposed patch none

Description Roberto Sanchez Herrera CLA 2011-12-13 15:36:46 EST
An adopter is requesting to backport this bug to WTP 3.2.5P

+++ This bug was initially created as a clone of Bug #365653 +++

I need to generate an EJB project, and an EJB Client jar project. But I do not want to add the result to an EAR. I have a different containing application that contains both my EJB and EJB Client projects. The property  IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR need to be set to false.
This would disable the page where a user can select to generate an EJB Client Jar.

We tried to set IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR to true, to enable the UI, and then set it to false only when the user selects to Finish, but that did not work either.
Because the underneath Code blocks the EJB Client generation if the IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR is set to false (not only the UI is blocked).  The following code snippet in the EjbFacetInstallDataModelProvider class propertySet() method  is just the tip of the problem:

 } else if (propertyName.equals(ADD_TO_EAR)) {
   			boolean addToEar = (Boolean) propertyValue;
	    	if (!addToEar && isPropertySet(CREATE_CLIENT)) {
	    		model.setBooleanProperty(CREATE_CLIENT, false);  // create client disabled!
	    	} else {

If we leave the IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR to true, the wizard would finish and generates an EAR project , and this is not what we need.
Seems this property is used for a double purpose. It actually means a creation of an EAR project and it is used to enable the EJB Client generation.
Now we either have no Client jar generation , or we have to end up with an EAR getting generated in the workspace. We need to decouple these two logic with two separate flags.

Suggest to add a new flag like ADD_TO_APPLICATION, which does not imply creation of an application, but means that the project would be part of an application.
Comment 1 Roberto Sanchez Herrera CLA 2011-12-13 15:53:16 EST
Created attachment 208340 [details]
Proposed patch

Proposed patch built using R3_2_5_patches
Comment 2 Carl Anderson CLA 2011-12-13 15:56:47 EST
This same patch was reviewed by the PMC for WTP 3.3.2, and as such merits inclusion in our WTP 3.2.5 patches.
Comment 3 Roberto Sanchez Herrera CLA 2012-01-20 15:32:10 EST
Code committed and released to R3_2_5_patches. Resolving bug.