Skip to content

Commit

Permalink
Merge pull request #6257 from matthiasblaesing/session_bean_interface…
Browse files Browse the repository at this point in the history
…_less_ejb

Bugfix: Bring back singleton option when creating a new Session Bean and interfaceless EJBs
  • Loading branch information
neilcsmith-net authored Jul 31, 2023
2 parents 61a38aa + 18e2961 commit a9904d9
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.netbeans.modules.j2ee.metadata.model.api.support.annotation.ObjectProvider;
import org.netbeans.modules.j2ee.metadata.model.api.support.annotation.PersistentObjectManager;

// @todo: Support JakartaEE
public class EnterpriseBeansImpl implements EnterpriseBeans {

private final AnnotationModelHelper helper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
/**
* @author Petr Slechta
*/
// @todo: Support JakartaEE
public class AnnotationHelpers {

private AnnotationModelHelper helper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
*
* @author Martin Adamek
*/
// @todo: Support JakartaEE
public final class SendJMSGenerator {

private static final Logger LOG = Logger.getLogger(SendJMSGenerator.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public EjbType run(EjbJarMetadata metadata) throws Exception {
Project project = FileOwnerQuery.getOwner(ejbClassFO);
if (project != null){
J2eeProjectCapabilities projectCap = J2eeProjectCapabilities.forProject(project);
allowsNoInterface = projectCap != null ? projectCap.isEjb31LiteSupported() : false;
allowsNoInterface = (projectCap != null && (projectCap.isEjb31LiteSupported() || projectCap.isEjb40LiteSupported()));
}

controller = new SessionMethodController(className, model, allowsNoInterface);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,9 @@ private void inProjectComboActionPerformed(java.awt.event.ActionEvent evt) {//GE
// End of variables declaration//GEN-END:variables

private void updateCheckboxes() {
J2eeProjectCapabilities projectCap = J2eeProjectCapabilities.forProject(project);
//by default for ejb 3.1 no interfaces will be created
localCheckBox.setSelected(!J2eeProjectCapabilities.forProject(project).isEjb31LiteSupported());
localCheckBox.setSelected(!(projectCap.isEjb31LiteSupported() || projectCap.isEjb40LiteSupported()));
changeSupport.fireChange();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ public boolean isValid() {
return false;
}
if (!(component.isRemote() || component.isLocal())) {
if(J2eeProjectCapabilities.forProject(project).isEjb31LiteSupported()) {
J2eeProjectCapabilities projectCap = J2eeProjectCapabilities.forProject(project);
if(projectCap.isEjb31LiteSupported() || projectCap.isEjb40LiteSupported()) {
//if it's jee6 project, ejb 3.1 allow to omit any interfaces
} else {
wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, NbBundle.getMessage(EjbFacadeWizardPanel2.class, "ERR_ChooseInterface")); // NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
*
* @author Martin Fousek <marfous@netbeans.org>
*/
// @todo: Support JakartaEE
@SuppressWarnings("serial") // not used to be serialized
public class MdbPropertiesPanelVisual extends javax.swing.JPanel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
* This class contains only static methods.
* @author Tomas Mysik
*/
// @todo: Support JakartaEE
public abstract class MessageDestinationUiSupport {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public boolean isValid() {
}
boolean isLocal = wizardPanel.isLocal();
boolean isRemote = wizardPanel.isRemote();
if (!isLocal && !isRemote && !J2eeProjectCapabilities.forProject(project).isEjb31LiteSupported()) {
J2eeProjectCapabilities projectCap = J2eeProjectCapabilities.forProject(project);
if (!isLocal && !isRemote && !projectCap.isEjb31LiteSupported() && !projectCap.isEjb40LiteSupported()) {
wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, NbBundle.getMessage(SessionEJBWizardDescriptor.class,"ERR_RemoteOrLocal_MustBeSelected")); //NOI18N
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,15 @@ public Project getRemoteInterfaceProject() {
}

private boolean isSingletonSupported(J2eeProjectCapabilities projectCap) {
return projectCap.isEjb31LiteSupported();
return projectCap.isEjb31LiteSupported() || projectCap.isEjb40LiteSupported();
}

private boolean isNoInterfaceViewSupported(J2eeProjectCapabilities projectCap) {
return projectCap.isEjb31LiteSupported();
return projectCap.isEjb31LiteSupported() || projectCap.isEjb40LiteSupported();
}

private boolean isTimerSupported(J2eeProjectCapabilities projectCap) {
return projectCap.isEjb31Supported() || projectCap.isEjb32LiteSupported();
return projectCap.isEjb31Supported() || projectCap.isEjb32LiteSupported() || projectCap.isEjb40LiteSupported();
}

private boolean isRemoteInterfaceSupported() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"AsynchronousMethodInvocation.description=Checks usage of @Asynchronous. Tests whether it's used within supported project and interface type.",
"AsynchronousMethodInvocation.err.asynchronous.in.ejb31=Asynchronous method invocation is not allowed in project targeting JavaEE 6 Lite profile"
})
// @todo: Support JakartaEE
public final class AsynchronousMethodInvocation {

private AsynchronousMethodInvocation() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
* @author ads
*
*/
// @todo: Support JakartaEE
class ObjectProviders {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.netbeans.modules.j2ee.metadata.model.api.support.annotation.PersistentObjectManager;
import org.netbeans.modules.j2ee.persistence.api.metadata.orm.*;

// @todo: Support JakartaEE
public class EntityMappingsImpl implements EntityMappings {

private final AnnotationModelHelper helper;
Expand Down

0 comments on commit a9904d9

Please sign in to comment.