[JBoss JIRA] Created: (JBPM-1164) Null Pointer Exception is thrown when subprocess is leave event is fired.
by Gurpreet Sahota (JIRA)
Null Pointer Exception is thrown when subprocess is leave event is fired.
-------------------------------------------------------------------------
Key: JBPM-1164
URL: http://jira.jboss.com/jira/browse/JBPM-1164
Project: JBoss jBPM
Issue Type: Bug
Affects Versions: jBPM jPDL 3.2.2
Environment: Windows XP Pro, Sun JDK 1.5.0_13
Reporter: Gurpreet Sahota
Assigned To: Tom Baeyens
I have a process flow where process (A) calls a process state that in turn calls subprocess (B). When Subprocess "end" state is signalled then I receive a Null Pointer Exception.
Following is stack trace
java.lang.NullPointerException
at org.jbpm.graph.node.ProcessState.leave(ProcessState.java:204)
at org.jbpm.graph.exe.Token.signal(Token.java:195)
at org.jbpm.graph.exe.Token.signal(Token.java:140)
When debugging, it turns out that "leave" method in ProcessState tries to retrieve subProcessInstance from execution context. This is set to null causing exception. If executionContext.getToken() is used to retrieve the subProcessInstance, then it is not null.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[JBoss JIRA] Created: (JBPM-1930) NullPointerException in jbpm-console when viewing running process
by Joakim Sandström (JIRA)
NullPointerException in jbpm-console when viewing running process
-----------------------------------------------------------------
Key: JBPM-1930
URL: https://jira.jboss.org/jira/browse/JBPM-1930
Project: JBoss jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Console
Affects Versions: jBPM 3.2.2
Reporter: Joakim Sandström
2008-12-18 10:39:11,928 ERROR [javax.enterprise.resource.webcontainer.jsf.lifecycle] JSF1054: (Phase ID: RENDER_RESPONSE 6, View ID: /sa/procins.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.
faces.lifecycle.LifecycleImpl@1946a32]
2008-12-18 10:39:11,946 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/jbpm-console].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
at java.lang.String.compareTo(String.java:1168)
at java.lang.String.compareTo(String.java:92)
at org.jboss.gravel.data.action.SortActionListener$ELComparator.compare(SortActionListener.java:140)
at java.util.Arrays.mergeSort(Arrays.java:1270)
at java.util.Arrays.sort(Arrays.java:1210)
at java.util.Collections.sort(Collections.java:159)
at org.jboss.gravel.data.action.SortActionListener.processAction(SortActionListener.java:83)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:771)
at javax.faces.component.UICommand.broadcast(UICommand.java:372)
at org.jboss.gravel.action.handler.ResponseActionsHandler.onComponentPopulated(ResponseActionsHandler.java:24)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:180)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at org.jboss.gravel.common.handler.CollectionHandler.applyNextHandler(CollectionHandler.java:155)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
at com.sun.facelets.tag.ui.DecorateHandler.apply(DecorateHandler.java:105)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.ui.DefineHandler.apply(DefineHandler.java:58)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:128)
at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:306)
at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:279)
at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:503)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:546)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:619)
2008-12-18 10:39:19,410 ERROR [STDERR] Dec 18, 2008 10:39:19 AM com.sun.facelets.FaceletViewHandler handleRenderException
SEVERE: Error Rendering View[/sa/procins.xhtml]
java.lang.NullPointerException
at java.lang.String.compareTo(String.java:1168)
at java.lang.String.compareTo(String.java:92)
at org.jboss.gravel.data.action.SortActionListener$ELComparator.compare(SortActionListener.java:140)
at java.util.Arrays.mergeSort(Arrays.java:1270)
at java.util.Arrays.sort(Arrays.java:1210)
at java.util.Collections.sort(Collections.java:159)
at org.jboss.gravel.data.action.SortActionListener.processAction(SortActionListener.java:83)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:771)
at javax.faces.component.UICommand.broadcast(UICommand.java:372)
at org.jboss.gravel.action.handler.ResponseActionsHandler.onComponentPopulated(ResponseActionsHandler.java:24)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:180)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at org.jboss.gravel.common.handler.CollectionHandler.applyNextHandler(CollectionHandler.java:155)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
at com.sun.facelets.tag.ui.DecorateHandler.apply(DecorateHandler.java:105)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.ui.DefineHandler.apply(DefineHandler.java:58)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:128)
at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:306)
at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:279)
at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
at com.sun.facelets.tag.ui.DecorateHandler.apply(DecorateHandler.java:105)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.ui.DefineHandler.apply(DefineHandler.java:58)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:128)
at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:306)
at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:279)
at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:503)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:546)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:619)
2008-12-18 10:39:19,736 ERROR [javax.enterprise.resource.webcontainer.jsf.lifecycle] JSF1054: (Phase ID: RENDER_RESPONSE 6, View ID: /sa/procins.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@1946a32]
2008-12-18 10:39:19,954 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/jbpm-console].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
at java.lang.String.compareTo(String.java:1168)
at java.lang.String.compareTo(String.java:92)
at org.jboss.gravel.data.action.SortActionListener$ELComparator.compare(SortActionListener.java:140)
at java.util.Arrays.mergeSort(Arrays.java:1270)
at java.util.Arrays.sort(Arrays.java:1210)
at java.util.Collections.sort(Collections.java:159)
at org.jboss.gravel.data.action.SortActionListener.processAction(SortActionListener.java:83)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (JBPM-1147) iCalendar Wrapper for jBPM tasks
by Adrian Apthorp (JIRA)
iCalendar Wrapper for jBPM tasks
--------------------------------
Key: JBPM-1147
URL: http://jira.jboss.com/jira/browse/JBPM-1147
Project: JBoss jBPM
Issue Type: Feature Request
Reporter: Adrian Apthorp
Assigned To: Tom Baeyens
Provide iCalendar Wrapper for jBPM tasks for HTTP and Mail channels.
The following code sample is an example servlet for retrieving tasks in iCalendar format to demonstrate mapping of Taskinstance to iCalendar VTODO.
[code]
package org.jbpm.examples.simple.web;
import java.io.IOException;
import java.net.URI;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
// Use iCal4j package
import net.fortuna.ical4j.model.DateTime;
import net.fortuna.ical4j.model.Property;
import net.fortuna.ical4j.model.TimeZoneRegistry;
import net.fortuna.ical4j.model.TimeZoneRegistryFactory;
import net.fortuna.ical4j.model.component.VEvent;
import net.fortuna.ical4j.model.component.VToDo;
import net.fortuna.ical4j.model.component.VTimeZone;
import net.fortuna.ical4j.model.property.Attach;
import net.fortuna.ical4j.model.property.Attendee;
import net.fortuna.ical4j.model.property.CalScale;
import net.fortuna.ical4j.model.property.Comment;
import net.fortuna.ical4j.model.property.Completed;
import net.fortuna.ical4j.model.property.Contact;
import net.fortuna.ical4j.model.property.Created;
import net.fortuna.ical4j.model.property.Description;
import net.fortuna.ical4j.model.property.Location;
import net.fortuna.ical4j.model.property.Method;
import net.fortuna.ical4j.model.property.Organizer;
import net.fortuna.ical4j.model.property.Priority;
import net.fortuna.ical4j.model.property.ProdId;
import net.fortuna.ical4j.model.property.Version;
import net.fortuna.ical4j.util.UidGenerator;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.mail.AddressResolver;
import org.jbpm.taskmgmt.exe.TaskInstance;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.exe.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Servlet implementation class for Servlet: ICalServlet
*
*/
public class ICalServlet extends javax.servlet.http.HttpServlet implements
javax.servlet.Servlet {
static final long serialVersionUID = 1L;
private static Log log = LogFactory.getLog(ICalServlet.class);
private String localMachine;
private String PORT = "8080";
private static final String TASK_URI = "/jbpm-console/sa/task.jsf?id=";
public ICalServlet() {
super();
try {
localMachine = java.net.InetAddress.getLocalHost().getHostName();
log.info("Hostname of local machine: " + localMachine);
} catch (java.net.UnknownHostException uhe) {
log.info("Can't Retrieve Hostname");
localMachine = "localhost";
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String pathInfo = null;
log.debug("Request Path:" + request.getPathInfo());
if (request.getPathInfo() != null) {
pathInfo = request.getPathInfo().toLowerCase();
}
boolean isTaskList = pathInfo != null && pathInfo.endsWith("tasklist.ics");
boolean isFreeBusy = pathInfo != null && pathInfo.endsWith("freebusy.ifb");
if (isTaskList) {
doTaskList(request, response);
} else if (isFreeBusy) {
/*
* doGetFreeBusy(request, response);
*/
}
}
/**
*
* http://localhost:8080/calendar/reply?actor=user
*
*/
public final void doTaskList(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
String actorName = req.getParameter("actor");
log.info("Actor:" + actorName);
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
resp.setContentType("text/calendar");
try {
java.util.List toDoList = jbpmContext.getTaskMgmtSession()
.findTaskInstances(actorName);
/*
* jbpmContext.getTaskMgmtSession().findPooledTaskInstances(actorName)
*/
if (toDoList == null) {
resp.sendError(HttpServletResponse.SC_NOT_FOUND,
"No Tasks Found For User");
return;
}
net.fortuna.ical4j.model.Calendar calendar = new net.fortuna.ical4j.model.Calendar();
calendar.getProperties().add(
new ProdId("-//aapthorp//jBPM iCal wrapper//EN"));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
calendar.getProperties().add(Method.REQUEST);
for (Iterator iter = toDoList.iterator(); iter.hasNext();) {
TaskInstance task = (TaskInstance) iter.next();
ProcessInstance processInstance = task.getProcessInstance();
ContextInstance contextInstance = processInstance.getContextInstance();
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance()
.createRegistry();
String taskId = String.valueOf(task.getId());
String actorId = task.getActorId();
String taskName = task.getName();
// Due Date - This property defines the date and time that a to do is
// expected to be completed.
net.fortuna.ical4j.model.DateTime dueDate = new net.fortuna.ical4j.model.DateTime(
task.getDueDate());
// Start Date - This property specifies when the calendar component
// begins. There is no direct jBPM equivalent so we use a task variable.
java.util.Calendar beginDate = new GregorianCalendar();
net.fortuna.ical4j.model.TimeZone timezone = registry
.getTimeZone(beginDate.getTimeZone().getID());
net.fortuna.ical4j.model.DateTime startDate = null;
if (contextInstance.hasVariable("start")) {
beginDate.setTime((java.util.Date) contextInstance.getVariable(
"start", task.getToken()));
startDate = new net.fortuna.ical4j.model.DateTime(beginDate.getTime());
startDate.setTimeZone(timezone);
}
dueDate.setTimeZone(timezone);
/*
* Create the VTODO
*
* For testing purposes with user agents that can't handle VTODO's we
* can creat a Vevent VEvent toDo = new VEvent(null,dueDate,taskName+" -
* "+taskId);
*
*/
log.info("Create VTODO: task - " + taskId + " start - " + startDate
+ " due - " + dueDate);
VToDo toDo = new VToDo(startDate, dueDate, taskName + " - " + taskId);
// Creation Date
toDo.getProperties()
.add(
new Created(new net.fortuna.ical4j.model.DateTime(task
.getCreate())));
// End Date a.k.a. Completed Date. This property defines the date and
// time that a to-do was actually completed.
if (task.getEnd() != null) {
toDo.getProperties().add(
new Completed(
new net.fortuna.ical4j.model.DateTime(task.getEnd())));
}
// Generate a UID for the toDo
toDo.getProperties().add((new UidGenerator(taskId)).generateUid());
// Attach URL to Task
toDo.getProperties().add(
new Attach(new URI("http://" + localMachine + ":" + PORT + TASK_URI
+ taskId.toString())));
// Set Contact - We set a task variable for this.
if (contextInstance.hasVariable("Name")) {
toDo.getProperties().add(
new Contact((String) contextInstance.getVariable("Name", task
.getToken())));
}
// Set Location - We set a task variable for this.
if (contextInstance.hasVariable("Address")) {
toDo.getProperties().add(
new Location((String) contextInstance.getVariable("Address", task
.getToken())));
}
// Set Priority
toDo.getProperties().add(new Priority(task.getPriority()));
if (task.getDescription() != null) {
toDo.getProperties().add(new Description(task.getDescription()));
}
java.util.List commentList = task.getComments();
if (commentList != null) {
for (Iterator commentIter = commentList.iterator(); commentIter
.hasNext();) {
org.jbpm.graph.exe.Comment myComment = (org.jbpm.graph.exe.Comment) commentIter
.next();
toDo.getProperties().add(
new net.fortuna.ical4j.model.property.Comment(myComment.getId()
+ ":" + myComment.getTime() + ":" + myComment.getActorId()
+ ":" + myComment.getMessage()));
}
}
// Set Attendee
net.fortuna.ical4j.model.ParameterList attendeePL = new net.fortuna.ical4j.model.ParameterList();
attendeePL.add(new net.fortuna.ical4j.model.parameter.Cn(actorId));
attendeePL.add(new net.fortuna.ical4j.model.parameter.Role(
"REQ-PARTICIPANT"));
attendeePL.add(new net.fortuna.ical4j.model.parameter.PartStat(
"NEEDS-ACTION"));
attendeePL.add(new net.fortuna.ical4j.model.parameter.Rsvp("TRUE"));
AddressResolver addressResolver = (AddressResolver) JbpmConfiguration.Configs
.getObject("jbpm.mail.address.resolver");
URI attendeeURI = new URI("MAILTO", (String) addressResolver
.resolveAddress(actorId), null);
toDo.getProperties().add(new Attendee(attendeePL, attendeeURI));
// Set Organizer
String orgAddress = getFromAddress();
if (orgAddress != null) {
URI mailToURI = new URI("MAILTO", orgAddress, null);
toDo.getProperties().add(new Organizer(mailToURI));
}
calendar.getComponents().add(toDo);
}
resp.getOutputStream().write(calendar.toString().getBytes());
} catch (Exception e) {
e.printStackTrace();
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Caught exception: " + e);
} finally {
jbpmContext.close();
}
}
public String getFromAddress() {
if (JbpmConfiguration.Configs.hasObject("jbpm.mail.from.address")) {
return JbpmConfiguration.Configs.getString("jbpm.mail.from.address");
}
return "jbpm@noreply";
}
}
[/code]
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months