Bug in the templates used to generate a skeleton Seam application

Description

There is a bug in the templates used to generate a skeleton Seam application.

In the following generated class, the generated code

@DataModelSelection
private LocationTable selectedLocationTable;

should be:

@DataModelSelection("locationTablesList")
private LocationTable selectedLocationTable;

package test1.model;

// Generated 13/02/2006 20:05:13 by Hibernate Tools 3.1.0.beta4

import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import javax.ejb.Interceptors;
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.ejb.TransactionAttribute;
import static javax.ejb.TransactionAttributeType.NOT_SUPPORTED;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.persistence.EntityManager;
import org.hibernate.validator.Valid;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.IfInvalid;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Outcome;
import org.jboss.seam.annotations.datamodel.DataModel;
import org.jboss.seam.annotations.datamodel.DataModelSelection;
import org.jboss.seam.ejb.SeamInterceptor;

@Name("clientEditor")
@Stateful
@Interceptors(SeamInterceptor.class)
public class ClientEditorBean implements ClientEditor {

@In(create = true)
private EntityManager entityManager;

@Valid
private Client instance = new Client();

@TransactionAttribute(NOT_SUPPORTED)
public Client getInstance() {
return instance;
}

public void setInstance(Client instance) {
this.instance = instance;
}

private boolean isNew = true;

@TransactionAttribute(NOT_SUPPORTED)
public boolean isNew() {
return isNew;
}

public void setNew(boolean isNew) {
this.isNew = isNew;
}

private String doneOutcome = "find";

public void setDoneOutcome(String outcome) {
doneOutcome = outcome;
}

@In(required = false)
private transient ClientFinder clientFinder;

@In
private transient ResourceBundle resourceBundle;

@Begin(join = true)
@IfInvalid(outcome = Outcome.REDISPLAY)
public String create() {
if (entityManager.find(Client.class, instance.getId()) != null) {
FacesContext.getCurrentInstance().addMessage(
null,
new FacesMessage(resourceBundle.getString("Client_id")
+ " " + resourceBundle.getString("AlreadyExists")));
return null;
}
entityManager.persist(instance);
isNew = false;
refreshFinder();
return "editClient";
}

@IfInvalid(outcome = Outcome.REDISPLAY)
public String update() {
refreshFinder();
return null;
}

@End(ifOutcome = "find")
public String delete() {
entityManager.remove(instance);
refreshFinder();
return doneOutcome;
}

@End(ifOutcome = "find")
public String done() {
if (!isNew)
entityManager.refresh(instance);
return doneOutcome;
}

private void refreshFinder() {
if (clientFinder != null)
clientFinder.refresh();
}

@Destroy
@Remove
public void destroy() {
}

@DataModel
public List getServiceGroupsList() {
return instance == null || instance.getServiceGroups() == null ? null
: new ArrayList(instance.getServiceGroups());
}

@DataModelSelection
private ServiceGroup selectedServiceGroup;

@In(create = true)
private transient ServiceGroupEditor servicegroupEditor;

public String createServiceGroup() {
servicegroupEditor.setNew(true);
servicegroupEditor.setInstance(new ServiceGroup());
servicegroupEditor.getInstance().setClient(instance);
servicegroupEditor.setDoneOutcome("editClient");
return "editServiceGroup";
}

public String selectServiceGroup() {
servicegroupEditor.setNew(false);
servicegroupEditor.setInstance(selectedServiceGroup);
servicegroupEditor.setDoneOutcome("editClient");
return "editServiceGroup";
}

@DataModel
public List getResourceTypesList() {
return instance == null || instance.getResourceTypes() == null ? null
: new ArrayList(instance.getResourceTypes());
}

@DataModelSelection
private ResourceType selectedResourceType;

@In(create = true)
private transient ResourceTypeEditor resourcetypeEditor;

public String createResourceType() {
resourcetypeEditor.setNew(true);
resourcetypeEditor.setInstance(new ResourceType());
resourcetypeEditor.getInstance().setClient(instance);
resourcetypeEditor.setDoneOutcome("editClient");
return "editResourceType";
}

public String selectResourceType() {
resourcetypeEditor.setNew(false);
resourcetypeEditor.setInstance(selectedResourceType);
resourcetypeEditor.setDoneOutcome("editClient");
return "editResourceType";
}

@DataModel
public List getLocationTablesList() {
return instance == null || instance.getLocationTables() == null ? null
: new ArrayList(instance.getLocationTables());
}

@DataModelSelection
private LocationTable selectedLocationTable;

@In(create = true)
private transient LocationTableEditor locationtableEditor;

public String createLocationTable() {
locationtableEditor.setNew(true);
locationtableEditor.setInstance(new LocationTable());
locationtableEditor.getInstance().setClient(instance);
locationtableEditor.setDoneOutcome("editClient");
return "editLocationTable";
}

public String selectLocationTable() {
locationtableEditor.setNew(false);
locationtableEditor.setInstance(selectedLocationTable);
locationtableEditor.setDoneOutcome("editClient");
return "editLocationTable";
}

}

Environment

None

Activity

Show:

GavinG February 15, 2006 at 11:46 PM

fixed in CVS

Fixed

Details

Assignee

Reporter

Bug Testcase Reminder (view)

Bug reports should generally be accompanied by a test case!

Bug Testcase Reminder (edit)

Bug reports should generally be accompanied by a test case!

Participants

Bruce Raggett
GavinG

Components

Fix versions

Affects versions

Priority

Created February 14, 2006 at 2:42 AM
Updated February 15, 2006 at 11:46 PM
Resolved February 15, 2006 at 11:46 PM