diff --git a/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/api/AppClientProjectGenerator.java b/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/api/AppClientProjectGenerator.java
--- a/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/api/AppClientProjectGenerator.java
+++ b/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/api/AppClientProjectGenerator.java
@@ -434,8 +434,7 @@
}
}
Profile j2eeProfile = createData.getJavaEEProfile();
- if (j2eeProfile.equals(Profile.JAVA_EE_6_FULL) || j2eeProfile.equals(Profile.JAVA_EE_6_WEB) ||
- j2eeProfile.equals(Profile.JAVA_EE_7_FULL) || j2eeProfile.equals(Profile.JAVA_EE_7_WEB)) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
if (rh.getProjectLibraryManager().getLibrary(Util.ENDORSED_LIBRARY_NAME) == null) { // NOI18N
rh.copyLibrary(LibraryManager.getDefault().getLibrary(Util.ENDORSED_LIBRARY_NAME)); // NOI18N
}
@@ -672,8 +671,7 @@
ep.put(AppClientProjectProperties.CLIENT_NAME, mainClassArgs);
}
- if (j2eeProfile.equals(Profile.JAVA_EE_6_FULL) || j2eeProfile.equals(Profile.JAVA_EE_6_WEB) ||
- j2eeProfile.equals(Profile.JAVA_EE_7_FULL) || j2eeProfile.equals(Profile.JAVA_EE_7_WEB)) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
ep.setProperty(ProjectProperties.ENDORSED_CLASSPATH, new String[]{Util.ENDORSED_LIBRARY_CLASSPATH});
}
diff --git a/j2ee.common/manifest.mf b/j2ee.common/manifest.mf
--- a/j2ee.common/manifest.mf
+++ b/j2ee.common/manifest.mf
@@ -2,5 +2,5 @@
OpenIDE-Module: org.netbeans.modules.j2ee.common/1
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/j2ee/common/Bundle.properties
OpenIDE-Module-Needs: javax.script.ScriptEngine.freemarker
-OpenIDE-Module-Specification-Version: 1.74
+OpenIDE-Module-Specification-Version: 1.75
AutoUpdate-Show-In-Client: false
diff --git a/j2ee.common/src/org/netbeans/modules/j2ee/common/Util.java b/j2ee.common/src/org/netbeans/modules/j2ee/common/Util.java
--- a/j2ee.common/src/org/netbeans/modules/j2ee/common/Util.java
+++ b/j2ee.common/src/org/netbeans/modules/j2ee/common/Util.java
@@ -228,6 +228,118 @@
}
/**
+ * Find out if the version of the given profile is at least Java EE 5 or higher.
+ *
+ * @param profile profile that we want to compare
+ * @return true if the version of the given profile is Java EE 5 or higher,
+ * false otherwise
+ * @since 1.75
+ */
+ public static boolean isAtLeastJavaEE5(@NonNull Profile profile) {
+ return isVersionEqualOrHigher(profile, Profile.JAVA_EE_5);
+ }
+
+ /**
+ * Find out if the version of the given profile is at least Java EE 6 Web or
+ * higher.
+ *
+ * @param profile profile that we want to compare
+ * @return true if the version of the given profile is Java EE 6 Web or
+ * higher, false otherwise
+ * @since 1.75
+ */
+ public static boolean isAtLeastJavaEE6Web(@NonNull Profile profile) {
+ return isVersionEqualOrHigher(profile, Profile.JAVA_EE_6_WEB);
+ }
+
+ /**
+ * Compares if the first given profile has equal or higher Java EE version
+ * in comparison to the second profile.
+ *
+ * Please be aware of the following rules:
+ *
+ *
+ * 1) Each Java EE X version is considered as lower than Java EE X+1 version
+ * (this applies regardless on Web/Full specification and in reality it means
+ * that even Java EE 6 Full version is considered as lower than Java EE 7 Web)
+ *
+ *
+ * 2) Each Java EE X Web version is considered as lower than Java EE X Full
+ *
+ *
+ * @param profileToCompare profile that we want to compare
+ * @param comparingVersion version which we are comparing with
+ * @return true
if the profile version is equal or higher in
+ * comparison with the second one, false
otherwise
+ * @since 1.75
+ */
+ private static boolean isVersionEqualOrHigher(
+ @NonNull Profile profileToCompare,
+ @NonNull Profile comparingVersion) {
+
+ int comparisonResult = Profile.UI_COMPARATOR.compare(profileToCompare, comparingVersion);
+ if (comparisonResult == 0) {
+ // The same version for both
+ return true;
+
+ } else {
+ String profileToCompareVersion = getProfileVersion(profileToCompare);
+ String comparingProfileVersion = getProfileVersion(comparingVersion);
+
+ // If the canonicalName is the same value we have to differ between Web and Full profile
+ if (profileToCompareVersion.equals(comparingProfileVersion)) {
+ return compareWebAndFull(profileToCompare, comparingVersion);
+ } else {
+ if (comparisonResult > 0) {
+ // profileToCompare has lower version than comparingVersion
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+ }
+
+ private static boolean compareWebAndFull(
+ @NonNull Profile profileToCompare,
+ @NonNull Profile comparingVersion) {
+
+ boolean isThisFullProfile = isFullProfile(profileToCompare);
+ boolean isParamFullProfile = isFullProfile(comparingVersion);
+
+ if (isThisFullProfile && isParamFullProfile) {
+ // Both profiles are Java EE Full
+ return true;
+ }
+ if (!isThisFullProfile && !isParamFullProfile) {
+ // Both profiles are Java EE Web
+ return true;
+ }
+ if (isThisFullProfile && !isParamFullProfile) {
+ // profileToCompare is Java EE Full profile and comparingVersion is only Java EEWeb profile
+ return true;
+ }
+ return false;
+ }
+
+ private static String getProfileVersion(@NonNull Profile profile) {
+ String profileDetails = profile.toPropertiesString();
+ int indexOfDash = profileDetails.indexOf("-");
+ if (indexOfDash != -1) {
+ return profileDetails.substring(0, indexOfDash);
+ }
+ return profileDetails;
+ }
+
+ private static boolean isFullProfile(@NonNull Profile profile) {
+ final String profileDetails = profile.toPropertiesString();
+ if (profileDetails.indexOf("-") == -1) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Returns source level of a given project
*
* @param project Project
diff --git a/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/DDHelper.java b/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/DDHelper.java
--- a/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/DDHelper.java
+++ b/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/DDHelper.java
@@ -49,6 +49,7 @@
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import org.netbeans.api.j2ee.core.Profile;
+import org.netbeans.modules.j2ee.common.Util;
import org.openide.filesystems.FileLock;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
@@ -85,8 +86,7 @@
*/
public static FileObject createWebXml(Profile j2eeProfile, boolean webXmlRequired, FileObject dir) throws IOException {
String template = null;
- if ((Profile.JAVA_EE_6_FULL == j2eeProfile || Profile.JAVA_EE_6_WEB == j2eeProfile ||
- Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) && webXmlRequired) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile) && webXmlRequired) {
template = "web-3.0.xml"; //NOI18N
} else if (Profile.JAVA_EE_5 == j2eeProfile) {
template = "web-2.5.xml"; //NOI18N
@@ -116,8 +116,7 @@
*/
public static FileObject createWebFragmentXml(Profile j2eeProfile, FileObject dir) throws IOException {
String template = null;
- if (Profile.JAVA_EE_6_FULL == j2eeProfile || Profile.JAVA_EE_6_WEB == j2eeProfile ||
- Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
template = "web-fragment-3.0.xml"; //NOI18N
}
@@ -155,8 +154,7 @@
*/
public static FileObject createBeansXml(Profile j2eeProfile, FileObject dir, String name) throws IOException {
String template = null;
- if (Profile.JAVA_EE_6_FULL == j2eeProfile || Profile.JAVA_EE_6_WEB == j2eeProfile ||
- Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
template = "beans-1.0.xml"; //NOI18N
}
@@ -194,8 +192,7 @@
*/
public static FileObject createValidationXml(Profile j2eeProfile, FileObject dir, String name) throws IOException {
String template = null;
- if (Profile.JAVA_EE_6_FULL == j2eeProfile || Profile.JAVA_EE_6_WEB == j2eeProfile ||
- Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
template = "validation.xml"; //NOI18N
}
@@ -233,8 +230,7 @@
*/
public static FileObject createConstraintXml(Profile j2eeProfile, FileObject dir, String name) throws IOException {
String template = null;
- if (Profile.JAVA_EE_6_FULL == j2eeProfile || Profile.JAVA_EE_6_WEB == j2eeProfile ||
- Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) {
+ if (Util.isAtLeastJavaEE6Web(Profile.JAVA_EE_6_FULL)) {
template = "constraint.xml"; //NOI18N
}
diff --git a/j2ee.common/src/org/netbeans/modules/j2ee/common/project/ui/ProjectServerPanel.java b/j2ee.common/src/org/netbeans/modules/j2ee/common/project/ui/ProjectServerPanel.java
--- a/j2ee.common/src/org/netbeans/modules/j2ee/common/project/ui/ProjectServerPanel.java
+++ b/j2ee.common/src/org/netbeans/modules/j2ee/common/project/ui/ProjectServerPanel.java
@@ -73,6 +73,7 @@
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeApplicationProvider;
import org.netbeans.api.j2ee.core.Profile;
import org.netbeans.api.project.ant.AntArtifactQuery;
+import org.netbeans.modules.j2ee.common.Util;
import org.netbeans.modules.j2ee.deployment.devmodules.api.ServerInstance;
import org.netbeans.spi.project.support.ant.PropertyUtils;
import org.openide.WizardDescriptor;
@@ -838,8 +839,7 @@
cdiCheckbox.setVisible(false);
return;
}
- cdiCheckbox.setVisible(!importScenario && (j2ee.equals(Profile.JAVA_EE_6_FULL) || j2ee.equals(Profile.JAVA_EE_6_WEB) ||
- j2ee.equals(Profile.JAVA_EE_7_FULL) || j2ee.equals(Profile.JAVA_EE_7_WEB)));
+ cdiCheckbox.setVisible(!importScenario && Util.isAtLeastJavaEE6Web(j2ee));
String warningType = J2eeVersionWarningPanel.findWarningType(j2ee);
if (warningType == null && warningPanel == null) {
warningPlaceHolderPanel.setVisible(false);
diff --git a/j2ee.common/test/unit/src/org/netbeans/modules/j2ee/common/UtilTest.java b/j2ee.common/test/unit/src/org/netbeans/modules/j2ee/common/UtilTest.java
--- a/j2ee.common/test/unit/src/org/netbeans/modules/j2ee/common/UtilTest.java
+++ b/j2ee.common/test/unit/src/org/netbeans/modules/j2ee/common/UtilTest.java
@@ -51,9 +51,8 @@
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
-import org.netbeans.junit.Manager;
+import org.netbeans.api.j2ee.core.Profile;
import org.netbeans.junit.NbTestCase;
-import org.netbeans.modules.j2ee.common.Util;
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
import org.openide.filesystems.FileUtil;
@@ -68,6 +67,27 @@
super(testName);
}
+ public void testIsHigherJavaEEVersionJavaEE5() {
+ assertFalse(Util.isAtLeastJavaEE5(Profile.J2EE_13));
+ assertFalse(Util.isAtLeastJavaEE5(Profile.J2EE_14));
+
+ assertTrue(Util.isAtLeastJavaEE5(Profile.JAVA_EE_5));
+ assertTrue(Util.isAtLeastJavaEE5(Profile.JAVA_EE_6_FULL));
+ assertTrue(Util.isAtLeastJavaEE5(Profile.JAVA_EE_6_WEB));
+ assertTrue(Util.isAtLeastJavaEE5(Profile.JAVA_EE_7_FULL));
+ assertTrue(Util.isAtLeastJavaEE5(Profile.JAVA_EE_7_WEB));
+ }
+
+ public void testIsHigherJavaEEVersionJavaEE6full() {
+ assertFalse(Util.isAtLeastJavaEE6Web(Profile.J2EE_13));
+ assertFalse(Util.isAtLeastJavaEE6Web(Profile.J2EE_14));
+ assertFalse(Util.isAtLeastJavaEE6Web(Profile.JAVA_EE_5));
+
+ assertTrue(Util.isAtLeastJavaEE6Web(Profile.JAVA_EE_6_WEB));
+ assertTrue(Util.isAtLeastJavaEE6Web(Profile.JAVA_EE_6_FULL));
+ assertTrue(Util.isAtLeastJavaEE6Web(Profile.JAVA_EE_7_WEB));
+ assertTrue(Util.isAtLeastJavaEE6Web(Profile.JAVA_EE_7_FULL));
+ }
public void testContainsClass() throws IOException {
File dataDir = getDataDir();
diff --git a/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/EarProjectGenerator.java b/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/EarProjectGenerator.java
--- a/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/EarProjectGenerator.java
+++ b/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/EarProjectGenerator.java
@@ -233,8 +233,7 @@
SharabilityUtility.createLibrary(
h.resolveFile(h.getLibrariesLocation()), serverlibraryName, serverInstanceId);
}
- if (j2eeProfile.equals(Profile.JAVA_EE_6_FULL) || j2eeProfile.equals(Profile.JAVA_EE_6_WEB) ||
- j2eeProfile.equals(Profile.JAVA_EE_7_FULL) || j2eeProfile.equals(Profile.JAVA_EE_7_WEB)) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
if (rh.getProjectLibraryManager().getLibrary(Util.ENDORSED_LIBRARY_NAME) == null) { // NOI18N
rh.copyLibrary(LibraryManager.getDefault().getLibrary(Util.ENDORSED_LIBRARY_NAME)); // NOI18N
}
@@ -526,8 +525,7 @@
} else if (Profile.JAVA_EE_5.equals(j2eeProfile)) {
template = FileUtil.getConfigFile(
"org-netbeans-modules-j2ee-earproject/ear-5.xml"); // NOI18N
- } else if (Profile.JAVA_EE_6_FULL.equals(j2eeProfile) || Profile.JAVA_EE_6_WEB.equals(j2eeProfile) ||
- Profile.JAVA_EE_7_FULL.equals(j2eeProfile) || Profile.JAVA_EE_7_WEB.equals(j2eeProfile)) {
+ } else if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
template = FileUtil.getConfigFile(
"org-netbeans-modules-j2ee-earproject/ear-6.xml"); // NOI18N
} else {
@@ -646,8 +644,7 @@
EarProjectProperties.JAR_CONTENT_ADDITIONAL+"}:${"+ // NOI18N
EarProjectProperties.RUN_CLASSPATH+"}"); // NOI18N
- if (j2eeProfile.equals(Profile.JAVA_EE_6_FULL) || j2eeProfile.equals(Profile.JAVA_EE_6_WEB) ||
- j2eeProfile.equals(Profile.JAVA_EE_7_FULL) || j2eeProfile.equals(Profile.JAVA_EE_7_WEB)) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
ep.setProperty(ProjectProperties.ENDORSED_CLASSPATH, new String[]{Util.ENDORSED_LIBRARY_CLASSPATH});
}
diff --git a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/Utils.java b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/Utils.java
--- a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/Utils.java
+++ b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/Utils.java
@@ -76,6 +76,7 @@
import org.netbeans.api.project.FileOwnerQuery;
import org.netbeans.api.project.Project;
import org.netbeans.modules.j2ee.common.J2eeProjectCapabilities;
+import org.netbeans.modules.j2ee.common.Util;
import org.netbeans.modules.j2ee.dd.api.ejb.EjbJarMetadata;
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeApplicationProvider;
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
@@ -270,8 +271,7 @@
Profile profile = ejbJars.length > 0 ? ejbJars[0].getJ2eeProfile() : null;
if (J2eeModule.Type.EJB.equals(type) || (J2eeModule.Type.WAR.equals(type) &&
- (Profile.JAVA_EE_6_WEB.equals(profile) || Profile.JAVA_EE_6_FULL.equals(profile) ||
- Profile.JAVA_EE_7_WEB.equals(profile) || Profile.JAVA_EE_7_FULL.equals(profile)))){
+ Util.isAtLeastJavaEE6Web(profile))){
isEJBModule = true;
}
}
diff --git a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/AppServerValidationPanel.java b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/AppServerValidationPanel.java
--- a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/AppServerValidationPanel.java
+++ b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/AppServerValidationPanel.java
@@ -78,8 +78,7 @@
}
WebModule wm = WebModule.getWebModule(project.getProjectDirectory());
- if (wm != null && (wm.getJ2eeProfile() == Profile.JAVA_EE_6_FULL || wm.getJ2eeProfile() == Profile.JAVA_EE_6_WEB ||
- wm.getJ2eeProfile() == Profile.JAVA_EE_7_FULL || wm.getJ2eeProfile() == Profile.JAVA_EE_7_WEB)) {
+ if (wm != null && Util.isAtLeastJavaEE6Web(wm.getJ2eeProfile())) {
// check that server is EJB lite sufficient
EjbSupport ejbSupport = EjbSupport.getInstance(j2eePlatform);
if (!ejbSupport.isEjb31LiteSupported(j2eePlatform)) {
diff --git a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/EjbFacadeVisualPanel2.java b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/EjbFacadeVisualPanel2.java
--- a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/EjbFacadeVisualPanel2.java
+++ b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/EjbFacadeVisualPanel2.java
@@ -42,8 +42,6 @@
package org.netbeans.modules.j2ee.ejbcore.ejb.wizard.jpa.dao;
import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
@@ -58,12 +56,10 @@
import javax.swing.event.DocumentListener;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
-import org.netbeans.api.j2ee.core.Profile;
import org.netbeans.api.project.Project;
import org.netbeans.api.project.ProjectUtils;
import org.netbeans.api.project.SourceGroup;
import org.netbeans.modules.j2ee.common.J2eeProjectCapabilities;
-import org.netbeans.modules.j2ee.common.Util;
import org.netbeans.modules.j2ee.core.api.support.SourceGroups;
import org.netbeans.modules.j2ee.ejbcore.ejb.wizard.session.SessionEJBWizardPanel;
import org.netbeans.modules.j2ee.persistence.wizard.fromdb.SourceGroupUISupport;
@@ -96,10 +92,8 @@
handleCheckboxes();
J2eeProjectCapabilities projectCap = J2eeProjectCapabilities.forProject(project);
- if (projectCap.isEjb31LiteSupported()){
- boolean serverSupportsEJB31 = Util.getSupportedProfiles(project).contains(Profile.JAVA_EE_6_FULL) ||
- Util.getSupportedProfiles(project).contains(Profile.JAVA_EE_7_FULL);
- if (!projectCap.isEjb31Supported() && !serverSupportsEJB31){
+ if (projectCap != null && projectCap.isEjb31LiteSupported()){
+ if (!projectCap.isEjb31Supported()){
remoteCheckBox.setVisible(false);
remoteCheckBox.setEnabled(false);
}
diff --git a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/mdb/MessageEJBWizard.java b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/mdb/MessageEJBWizard.java
--- a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/mdb/MessageEJBWizard.java
+++ b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/mdb/MessageEJBWizard.java
@@ -54,6 +54,7 @@
import org.netbeans.api.project.Project;
import org.netbeans.api.project.SourceGroup;
import org.netbeans.modules.j2ee.api.ejbjar.EjbJar;
+import org.netbeans.modules.j2ee.common.Util;
import org.netbeans.spi.project.ui.templates.support.Templates;
import org.openide.filesystems.FileObject;
import org.netbeans.modules.j2ee.core.api.support.SourceGroups;
@@ -103,11 +104,7 @@
// TODO: UI - add checkbox for Java EE 5 to create also EJB 2.1 style EJBs
Profile profile = ejbModule.getJ2eeProfile();
- boolean isSimplified = Profile.JAVA_EE_5.equals(profile) ||
- Profile.JAVA_EE_6_FULL.equals(profile) ||
- Profile.JAVA_EE_6_WEB.equals(profile) ||
- Profile.JAVA_EE_7_FULL.equals(profile) ||
- Profile.JAVA_EE_7_WEB.equals(profile);
+ boolean isSimplified = Util.isAtLeastJavaEE5(profile);
MessageGenerator generator = MessageGenerator.create(
Templates.getTargetName(wiz),
pkg,
diff --git a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizard.java b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizard.java
--- a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizard.java
+++ b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizard.java
@@ -54,6 +54,7 @@
import org.netbeans.api.project.Project;
import org.netbeans.api.project.SourceGroup;
import org.netbeans.modules.j2ee.api.ejbjar.EjbJar;
+import org.netbeans.modules.j2ee.common.Util;
import org.netbeans.spi.project.ui.templates.support.Templates;
import org.openide.filesystems.FileObject;
import org.netbeans.modules.j2ee.core.api.support.SourceGroups;
@@ -113,8 +114,7 @@
EjbJar ejbModule = EjbJar.getEjbJar(pkg);
// TODO: UI - add checkbox for Java EE 5 to create also EJB 2.1 style EJBs
Profile profile = ejbModule.getJ2eeProfile();
- boolean isSimplified = Profile.JAVA_EE_5.equals(profile) || Profile.JAVA_EE_6_FULL.equals(profile) || Profile.JAVA_EE_6_WEB.equals(profile) ||
- Profile.JAVA_EE_7_FULL.equals(profile) || Profile.JAVA_EE_7_WEB.equals(profile);
+ boolean isSimplified = Util.isAtLeastJavaEE5(profile);
SessionGenerator sessionGenerator = SessionGenerator.create(
Templates.getTargetName(wiz),
pkg,
diff --git a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizardPanel.java b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizardPanel.java
--- a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizardPanel.java
+++ b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizardPanel.java
@@ -61,7 +61,6 @@
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
-import org.netbeans.api.j2ee.core.Profile;
import org.netbeans.api.java.classpath.ClassPath;
import org.netbeans.api.java.project.JavaProjectConstants;
import org.netbeans.api.java.queries.SourceForBinaryQuery;
@@ -72,7 +71,6 @@
import org.netbeans.api.project.ant.AntArtifactQuery;
import org.netbeans.api.project.ui.OpenProjects;
import org.netbeans.modules.j2ee.common.J2eeProjectCapabilities;
-import org.netbeans.modules.j2ee.common.Util;
import org.netbeans.modules.j2ee.dd.api.ejb.Session;
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
import org.netbeans.spi.project.ant.AntArtifactProvider;
@@ -99,10 +97,8 @@
initComponents();
J2eeProjectCapabilities projectCap = J2eeProjectCapabilities.forProject(project);
- if (projectCap.isEjb31LiteSupported()){
- boolean serverSupportsEJB31 = Util.getSupportedProfiles(project).contains(Profile.JAVA_EE_6_FULL) ||
- Util.getSupportedProfiles(project).contains(Profile.JAVA_EE_7_FULL);
- if (!projectCap.isEjb31Supported() && !serverSupportsEJB31){
+ if (projectCap != null && projectCap.isEjb31LiteSupported()){
+ if (!projectCap.isEjb31Supported()){
remoteCheckBox.setVisible(false);
remoteCheckBox.setEnabled(false);
}
diff --git a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ui/logicalview/ejb/shared/EjbViewController.java b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ui/logicalview/ejb/shared/EjbViewController.java
--- a/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ui/logicalview/ejb/shared/EjbViewController.java
+++ b/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ui/logicalview/ejb/shared/EjbViewController.java
@@ -55,7 +55,7 @@
import org.netbeans.api.java.source.ElementHandle;
import org.netbeans.api.java.source.SourceUtils;
import org.netbeans.modules.j2ee.api.ejbjar.EjbReference;
-import org.netbeans.modules.j2ee.dd.api.common.EjbRef;
+import org.netbeans.modules.j2ee.common.Util;
import org.netbeans.modules.j2ee.dd.api.ejb.AssemblyDescriptor;
import org.netbeans.modules.j2ee.dd.api.ejb.ContainerTransaction;
import org.netbeans.modules.j2ee.dd.api.ejb.DDProvider;
@@ -65,7 +65,6 @@
import org.netbeans.modules.j2ee.dd.api.ejb.EjbRelation;
import org.netbeans.modules.j2ee.dd.api.ejb.EjbRelationshipRole;
import org.netbeans.modules.j2ee.dd.api.ejb.EnterpriseBeans;
-import org.netbeans.modules.j2ee.dd.api.ejb.Entity;
import org.netbeans.modules.j2ee.dd.api.ejb.EntityAndSession;
import org.netbeans.modules.j2ee.dd.api.ejb.Method;
import org.netbeans.modules.j2ee.dd.api.ejb.MethodPermission;
@@ -129,11 +128,7 @@
public void delete(boolean deleteClasses) throws IOException {
Profile profile = ejbModule.getJ2eeProfile();
- boolean isEE5orEE6or7 = Profile.JAVA_EE_5.equals(profile) ||
- Profile.JAVA_EE_6_FULL.equals(profile) ||
- Profile.JAVA_EE_6_WEB.equals(profile) ||
- Profile.JAVA_EE_7_FULL.equals(profile) ||
- Profile.JAVA_EE_7_WEB.equals(profile);
+ boolean isEE5orEE6or7 = Util.isAtLeastJavaEE5(profile);
if (!isEE5orEE6or7) {
ejbModule.getMetadataModel().runReadAction(new MetadataModelAction() {
diff --git a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProvider.java b/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProvider.java
--- a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProvider.java
+++ b/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProvider.java
@@ -56,6 +56,7 @@
import org.netbeans.api.project.SourceGroup;
import org.netbeans.api.project.Sources;
import org.netbeans.api.project.ui.OpenProjects;
+import org.netbeans.modules.j2ee.common.Util;
import org.netbeans.modules.java.api.common.classpath.ClassPathProviderImpl;
import org.netbeans.modules.j2ee.dd.api.ejb.EjbJarMetadata;
import org.netbeans.modules.j2ee.dd.api.webservices.WebservicesMetadata;
@@ -313,8 +314,7 @@
if (platformVersion == null) {
platformVersion = Profile.JAVA_EE_6_FULL;
}
- if (Profile.JAVA_EE_6_FULL.equals(platformVersion) || Profile.JAVA_EE_6_WEB.equals(platformVersion) ||
- Profile.JAVA_EE_7_FULL.equals(platformVersion) || Profile.JAVA_EE_7_WEB.equals(platformVersion)) {
+ if (Util.isAtLeastJavaEE6Web(platformVersion)) {
return EjbJar.VERSION_3_1;
} else if (Profile.JAVA_EE_5.equals(platformVersion)) {
return EjbJar.VERSION_3_0;
diff --git a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/api/EjbJarProjectGenerator.java b/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/api/EjbJarProjectGenerator.java
--- a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/api/EjbJarProjectGenerator.java
+++ b/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/api/EjbJarProjectGenerator.java
@@ -205,8 +205,7 @@
// create ejb-jar.xml
Profile profile = createData.getJavaEEProfile();
- if (!Profile.JAVA_EE_5.equals(profile) && !Profile.JAVA_EE_6_FULL.equals(profile) && !Profile.JAVA_EE_6_WEB.equals(profile) &&
- !Profile.JAVA_EE_7_FULL.equals(profile) && !Profile.JAVA_EE_7_WEB.equals(profile)) {
+ if (!Util.isAtLeastJavaEE5(profile)) {
String resource = "org-netbeans-modules-j2ee-ejbjarproject/ejb-jar-2.1.xml";
FileObject ddFile = FileUtil.copyFile(FileUtil.getConfigFile(resource), confRoot, "ejb-jar"); //NOI18N
EjbJar ejbJar = DDProvider.getDefault().getDDRoot(ddFile);
@@ -435,8 +434,7 @@
}
}
Profile j2eeProfile = data.getJavaEEProfile();
- if (j2eeProfile.equals(Profile.JAVA_EE_6_FULL) || j2eeProfile.equals(Profile.JAVA_EE_6_WEB) ||
- j2eeProfile.equals(Profile.JAVA_EE_7_FULL) || j2eeProfile.equals(Profile.JAVA_EE_7_WEB)) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
if (rh.getProjectLibraryManager().getLibrary(Util.ENDORSED_LIBRARY_NAME) == null) { // NOI18N
rh.copyLibrary(LibraryManager.getDefault().getLibrary(Util.ENDORSED_LIBRARY_NAME)); // NOI18N
}
@@ -618,8 +616,7 @@
Charset enc = FileEncodingQuery.getDefaultEncoding();
ep.setProperty(EjbJarProjectProperties.SOURCE_ENCODING, enc.name());
- if (j2eeProfile.equals(Profile.JAVA_EE_6_FULL) || j2eeProfile.equals(Profile.JAVA_EE_6_WEB) ||
- j2eeProfile.equals(Profile.JAVA_EE_7_FULL) || j2eeProfile.equals(Profile.JAVA_EE_7_WEB)) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
ep.setProperty(ProjectProperties.ENDORSED_CLASSPATH, new String[]{Util.ENDORSED_LIBRARY_CLASSPATH});
}
diff --git a/web.project/src/org/netbeans/modules/web/project/ProjectWebModule.java b/web.project/src/org/netbeans/modules/web/project/ProjectWebModule.java
--- a/web.project/src/org/netbeans/modules/web/project/ProjectWebModule.java
+++ b/web.project/src/org/netbeans/modules/web/project/ProjectWebModule.java
@@ -58,6 +58,7 @@
import org.netbeans.api.project.SourceGroup;
import org.netbeans.api.project.Sources;
import org.netbeans.api.project.ui.OpenProjects;
+import org.netbeans.modules.j2ee.common.Util;
import org.netbeans.modules.j2ee.dd.api.web.WebApp;
import org.netbeans.modules.j2ee.dd.api.web.WebAppMetadata;
import org.netbeans.modules.j2ee.dd.api.webservices.WebservicesMetadata;
@@ -592,8 +593,7 @@
public String getModuleVersion () {
// return a version based on the Java EE version
Profile platformVersion = getJ2eeProfile();
- if (Profile.JAVA_EE_6_FULL.equals(platformVersion) || Profile.JAVA_EE_6_WEB.equals(platformVersion) ||
- Profile.JAVA_EE_7_FULL.equals(platformVersion) || Profile.JAVA_EE_7_WEB.equals(platformVersion)) {
+ if (Util.isAtLeastJavaEE6Web(platformVersion)) {
return WebApp.VERSION_3_0;
} else if (Profile.JAVA_EE_5.equals(platformVersion)) {
return WebApp.VERSION_2_5;
diff --git a/web.project/src/org/netbeans/modules/web/project/WebProject.java b/web.project/src/org/netbeans/modules/web/project/WebProject.java
--- a/web.project/src/org/netbeans/modules/web/project/WebProject.java
+++ b/web.project/src/org/netbeans/modules/web/project/WebProject.java
@@ -1421,7 +1421,6 @@
private boolean checked = false;
private boolean isArchive = false;
private boolean isEE5 = false;
- private boolean serverSupportsEJB31 = false;
public String[] getRecommendedTypes() {
checkEnvironment();
@@ -1429,7 +1428,7 @@
return TYPES_ARCHIVE;
} else if (projectCap.isEjb31LiteSupported()){
List list = new ArrayList(Arrays.asList(TYPES));
- if (projectCap.isEjb31Supported() || serverSupportsEJB31){
+ if (projectCap.isEjb31Supported()){
list.addAll(Arrays.asList(TYPES_EJB));
} else {
list.addAll(Arrays.asList(TYPES_EJB_LITE));
@@ -1448,7 +1447,7 @@
List list;
if (projectCap.isEjb31LiteSupported()) {
list = getPrivilegedTemplatesEE5();
- if (projectCap.isEjb31Supported() || serverSupportsEJB31){
+ if (projectCap.isEjb31Supported()){
list.addAll(13, Arrays.asList(PRIVILEGED_NAMES_EE6_FULL));
} else {
list.addAll(13, Arrays.asList(PRIVILEGED_NAMES_EE6_WEB));
@@ -1472,8 +1471,6 @@
projectCap = J2eeProjectCapabilities.forProject(project);
Profile profile = Profile.fromPropertiesString(eval.getProperty(WebProjectProperties.J2EE_PLATFORM));
isEE5 = profile == Profile.JAVA_EE_5;
- serverSupportsEJB31 = Util.getSupportedProfiles(project).contains(Profile.JAVA_EE_6_FULL) ||
- Util.getSupportedProfiles(project).contains(Profile.JAVA_EE_7_FULL);
checked = true;
}
}
@@ -2235,8 +2232,7 @@
private void updateLookup(){
Profile profile = Profile.fromPropertiesString(project.evaluator().getProperty(WebProjectProperties.J2EE_PLATFORM));
- if (Profile.JAVA_EE_6_FULL.equals(profile) || Profile.JAVA_EE_6_WEB.equals(profile) ||
- Profile.JAVA_EE_7_FULL.equals(profile) || Profile.JAVA_EE_7_WEB.equals(profile)){
+ if (Util.isAtLeastJavaEE6Web(profile)) {
setLookups(base, ee6);
}else{
setLookups(base);
diff --git a/web.project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java b/web.project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java
--- a/web.project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java
+++ b/web.project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java
@@ -666,8 +666,7 @@
}
}
Profile j2eeProfile = data.getJavaEEProfile();
- if (j2eeProfile.equals(Profile.JAVA_EE_6_FULL) || j2eeProfile.equals(Profile.JAVA_EE_6_WEB) ||
- j2eeProfile.equals(Profile.JAVA_EE_7_FULL) || j2eeProfile.equals(Profile.JAVA_EE_7_WEB)) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
if (rh.getProjectLibraryManager().getLibrary(Util.ENDORSED_LIBRARY_NAME) == null) { // NOI18N
rh.copyLibrary(LibraryManager.getDefault().getLibrary(Util.ENDORSED_LIBRARY_NAME)); // NOI18N
}
@@ -843,8 +842,7 @@
Charset enc = FileEncodingQuery.getDefaultEncoding();
ep.setProperty(WebProjectProperties.SOURCE_ENCODING, enc.name());
- if (j2eeProfile.equals(Profile.JAVA_EE_6_FULL) || j2eeProfile.equals(Profile.JAVA_EE_6_WEB) ||
- j2eeProfile.equals(Profile.JAVA_EE_7_FULL) || j2eeProfile.equals(Profile.JAVA_EE_7_WEB)) {
+ if (Util.isAtLeastJavaEE6Web(j2eeProfile)) {
ep.setProperty(ProjectProperties.ENDORSED_CLASSPATH, new String[]{Util.ENDORSED_LIBRARY_CLASSPATH});
}