[366346] Allow adopters to add @Remote and @Local annotations to EJB class when creating a session EJB
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/BusinessInterfaceAnnotationLocationType.java b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/BusinessInterfaceAnnotationLocationType.java
new file mode 100644
index 0000000..25185c3
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/BusinessInterfaceAnnotationLocationType.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jst.j2ee.ejb.internal.operations;
+
+public enum BusinessInterfaceAnnotationLocationType {
+ /**
+ * The business interface annotations <code>(javax.ejb.Local and javax.ejb.Remote) </code> should be added to the
+ * bean class of the EJB being created.
+ */
+ BEAN_CLASS_ONLY,
+
+ /**
+ * The business interface annotations <code>(javax.ejb.Local and javax.ejb.Remote) </code> should be added to the
+ * business interfaces of the EJB being created.
+ */
+ INTERFACE_ONLY,
+
+ /**
+ * The business interface annotations <code>(javax.ejb.Local and javax.ejb.Remote) </code> should be added to both the
+ * business interfaces and the bean class of the EJB being created.
+ */
+ BEAN_CLASS_AND_INTERFACE,
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/CreateSessionBeanTemplateModel.java b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/CreateSessionBeanTemplateModel.java
index 0cbf234..6917d3e 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/CreateSessionBeanTemplateModel.java
+++ b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/CreateSessionBeanTemplateModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG and others.
+ * Copyright (c) 2007, 2012 SAP AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ * Roberto Sanchez, rsanchez@mx1.ibm.com - Add remote and local annotations to bean class
*******************************************************************************/
package org.eclipse.jst.j2ee.ejb.internal.operations;
@@ -89,11 +90,22 @@
}
List<BusinessInterface> interfaces = getBusinessInterfaces();
- for (BusinessInterface iface : interfaces) {
- if (iface.isLocal() && iface.exists()) {
- collection.add(QUALIFIED_LOCAL);
- } else if (iface.isRemote() && iface.exists()) {
- collection.add(QUALIFIED_REMOTE);
+ if (addBusinessAnnotationToBeanClass()){
+ for (BusinessInterface iface : interfaces) {
+ if (iface.isLocal()) {
+ collection.add(QUALIFIED_LOCAL);
+ } else if (iface.isRemote()) {
+ collection.add(QUALIFIED_REMOTE);
+ }
+ }
+ }
+ else {
+ for (BusinessInterface iface : interfaces) {
+ if (iface.isLocal() && iface.exists()) {
+ collection.add(QUALIFIED_LOCAL);
+ } else if (iface.isRemote() && iface.exists()) {
+ collection.add(QUALIFIED_REMOTE);
+ }
}
}
@@ -134,6 +146,18 @@
return (List<BusinessInterface>) dataModel.getProperty(INTERFACES);
}
+ public List<BusinessInterface> getLocalBusinessInterfaces() {
+ List<BusinessInterface> result = new ArrayList<BusinessInterface>();
+
+ List<BusinessInterface> interfaces = getBusinessInterfaces();
+ for (BusinessInterface iface : interfaces) {
+ if (iface.isLocal())
+ result.add(iface);
+ }
+
+ return result;
+ }
+
public List<BusinessInterface> getExistingLocalBusinessInterfaces() {
List<BusinessInterface> result = new ArrayList<BusinessInterface>();
@@ -146,6 +170,18 @@
return result;
}
+ public List<BusinessInterface> getRemoteBusinessInterfaces() {
+ List<BusinessInterface> result = new ArrayList<BusinessInterface>();
+
+ List<BusinessInterface> interfaces = getBusinessInterfaces();
+ for (BusinessInterface iface : interfaces) {
+ if (iface.isRemote())
+ result.add(iface);
+ }
+
+ return result;
+ }
+
public List<BusinessInterface> getExistingRemoteBusinessInterfaces() {
List<BusinessInterface> result = new ArrayList<BusinessInterface>();
@@ -265,4 +301,16 @@
public void setRemoteComponentClassName(String remoteComponentClassName) {
this.remoteComponentClassName = remoteComponentClassName;
}
+
+ public boolean addBusinessAnnotationToBeanClass(){
+ String prop = dataModel.getStringProperty(BUSINESS_INTERFACE_ANNOTATION_LOCATION);
+ return (prop.equals(BusinessInterfaceAnnotationLocationType.BEAN_CLASS_ONLY.toString()) ||
+ prop.equals(BusinessInterfaceAnnotationLocationType.BEAN_CLASS_AND_INTERFACE.toString()));
+ }
+
+ public boolean addBusinessAnnotationToInterface(){
+ String prop = dataModel.getStringProperty(BUSINESS_INTERFACE_ANNOTATION_LOCATION);
+ return (prop.equals(BusinessInterfaceAnnotationLocationType.INTERFACE_ONLY.toString()) ||
+ prop.equals(BusinessInterfaceAnnotationLocationType.BEAN_CLASS_AND_INTERFACE.toString()));
+ }
}
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/INewSessionBeanClassDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/INewSessionBeanClassDataModelProperties.java
index c0fa887..19e03f6 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/INewSessionBeanClassDataModelProperties.java
+++ b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/INewSessionBeanClassDataModelProperties.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG and others.
+ * Copyright (c) 2007, 2012 SAP AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ * Roberto Sanchez, rsanchez@mx1.ibm.com - Add remote and local annotations to bean class
*******************************************************************************/
package org.eclipse.jst.j2ee.ejb.internal.operations;
@@ -67,4 +68,6 @@
*/
public static final String STATE_TYPE = "INewSessionBeanClassDataModelProperties.STATE_TYPE"; //$NON-NLS-1$
+ public static final String BUSINESS_INTERFACE_ANNOTATION_LOCATION = "INewSessionBeanClassDataModelProperties.BUSINESS_INTERFACE_ANNOTATION_LOCATION"; //$NON-NLS-1$
+
}
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/LocalBusinessInterfaceTemplate.java b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/LocalBusinessInterfaceTemplate.java
index 837ced1..bdfad51 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/LocalBusinessInterfaceTemplate.java
+++ b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/LocalBusinessInterfaceTemplate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 SAP AG and others.
+ * Copyright (c) 2007, 2012 SAP AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,9 +23,11 @@
public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; //$NON-NLS-1$
protected final String TEXT_1 = "package "; //$NON-NLS-1$
protected final String TEXT_2 = ";"; //$NON-NLS-1$
- protected final String TEXT_3 = NL + "import javax.ejb.Local;" + NL + "" + NL + "@Local" + NL + "public interface "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- protected final String TEXT_4 = " {" + NL + "" + NL + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_5 = NL;
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + "import javax.ejb.Local;" + NL + "" + NL + "@Local"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_5 = NL + "public interface "; //$NON-NLS-1$
+ protected final String TEXT_6 = " {" + NL + "" + NL + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_7 = NL;
public String generate(Object argument)
{
@@ -41,9 +43,17 @@
}
stringBuffer.append(TEXT_3);
- stringBuffer.append(model.getBusinessInterfaceClassName());
+
+ if (model.addBusinessAnnotationToInterface()) {
+
stringBuffer.append(TEXT_4);
+
+ }
+
stringBuffer.append(TEXT_5);
+ stringBuffer.append(model.getBusinessInterfaceClassName());
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_7);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/NewSessionBeanClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/NewSessionBeanClassDataModelProvider.java
index 94c7563..fb0eca8 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/NewSessionBeanClassDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/NewSessionBeanClassDataModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG and others.
+ * Copyright (c) 2007, 2012 SAP AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ * Roberto Sanchez, rsanchez@mx1.ibm.com - Add remote and local annotations to bean class
*******************************************************************************/
package org.eclipse.jst.j2ee.ejb.internal.operations;
@@ -22,6 +23,7 @@
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewSessionBeanClassDataModelProperties.REMOTE_HOME;
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewSessionBeanClassDataModelProperties.REMOTE_HOME_INTERFACE;
import static org.eclipse.jst.j2ee.ejb.internal.operations.INewSessionBeanClassDataModelProperties.STATE_TYPE;
+import static org.eclipse.jst.j2ee.ejb.internal.operations.INewSessionBeanClassDataModelProperties.BUSINESS_INTERFACE_ANNOTATION_LOCATION;
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.JAVA_PACKAGE;
@@ -49,6 +51,7 @@
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
import org.eclipse.jst.j2ee.internal.ejb.project.operations.EJBCreationResourceHandler;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
import org.eclipse.osgi.util.NLS;
@@ -58,6 +61,7 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.project.facet.IProductConstants;
public class NewSessionBeanClassDataModelProvider extends NewEnterpriseBeanClassDataModelProvider {
@@ -97,6 +101,7 @@
propertyNames.add(LOCAL_HOME_INTERFACE);
propertyNames.add(LOCAL_COMPONENT_INTERFACE);
propertyNames.add(REMOTE_COMPONENT_INTERFACE);
+ propertyNames.add(BUSINESS_INTERFACE_ANNOTATION_LOCATION);
return propertyNames;
}
@@ -167,6 +172,19 @@
String className = getStringProperty(QUALIFIED_CLASS_NAME);
return className + REMOTE_COMPONENT_SUFFIX;
}
+ else if (BUSINESS_INTERFACE_ANNOTATION_LOCATION.equals(propertyName))
+ {
+ boolean inInterface = J2EEPlugin.getDefault().getJ2EEPreferences().getBoolean(IProductConstants.EJB_BUSINESS_INTERFACE_ANNOTATION_IN_INTERFACE);
+ boolean inBean = J2EEPlugin.getDefault().getJ2EEPreferences().getBoolean(IProductConstants.EJB_BUSINESS_INTERFACE_ANNOTATION_IN_BEAN);
+ if (inInterface && inBean){
+ return BusinessInterfaceAnnotationLocationType.BEAN_CLASS_AND_INTERFACE.toString();
+ }
+ if (inBean){
+ return BusinessInterfaceAnnotationLocationType.BEAN_CLASS_ONLY.toString();
+ }
+ return BusinessInterfaceAnnotationLocationType.INTERFACE_ONLY.toString();
+
+ }
// Otherwise check super for default value for property
return super.getDefaultProperty(propertyName);
}
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/RemoteBusinessInterfaceTemplate.java b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/RemoteBusinessInterfaceTemplate.java
index 853392e..89eb3b7 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/RemoteBusinessInterfaceTemplate.java
+++ b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/RemoteBusinessInterfaceTemplate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 SAP AG and others.
+ * Copyright (c) 2007, 2012 SAP AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,9 +23,11 @@
public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; //$NON-NLS-1$
protected final String TEXT_1 = "package "; //$NON-NLS-1$
protected final String TEXT_2 = ";"; //$NON-NLS-1$
- protected final String TEXT_3 = NL + "import javax.ejb.Remote;" + NL + "" + NL + "@Remote" + NL + "public interface "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- protected final String TEXT_4 = " {" + NL + "" + NL + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_5 = NL;
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + "import javax.ejb.Remote;" + NL + "" + NL + "@Remote"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_5 = NL + "public interface "; //$NON-NLS-1$
+ protected final String TEXT_6 = " {" + NL + "" + NL + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_7 = NL;
public String generate(Object argument)
{
@@ -41,9 +43,17 @@
}
stringBuffer.append(TEXT_3);
- stringBuffer.append(model.getBusinessInterfaceClassName());
+
+ if (model.addBusinessAnnotationToInterface()) {
+
stringBuffer.append(TEXT_4);
+
+ }
+
stringBuffer.append(TEXT_5);
+ stringBuffer.append(model.getBusinessInterfaceClassName());
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_7);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/SessionBeanTemplate.java b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/SessionBeanTemplate.java
index eae609b..4da505d 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/SessionBeanTemplate.java
+++ b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/SessionBeanTemplate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 SAP AG and others.
+ * Copyright (c) 2007, 2012 SAP AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,14 +40,14 @@
protected final String TEXT_14 = "\""; //$NON-NLS-1$
protected final String TEXT_15 = ")"; //$NON-NLS-1$
protected final String TEXT_16 = NL + "@TransactionManagement(TransactionManagementType.BEAN)"; //$NON-NLS-1$
- protected final String TEXT_17 = NL + "@Local( { "; //$NON-NLS-1$
+ protected final String TEXT_17 = NL + "@Local("; //$NON-NLS-1$
protected final String TEXT_18 = ", "; //$NON-NLS-1$
protected final String TEXT_19 = ".class"; //$NON-NLS-1$
- protected final String TEXT_20 = " })"; //$NON-NLS-1$
- protected final String TEXT_21 = NL + "@Remote( { "; //$NON-NLS-1$
+ protected final String TEXT_20 = ")"; //$NON-NLS-1$
+ protected final String TEXT_21 = NL + "@Remote("; //$NON-NLS-1$
protected final String TEXT_22 = ", "; //$NON-NLS-1$
protected final String TEXT_23 = ".class"; //$NON-NLS-1$
- protected final String TEXT_24 = " })"; //$NON-NLS-1$
+ protected final String TEXT_24 = ")"; //$NON-NLS-1$
protected final String TEXT_25 = NL + "@LocalBean"; //$NON-NLS-1$
protected final String TEXT_26 = NL + "@LocalHome("; //$NON-NLS-1$
protected final String TEXT_27 = ".class)"; //$NON-NLS-1$
@@ -62,15 +62,15 @@
protected final String TEXT_36 = ", "; //$NON-NLS-1$
protected final String TEXT_37 = " {"; //$NON-NLS-1$
protected final String TEXT_38 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- protected final String TEXT_39 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_39 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
protected final String TEXT_40 = NL + " " + NL + " /**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
protected final String TEXT_41 = "#"; //$NON-NLS-1$
protected final String TEXT_42 = "("; //$NON-NLS-1$
protected final String TEXT_43 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
protected final String TEXT_44 = "("; //$NON-NLS-1$
protected final String TEXT_45 = ") {" + NL + " super("; //$NON-NLS-1$ //$NON-NLS-2$
- protected final String TEXT_46 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- protected final String TEXT_47 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$//$NON-NLS-2$
+ protected final String TEXT_46 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_47 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$
protected final String TEXT_48 = "#"; //$NON-NLS-1$
protected final String TEXT_49 = "("; //$NON-NLS-1$
protected final String TEXT_50 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -152,10 +152,22 @@
}
- List<BusinessInterface> localInterfaces = model.getExistingLocalBusinessInterfaces();
+ List<BusinessInterface> localInterfaces = null;
+ if (model.addBusinessAnnotationToBeanClass()){
+ localInterfaces = model.getLocalBusinessInterfaces();
+ }
+ else {
+ localInterfaces = model.getExistingLocalBusinessInterfaces();
+ }
if (!localInterfaces.isEmpty()) {
+ String open = "", close = ""; //$NON-NLS-1$ //$NON-NLS-2$
+ if (localInterfaces.size() > 1){
+ open = "{"; //$NON-NLS-1$
+ close = "}"; //$NON-NLS-1$
+ }
stringBuffer.append(TEXT_17);
+ stringBuffer.append( open );
boolean needComma = false;
for (BusinessInterface iface : localInterfaces) {
@@ -171,14 +183,27 @@
needComma = true;
}
+ stringBuffer.append( close );
stringBuffer.append(TEXT_20);
}
- List<BusinessInterface> remoteInterfaces = model.getExistingRemoteBusinessInterfaces();
+ List<BusinessInterface> remoteInterfaces = null;
+ if (model.addBusinessAnnotationToBeanClass()){
+ remoteInterfaces = model.getRemoteBusinessInterfaces();
+ }
+ else{
+ remoteInterfaces = model.getExistingRemoteBusinessInterfaces();
+ }
if (!remoteInterfaces.isEmpty()) {
+ String open = "", close = ""; //$NON-NLS-1$ //$NON-NLS-2$
+ if (remoteInterfaces.size() > 1){
+ open = "{"; //$NON-NLS-1$
+ close = "}"; //$NON-NLS-1$
+ }
stringBuffer.append(TEXT_21);
+ stringBuffer.append( open );
boolean needComma = false;
for (BusinessInterface iface : remoteInterfaces) {
@@ -194,6 +219,7 @@
needComma = true;
}
+ stringBuffer.append( close );
stringBuffer.append(TEXT_24);
}
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/templates/localBusinessInterface.javajet b/plugins/org.eclipse.jst.j2ee.ejb/templates/localBusinessInterface.javajet
index 84e8d28..6b5550c 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/templates/localBusinessInterface.javajet
+++ b/plugins/org.eclipse.jst.j2ee.ejb/templates/localBusinessInterface.javajet
@@ -9,9 +9,16 @@
<%
}
%>
+
+<%
+ if (model.addBusinessAnnotationToInterface()) {
+%>
import javax.ejb.Local;
@Local
+<%
+ }
+%>
public interface <%=model.getBusinessInterfaceClassName()%> {
}
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/templates/remoteBusinessInterface.javajet b/plugins/org.eclipse.jst.j2ee.ejb/templates/remoteBusinessInterface.javajet
index 6b3c178..74b3255 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/templates/remoteBusinessInterface.javajet
+++ b/plugins/org.eclipse.jst.j2ee.ejb/templates/remoteBusinessInterface.javajet
@@ -9,9 +9,16 @@
<%
}
%>
+
+<%
+ if (model.addBusinessAnnotationToInterface()) {
+%>
import javax.ejb.Remote;
@Remote
+<%
+ }
+%>
public interface <%=model.getBusinessInterfaceClassName()%> {
}
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/templates/sessionBean_classHeader.template b/plugins/org.eclipse.jst.j2ee.ejb/templates/sessionBean_classHeader.template
index 74a7388..b8d3eec 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/templates/sessionBean_classHeader.template
+++ b/plugins/org.eclipse.jst.j2ee.ejb/templates/sessionBean_classHeader.template
@@ -30,10 +30,21 @@
<%
}
- List<BusinessInterface> localInterfaces = model.getExistingLocalBusinessInterfaces();
+ List<BusinessInterface> localInterfaces = null;
+ if (model.addBusinessAnnotationToBeanClass()){
+ localInterfaces = model.getLocalBusinessInterfaces();
+ }
+ else {
+ localInterfaces = model.getExistingLocalBusinessInterfaces();
+ }
if (!localInterfaces.isEmpty()) {
+ String open = "", close = "";
+ if (localInterfaces.size() > 1){
+ open = "{";
+ close = "}";
+ }
%>
-@Local( {
+@Local(<%= open %>
<%
boolean needComma = false;
for (BusinessInterface iface : localInterfaces) {
@@ -45,14 +56,25 @@
<%
needComma = true;
}
-%> })
+%><%= close %>)
<%
}
- List<BusinessInterface> remoteInterfaces = model.getExistingRemoteBusinessInterfaces();
+ List<BusinessInterface> remoteInterfaces = null;
+ if (model.addBusinessAnnotationToBeanClass()){
+ remoteInterfaces = model.getRemoteBusinessInterfaces();
+ }
+ else{
+ remoteInterfaces = model.getExistingRemoteBusinessInterfaces();
+ }
if (!remoteInterfaces.isEmpty()) {
+ String open = "", close = "";
+ if (remoteInterfaces.size() > 1){
+ open = "{";
+ close = "}";
+ }
%>
-@Remote( {
+@Remote(<%= open %>
<%
boolean needComma = false;
for (BusinessInterface iface : remoteInterfaces) {
@@ -64,7 +86,7 @@
<%
needComma = true;
}
-%> })
+%><%= close %>)
<%
}