Problem Ending a Task
mdarr Mar 10, 2007 10:29 PMOk so i have followed along with the dvd-seam example.
However I am apparently doing something wrong here.
I start the task ... i can see it in the debug.seam page.
But when i go to end it. Nothing happens.
Task as defined in the xml ->
<task-node name="working" end-tasks="true"> <task name="taskWorking" description="Tasks being worked on"> <assignment pooled-actors="ticket-worker"/> </task> <transition name="next" to="finished"/> </task-node>
The code on the task list where you start the task ->
<s:button action="#{ticketWorking.viewTask}" taskInstance="#{task}"
value="Set Task to Working"/>
The Class ->
@Stateful
@Name("ticketWorking")
public class TicketWorkingAction implements TicketWorking {
@Logger
Log log;
@PersistenceContext(type=PersistenceContextType.EXTENDED)
EntityManager em;
@Out(required=false, scope=ScopeType.CONVERSATION)
Ticket ticket;
@In(required=false)
Long ticketId;
@In(required = false)
String name;
@In(required = false)
String description;
@In
User authUser;
@StartTask
//@BeginTask -- i tried either or
public String viewTask() {
log.info("ticket working - view task - #{ticketId}");
ticket = (Ticket) em.find(Ticket.class, ticketId);
log.info("ticket found - #{ticket}");
return "/ticket_work.xhtml";
}
@EndTask(transition="next")
public String save() {
log.info("ticket working - save");
saveChange();
return "/ticket_list.xhtml";
}
@EndTask//(transition="next")
public String finished() {
log.info("ticket working - finished");
saveChange();
return "/ticket_list.xhtml";
}
private void saveChange() {
// TODO change the owner?
TicketChange tChange = new TicketChange();
tChange.setDescription(description);
tChange.setUser(authUser);
em.persist(tChange);
}
@Remove
@Destroy
public void destroy() {
}
}
The JSF page ->
<f:view>
<h:form>
Description - <h:inputText value="#{description}"/><br/>
<h:commandButton value="Save" action="#{ticketWorking.save}"/><br/>
<h:commandButton value="Save and Send to Approval" action="#{ticketWorking.finished}"/><br/>
<p>
<s:link value="View Tickets" action="/ticket_list.xhtml"/><br/>
</p>
</h:form>
</f:view>
.... i am hoping its just something stupid. But any ideas could help
Btw i have the two methods because I was trying both ways.
FWIW Ticket is an Entity Bean.