diff --git a/config/alfresco/messages/jbpm.properties b/config/alfresco/messages/jbpm.properties deleted file mode 100644 index e994165d7f..0000000000 --- a/config/alfresco/messages/jbpm.properties +++ /dev/null @@ -1,13 +0,0 @@ -processDefinitionsList=Process Definitions List -searchProcessInstances=Search Process Instances -processDefinitions=Process Definitions -variableName=Variable Name -variableValue=Variable Value -search=Search -id=Id -name=Name -version=Version -instances=Instances -start=Start -end=End -value=Value \ No newline at end of file diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 2af4db2ddc..c1559717aa 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -1032,6 +1032,15 @@ admin_limited_license=Licensed: {0} license granted to {1} and limited to {3} da admin_unlimited_license=Licensed: {0} license granted to {1} and does not expire (issued on {2,date,short}). admin_invalid_license=Licensed: LICENSE INVALID - Alfresco Repository restricted to read-only capability. +# Workflow Console messages +title_workflow_console=Workflow Console +workflow_context=Context +workflow_command=Command (type help for help) +workflow_command_submit=Submit +workflow_last_command=Last command: +workflow_duration=Duration: +workflow_duration_ms=ms + # UI Page Titles title_about=About Alfresco title_login=Alfresco Web Client - Login diff --git a/config/alfresco/web-client-config-actions.xml b/config/alfresco/web-client-config-actions.xml index 529ca0e2ce..9d4056c45f 100644 --- a/config/alfresco/web-client-config-actions.xml +++ b/config/alfresco/web-client-config-actions.xml @@ -385,7 +385,7 @@ - ChangePermissions + CreateChildren advanced_space_wizard /images/icons/create_space.gif diff --git a/config/alfresco/web-client-config-workflow-actions.xml b/config/alfresco/web-client-config-workflow-actions.xml index d8064a9fd4..8832d174cf 100644 --- a/config/alfresco/web-client-config-workflow-actions.xml +++ b/config/alfresco/web-client-config-workflow-actions.xml @@ -149,17 +149,17 @@ + + + + + - + - - - - - - - + + @@ -170,8 +170,26 @@ + + + + + - + + + + + + + + + + + + + + diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index 9597417ee7..de6fe0e18a 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -46,6 +46,9 @@ -1 + + 500 + diff --git a/source/java/org/alfresco/web/action/evaluator/CancelWorkflowEvaluator.java b/source/java/org/alfresco/web/action/evaluator/CancelWorkflowEvaluator.java index cdefed2495..86a7219a8c 100644 --- a/source/java/org/alfresco/web/action/evaluator/CancelWorkflowEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/CancelWorkflowEvaluator.java @@ -21,7 +21,6 @@ import javax.faces.context.FacesContext; import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.workflow.WorkflowService; import org.alfresco.service.cmr.workflow.WorkflowTask; import org.alfresco.util.ISO9075; import org.alfresco.web.action.ActionEvaluator; @@ -45,37 +44,28 @@ public class CancelWorkflowEvaluator implements ActionEvaluator public boolean evaluate(Node node) { boolean result = false; - - // get the id of the task - String taskId = (String)node.getProperties().get("id"); - if (taskId != null) + FacesContext context = FacesContext.getCurrentInstance(); + + // get the task from the node + WorkflowTask task = (WorkflowTask)node.getProperties().get("workflowTask"); + if (task != null) { - FacesContext context = FacesContext.getCurrentInstance(); - - // get the initiator of the workflow the task belongs to - WorkflowService workflowSvc = Repository.getServiceRegistry( - context).getWorkflowService(); - - WorkflowTask task = workflowSvc.getTaskById(taskId); - if (task != null) + NodeRef initiator = task.path.instance.initiator; + if (initiator != null) { - NodeRef initiator = task.path.instance.initiator; - if (initiator != null) + // find the current username + User user = Application.getCurrentUser(context); + String currentUserName = ISO9075.encode(user.getUserName()); + + // get the username of the initiator + NodeService nodeSvc = Repository.getServiceRegistry( + context).getNodeService(); + String userName = (String)nodeSvc.getProperty(initiator, ContentModel.PROP_USERNAME); + + // if the current user started the workflow allow the cancel action + if (currentUserName.equals(userName)) { - // find the current username - User user = Application.getCurrentUser(context); - String currentUserName = ISO9075.encode(user.getUserName()); - - // get the username of the initiator - NodeService nodeSvc = Repository.getServiceRegistry( - context).getNodeService(); - String userName = (String)nodeSvc.getProperty(initiator, ContentModel.PROP_USERNAME); - - // if the current user started the workflow allow the cancel action - if (currentUserName.equals(userName)) - { - result = true; - } + result = true; } } } diff --git a/source/java/org/alfresco/web/app/servlet/BaseTemplateContentServlet.java b/source/java/org/alfresco/web/app/servlet/BaseTemplateContentServlet.java new file mode 100644 index 0000000000..741d1d9948 --- /dev/null +++ b/source/java/org/alfresco/web/app/servlet/BaseTemplateContentServlet.java @@ -0,0 +1,305 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.app.servlet; + +import java.io.IOException; +import java.net.SocketException; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; +import java.util.StringTokenizer; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.transaction.UserTransaction; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.repository.TemplateException; +import org.alfresco.service.cmr.repository.TemplateImageResolver; +import org.alfresco.service.cmr.repository.TemplateNode; +import org.alfresco.service.cmr.repository.TemplateService; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.web.ui.common.Utils; +import org.apache.commons.logging.Log; + +/** + * Base class for the template content servlets. Provides common + * processing for the request. + * + * @see org.alfresco.web.app.servlet.TemplateContentServlet + * @see org.alfresco.web.app.servlet.GuestTemplateContentServlet + * + * @author Kevin Roast + * @author gavinc + */ +public abstract class BaseTemplateContentServlet extends BaseServlet +{ + private static final String MIMETYPE_HTML = "text/html"; + + private static final long serialVersionUID = -4123407921997235977L; + + private static final String ARG_MIMETYPE = "mimetype"; + private static final String ARG_TEMPLATE_PATH = "templatePath"; + private static final String ARG_CONTEXT_PATH = "contextPath"; + + /** + * Gets the logger to use for this request. + *

+ * This will show all debug entries from this class as though they + * came from the subclass. + * + * @return The logger + */ + protected abstract Log getLogger(); + + /** + * Builds the FreeMarker model + * + * @param services Service Registry instance + * @param req Http request + * @param templateRef The node ref of the template to process + * @return The FreeMarker model + */ + protected abstract Map buildModel(ServiceRegistry services, + HttpServletRequest req, NodeRef templateRef); + + /** + * Processes the template request using the current context i.e. no + * authentication checks are made, it is presumed they have already + * been done. + * + * @param req The HTTP request + * @param res The HTTP response + * @param redirectToLogin Flag to determine whether to redirect to the login + * page if the user does not have the correct permissions + */ + protected void processTemplateRequest(HttpServletRequest req, HttpServletResponse res, + boolean redirectToLogin) throws ServletException, IOException + { + Log logger = getLogger(); + String uri = req.getRequestURI(); + + if (logger.isDebugEnabled()) + { + String queryString = req.getQueryString(); + logger.debug("Processing URL: " + uri + + ((queryString != null && queryString.length() > 0) ? ("?" + queryString) : "")); + } + + uri = uri.substring(req.getContextPath().length()); + StringTokenizer t = new StringTokenizer(uri, "/"); + int tokenCount = t.countTokens(); + + t.nextToken(); // skip servlet name + + NodeRef nodeRef = null; + NodeRef templateRef = null; + + String contentPath = req.getParameter(ARG_CONTEXT_PATH); + if (contentPath != null && contentPath.length() != 0) + { + // process the name based path to resolve the NodeRef + PathRefInfo pathInfo = resolveNamePath(getServletContext(), contentPath); + + nodeRef = pathInfo.NodeRef; + } + else if (tokenCount > 3) + { + // get NodeRef to the content from the URL elements + StoreRef storeRef = new StoreRef(t.nextToken(), t.nextToken()); + nodeRef = new NodeRef(storeRef, t.nextToken()); + } + + // get NodeRef to the template if supplied + String templatePath = req.getParameter(ARG_TEMPLATE_PATH); + if (templatePath != null && templatePath.length() != 0) + { + // process the name based path to resolve the NodeRef + PathRefInfo pathInfo = resolveNamePath(getServletContext(), templatePath); + + templateRef = pathInfo.NodeRef; + } + else if (tokenCount >= 7) + { + StoreRef storeRef = new StoreRef(t.nextToken(), t.nextToken()); + templateRef = new NodeRef(storeRef, t.nextToken()); + } + + // if no context is specified, use the template itself + // TODO: should this default to something else? + if (nodeRef == null && templateRef != null) + { + nodeRef = templateRef; + } + + if (nodeRef == null) + { + throw new TemplateException("Not enough elements supplied in URL or no 'path' argument specified."); + } + + // get the services we need to retrieve the content + ServiceRegistry serviceRegistry = getServiceRegistry(getServletContext()); + NodeService nodeService = serviceRegistry.getNodeService(); + TemplateService templateService = serviceRegistry.getTemplateService(); + PermissionService permissionService = serviceRegistry.getPermissionService(); + + // check that the user has at least READ access on any nodes - else redirect to the login page + if (permissionService.hasPermission(nodeRef, PermissionService.READ) == AccessStatus.DENIED || + (templateRef != null && permissionService.hasPermission(templateRef, PermissionService.READ) == AccessStatus.DENIED)) + { + if (redirectToLogin) + { + if (logger.isDebugEnabled()) + logger.debug("Redirecting to login page..."); + + redirectToLoginPage(req, res, getServletContext()); + } + else + { + if (logger.isDebugEnabled()) + logger.debug("Returning 403 Forbidden error..."); + + res.sendError(HttpServletResponse.SC_FORBIDDEN); + } + + return; + } + + String mimetype = MIMETYPE_HTML; + if (req.getParameter(ARG_MIMETYPE) != null) + { + mimetype = req.getParameter(ARG_MIMETYPE); + } + res.setContentType(mimetype); + + try + { + UserTransaction txn = null; + try + { + txn = serviceRegistry.getTransactionService().getUserTransaction(true); + txn.begin(); + + // if template not supplied, then use the default against the node + if (templateRef == null) + { + if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPLATABLE)) + { + templateRef = (NodeRef)nodeService.getProperty(nodeRef, ContentModel.PROP_TEMPLATE); + } + if (templateRef == null) + { + throw new TemplateException("Template reference not set against node or not supplied in URL."); + } + } + + // create the model - put the supplied noderef in as space/document as appropriate + Object model = getModel(serviceRegistry, req, templateRef, nodeRef); + + // process the template against the node content directly to the response output stream + // assuming the repo is capable of streaming in chunks, this should allow large files + // to be streamed directly to the browser response stream. + try + { + templateService.processTemplate( + null, + templateRef.toString(), + model, + res.getWriter()); + + // commit the transaction + txn.commit(); + } + catch (SocketException e) + { + if (e.getMessage().contains("ClientAbortException")) + { + // the client cut the connection - our mission was accomplished apart from a little error message + logger.error("Client aborted stream read:\n node: " + nodeRef + "\n template: " + templateRef); + try { if (txn != null) {txn.rollback();} } catch (Exception tex) {} + } + else + { + throw e; + } + } + } + catch (Throwable txnErr) + { + try { if (txn != null) {txn.rollback();} } catch (Exception tex) {} + throw txnErr; + } + } + catch (Throwable err) + { + throw new AlfrescoRuntimeException("Error during template servlet processing: " + err.getMessage(), err); + } + } + + /** + * Build the model that to process the template against. + *

+ * The model includes the usual template root objects such as 'companyhome', 'userhome', + * 'person' and also includes the node specified on the servlet URL as 'space' and 'document' + * + * @param services ServiceRegistry required for TemplateNode construction + * @param req Http request - for accessing Session and url args + * @param templateRef NodeRef of the template itself + * @param nodeRef NodeRef of the space/document to process template against + * + * @return an object model ready for executing template against + */ + @SuppressWarnings("unchecked") + private Object getModel(ServiceRegistry services, HttpServletRequest req, NodeRef templateRef, NodeRef nodeRef) + { + // build FreeMarker default model and merge + Map root = buildModel(services, req, templateRef); + + // put the current NodeRef in as "space" and "document" + TemplateNode node = new TemplateNode(nodeRef, services, this.imageResolver); + root.put("space", node); + root.put("document", node); + + // add URL arguments as a map called 'args' to the root of the model + Map args = new HashMap(8, 1.0f); + Enumeration names = req.getParameterNames(); + while (names.hasMoreElements()) + { + String name = (String)names.nextElement(); + args.put(name, req.getParameter(name)); + } + root.put("args", args); + + return root; + } + + /** Template Image resolver helper */ + private TemplateImageResolver imageResolver = new TemplateImageResolver() + { + public String resolveImagePathForName(String filename, boolean small) + { + return Utils.getFileTypeImage(getServletContext(), filename, small); + } + }; +} diff --git a/source/java/org/alfresco/web/app/servlet/GuestTemplateContentServlet.java b/source/java/org/alfresco/web/app/servlet/GuestTemplateContentServlet.java new file mode 100644 index 0000000000..6800dcacd5 --- /dev/null +++ b/source/java/org/alfresco/web/app/servlet/GuestTemplateContentServlet.java @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.app.servlet; + +import java.io.IOException; +import java.text.MessageFormat; +import java.util.Map; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.repository.InvalidNodeRefException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.AuthenticationService; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.web.bean.repository.User; +import org.alfresco.web.ui.repo.component.template.DefaultModelHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * Servlet responsible for streaming content from a template processed against a node directly + * to the response stream. + *

+ * The URL to the servlet should be generated thus: + *

/alfresco/template/workspace/SpacesStore/0000-0000-0000-0000
+ * or + *
/alfresco/template/workspace/SpacesStore/0000-0000-0000-0000/workspace/SpacesStore/0000-0000-0000-0000
+ * or + *
/alfresco/template?templatePath=/Company%20Home/Data%20Dictionary/Presentation%20Templates/doc_info.ftl&contextPath=/Company%20Home/mydoc.txt
+ *

+ * The store protocol, followed by the store ID, followed by the content Node Id used to + * identify the node to execute the default template for. The second set of elements encode + * the store and node Id of the template to used if a default is not set or not requested. Instead + * of using NodeRef references to the template and context, path arguments can be used. The URL args + * of 'templatePath' and 'contextPath' can be used instead to specify name based encoded Paths to the + * template and its context. + *

+ * The URL may be followed by a 'mimetype' argument specifying the mimetype to return the result as + * on the stream. Otherwise it is assumed that HTML is the default response mimetype. + *

+ * Like most Alfresco servlets, the URL may be followed by a valid 'ticket' argument for authentication: + * ?ticket=1234567890 + *

+ * And/or also followed by the "?guest=true" argument to force guest access login for the URL. If the + * guest=true parameter is used the current session will be logged out and the guest user logged in. + * Therefore upon completion of this request the current user will be "guest". + *

+ * This servlet only accesses content available to the guest user. If the guest user does not + * have access to the requested a 401 Forbidden response is returned to the caller. + *

+ * This servlet does not effect the current session, therefore if guest access is required to a + * resource this servlet can be used without logging out the current user. + * + * @author gavinc + */ +public class GuestTemplateContentServlet extends BaseTemplateContentServlet +{ + private static final long serialVersionUID = -2510767849932627519L; + + private static final Log logger = LogFactory.getLog(GuestTemplateContentServlet.class); + + private static final String DEFAULT_URL = "/guestTemplate/{0}/{1}/{2}"; + private static final String TEMPLATE_URL = "/guestTemplate/{0}/{1}/{2}/{3}/{4}/{5}"; + + @Override + protected Log getLogger() + { + return logger; + } + + @Override + protected Map buildModel(ServiceRegistry services, HttpServletRequest req, + NodeRef templateRef) + { + // setup the guest user to pass to the build model helper method + AuthenticationService auth = (AuthenticationService)services.getAuthenticationService(); + PersonService personService = (PersonService)services.getPersonService(); + NodeService nodeService = (NodeService)services.getNodeService(); + + NodeRef guestRef = personService.getPerson(PermissionService.GUEST_AUTHORITY); + User guestUser = new User(PermissionService.GUEST_AUTHORITY, auth.getCurrentTicket(), guestRef); + NodeRef guestHomeRef = (NodeRef)nodeService.getProperty(guestRef, ContentModel.PROP_HOMEFOLDER); + if (nodeService.exists(guestHomeRef) == false) + { + throw new InvalidNodeRefException(guestHomeRef); + } + guestUser.setHomeSpaceId(guestHomeRef.getId()); + + // build the default model + return DefaultModelHelper.buildDefaultModel(services, guestUser, templateRef); + } + + /** + * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + protected void service(HttpServletRequest req, HttpServletResponse res) + throws ServletException, IOException + { + if (logger.isDebugEnabled()) + { + String queryString = req.getQueryString(); + logger.debug("Setting up guest access to URL: " + req.getRequestURI() + + ((queryString != null && queryString.length() > 0) ? ("?" + queryString) : "")); + } + + TemplateContentWork tcw = new TemplateContentWork(req, res); + AuthenticationUtil.runAs(tcw, PermissionService.GUEST_AUTHORITY); + } + + /** + * Helper to generate a URL to process a template against a node. + *

+ * The result of the template is supplied returned as the response. + * + * @param nodeRef NodeRef of the content node to generate URL for (cannot be null) + * @param templateRef NodeRef of the template to process against, or null to use default + * + * @return URL to process the template + */ + public final static String generateURL(NodeRef nodeRef, NodeRef templateRef) + { + if (templateRef == null) + { + return MessageFormat.format(DEFAULT_URL, new Object[] { + nodeRef.getStoreRef().getProtocol(), + nodeRef.getStoreRef().getIdentifier(), + nodeRef.getId() } ); + } + else + { + return MessageFormat.format(TEMPLATE_URL, new Object[] { + nodeRef.getStoreRef().getProtocol(), + nodeRef.getStoreRef().getIdentifier(), + nodeRef.getId(), + templateRef.getStoreRef().getProtocol(), + templateRef.getStoreRef().getIdentifier(), + templateRef.getId()} ); + } + } + + /** + * Class to wrap the call to processTemplateRequest. + * + * @author gavinc + */ + public class TemplateContentWork implements RunAsWork + { + private HttpServletRequest req = null; + private HttpServletResponse res = null; + + public TemplateContentWork(HttpServletRequest req, HttpServletResponse res) + { + this.req = req; + this.res = res; + } + + public Object doWork() throws Exception + { + processTemplateRequest(this.req, this.res, false); + + return null; + } + } +} diff --git a/source/java/org/jbpm/webapp/servlet/ProcessImageServlet.java b/source/java/org/alfresco/web/app/servlet/JBPMProcessImageServlet.java similarity index 91% rename from source/java/org/jbpm/webapp/servlet/ProcessImageServlet.java rename to source/java/org/alfresco/web/app/servlet/JBPMProcessImageServlet.java index 85146b8d8d..fd4e895f5e 100644 --- a/source/java/org/jbpm/webapp/servlet/ProcessImageServlet.java +++ b/source/java/org/alfresco/web/app/servlet/JBPMProcessImageServlet.java @@ -1,55 +1,65 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.servlet; - -import java.io.IOException; -import java.io.OutputStream; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.jbpm.JbpmContext; -import org.jbpm.graph.def.ProcessDefinition; - -public class ProcessImageServlet extends HttpServlet { - - private static final long serialVersionUID = 1L; - - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - long processDefinitionId = Long.parseLong( request.getParameter( "definitionId" ) ); - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - ProcessDefinition processDefinition = jbpmContext.getGraphSession().loadProcessDefinition(processDefinitionId); - byte[] bytes = processDefinition.getFileDefinition().getBytes("processimage.jpg"); - OutputStream out = response.getOutputStream(); - out.write(bytes); - out.flush(); - - // leave this in. it is in case we want to set the mime type later. - // get the mime type - // String contentType = URLConnection.getFileNameMap().getContentTypeFor( fileName ); - // set the content type (=mime type) - // response.setContentType( contentType ); - } -} +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.alfresco.web.app.servlet; + +import java.io.IOException; +import java.io.OutputStream; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.jbpm.JbpmContext; +import org.jbpm.graph.def.ProcessDefinition; + + +// +// +// TODO: DC: Tidy up +// +// + + + + +public class JBPMProcessImageServlet extends HttpServlet { + + private static final long serialVersionUID = 1L; + + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + long processDefinitionId = Long.parseLong( request.getParameter( "definitionId" ) ); + JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); + ProcessDefinition processDefinition = jbpmContext.getGraphSession().loadProcessDefinition(processDefinitionId); + byte[] bytes = processDefinition.getFileDefinition().getBytes("processimage.jpg"); + OutputStream out = response.getOutputStream(); + out.write(bytes); + out.flush(); + + // leave this in. it is in case we want to set the mime type later. + // get the mime type + // String contentType = URLConnection.getFileNameMap().getContentTypeFor( fileName ); + // set the content type (=mime type) + // response.setContentType( contentType ); + } +} diff --git a/source/java/org/alfresco/web/app/servlet/TemplateContentServlet.java b/source/java/org/alfresco/web/app/servlet/TemplateContentServlet.java index a728e7bc93..09effd521d 100644 --- a/source/java/org/alfresco/web/app/servlet/TemplateContentServlet.java +++ b/source/java/org/alfresco/web/app/servlet/TemplateContentServlet.java @@ -17,32 +17,16 @@ package org.alfresco.web.app.servlet; import java.io.IOException; -import java.net.SocketException; import java.text.MessageFormat; -import java.util.Enumeration; -import java.util.HashMap; import java.util.Map; -import java.util.StringTokenizer; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.transaction.UserTransaction; -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.repository.TemplateException; -import org.alfresco.service.cmr.repository.TemplateImageResolver; -import org.alfresco.service.cmr.repository.TemplateNode; -import org.alfresco.service.cmr.repository.TemplateService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.web.app.Application; -import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.repo.component.template.DefaultModelHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -71,24 +55,37 @@ import org.apache.commons.logging.LogFactory; * Like most Alfresco servlets, the URL may be followed by a valid 'ticket' argument for authentication: * ?ticket=1234567890 *

- * And/or also followed by the "?guest=true" argument to force guest access login for the URL. + * And/or also followed by the "?guest=true" argument to force guest access login for the URL. If the + * guest=true parameter is used the current session will be logged out and the guest user logged in. + * Therefore upon completion of this request the current user will be "guest". + *

+ * If the user attempting the request is not authorised to access the requested node the login page + * will be redirected to. * * @author Kevin Roast */ -public class TemplateContentServlet extends BaseServlet -{ - private static final String MIMETYPE_HTML = "text/html"; +public class TemplateContentServlet extends BaseTemplateContentServlet +{ + private static final long serialVersionUID = -2510767849932627519L; - private static final long serialVersionUID = -4123407921997235977L; - - private static Log logger = LogFactory.getLog(TemplateContentServlet.class); + private static final Log logger = LogFactory.getLog(TemplateContentServlet.class); private static final String DEFAULT_URL = "/template/{0}/{1}/{2}"; private static final String TEMPLATE_URL = "/template/{0}/{1}/{2}/{3}/{4}/{5}"; - private static final String ARG_MIMETYPE = "mimetype"; - private static final String ARG_TEMPLATE_PATH = "templatePath"; - private static final String ARG_CONTEXT_PATH = "contextPath"; + @Override + protected Log getLogger() + { + return logger; + } + + @Override + protected Map buildModel(ServiceRegistry services, HttpServletRequest req, + NodeRef templateRef) + { + return DefaultModelHelper.buildDefaultModel(services, + Application.getCurrentUser(req.getSession()), templateRef); + } /** * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @@ -96,12 +93,10 @@ public class TemplateContentServlet extends BaseServlet protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { - String uri = req.getRequestURI(); - if (logger.isDebugEnabled()) { String queryString = req.getQueryString(); - logger.debug("Processing URL: " + uri + + logger.debug("Authenticating request to URL: " + req.getRequestURI() + ((queryString != null && queryString.length() > 0) ? ("?" + queryString) : "")); } @@ -111,189 +106,9 @@ public class TemplateContentServlet extends BaseServlet return; } - uri = uri.substring(req.getContextPath().length()); - StringTokenizer t = new StringTokenizer(uri, "/"); - int tokenCount = t.countTokens(); - - t.nextToken(); // skip servlet name - - NodeRef nodeRef = null; - NodeRef templateRef = null; - - String contentPath = req.getParameter(ARG_CONTEXT_PATH); - if (contentPath != null && contentPath.length() != 0) - { - // process the name based path to resolve the NodeRef - PathRefInfo pathInfo = resolveNamePath(getServletContext(), contentPath); - - nodeRef = pathInfo.NodeRef; - } - else if (tokenCount > 3) - { - // get NodeRef to the content from the URL elements - StoreRef storeRef = new StoreRef(t.nextToken(), t.nextToken()); - nodeRef = new NodeRef(storeRef, t.nextToken()); - } - - // get NodeRef to the template if supplied - String templatePath = req.getParameter(ARG_TEMPLATE_PATH); - if (templatePath != null && templatePath.length() != 0) - { - // process the name based path to resolve the NodeRef - PathRefInfo pathInfo = resolveNamePath(getServletContext(), templatePath); - - templateRef = pathInfo.NodeRef; - } - else if (tokenCount >= 7) - { - StoreRef storeRef = new StoreRef(t.nextToken(), t.nextToken()); - templateRef = new NodeRef(storeRef, t.nextToken()); - } - - // if no context is specified, use the template itself - // TODO: should this default to something else? - if (nodeRef == null && templateRef != null) - { - nodeRef = templateRef; - } - - if (nodeRef == null) - { - throw new TemplateException("Not enough elements supplied in URL or no 'path' argument specified."); - } - - // get the services we need to retrieve the content - ServiceRegistry serviceRegistry = getServiceRegistry(getServletContext()); - NodeService nodeService = serviceRegistry.getNodeService(); - TemplateService templateService = serviceRegistry.getTemplateService(); - PermissionService permissionService = serviceRegistry.getPermissionService(); - - // check that the user has at least READ access on any nodes - else redirect to the login page - if (permissionService.hasPermission(nodeRef, PermissionService.READ) == AccessStatus.DENIED || - (templateRef != null && permissionService.hasPermission(templateRef, PermissionService.READ) == AccessStatus.DENIED)) - { - redirectToLoginPage(req, res, getServletContext()); - return; - } - - String mimetype = MIMETYPE_HTML; - if (req.getParameter(ARG_MIMETYPE) != null) - { - mimetype = req.getParameter(ARG_MIMETYPE); - } - res.setContentType(mimetype); - - try - { - UserTransaction txn = null; - try - { - txn = serviceRegistry.getTransactionService().getUserTransaction(true); - txn.begin(); - - // if template not supplied, then use the default against the node - if (templateRef == null) - { - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPLATABLE)) - { - templateRef = (NodeRef)nodeService.getProperty(nodeRef, ContentModel.PROP_TEMPLATE); - } - if (templateRef == null) - { - throw new TemplateException("Template reference not set against node or not supplied in URL."); - } - } - - // create the model - put the supplied noderef in as space/document as appropriate - Object model = getModel(serviceRegistry, req, templateRef, nodeRef); - - // process the template against the node content directly to the response output stream - // assuming the repo is capable of streaming in chunks, this should allow large files - // to be streamed directly to the browser response stream. - try - { - templateService.processTemplate( - null, - templateRef.toString(), - model, - res.getWriter()); - - // commit the transaction - txn.commit(); - } - catch (SocketException e) - { - if (e.getMessage().contains("ClientAbortException")) - { - // the client cut the connection - our mission was accomplished apart from a little error message - logger.error("Client aborted stream read:\n node: " + nodeRef + "\n template: " + templateRef); - try { if (txn != null) {txn.rollback();} } catch (Exception tex) {} - } - else - { - throw e; - } - } - } - catch (Throwable txnErr) - { - try { if (txn != null) {txn.rollback();} } catch (Exception tex) {} - throw txnErr; - } - } - catch (Throwable err) - { - throw new AlfrescoRuntimeException("Error during template servlet processing: " + err.getMessage(), err); - } + processTemplateRequest(req, res, true); } - /** - * Build the model that to process the template against. - *

- * The model includes the usual template root objects such as 'companyhome', 'userhome', - * 'person' and also includes the node specified on the servlet URL as 'space' and 'document' - * - * @param services ServiceRegistry required for TemplateNode construction - * @param req Http request - for accessing Session and url args - * @param templateRef NodeRef of the template itself - * @param nodeRef NodeRef of the space/document to process template against - * - * @return an object model ready for executing template against - */ - @SuppressWarnings("unchecked") - private Object getModel(ServiceRegistry services, HttpServletRequest req, NodeRef templateRef, NodeRef nodeRef) - { - // build FreeMarker default model and merge - Map root = DefaultModelHelper.buildDefaultModel( - services, Application.getCurrentUser(req.getSession()), templateRef); - - // put the current NodeRef in as "space" and "document" - TemplateNode node = new TemplateNode(nodeRef, services, this.imageResolver); - root.put("space", node); - root.put("document", node); - - // add URL arguments as a map called 'args' to the root of the model - Map args = new HashMap(8, 1.0f); - Enumeration names = req.getParameterNames(); - while (names.hasMoreElements()) - { - String name = (String)names.nextElement(); - args.put(name, req.getParameter(name)); - } - root.put("args", args); - - return root; - } - - /** Template Image resolver helper */ - private TemplateImageResolver imageResolver = new TemplateImageResolver() - { - public String resolveImagePathForName(String filename, boolean small) - { - return Utils.getFileTypeImage(getServletContext(), filename, small); - } - }; - /** * Helper to generate a URL to process a template against a node. *

diff --git a/source/java/org/alfresco/web/app/servlet/command/ApproveWorkflowCommand.java b/source/java/org/alfresco/web/app/servlet/command/ApproveWorkflowCommand.java index 135da7aadf..1ffb92f8df 100644 --- a/source/java/org/alfresco/web/app/servlet/command/ApproveWorkflowCommand.java +++ b/source/java/org/alfresco/web/app/servlet/command/ApproveWorkflowCommand.java @@ -20,7 +20,7 @@ import java.util.Map; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.web.bean.WorkflowUtil; +import org.alfresco.web.bean.workflow.WorkflowUtil; /** * Approve Workflow command implementation diff --git a/source/java/org/alfresco/web/app/servlet/command/RejectWorkflowCommand.java b/source/java/org/alfresco/web/app/servlet/command/RejectWorkflowCommand.java index aee30ccb9b..2775f360fe 100644 --- a/source/java/org/alfresco/web/app/servlet/command/RejectWorkflowCommand.java +++ b/source/java/org/alfresco/web/app/servlet/command/RejectWorkflowCommand.java @@ -20,7 +20,7 @@ import java.util.Map; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.web.bean.WorkflowUtil; +import org.alfresco.web.bean.workflow.WorkflowUtil; /** * Reject Workflow command implementation diff --git a/source/java/org/alfresco/web/bean/BaseDetailsBean.java b/source/java/org/alfresco/web/bean/BaseDetailsBean.java index 09d0b7b6bb..c235d4aa2c 100644 --- a/source/java/org/alfresco/web/bean/BaseDetailsBean.java +++ b/source/java/org/alfresco/web/bean/BaseDetailsBean.java @@ -39,6 +39,7 @@ import org.alfresco.web.app.context.UIContextService; import org.alfresco.web.bean.actions.handlers.SimpleWorkflowHandler; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.workflow.WorkflowUtil; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils.URLMode; import org.alfresco.web.ui.common.component.UIActionLink; diff --git a/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java b/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java index 0d0e8fa77e..f377404a61 100644 --- a/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java +++ b/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java @@ -783,7 +783,8 @@ public class CheckinCheckoutBean } catch (Throwable err) { - Utils.addErrorMessage(MSG_ERROR_CANCELCHECKOUT + err.getMessage(), err); + Utils.addErrorMessage(Application.getMessage( + FacesContext.getCurrentInstance(), MSG_ERROR_CANCELCHECKOUT) + err.getMessage(), err); } } else diff --git a/source/java/org/alfresco/web/bean/SpaceDetailsBean.java b/source/java/org/alfresco/web/bean/SpaceDetailsBean.java index 39b0793ad3..5e3bc342a0 100644 --- a/source/java/org/alfresco/web/bean/SpaceDetailsBean.java +++ b/source/java/org/alfresco/web/bean/SpaceDetailsBean.java @@ -34,6 +34,7 @@ import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.namespace.QName; import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.Application; +import org.alfresco.web.app.servlet.GuestTemplateContentServlet; import org.alfresco.web.app.servlet.TemplateContentServlet; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; @@ -506,9 +507,9 @@ public class SpaceDetailsBean extends BaseDetailsBean // build RSS feed template URL from selected template and the space NodeRef and // add the guest=true URL parameter - this is required for no login access and // add the mimetype=text/xml URL parameter - required to return correct stream type - return TemplateContentServlet.generateURL(space.getNodeRef(), + return GuestTemplateContentServlet.generateURL(space.getNodeRef(), (NodeRef)space.getProperties().get(ContentModel.PROP_FEEDTEMPLATE)) - + "/rss.xml?guest=true" + "&mimetype=text%2Fxml"; + + "/rss.xml?mimetype=text%2Fxml"; } /** diff --git a/source/java/org/alfresco/web/bean/repository/TransientNode.java b/source/java/org/alfresco/web/bean/repository/TransientNode.java index 9f5332fd8b..fa7ca06c0a 100644 --- a/source/java/org/alfresco/web/bean/repository/TransientNode.java +++ b/source/java/org/alfresco/web/bean/repository/TransientNode.java @@ -70,6 +70,9 @@ public class TransientNode extends Node // setup the transient node so that the super class methods work // and do not need to go back to the repository + if (logger.isDebugEnabled()) + logger.debug("Initialising transient node with data: " + data); + DictionaryService ddService = this.getServiceRegistry().getDictionaryService(); // marshall the given properties and associations into the internal maps @@ -94,25 +97,11 @@ public class TransientNode extends Node { if (assocDef.isChild()) { - // TODO: handle lists of NodeRef's - NodeRef child = null; Object obj = data.get(item); - if (obj instanceof String) - { - child = new NodeRef((String)obj); - } - else if (obj instanceof NodeRef) - { - child = (NodeRef)obj; - } - else if (obj instanceof List) - { - if (logger.isWarnEnabled()) - logger.warn("0..* child associations are not supported yet"); - } - - if (child != null) + if (obj instanceof NodeRef) { + NodeRef child = (NodeRef)obj; + // create a child association reference, add it to a list and add the list // to the list of child associations for this node List assocs = new ArrayList(1); @@ -122,28 +111,36 @@ public class TransientNode extends Node this.childAssociations.put(item, assocs); } + else if (obj instanceof List) + { + List targets = (List)obj; + + List assocs = new ArrayList(targets.size()); + + for (Object target : targets) + { + if (target instanceof NodeRef) + { + NodeRef currentChild = (NodeRef)target; + ChildAssociationRef childRef = new ChildAssociationRef(assocDef.getName(), + this.nodeRef, null, currentChild); + assocs.add(childRef); + } + } + + if (assocs.size() > 0) + { + this.childAssociations.put(item, assocs); + } + } } else { - // TODO: handle lists of NodeRef's - NodeRef target = null; Object obj = data.get(item); - if (obj instanceof String) - { - target = new NodeRef((String)obj); - } - else if (obj instanceof NodeRef) - { - target = (NodeRef)obj; - } - else if (obj instanceof List) - { - if (logger.isWarnEnabled()) - logger.warn("0..* associations are not supported yet"); - } - - if (target != null) + if (obj instanceof NodeRef) { + NodeRef target = (NodeRef)obj; + // create a association reference, add it to a list and add the list // to the list of associations for this node List assocs = new ArrayList(1); @@ -152,6 +149,27 @@ public class TransientNode extends Node this.associations.put(item, assocs); } + else if (obj instanceof List) + { + List targets = (List)obj; + + List assocs = new ArrayList(targets.size()); + + for (Object target : targets) + { + if (target instanceof NodeRef) + { + NodeRef currentTarget = (NodeRef)target; + AssociationRef assocRef = new AssociationRef(this.nodeRef, assocDef.getName(), currentTarget); + assocs.add(assocRef); + } + } + + if (assocs.size() > 0) + { + this.associations.put(item, assocs); + } + } } } } diff --git a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java index 2e63eb4630..04ba84f892 100644 --- a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java +++ b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java @@ -136,7 +136,7 @@ public class ManageTaskDialog extends BaseDialogBean logger.debug("Saving task: " + this.task.id); // prepare the edited parameters for saving - Map params = WorkflowBean.prepareTaskParams(this.taskNode); + Map params = WorkflowUtil.prepareTaskParams(this.taskNode); if (logger.isDebugEnabled()) logger.debug("Saving task with parameters: " + params); @@ -262,7 +262,7 @@ public class ManageTaskDialog extends BaseDialogBean tx.begin(); // prepare the edited parameters for saving - Map params = WorkflowBean.prepareTaskParams(this.taskNode); + Map params = WorkflowUtil.prepareTaskParams(this.taskNode); if (logger.isDebugEnabled()) logger.debug("Transitioning task with parameters: " + params); @@ -399,7 +399,7 @@ public class ManageTaskDialog extends BaseDialogBean */ public void togglePackageItemComplete(ActionEvent event) { - // TODO: implement this! + // TODO: not supported yet } // ------------------------------------------------------------------------------ diff --git a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java index 7425da8575..5616f95813 100644 --- a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java +++ b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java @@ -119,7 +119,7 @@ public class StartWorkflowWizard extends BaseWizardBean logger.debug("Starting workflow: " + this.selectedWorkflow); // prepare the parameters from the current state of the property sheet - Map params = WorkflowBean.prepareTaskParams(this.startTaskNode); + Map params = WorkflowUtil.prepareTaskParams(this.startTaskNode); if (logger.isDebugEnabled()) logger.debug("Starting workflow with parameters: " + params); diff --git a/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java b/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java index 4e5da783fd..e90aa78e15 100644 --- a/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java +++ b/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java @@ -1,17 +1,13 @@ package org.alfresco.web.bean.workflow; -import java.io.Serializable; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import javax.faces.context.FacesContext; import javax.transaction.UserTransaction; import org.alfresco.model.ContentModel; import org.alfresco.repo.workflow.WorkflowModel; -import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.workflow.WorkflowService; @@ -19,7 +15,6 @@ import org.alfresco.service.cmr.workflow.WorkflowTask; import org.alfresco.service.cmr.workflow.WorkflowTaskDefinition; import org.alfresco.service.cmr.workflow.WorkflowTaskState; import org.alfresco.service.cmr.workflow.WorkflowTransition; -import org.alfresco.service.namespace.QName; import org.alfresco.util.ISO9075; import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Node; @@ -31,7 +26,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** - * Managed bean used for handling workflow related features + * Managed bean used for providing support for the workflow task dashlets * * @author gavinc */ @@ -55,40 +50,43 @@ public class WorkflowBean */ public List getTasksToDo() { - // get the current username - FacesContext context = FacesContext.getCurrentInstance(); - User user = Application.getCurrentUser(context); - String userName = ISO9075.encode(user.getUserName()); - - UserTransaction tx = null; - try + if (this.tasks == null) { - tx = Repository.getUserTransaction(context, true); - tx.begin(); + // get the current username + FacesContext context = FacesContext.getCurrentInstance(); + User user = Application.getCurrentUser(context); + String userName = ISO9075.encode(user.getUserName()); - // get the current in progress tasks for the current user - List tasks = this.workflowService.getAssignedTasks( - userName, WorkflowTaskState.IN_PROGRESS); - - // create a list of transient nodes to represent - this.tasks = new ArrayList(tasks.size()); - for (WorkflowTask task : tasks) + UserTransaction tx = null; + try { - Node node = createTask(task); - this.tasks.add(node); + tx = Repository.getUserTransaction(context, true); + tx.begin(); - if (logger.isDebugEnabled()) - logger.debug("Added to do task: " + node); + // get the current in progress tasks for the current user + List tasks = this.workflowService.getAssignedTasks( + userName, WorkflowTaskState.IN_PROGRESS); + + // create a list of transient nodes to represent + this.tasks = new ArrayList(tasks.size()); + for (WorkflowTask task : tasks) + { + Node node = createTask(task); + this.tasks.add(node); + + if (logger.isDebugEnabled()) + logger.debug("Added to do task: " + node); + } + + // commit the changes + tx.commit(); + } + catch (Throwable e) + { + // rollback the transaction + try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} + Utils.addErrorMessage("Failed to get to do tasks: " + e.toString(), e); } - - // commit the changes - tx.commit(); - } - catch (Throwable e) - { - // rollback the transaction - try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} - Utils.addErrorMessage("Failed to get to do tasks: " + e.toString(), e); } return this.tasks; @@ -102,40 +100,43 @@ public class WorkflowBean */ public List getTasksCompleted() { - // get the current username - FacesContext context = FacesContext.getCurrentInstance(); - User user = Application.getCurrentUser(context); - String userName = ISO9075.encode(user.getUserName()); - - UserTransaction tx = null; - try + if (this.completedTasks == null) { - tx = Repository.getUserTransaction(context, true); - tx.begin(); + // get the current username + FacesContext context = FacesContext.getCurrentInstance(); + User user = Application.getCurrentUser(context); + String userName = ISO9075.encode(user.getUserName()); - // get the current in progress tasks for the current user - List tasks = this.workflowService.getAssignedTasks( - userName, WorkflowTaskState.COMPLETED); - - // create a list of transient nodes to represent - this.completedTasks = new ArrayList(tasks.size()); - for (WorkflowTask task : tasks) + UserTransaction tx = null; + try { - Node node = createTask(task); - this.completedTasks.add(node); + tx = Repository.getUserTransaction(context, true); + tx.begin(); - if (logger.isDebugEnabled()) - logger.debug("Added completed task: " + node); + // get the current in progress tasks for the current user + List tasks = this.workflowService.getAssignedTasks( + userName, WorkflowTaskState.COMPLETED); + + // create a list of transient nodes to represent + this.completedTasks = new ArrayList(tasks.size()); + for (WorkflowTask task : tasks) + { + Node node = createTask(task); + this.completedTasks.add(node); + + if (logger.isDebugEnabled()) + logger.debug("Added completed task: " + node); + } + + // commit the changes + tx.commit(); } - - // commit the changes - tx.commit(); - } - catch (Throwable e) - { - // rollback the transaction - try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} - Utils.addErrorMessage("Failed to get completed tasks: " + e.toString(), e); + catch (Throwable e) + { + // rollback the transaction + try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} + Utils.addErrorMessage("Failed to get completed tasks: " + e.toString(), e); + } } return this.completedTasks; @@ -163,47 +164,6 @@ public class WorkflowBean // ------------------------------------------------------------------------------ // Helper methods - - public static Map prepareTaskParams(Node node) - { - Map params = new HashMap(); - - // marshal the properties and associations captured by the property sheet - // back into a Map to pass to the workflow service - - // go through all the properties in the transient node and add them to - // params map - Map props = node.getProperties(); - for (String propName : props.keySet()) - { - QName propQName = Repository.resolveToQName(propName); - params.put(propQName, (Serializable)props.get(propName)); - } - - // go through any associations that have been added to the start task - // and build a list of NodeRefs representing the targets - Map> assocs = node.getAddedAssociations(); - for (String assocName : assocs.keySet()) - { - QName assocQName = Repository.resolveToQName(assocName); - - // get the associations added and create list of targets - Map addedAssocs = assocs.get(assocName); - List targets = new ArrayList(addedAssocs.size()); - for (AssociationRef assoc : addedAssocs.values()) - { - targets.add(assoc.getTargetRef()); - } - - // add the targets for this particular association - if (targets.size() > 0) - { - params.put(assocQName, (Serializable)targets); - } - } - - return params; - } /** * Creates and populates a TransientNode to represent the given @@ -260,6 +220,9 @@ public class WorkflowBean // add the workflow instance id and name this taks belongs to node.getProperties().put("workflowInstanceId", task.path.instance.id); + + // add the task itself as a property + node.getProperties().put("workflowTask", task); } return node; diff --git a/source/java/org/alfresco/web/bean/workflow/WorkflowConsoleBean.java b/source/java/org/alfresco/web/bean/workflow/WorkflowConsoleBean.java new file mode 100644 index 0000000000..cdf66e8149 --- /dev/null +++ b/source/java/org/alfresco/web/bean/workflow/WorkflowConsoleBean.java @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.bean.workflow; + +import org.alfresco.repo.workflow.WorkflowInterpreter; +import org.alfresco.service.cmr.workflow.WorkflowDefinition; + + +/** + * Backing bean to support the Workflow Console + */ +public class WorkflowConsoleBean +{ + // command + private String command = ""; + private String submittedCommand = "none"; + private long duration = 0L; + private String result = null; + + // supporting repository services + private WorkflowInterpreter workflowInterpreter; + + + /** + * @param nodeService node service + */ + public void setWorkflowInterpreter(WorkflowInterpreter workflowInterpreter) + { + this.workflowInterpreter = workflowInterpreter; + } + + /** + * Gets the command result + * + * @return result + */ + public String getResult() + { + if (result == null) + { + interpretCommand("help"); + } + return result; + } + + /** + * Sets the command result + * + * @param result + */ + public void setResult(String result) + { + this.result = result; + } + + /** + * Gets the current query + * + * @return query statement + */ + public String getCommand() + { + return command; + } + + /** + * Set the current query + * + * @param query query statement + */ + public void setCommand(String command) + { + this.command = command; + } + + /** + * Gets the submitted command + * + * @return submitted command + */ + public String getSubmittedCommand() + { + return submittedCommand; + } + + /** + * Set the current query + * + * @param query query statement + */ + public void setSubmittedCommand(String submittedCommand) + { + this.submittedCommand = submittedCommand; + } + + /** + * Gets the last command duration + * + * @return command duration + */ + public long getDuration() + { + return duration; + } + + /** + * Set the current query + * + * @param query query statement + */ + public void setDuration(long duration) + { + this.duration = duration; + } + + /** + * Action to submit command + * + * @return next action + */ + public String submitCommand() + { + interpretCommand(command); + return "success"; + } + + /** + * Gets the current user name + * + * @return user name + */ + public String getCurrentUserName() + { + return workflowInterpreter.getCurrentUserName(); + } + + /** + * Gets the current workflow definition + * + * @return workflow definition + */ + public String getCurrentWorkflowDef() + { + WorkflowDefinition def = workflowInterpreter.getCurrentWorkflowDef(); + return (def == null) ? "None" : def.title + " v" + def.version; + } + + /** + * Interpret workflow console command + * + * @param command command + */ + private void interpretCommand(String command) + { + try + { + long startms = System.currentTimeMillis(); + String result = workflowInterpreter.interpretCommand(command); + setDuration(System.currentTimeMillis() - startms); + setResult(result); + setCommand(""); + setSubmittedCommand(command); + } + catch (Exception e) + { + setResult(e.toString()); + } + } + +} diff --git a/source/java/org/alfresco/web/bean/WorkflowUtil.java b/source/java/org/alfresco/web/bean/workflow/WorkflowUtil.java similarity index 64% rename from source/java/org/alfresco/web/bean/WorkflowUtil.java rename to source/java/org/alfresco/web/bean/workflow/WorkflowUtil.java index fa57b332d7..2f6412f4e9 100644 --- a/source/java/org/alfresco/web/bean/WorkflowUtil.java +++ b/source/java/org/alfresco/web/bean/workflow/WorkflowUtil.java @@ -14,22 +14,29 @@ * language governing permissions and limitations under the * License. */ -package org.alfresco.web.bean; +package org.alfresco.web.bean.workflow; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import java.util.Map; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; +import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.CopyService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.web.bean.repository.Node; -import org.apache.log4j.Logger; +import org.alfresco.web.bean.repository.Repository; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** - * Helper class for common Simple Workflow functionality. + * Helper class for common Workflow functionality. *

* This class should be replaced with calls to a WorkflowService once it is available. * @@ -37,7 +44,7 @@ import org.apache.log4j.Logger; */ public class WorkflowUtil { - private static Logger logger = Logger.getLogger(WorkflowUtil.class); + private static Log logger = LogFactory.getLog(WorkflowUtil.class); /** * Execute the Approve step for the Simple Workflow on a node. @@ -139,9 +146,14 @@ public class WorkflowUtil else { // copy the document to the specified folder - String qname = QName.createValidLocalName(docNode.getName()); - copyService.copy(ref, rejectFolder, ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, qname)); + String name = docNode.getName(); + String qname = QName.createValidLocalName(name); + NodeRef newNode = copyService.copy(ref, rejectFolder, ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, qname), true); + + // the copy service does not copy the name of the node so we + // need to update the property on the copied item + nodeService.setProperty(newNode, ContentModel.PROP_NAME, name); } if (logger.isDebugEnabled()) @@ -151,4 +163,60 @@ public class WorkflowUtil rejectFolder.getId()); } } + + /** + * Prepares the given node for persistence in the workflow engine. + * + * @param node The node to package up for persistence + * @return The map of data representing the node + */ + public static Map prepareTaskParams(Node node) + { + Map params = new HashMap(); + + // marshal the properties and associations captured by the property sheet + // back into a Map to pass to the workflow service + + // go through all the properties in the transient node and add them to + // params map + Map props = node.getProperties(); + for (String propName : props.keySet()) + { + QName propQName = Repository.resolveToQName(propName); + params.put(propQName, (Serializable)props.get(propName)); + } + + // go through any associations that have been added to the start task + // and build a list of NodeRefs representing the targets + Map> assocs = node.getAddedAssociations(); + for (String assocName : assocs.keySet()) + { + QName assocQName = Repository.resolveToQName(assocName); + + // get the associations added and create list of targets + Map addedAssocs = assocs.get(assocName); + List targets = new ArrayList(addedAssocs.size()); + for (AssociationRef assoc : addedAssocs.values()) + { + targets.add(assoc.getTargetRef()); + } + + // add the targets for this particular association + if (targets.size() > 0) + { + params.put(assocQName, (Serializable)targets); + } + } + + // TODO: Deal with child associations if and when we need to support + // them for workflow tasks, for now warn that they are being used + Map childAssocs = node.getAddedChildAssociations(); + if (childAssocs.size() > 0) + { + if (logger.isWarnEnabled()) + logger.warn("Child associations are present but are not supported for workflow tasks, ignoring..."); + } + + return params; + } } diff --git a/source/java/org/alfresco/web/config/ClientConfigElement.java b/source/java/org/alfresco/web/config/ClientConfigElement.java index b151b3b0fe..e2fd3e5665 100644 --- a/source/java/org/alfresco/web/config/ClientConfigElement.java +++ b/source/java/org/alfresco/web/config/ClientConfigElement.java @@ -36,6 +36,7 @@ public class ClientConfigElement extends ConfigElementAdapter private int searchMinimum = 3; private boolean forceAndTerms = false; private int searchMaxResults = -1; + private int selectorsSearchMaxResults = 500; private String helpUrl = null; private String editLinkType = "http"; private String homeSpacePermission = null; @@ -135,6 +136,11 @@ public class ClientConfigElement extends ConfigElementAdapter combinedElement.setSearchMaxResults(newElement.getSearchMaxResults()); } + if (newElement.getSelectorsSearchMaxResults() != combinedElement.getSelectorsSearchMaxResults()) + { + combinedElement.setSelectorsSearchMaxResults(newElement.getSelectorsSearchMaxResults()); + } + if (newElement.isShelfVisible() != combinedElement.isShelfVisible()) { combinedElement.setShelfVisible(newElement.isShelfVisible()); @@ -310,10 +316,9 @@ public class ClientConfigElement extends ConfigElementAdapter * * @return */ - public int getSearchMaxResults() { - return searchMaxResults; + return this.searchMaxResults; } /** @@ -326,6 +331,29 @@ public class ClientConfigElement extends ConfigElementAdapter { this.searchMaxResults = searchMaxResults; } + + /** + * If positive, this will limit the size of the result set from the search + * used in selector components. + * + * @return The maximum number of results to display + */ + public int getSelectorsSearchMaxResults() + { + return this.selectorsSearchMaxResults; + } + + /** + * Set if the the result set from a search for the selector components + * will be of limited size. If negative it is unlimited, by default, + * this is set to 500. + * + * @param selectorsSearchMaxResults + */ + /*package*/ void setSelectorsSearchMaxResults(int selectorsSearchMaxResults) + { + this.selectorsSearchMaxResults = selectorsSearchMaxResults; + } /** * @return Returns the default Home Space permissions. diff --git a/source/java/org/alfresco/web/config/ClientElementReader.java b/source/java/org/alfresco/web/config/ClientElementReader.java index 43d25005ee..a66da1050c 100644 --- a/source/java/org/alfresco/web/config/ClientElementReader.java +++ b/source/java/org/alfresco/web/config/ClientElementReader.java @@ -36,6 +36,7 @@ public class ClientElementReader implements ConfigElementReader public static final String ELEMENT_SEARCHMINIMUM = "search-minimum"; public static final String ELEMENT_SEARCHANDTERMS = "search-and-terms"; public static final String ELEMENT_SEARCHMAXRESULTS = "search-max-results"; + public static final String ELEMENT_SELECTORSSEARCHMAXRESULTS = "selectors-search-max-results"; public static final String ELEMENT_HOMESPACEPERMISSION = "home-space-permission"; public static final String ELEMENT_FROMEMAILADDRESS = "from-email-address"; public static final String ELEMENT_SHELFVISIBLE = "shelf-visible"; @@ -111,6 +112,14 @@ public class ClientElementReader implements ConfigElementReader configElement.setSearchMaxResults(Integer.parseInt(searchMaxResults.getTextTrim())); } + // get the selectors search max results size + Element selectorsSearchMaxResults = element.element(ELEMENT_SELECTORSSEARCHMAXRESULTS); + if (selectorsSearchMaxResults != null) + { + configElement.setSelectorsSearchMaxResults( + Integer.parseInt(selectorsSearchMaxResults.getTextTrim())); + } + // get the default permission for newly created users Home Spaces Element permission = element.element(ELEMENT_HOMESPACEPERMISSION); if (permission != null) diff --git a/source/java/org/alfresco/web/ui/repo/component/UIContentSelector.java b/source/java/org/alfresco/web/ui/repo/component/UIContentSelector.java index 2aeec8d7a4..de99c00fab 100644 --- a/source/java/org/alfresco/web/ui/repo/component/UIContentSelector.java +++ b/source/java/org/alfresco/web/ui/repo/component/UIContentSelector.java @@ -30,7 +30,9 @@ import javax.faces.el.ValueBinding; import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.search.LimitBy; import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchParameters; import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; @@ -353,15 +355,30 @@ public class UIContentSelector extends UIInput query.append(":*" + safeContains + "*"); } + + int maxResults = Application.getClientConfig(context).getSelectorsSearchMaxResults(); if (logger.isDebugEnabled()) + { logger.debug("Query: " + query.toString()); + logger.debug("Max results size: " + maxResults); + } + + // setup search parameters, including limiting the results + SearchParameters searchParams = new SearchParameters(); + searchParams.addStore(Repository.getStoreRef()); + searchParams.setLanguage(SearchService.LANGUAGE_LUCENE); + searchParams.setQuery(query.toString()); + if (maxResults > 0) + { + searchParams.setLimit(maxResults); + searchParams.setLimitBy(LimitBy.FINAL_SIZE); + } ResultSet results = null; try { - results = Repository.getServiceRegistry(context).getSearchService().query( - Repository.getStoreRef(), SearchService.LANGUAGE_LUCENE, query.toString()); + results = Repository.getServiceRegistry(context).getSearchService().query(searchParams); this.availableOptions = results.getNodeRefs(); } finally diff --git a/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java b/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java index 3cf4ac6590..3efa70b2d8 100644 --- a/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java +++ b/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java @@ -36,6 +36,7 @@ import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.dictionary.AssociationDefinition; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.search.LimitBy; import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.SearchParameters; import org.alfresco.service.cmr.search.SearchService; @@ -914,13 +915,23 @@ public abstract class BaseAssociationEditor extends UIInput } } + int maxResults = Application.getClientConfig(context).getSelectorsSearchMaxResults(); + if (logger.isDebugEnabled()) + { logger.debug("Query: " + query.toString()); + logger.debug("Max results size: " + maxResults); + } SearchParameters searchParams = new SearchParameters(); searchParams.addStore(Repository.getStoreRef()); searchParams.setLanguage(SearchService.LANGUAGE_LUCENE); searchParams.setQuery(query.toString()); + if (maxResults > 0) + { + searchParams.setLimit(maxResults); + searchParams.setLimitBy(LimitBy.FINAL_SIZE); + } if (type.equals(ContentModel.TYPE_PERSON.toString())) { diff --git a/source/java/org/alfresco/web/ui/repo/component/property/UIProperty.java b/source/java/org/alfresco/web/ui/repo/component/property/UIProperty.java index d6b4b7c09c..b3677bbf73 100644 --- a/source/java/org/alfresco/web/ui/repo/component/property/UIProperty.java +++ b/source/java/org/alfresco/web/ui/repo/component/property/UIProperty.java @@ -176,10 +176,11 @@ public class UIProperty extends PropertySheetItem // if we're in edit mode ensure that we don't allow editing of system properties or scenarios we don't support if (propSheet.inEditMode()) { - // if we are trying to edit a NodeRef or Path property type set it to read-only as - // these are internal properties that shouldn't be edited. + // if we are trying to edit a system property type set it to read-only as these are internal + // properties that shouldn't be edited. if (typeName.equals(DataTypeDefinition.NODE_REF) || typeName.equals(DataTypeDefinition.PATH) || - typeName.equals(DataTypeDefinition.CONTENT)) + typeName.equals(DataTypeDefinition.CONTENT) || typeName.equals(DataTypeDefinition.QNAME) || + typeName.equals(DataTypeDefinition.CHILD_ASSOC_REF) || typeName.equals(DataTypeDefinition.ASSOC_REF)) { logger.warn("Setting property " + propDef.getName().toString() + " to read-only as it can not be edited"); control.getAttributes().put("disabled", Boolean.TRUE); diff --git a/source/java/org/jbpm/webapp/tag/ProcessImageTag.java b/source/java/org/alfresco/web/ui/repo/tag/JBPMProcessImageTag.java similarity index 95% rename from source/java/org/jbpm/webapp/tag/ProcessImageTag.java rename to source/java/org/alfresco/web/ui/repo/tag/JBPMProcessImageTag.java index 5eaf9ffd63..90faf788e8 100644 --- a/source/java/org/jbpm/webapp/tag/ProcessImageTag.java +++ b/source/java/org/alfresco/web/ui/repo/tag/JBPMProcessImageTag.java @@ -1,244 +1,254 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.tag; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.JspWriter; -import javax.servlet.jsp.tagext.TagSupport; - -import org.dom4j.DocumentException; -import org.dom4j.DocumentHelper; -import org.dom4j.Element; -import org.dom4j.XPath; -import org.dom4j.xpath.DefaultXPath; -import org.jbpm.JbpmContext; -import org.jbpm.file.def.FileDefinition; -import org.jbpm.graph.def.ProcessDefinition; -import org.jbpm.graph.exe.Token; -import org.jbpm.taskmgmt.exe.TaskInstance; - -public class ProcessImageTag extends TagSupport { - - private static final long serialVersionUID = 1L; - private long taskInstanceId = -1; - private long tokenInstanceId = -1; - - private byte[] gpdBytes = null; - private byte[] imageBytes = null; - private Token currentToken = null; - private ProcessDefinition processDefinition = null; - - static String currentTokenColor = "red"; - static String childTokenColor = "blue"; - static String tokenNameColor = "blue"; - - - public void release() { - taskInstanceId = -1; - gpdBytes = null; - imageBytes = null; - currentToken = null; - } - - public int doEndTag() throws JspException { - try { - initialize(); - retrieveByteArrays(); - if (gpdBytes != null && imageBytes != null) { - writeTable(); - } - } catch (IOException e) { - e.printStackTrace(); - throw new JspException("table couldn't be displayed", e); - } catch (DocumentException e) { - e.printStackTrace(); - throw new JspException("table couldn't be displayed", e); - } - release(); - return EVAL_PAGE; - } - - private void retrieveByteArrays() { - try { - FileDefinition fileDefinition = processDefinition.getFileDefinition(); - gpdBytes = fileDefinition.getBytes("gpd.xml"); - imageBytes = fileDefinition.getBytes("processimage.jpg"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private void writeTable() throws IOException, DocumentException { - - int borderWidth = 4; - Element rootDiagramElement = DocumentHelper.parseText(new String(gpdBytes)).getRootElement(); - int[] boxConstraint; - int[] imageDimension = extractImageDimension(rootDiagramElement); - String imageLink = "/alfresco/processimage?definitionId=" + processDefinition.getId(); - JspWriter jspOut = pageContext.getOut(); - - if (tokenInstanceId > 0) { - - List allTokens = new ArrayList(); - walkTokens(currentToken, allTokens); - - jspOut.println("

"); - - for (int i = 0; i < allTokens.size(); i++) - { - Token token = (Token) allTokens.get(i); - - //check how many tokens are on teh same level (= having the same parent) - int offset = i; - if(i > 0) { - while(offset > 0 && ((Token) allTokens.get(offset - 1)).getParent().equals(token.getParent())) { - offset--; - } - } - boxConstraint = extractBoxConstraint(rootDiagramElement, token); - - //Adjust for borders - //boxConstraint[2]-=borderWidth*2; - //boxConstraint[3]-=borderWidth*2; - - jspOut.println("
"); - - if(token.getName()!=null) - { - jspOut.println(" " + token.getName() +""); - } - - jspOut.println("
"); - } - jspOut.println("
"); - } - else - { - boxConstraint = extractBoxConstraint(rootDiagramElement); - - jspOut.println(""); - jspOut.println(" "); - jspOut.println(" "); - jspOut.println(" "); - jspOut.println("
"); - jspOut.println(" "); - jspOut.println(" "); - jspOut.println(" "); - jspOut.println(" "); - jspOut.println(" "); - jspOut.println(" "); - jspOut.println(" "); - jspOut.println(" "); - jspOut.println("
 
"); - jspOut.println("
"); - } - } - - private int[] extractBoxConstraint(Element root) { - int[] result = new int[4]; - String nodeName = currentToken.getNode().getName(); - XPath xPath = new DefaultXPath("//node[@name='" + nodeName + "']"); - Element node = (Element) xPath.selectSingleNode(root); - result[0] = Integer.valueOf(node.attribute("x").getValue()).intValue(); - result[1] = Integer.valueOf(node.attribute("y").getValue()).intValue(); - result[2] = Integer.valueOf(node.attribute("width").getValue()).intValue(); - result[3] = Integer.valueOf(node.attribute("height").getValue()).intValue(); - return result; - } - - private int[] extractBoxConstraint(Element root, Token token) { - int[] result = new int[4]; - String nodeName = token.getNode().getName(); - XPath xPath = new DefaultXPath("//node[@name='" + nodeName + "']"); - Element node = (Element) xPath.selectSingleNode(root); - result[0] = Integer.valueOf(node.attribute("x").getValue()).intValue(); - result[1] = Integer.valueOf(node.attribute("y").getValue()).intValue(); - result[2] = Integer.valueOf(node.attribute("width").getValue()).intValue(); - result[3] = Integer.valueOf(node.attribute("height").getValue()).intValue(); - return result; - } - - private int[] extractImageDimension(Element root) { - int[] result = new int[2]; - result[0] = Integer.valueOf(root.attribute("width").getValue()).intValue(); - result[1] = Integer.valueOf(root.attribute("height").getValue()).intValue(); - return result; - } - - private void initialize() { - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - if (this.taskInstanceId > 0) { - TaskInstance taskInstance = jbpmContext.getTaskMgmtSession().loadTaskInstance(taskInstanceId); - currentToken = taskInstance.getToken(); - } - else - { - if (this.tokenInstanceId > 0) - currentToken = jbpmContext.getGraphSession().loadToken(this.tokenInstanceId); - } - processDefinition = currentToken.getProcessInstance().getProcessDefinition(); - } - - private void walkTokens(Token parent, List allTokens) - { - Map children = parent.getChildren(); - if(children != null && children.size() > 0) - { - Collection childTokens = children.values(); - for (Iterator iterator = childTokens.iterator(); iterator.hasNext();) - { - Token child = (Token) iterator.next(); - walkTokens(child, allTokens); - } - } - - allTokens.add(parent); - } - - public void setTask(long id) { - this.taskInstanceId = id; - } - - public void setToken(long id) { - this.tokenInstanceId = id; - } - -} +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.alfresco.web.ui.repo.tag; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.tagext.TagSupport; + +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.dom4j.XPath; +import org.dom4j.xpath.DefaultXPath; +import org.jbpm.JbpmContext; +import org.jbpm.file.def.FileDefinition; +import org.jbpm.graph.def.ProcessDefinition; +import org.jbpm.graph.exe.Token; +import org.jbpm.taskmgmt.exe.TaskInstance; + + +// +// +// TODO: DC - Tidy up +// +// + + + + +public class JBPMProcessImageTag extends TagSupport { + + private static final long serialVersionUID = 1L; + private long taskInstanceId = -1; + private long tokenInstanceId = -1; + + private byte[] gpdBytes = null; + private byte[] imageBytes = null; + private Token currentToken = null; + private ProcessDefinition processDefinition = null; + + static String currentTokenColor = "red"; + static String childTokenColor = "blue"; + static String tokenNameColor = "blue"; + + + public void release() { + taskInstanceId = -1; + gpdBytes = null; + imageBytes = null; + currentToken = null; + } + + public int doEndTag() throws JspException { + try { + initialize(); + retrieveByteArrays(); + if (gpdBytes != null && imageBytes != null) { + writeTable(); + } + } catch (IOException e) { + e.printStackTrace(); + throw new JspException("table couldn't be displayed", e); + } catch (DocumentException e) { + e.printStackTrace(); + throw new JspException("table couldn't be displayed", e); + } + release(); + return EVAL_PAGE; + } + + private void retrieveByteArrays() { + try { + FileDefinition fileDefinition = processDefinition.getFileDefinition(); + gpdBytes = fileDefinition.getBytes("gpd.xml"); + imageBytes = fileDefinition.getBytes("processimage.jpg"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void writeTable() throws IOException, DocumentException { + + int borderWidth = 4; + Element rootDiagramElement = DocumentHelper.parseText(new String(gpdBytes)).getRootElement(); + int[] boxConstraint; + int[] imageDimension = extractImageDimension(rootDiagramElement); + String imageLink = "/alfresco/processimage?definitionId=" + processDefinition.getId(); + JspWriter jspOut = pageContext.getOut(); + + if (tokenInstanceId > 0) { + + List allTokens = new ArrayList(); + walkTokens(currentToken, allTokens); + + jspOut.println("
"); + + for (int i = 0; i < allTokens.size(); i++) + { + Token token = (Token) allTokens.get(i); + + //check how many tokens are on teh same level (= having the same parent) + int offset = i; + if(i > 0) { + while(offset > 0 && ((Token) allTokens.get(offset - 1)).getParent().equals(token.getParent())) { + offset--; + } + } + boxConstraint = extractBoxConstraint(rootDiagramElement, token); + + //Adjust for borders + //boxConstraint[2]-=borderWidth*2; + //boxConstraint[3]-=borderWidth*2; + + jspOut.println("
"); + + if(token.getName()!=null) + { + jspOut.println(" " + token.getName() +""); + } + + jspOut.println("
"); + } + jspOut.println("
"); + } + else + { + boxConstraint = extractBoxConstraint(rootDiagramElement); + + jspOut.println(""); + jspOut.println(" "); + jspOut.println(" "); + jspOut.println(" "); + jspOut.println("
"); + jspOut.println(" "); + jspOut.println(" "); + jspOut.println(" "); + jspOut.println(" "); + jspOut.println(" "); + jspOut.println(" "); + jspOut.println(" "); + jspOut.println(" "); + jspOut.println("
 
"); + jspOut.println("
"); + } + } + + private int[] extractBoxConstraint(Element root) { + int[] result = new int[4]; + String nodeName = currentToken.getNode().getName(); + XPath xPath = new DefaultXPath("//node[@name='" + nodeName + "']"); + Element node = (Element) xPath.selectSingleNode(root); + result[0] = Integer.valueOf(node.attribute("x").getValue()).intValue(); + result[1] = Integer.valueOf(node.attribute("y").getValue()).intValue(); + result[2] = Integer.valueOf(node.attribute("width").getValue()).intValue(); + result[3] = Integer.valueOf(node.attribute("height").getValue()).intValue(); + return result; + } + + private int[] extractBoxConstraint(Element root, Token token) { + int[] result = new int[4]; + String nodeName = token.getNode().getName(); + XPath xPath = new DefaultXPath("//node[@name='" + nodeName + "']"); + Element node = (Element) xPath.selectSingleNode(root); + result[0] = Integer.valueOf(node.attribute("x").getValue()).intValue(); + result[1] = Integer.valueOf(node.attribute("y").getValue()).intValue(); + result[2] = Integer.valueOf(node.attribute("width").getValue()).intValue(); + result[3] = Integer.valueOf(node.attribute("height").getValue()).intValue(); + return result; + } + + private int[] extractImageDimension(Element root) { + int[] result = new int[2]; + result[0] = Integer.valueOf(root.attribute("width").getValue()).intValue(); + result[1] = Integer.valueOf(root.attribute("height").getValue()).intValue(); + return result; + } + + private void initialize() { + JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); + if (this.taskInstanceId > 0) { + TaskInstance taskInstance = jbpmContext.getTaskMgmtSession().loadTaskInstance(taskInstanceId); + currentToken = taskInstance.getToken(); + } + else + { + if (this.tokenInstanceId > 0) + currentToken = jbpmContext.getGraphSession().loadToken(this.tokenInstanceId); + } + processDefinition = currentToken.getProcessInstance().getProcessDefinition(); + } + + private void walkTokens(Token parent, List allTokens) + { + Map children = parent.getChildren(); + if(children != null && children.size() > 0) + { + Collection childTokens = children.values(); + for (Iterator iterator = childTokens.iterator(); iterator.hasNext();) + { + Token child = (Token) iterator.next(); + walkTokens(child, allTokens); + } + } + + allTokens.add(parent); + } + + public void setTask(long id) { + this.taskInstanceId = id; + } + + public void setToken(long id) { + this.tokenInstanceId = id; + } + +} diff --git a/source/java/org/jbpm/webapp/bean/AdminBean.java b/source/java/org/jbpm/webapp/bean/AdminBean.java deleted file mode 100644 index e35540f3b7..0000000000 --- a/source/java/org/jbpm/webapp/bean/AdminBean.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -import java.util.List; - -import javax.faces.context.FacesContext; - -import org.jbpm.scheduler.impl.Scheduler; - -public class AdminBean { - - String deployUrl; - - public void deployProcess() { - } - - public void createSchema() { - } - - public void dropSchema() { - } - - public boolean isSchedulerRunning() { - return getScheduler().isRunning(); - } - - public List getSchedulerHistoryLogs() { - return getScheduler().getSchedulerHistoryLogs(); - } - - private Scheduler getScheduler() { - return (Scheduler) FacesContext.getCurrentInstance() - .getExternalContext() - .getApplicationMap() - .get("scheduler"); - } - - public String getDeployUrl() { - return deployUrl; - } - public void setDeployUrl(String deployUrl) { - this.deployUrl = deployUrl; - } -} diff --git a/source/java/org/jbpm/webapp/bean/AlfrescoUserBean.java b/source/java/org/jbpm/webapp/bean/AlfrescoUserBean.java deleted file mode 100644 index 12b682a8ca..0000000000 --- a/source/java/org/jbpm/webapp/bean/AlfrescoUserBean.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jbpm.webapp.bean; - -import org.alfresco.service.cmr.security.AuthenticationService; - -public class AlfrescoUserBean extends UserBean -{ - AuthenticationService authService; - - - public void setAuthenticationService(AuthenticationService authService) - { - this.authService = authService; - } - - - @Override - public String getUserName() - { - return authService.getCurrentUserName(); - } - -} diff --git a/source/java/org/jbpm/webapp/bean/FormParameter.java b/source/java/org/jbpm/webapp/bean/FormParameter.java deleted file mode 100644 index 61ee3eb221..0000000000 --- a/source/java/org/jbpm/webapp/bean/FormParameter.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -import org.jbpm.context.def.VariableAccess; - -public class FormParameter { - - private String value = null; - private VariableAccess variableAccess = null; - - public FormParameter(String value, VariableAccess variableAccess) { - this.value = value; - this.variableAccess = variableAccess; - } - - public String getValue() { - return value; - } - public VariableAccess getVariableAccess() { - return variableAccess; - } -} diff --git a/source/java/org/jbpm/webapp/bean/HomeBean.java b/source/java/org/jbpm/webapp/bean/HomeBean.java deleted file mode 100644 index 36fedc939c..0000000000 --- a/source/java/org/jbpm/webapp/bean/HomeBean.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -import java.util.List; - -import javax.faces.event.ActionEvent; -import javax.faces.model.DataModel; -import javax.faces.model.ListDataModel; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.jbpm.JbpmConfiguration; -import org.jbpm.JbpmContext; -import org.jbpm.db.GraphSession; -import org.jbpm.db.TaskMgmtSession; -import org.jbpm.graph.def.ProcessDefinition; -import org.jbpm.graph.def.Transition; -import org.jbpm.graph.exe.ProcessInstance; -import org.jbpm.taskmgmt.def.Task; -import org.jbpm.taskmgmt.exe.TaskInstance; - -public class HomeBean { - - UserBean userBean; - TaskBean taskBean; - JbpmConfiguration config; - DataModel taskInstances; - DataModel processDefs; - - - public HomeBean() - { - } - - public void setJbpmConfiguration(JbpmConfiguration config) - { - this.config = config; - } - - public List getTaskInstances() - { - JbpmContext xjbpmContext = config.getCurrentJbpmContext(); - JbpmContext jbpmContext = (xjbpmContext == null) ? config.createJbpmContext() : xjbpmContext; - - try - { - TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession(); - List taskInstances = taskMgmtSession.findTaskInstances(userBean.getUserName()); - for (TaskInstance taskInstance : taskInstances) - { - taskInstance.getName(); - taskInstance.getTaskMgmtInstance().getTaskMgmtDefinition().getProcessDefinition().getName(); - } - return taskInstances; - } - finally - { - if (xjbpmContext == null) jbpmContext.close(); - } - } - - public DataModel getTaskInstancesModel() - { - if (taskInstances == null) - { - taskInstances = new ListDataModel(getTaskInstances()); - } - return taskInstances; - } - - public List getLatestProcessDefinitions() - { - JbpmContext xjbpmContext = config.getCurrentJbpmContext(); - JbpmContext jbpmContext = (xjbpmContext == null) ? config.createJbpmContext() : xjbpmContext; - try - { - GraphSession graphSession = jbpmContext.getGraphSession(); - List procDefs = graphSession.findLatestProcessDefinitions(); - for (ProcessDefinition procDef : procDefs) - { - procDef.getName(); - Task startTask = procDef.getTaskMgmtDefinition().getStartTask(); - if (startTask != null) - { - startTask.getName(); - } - } - return procDefs; - } - finally - { - if (xjbpmContext == null) jbpmContext.close(); - } - } - - public DataModel getLatestProcessDefinitionsModel() - { - if (processDefs == null) - { - processDefs = new ListDataModel(getLatestProcessDefinitions()); - } - return processDefs; - } - - /** - * selects a task. - */ - public String selectTaskInstance() - { - JbpmContext xjbpmContext = config.getCurrentJbpmContext(); - JbpmContext jbpmContext = (xjbpmContext == null) ? config.createJbpmContext() : xjbpmContext; - - try - { - // Get the task instance id from request parameter - TaskInstance selectedTask = (TaskInstance)taskInstances.getRowData(); - long taskInstanceId = selectedTask.getId(); - TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession(); - TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(taskInstanceId); - taskBean.initialize(taskInstance); - - return "task"; - } - finally - { - taskInstances = null; - processDefs = null; - if (xjbpmContext == null ) jbpmContext.close(); - } - } - - /** - * prepares a task form for starting a new process instance. - */ - public String startProcessInstance() - { - JbpmContext xjbpmContext = config.getCurrentJbpmContext(); - JbpmContext jbpmContext = (xjbpmContext == null) ? config.createJbpmContext() : xjbpmContext; - try - { - jbpmContext.setActorId(AuthenticationUtil.getCurrentUserName()); - - // Get the task instance id from request parameter - ProcessDefinition selectedProc = (ProcessDefinition)processDefs.getRowData(); - long processDefinitionId = selectedProc.getId(); - GraphSession graphSession = jbpmContext.getGraphSession(); - ProcessDefinition processDefinition = graphSession.loadProcessDefinition(processDefinitionId); - - // create a new process instance to run - ProcessInstance processInstance = new ProcessInstance(processDefinition); - - // create a new taskinstance for the start task - Task startTask = processInstance.getTaskMgmtInstance().getTaskMgmtDefinition().getStartTask(); - if (startTask != null) - { - TaskInstance taskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance(); - taskBean.initialize(taskInstance); - } - - // Save the process instance along with the task instance - jbpmContext.save(processInstance); - - // Fill the task backing bean with useful information - return (startTask == null) ? "home" : "task"; - } - finally - { - if (xjbpmContext == null) jbpmContext.close(); - taskInstances = null; - processDefs = null; - } - } - - public UserBean getUserBean() { - return userBean; - } - public void setUserBean(UserBean userBean) { - this.userBean = userBean; - } - public TaskBean getTaskBean() { - return taskBean; - } - public void setTaskBean(TaskBean taskBean) { - this.taskBean = taskBean; - } -} diff --git a/source/java/org/jbpm/webapp/bean/JsfHelper.java b/source/java/org/jbpm/webapp/bean/JsfHelper.java deleted file mode 100644 index 1d287d1b2b..0000000000 --- a/source/java/org/jbpm/webapp/bean/JsfHelper.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; - -public class JsfHelper { - - public static long getId(String parameterName) { - long value = -1; - String valueText = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(parameterName); - try { - Long id = new Long(valueText); - value = id.longValue(); - } catch (NumberFormatException e) { - throw new RuntimeException("couldn't parse '"+parameterName+"'='"+valueText+"' as a long"); - } - return value; - } - - public static void addMessage(String msg) { - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(msg)); - } - - public static void setSessionAttribute(String key, Object value) { - FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(key, value); - } - - public static Object getSessionAttribute(String key) { - return FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(key); - } - - public static void removeSessionAttribute(String key) { - FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove(key); - } - - public static String getParameter(String name) { - return (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(name); - } - // private static final Log log = LogFactory.getLog(JsfHelper.class); -} diff --git a/source/java/org/jbpm/webapp/bean/MonitoringBean.java b/source/java/org/jbpm/webapp/bean/MonitoringBean.java deleted file mode 100644 index 2d1d254883..0000000000 --- a/source/java/org/jbpm/webapp/bean/MonitoringBean.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; - -import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; - -import org.jbpm.JbpmContext; -import org.jbpm.graph.def.ProcessDefinition; - - -/** - * Monitoring Bean Implementation. - * - * @author David Loiseau - */ - -public class MonitoringBean { - - long processInstanceId; - String message; - String variableName; - String variableValue; - String variableNameOperator; - String variableValueOperator; - ArrayList processInstances; - - public String showProcessDefinitions() { - return "processDefinitions"; - } - - public List getProcessDefinitions() { - - ArrayList processDefinitionsList = new ArrayList(); - - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - List processDefinitions = jbpmContext.getGraphSession().findAllProcessDefinitions(); - - if (processDefinitions.isEmpty() == false) { - ListIterator listProcessDefinitions = processDefinitions.listIterator(); - while (listProcessDefinitions.hasNext() ) { - ProcessDefinition processDefinition = (ProcessDefinition)listProcessDefinitions.next(); - - int instancesCount = 0; - try { - Connection connection = jbpmContext.getConnection(); - Statement statement = connection.createStatement(); - - String request = "SELECT COUNT(*) AS instancesCount " - + "FROM jbpm_processinstance " - + "WHERE processdefinition_='" - + processDefinition.getId() + "'"; - ResultSet resultSet = statement.executeQuery(request); - resultSet.next(); - instancesCount = resultSet.getInt("instancesCount"); - } - catch (Exception e) {} - - processDefinitionsList.add( - new ProcessDefinitionBean( - processDefinition.getId(), - processDefinition.getName(), - processDefinition.getVersion(), - instancesCount - )); - } - } - - return(processDefinitionsList); - } - - public String inspectInstance() { - try { - ProcessInstanceBean processInstanceBean = new ProcessInstanceBean(this.processInstanceId); - FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("processInstanceBean", processInstanceBean); - this.message = ""; - return "inspectInstance"; - } - catch (Exception exception) { - this.message = "Error for process instance " + this.processInstanceId; - return ""; - } - } - - public String showSearchInstances() { - return("showSearchInstances"); - } - - public String searchInstances() { - - long count = 0; - - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - - try { - Connection connection = jbpmContext.getConnection(); - Statement statement = connection.createStatement(); - statement.setMaxRows(100); - - String request = "SELECT DISTINCT processinstance_, name_, stringvalue_ FROM jbpm_variableinstance " - + "WHERE name_ " - + this.variableNameOperator + " '" - + variableName + "' AND stringvalue_ " - + this.variableValueOperator + " '" + variableValue + "'"; - - ResultSet resultSet = statement.executeQuery(request); - - processInstances = new ArrayList(); - - while (resultSet.next()) { - processInstances.add(new ProcessInstanceBean( - resultSet.getLong("processinstance_"), - resultSet.getString("name_"), - resultSet.getString("stringvalue_"))); - count++; - } - statement.close(); - } - catch (Exception e) { - this.message = "Search error " + e.getMessage(); - } - - if (count == 1) { - ProcessInstanceBean processInstanceBean = (ProcessInstanceBean)processInstances.iterator().next(); - FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("processInstanceBean", processInstanceBean); - return("inspectInstance"); - } - return ""; - } - - public List getOperatorsList (){ - - ArrayList operatorsList = new ArrayList(); - - SelectItem item = new SelectItem("=", "is equal to"); - operatorsList.add(item); - item = new SelectItem("like", "is like"); - operatorsList.add(item); - return operatorsList; - - } - - public long getProcessInstanceId() { - return processInstanceId; - } - - public void setProcessInstanceId(long processInstanceId) { - this.processInstanceId = processInstanceId; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean isShowProcessInstances() { - if (processInstances == null) return false; - if (processInstances.size() == 0) return false; - return true; - } - - public ArrayList getProcessInstances() { - return processInstances; - } - - public String getVariableName() { - return variableName; - } - - public void setVariableName(String variableName) { - this.variableName = variableName; - } - - public String getVariableValue() { - return variableValue; - } - - public void setVariableValue(String variableValue) { - this.variableValue = variableValue; - } - - public String getVariableNameOperator() { - return variableNameOperator; - } - - public void setVariableNameOperator(String variableNameOperator) { - this.variableNameOperator = variableNameOperator; - } - - public String getVariableValueOperator() { - return variableValueOperator; - } - - public void setVariableValueOperator(String variableValueOperator) { - this.variableValueOperator = variableValueOperator; - } - - -} diff --git a/source/java/org/jbpm/webapp/bean/ProcessDefinitionBean.java b/source/java/org/jbpm/webapp/bean/ProcessDefinitionBean.java deleted file mode 100644 index e78fa6fe09..0000000000 --- a/source/java/org/jbpm/webapp/bean/ProcessDefinitionBean.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; - -import javax.faces.context.FacesContext; - -import org.jbpm.JbpmContext; -import org.jbpm.db.GraphSession; -import org.jbpm.graph.def.ProcessDefinition; -import org.jbpm.graph.exe.ProcessInstance; - -/** - * Process Definition Bean Implementation. - * - * @author David Loiseau - */ - -public class ProcessDefinitionBean { - - String name; - int version; - long id; - int instancesCount; - - public ProcessDefinitionBean() { - } - - public ProcessDefinitionBean(long id) { - this.id = id; - initialize(); - } - - public ProcessDefinitionBean(long id, String name, int version, int instancesCount) { - this.id = id; - this.name = name; - this.version = version; - this.instancesCount = instancesCount; - } - - private void initialize() { - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - GraphSession graphSession = jbpmContext.getGraphSession(); - ProcessDefinition processDefinition = graphSession.loadProcessDefinition(id); - this.name = processDefinition.getName(); - this.version = processDefinition.getVersion(); - this.instancesCount = graphSession.findProcessInstances(this.id).size(); - } - - public List getProcessInstances() { - - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - GraphSession graphSession = jbpmContext.getGraphSession(); - - ArrayList processInstancesList = new ArrayList(); - - List listProcessInstance = graphSession.findProcessInstances(this.id); - - if (listProcessInstance.isEmpty() == false) { - ListIterator listProcessInstances = listProcessInstance.listIterator(); - while (listProcessInstances.hasNext()) { - ProcessInstance processInstance = (ProcessInstance) listProcessInstances.next(); - - processInstancesList.add(new ProcessInstanceBean(processInstance.getId(), processInstance.getStart(), processInstance.getEnd())); - } - } - - return processInstancesList; - } - - public String showProcessInstances() { - ProcessDefinitionBean processDefinitionBean = new ProcessDefinitionBean(); - processDefinitionBean.setId(this.id); - FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("processDefinitionBean", processDefinitionBean); - return ("processInstances"); - } - - public String startProcessInstance() { - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - GraphSession graphSession = jbpmContext.getGraphSession(); - ProcessDefinition processDefinition = graphSession.loadProcessDefinition(getId()); - processDefinition.createInstance(); - return showProcessInstances(); - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - this.initialize(); - } - - public int getInstancesCount() { - return instancesCount; - } - - public void setInstancesCount(int instancesCount) { - this.instancesCount = instancesCount; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getVersion() { - return version; - } - - public void setVersion(int version) { - this.version = version; - } - -} diff --git a/source/java/org/jbpm/webapp/bean/ProcessInstanceBean.java b/source/java/org/jbpm/webapp/bean/ProcessInstanceBean.java deleted file mode 100644 index 334eeb64c7..0000000000 --- a/source/java/org/jbpm/webapp/bean/ProcessInstanceBean.java +++ /dev/null @@ -1,420 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.Map.Entry; - -import javax.faces.context.FacesContext; - -import org.jbpm.JbpmContext; -import org.jbpm.db.GraphSession; -import org.jbpm.db.TaskMgmtSession; -import org.jbpm.graph.def.Transition; -import org.jbpm.graph.exe.ProcessInstance; -import org.jbpm.graph.exe.Token; -import org.jbpm.taskmgmt.exe.TaskInstance; - -/** - * Process Instance Bean Implementation. - * - * @author David Loiseau - */ - -public class ProcessInstanceBean { - - long id; - String processDefinitionLabel; - long processDefinitionId; - Date start; - Date end; - - ArrayList tokens; - ArrayList variables; - ArrayList tasks; - ArrayList transitions; - - String variableName; - String variableValue; - - long tokenInstanceId; - long taskInstanceId; - - public ProcessInstanceBean(long id, Date start, Date end) { - this.id = id; - this.start = start; - this.end = end; - } - - public ProcessInstanceBean(long id) { - this.id = id; - this.initialize(); - } - - public ProcessInstanceBean(long id, String variableName, String variableValue) { - this.id = id; - this.variableName = variableName; - this.variableValue = variableValue; - this.initialize(); - } - - public String inspectProcessInstance() { - ProcessInstanceBean processInstanceBean = new ProcessInstanceBean(this.id); - FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("processInstanceBean", processInstanceBean); - return ("inspectInstance"); - } - - public String deleteProcessInstance() { - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - GraphSession graphSession = jbpmContext.getGraphSession(); - graphSession.deleteProcessInstance(this.id); - return ("deleteInstance"); - } - - private void initialize() { - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - GraphSession graphSession = jbpmContext.getGraphSession(); - ProcessInstance processInstance = graphSession.loadProcessInstance(this.id); - this.start = processInstance.getStart(); - this.end = processInstance.getEnd(); - this.processDefinitionId = processInstance.getProcessDefinition().getId(); - this.processDefinitionLabel = processInstance.getProcessDefinition().getName() + " (version " + processInstance.getProcessDefinition().getVersion() + ")"; - - initializeVariablesList(processInstance); - initializeTokensList(processInstance); - initializeTasksList(processInstance); - } - - private void initializeAvailableTransitions(TaskInstance taskInstance) { - - transitions = new ArrayList(); - - if (taskInstance.getAvailableTransitions().isEmpty() == false) { - Iterator availableTransitionsIterator = taskInstance.getAvailableTransitions().iterator(); - while (availableTransitionsIterator.hasNext()) { - Transition transition = (Transition) availableTransitionsIterator.next(); - transitions.add(transition); - - } - } - } - - private void initializeAvailableTransitions(Token token) { - - transitions = new ArrayList(); - - if (token.getNode().getLeavingTransitions().isEmpty() == false) { - Iterator availableTransitionsIterator = token.getNode().getLeavingTransitions().iterator(); - while (availableTransitionsIterator.hasNext()) { - Transition transition = (Transition) availableTransitionsIterator.next(); - transitions.add(transition); - - } - } - } - - private void initializeVariablesList(ProcessInstance processInstance) { - - // Variables list - variables = new ArrayList(); - - if (processInstance.getContextInstance().getVariables() != null && !processInstance.getContextInstance().getVariables().values().isEmpty()) { - int mapsize = processInstance.getContextInstance().getVariables().size(); - Iterator variablesIterator = processInstance.getContextInstance().getVariables().entrySet().iterator(); - for (int i = 0; i < mapsize; i++) { - Entry entry = (Entry) variablesIterator.next(); - variables.add(new VariableBean((String) entry.getKey(), entry.getValue())); - } - } - - } - - private void initializeTasksList(ProcessInstance processInstance) { - - // Tasks list - tasks = new ArrayList(); - if (processInstance.getTaskMgmtInstance().getTaskInstances().isEmpty() == false) { - Iterator tasksIterator = processInstance.getTaskMgmtInstance().getTaskInstances().iterator(); - while (tasksIterator.hasNext()) { - TaskInstance taskInstance = (TaskInstance) tasksIterator.next(); - tasks.add(new TaskBean(taskInstance.getId(), taskInstance.getName(), taskInstance.getActorId(), taskInstance.getEnd())); - } - } - - } - - private void initializeTokensList(ProcessInstance processInstance) { - - // Tokens list - Token rootToken = processInstance.getRootToken(); - - tokens = new ArrayList(); - this.tokenInstanceId = rootToken.getId(); - this.taskInstanceId = 0; - tokens.add(new TokenBean(rootToken.getId(), "Root", rootToken.getNode().getName(), rootToken.getNode().getClass().getName(), rootToken.getStart(), - rootToken.getEnd(), 1)); - try { - if (rootToken.getChildren().isEmpty() == false) { - AddChildrenTokensToTokensList(this.tokens, rootToken, 2); - } - } catch (Exception exception) { - } - - } - - /** - * - * Add token childs to the current token beans list - * - * @param tokensList - * Current token list to update - * @param token - * Token where are the token childs - * @param level - * Level where is the token: 1 for the root token, 2 for the childs - * of the root token, ... - */ - private void AddChildrenTokensToTokensList(ArrayList tokensList, Token token, long level) { - - Iterator childrenIterator = token.getChildren().values().iterator(); - while (childrenIterator.hasNext()) { - Token childToken = (Token) childrenIterator.next(); - tokensList.add(new TokenBean(childToken.getId(), childToken.getName(), childToken.getNode().getName(), childToken.getNode().getClass().getName(), - childToken.getStart(), childToken.getEnd(), level)); - try { - if (childToken.getChildren().isEmpty() == false) { - AddChildrenTokensToTokensList(tokensList, childToken, level + 1); - } - } catch (Exception exception) { - } - } - } - - public String updateVariable() { - - if (this.variableName != null) { - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - GraphSession graphSession = jbpmContext.getGraphSession(); - ProcessInstance processInstance = graphSession.loadProcessInstance(this.id); - if (this.variableValue != null) { - processInstance.getContextInstance().setVariable(this.variableName, this.variableValue); - } else { - processInstance.getContextInstance().deleteVariable(this.variableName); - } - initializeVariablesList(processInstance); - } - return "inspectInstance"; - } - - public String selectToken() { - this.taskInstanceId = 0; - this.tokenInstanceId = JsfHelper.getId("tokenInstanceId"); - return ""; - } - - public String selectTask() { - this.tokenInstanceId = 0; - this.taskInstanceId = JsfHelper.getId("taskInstanceId"); - return ""; - } - - public String signal() { - - selectToken(); - - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - GraphSession graphSession = jbpmContext.getGraphSession(); - - Token token = graphSession.loadToken(this.tokenInstanceId); - - if (token.getNode().getLeavingTransitions().size() > 1) { - initializeAvailableTransitions(token); - return "showTransitions"; - } - - token.signal(); - - this.initializeTokensList(token.getProcessInstance()); - - return "inspectInstance"; - } - - public String selectTransition() { - String transitionName; - - transitionName = JsfHelper.getParameter("transitionName"); - ProcessInstance processInstance = null; - - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - if (this.taskInstanceId > 0) { - TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession(); - TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(this.taskInstanceId); - if (transitionName.equals("")) { - taskInstance.end(); - } else { - taskInstance.end(transitionName); - } - processInstance = taskInstance.getToken().getProcessInstance(); - } else if (this.tokenInstanceId > 0) { - GraphSession graphSession = jbpmContext.getGraphSession(); - Token token = graphSession.loadToken(this.tokenInstanceId); - if (transitionName.equals("")) { - token.signal(); - } else { - token.signal(transitionName); - } - processInstance = token.getProcessInstance(); - } - - jbpmContext.save(processInstance); - - this.initializeTasksList(processInstance); - this.initializeTokensList(processInstance); - - return "inspectInstance"; - } - - public String endTask() { - - selectTask(); - - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession(); - - TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(this.taskInstanceId); - - if (taskInstance.getAvailableTransitions().size() > 1) { - initializeAvailableTransitions(taskInstance); - return "showTransitions"; - } - - taskInstance.end(); - - ProcessInstance processInstance = taskInstance.getToken().getProcessInstance(); - jbpmContext.save(processInstance); - - this.initializeTasksList(processInstance); - this.initializeTokensList(processInstance); - - return "inspectInstance"; - } - - // Show all the process instances for a given process definition ID - public String showProcessInstances() { - ProcessDefinitionBean processDefinitionBean = new ProcessDefinitionBean(this.processDefinitionId); - FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("processDefinitionBean", processDefinitionBean); - return ("processInstances"); - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public Date getStart() { - return start; - } - - public void setStart(Date start) { - this.start = start; - } - - public Date getEnd() { - return end; - } - - public void setEnd(Date end) { - this.end = end; - } - - public ArrayList getTokens() { - return tokens; - } - - public void setTokens(ArrayList tokens) { - this.tokens = tokens; - } - - public String getProcessDefinitionLabel() { - return processDefinitionLabel; - } - - public void setProcessDefinitionLabel(String processDefinitionLabel) { - this.processDefinitionLabel = processDefinitionLabel; - } - - public ArrayList getVariables() { - return variables; - } - - public ArrayList getTasks() { - return tasks; - } - - public ArrayList getTransitions() { - return transitions; - } - - public void setVariables(ArrayList variables) { - this.variables = variables; - } - - public String getVariableName() { - return variableName; - } - - public void setVariableName(String variableName) { - this.variableName = variableName; - } - - public String getVariableValue() { - return variableValue; - } - - public void setVariableValue(String variableValue) { - this.variableValue = variableValue; - } - - public long getTokenInstanceId() { - return tokenInstanceId; - } - - public void setTokenInstanceId(long tokenInstanceId) { - this.taskInstanceId = 0; - this.tokenInstanceId = tokenInstanceId; - } - - public long getTaskInstanceId() { - return taskInstanceId; - } - - public void setTaskInstanceId(long taskInstanceId) { - this.tokenInstanceId = 0; - this.taskInstanceId = taskInstanceId; - } - -} diff --git a/source/java/org/jbpm/webapp/bean/TaskBean.java b/source/java/org/jbpm/webapp/bean/TaskBean.java deleted file mode 100644 index dba4ffbe5f..0000000000 --- a/source/java/org/jbpm/webapp/bean/TaskBean.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import javax.faces.model.DataModel; -import javax.faces.model.ListDataModel; -import javax.faces.model.SelectItem; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jbpm.JbpmContext; -import org.jbpm.context.def.VariableAccess; -import org.jbpm.graph.def.Transition; -import org.jbpm.graph.exe.ProcessInstance; -import org.jbpm.logging.exe.LoggingInstance; -import org.jbpm.taskmgmt.def.TaskController; -import org.jbpm.taskmgmt.exe.TaskInstance; -import org.jbpm.taskmgmt.log.TaskAssignLog; - -public class TaskBean { - - UserBean userBean = null; - List taskFormParameters; - List availableTransitions; - List availableTransitionItems; - TaskInstance taskInstance; - long taskInstanceId; - DataModel transitions; - -// JbpmContext jbpmContext; -// GraphSession graphSession; -// TaskMgmtSession taskMgmtSession; - - // For monitoring purposes - String name; - String actorId; - Date end; - - public TaskBean() { -// this.jbpmContext = JbpmContext.getCurrentJbpmContext(); -// this.graphSession = jbpmContext.getGraphSession(); -// this.taskMgmtSession = jbpmContext.getTaskMgmtSession(); - - // get the parameters from the session -// this.taskFormParameters = (List) JsfHelper.getSessionAttribute("taskFormParameters"); - } - - public TaskBean(long taskInstanceId, String name, String actorId, Date end) { - this.taskInstanceId = taskInstanceId; - this.name = name; - this.actorId = actorId; - this.end = end; - } - - public void initialize(TaskInstance taskInstance) { - this.taskInstance = taskInstance; - this.taskInstanceId = taskInstance.getId(); - - // set the parameters - this.taskFormParameters = new ArrayList(); - TaskController taskController = taskInstance.getTask().getTaskController(); - if (taskController!=null) { - List variableAccesses = taskController.getVariableAccesses(); - Iterator iter = variableAccesses.iterator(); - while (iter.hasNext()) { - VariableAccess variableAccess = (VariableAccess) iter.next(); - String mappedName = variableAccess.getMappedName(); - Object value = taskInstance.getVariable(mappedName); - TaskFormParameter tfp = new TaskFormParameter(variableAccess, value); - taskFormParameters.add(tfp); - } - } - - // store the parameters in the session - //JsfHelper.setSessionAttribute("taskFormParameters", taskFormParameters); - - // get the available transitions - availableTransitions = null; - - availableTransitions = taskInstance.getAvailableTransitions(); - if ((availableTransitions != null) && (availableTransitions.size() <= 1)) { - transitions = null; - availableTransitions = null; - availableTransitionItems = null; - } else { - transitions = new ListDataModel(availableTransitions); - availableTransitionItems = new ArrayList(); - Iterator iter = availableTransitions.iterator(); - while (iter.hasNext()) { - Transition transition = (Transition) iter.next(); - SelectItem transitionItem = new SelectItem(); - transitionItem.setValue(transition.getName()); - transitionItem.setLabel(transition.getName()); - transitionItem.setDisabled(false); - availableTransitionItems.add(transitionItem); - } - } - - log.debug("initialized availableTransitions " + availableTransitions); - } - - public String save() { - log.debug("saving the task parameters " + taskFormParameters); - - // submit the parameters in the jbpm task controller - TaskInstance taskInstance = JbpmContext.getCurrentJbpmContext().getTaskMgmtSession().loadTaskInstance(taskInstanceId); - - // collect the parameter values from the values that were updated in the - // parameters by jsf. - Iterator iter = taskFormParameters.iterator(); - while (iter.hasNext()) { - TaskFormParameter taskFormParameter = (TaskFormParameter) iter.next(); - - if ((taskFormParameter.isWritable()) && (taskFormParameter.getValue() != null)) { - log.debug("submitting [" + taskFormParameter.getLabel() + "]=" + taskFormParameter.getValue()); - taskInstance.setVariable(taskFormParameter.getLabel(), taskFormParameter.getValue()); - } else { - log.debug("ignoring unwritable [" + taskFormParameter.getLabel() + "]"); - } - } - - // save the process instance and hence the updated task instance variables - JbpmContext.getCurrentJbpmContext().save(taskInstance); - - // remove the parameters from the session - //JsfHelper.removeSessionAttribute("taskFormParameters"); - - return "home"; - } - - public String saveAndClose() { - // save - save(); - - TaskInstance taskInstance = JbpmContext.getCurrentJbpmContext().getTaskMgmtSession().loadTaskInstance(taskInstanceId); - - // close the task instance - if (transitions == null) - { - taskInstance.end(); - } - else - { - Transition selectedTransition = (Transition)transitions.getRowData(); - taskInstance.end(selectedTransition.getName()); - } - - ProcessInstance processInstance = taskInstance.getTaskMgmtInstance().getProcessInstance(); - if (processInstance.hasEnded()) { - JsfHelper.addMessage("The process has finished."); - } - - LoggingInstance loggingInstance = processInstance.getLoggingInstance(); - List assignmentLogs = loggingInstance.getLogs(TaskAssignLog.class); - - log.debug("assignmentlogs: " + assignmentLogs); - - if (assignmentLogs.size() == 1) { - TaskAssignLog taskAssignLog = (TaskAssignLog) assignmentLogs.get(0); - JsfHelper.addMessage("A new task has been assigned to '" + taskAssignLog.getTaskNewActorId() + "'"); - - } else if (assignmentLogs.size() > 1) { - String msg = "New tasks have been assigned to: "; - Iterator iter = assignmentLogs.iterator(); - while (iter.hasNext()) { - TaskAssignLog taskAssignLog = (TaskAssignLog) iter.next(); - msg += taskAssignLog.getActorId(); - if (iter.hasNext()) - msg += ", "; - } - msg += "."; - JsfHelper.addMessage(msg); - } - - JbpmContext.getCurrentJbpmContext().save(taskInstance); - - return "home"; - } - - public long getTaskInstanceId() { - return taskInstanceId; - } - public void setTaskInstanceId(long taskInstanceId) { - this.taskInstanceId = taskInstanceId; - } - public UserBean getUserBean() { - return userBean; - } - public void setUserBean(UserBean userBean) { - this.userBean = userBean; - } - public List getTaskFormParameters() { - return taskFormParameters; - } - - public DataModel getTransitions() - { - return transitions; - } - - public List getAvailableTransitions() { - return availableTransitions; - } - public void setAvailableTransitions(List availableTransitions) { - this.availableTransitions = availableTransitions; - } - public List getAvailableTransitionItems() { - return availableTransitionItems; - } - public TaskInstance getTaskInstance() { - return taskInstance; - } - - private static final Log log = LogFactory.getLog(TaskBean.class); - - public String getActorId() { - return actorId; - } - - public void setActorId(String actorId) { - this.actorId = actorId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Date getEnd() { - return end; - } - - public void setEnd(Date end) { - this.end = end; - } - - public boolean isEnded() { - if (end == null) - return true; - return false; - } -} diff --git a/source/java/org/jbpm/webapp/bean/TaskFormParameter.java b/source/java/org/jbpm/webapp/bean/TaskFormParameter.java deleted file mode 100644 index c3de976756..0000000000 --- a/source/java/org/jbpm/webapp/bean/TaskFormParameter.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -import java.io.Serializable; - -import org.hibernate.Session; -import org.jbpm.context.def.VariableAccess; -import org.jbpm.taskmgmt.exe.TaskInstance; - -public class TaskFormParameter implements Serializable { - - private static final long serialVersionUID = 1L; - - protected String label = null; - protected String description = null; - protected Object value = null; - protected boolean isReadable = true; - protected boolean isWritable = true; - protected boolean isRequired = true; - - public TaskFormParameter() { - } - - public TaskFormParameter(VariableAccess variableAccess, Object value) { - this.label = variableAccess.getMappedName(); - this.value = value; - this.isReadable = variableAccess.isReadable(); - this.isWritable = variableAccess.isWritable(); - this.isRequired = variableAccess.isRequired(); - } - - public TaskFormParameter(TaskFormParameter other) { - this.label = other.label; - this.description = other.description; - this.value = other.value; - this.isReadable = other.isReadable; - this.isWritable = other.isWritable; - this.isRequired = other.isRequired; - } - - public static TaskFormParameter create(TaskInstance instance, String name, Object value, Session session) { - TaskFormParameter taskFormParameter = null; - return taskFormParameter; - } - - public String toString() { - return "("+label+","+value+")"; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - public boolean isReadable() { - return isReadable; - } - public void setReadable(boolean isReadable) { - this.isReadable = isReadable; - } - public boolean isRequired() { - return isRequired; - } - public void setRequired(boolean isRequired) { - this.isRequired = isRequired; - } - public boolean isWritable() { - return isWritable; - } - public boolean isReadOnly() { - return !isWritable; - } - public void setWritable(boolean isWritable) { - this.isWritable = isWritable; - } - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - public Object getValue() { - return value; - } - public void setValue(Object value) { - this.value = value; - } -} diff --git a/source/java/org/jbpm/webapp/bean/TokenBean.java b/source/java/org/jbpm/webapp/bean/TokenBean.java deleted file mode 100644 index ba85f8c1a0..0000000000 --- a/source/java/org/jbpm/webapp/bean/TokenBean.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -import java.util.Date; - -/** - * Token Bean Implementation. - * - * @author David Loiseau - */ - -public class TokenBean { - - long id; - String name; - String nodeName; - String nodeClassName; - Date start; - Date end; - long level; - - public TokenBean(long id, String name, String nodeName, String nodeClassName, Date start, Date end, long level) { - - this.id = id; - this.name = name; - this.nodeName = nodeName; - this.nodeClassName = nodeClassName; - this.start = start; - this.end = end; - this.level = level; - } - - private String getTypeNameFromClassName(String className) { - String typeName = ""; - if (className.indexOf(".") > 0) { - typeName = className.substring(className.lastIndexOf(".") + 1); - } - return typeName; - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getLabel() { - String label = ""; - int i = 1; - while (i < this.level) { - label = label + "---"; - i++; - } - if (i > 1) - label = label + " "; - label = label + this.name; - - return label; - } - - public String getNodeName() { - return nodeName; - } - - public void setNodeName(String nodeName) { - this.nodeName = nodeName; - } - - public Date getEnd() { - return end; - } - - public void setEnd(Date end) { - this.end = end; - } - - public Date getStart() { - return start; - } - - public void setStart(Date start) { - this.start = start; - } - - public String getNodeType() { - return getTypeNameFromClassName(this.nodeClassName); - } - - public boolean isSignal() { - if (this.end == null) - return true; - return false; - } - -} diff --git a/source/java/org/jbpm/webapp/bean/UserBean.java b/source/java/org/jbpm/webapp/bean/UserBean.java deleted file mode 100644 index f5ecd333e7..0000000000 --- a/source/java/org/jbpm/webapp/bean/UserBean.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.faces.model.SelectItem; - -import org.hibernate.Session; -import org.jbpm.JbpmContext; -import org.jbpm.identity.User; -import org.jbpm.identity.hibernate.IdentitySession; - -public class UserBean { - - String userName; - - public String getUserName() { - return userName; - } - - public void setUserName(String name) { - this.userName = name; - } - - public String login() { - JbpmContext.getCurrentJbpmContext().setActorId(userName); - return "home"; - } - - public List getUsers() { - Session session = JbpmContext.getCurrentJbpmContext().getSession(); - IdentitySession identitySession = new IdentitySession(session); - return identitySession.getUsers(); - } - - public List getUserSelectItems() { - List userSelectItems = new ArrayList(); - - Iterator iter = getUsers().iterator(); - while (iter.hasNext()) { - User user = (User) iter.next(); - userSelectItems.add(new UserSelectItem(user)); - } - - return userSelectItems; - } - - public static class UserSelectItem extends SelectItem { - private static final long serialVersionUID = 1L; - public UserSelectItem(User user) { - setValue(user.getName()); - setLabel(user.getName()); - } - } -} diff --git a/source/java/org/jbpm/webapp/bean/VariableBean.java b/source/java/org/jbpm/webapp/bean/VariableBean.java deleted file mode 100644 index eefd7b2500..0000000000 --- a/source/java/org/jbpm/webapp/bean/VariableBean.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.bean; - -/** - * Variable Bean Implementation. - * - * @author David Loiseau - */ - -public class VariableBean { - - String name; - Object value; - - public VariableBean(String name, Object value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } -} diff --git a/source/java/org/jbpm/webapp/context/BpmContext.java b/source/java/org/jbpm/webapp/context/BpmContext.java deleted file mode 100644 index c8c18babdf..0000000000 --- a/source/java/org/jbpm/webapp/context/BpmContext.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.context; - -import org.jbpm.graph.def.ProcessDefinition; -import org.jbpm.taskmgmt.exe.TaskInstance; - -public class BpmContext { - - ProcessDefinition processDefinition; - TaskInstance taskInstance; - - public ProcessDefinition getProcessDefinition() { - return processDefinition; - } - public void setProcessDefinition(ProcessDefinition processDefinition) { - this.processDefinition = processDefinition; - } - public TaskInstance getTaskInstance() { - return taskInstance; - } - public void setTaskInstance(TaskInstance taskInstance) { - this.taskInstance = taskInstance; - } -} diff --git a/source/java/org/jbpm/webapp/context/Context.java b/source/java/org/jbpm/webapp/context/Context.java deleted file mode 100644 index 89b54a1840..0000000000 --- a/source/java/org/jbpm/webapp/context/Context.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.context; - -import java.util.HashMap; -import java.util.Map; - -public class Context { - - static ThreadLocal contextsThreadLocal = new ThreadLocal(); - - public static void create() { - contextsThreadLocal.set(new HashMap()); - } - - public static void destroy() { - contextsThreadLocal.set(null); - } - - public static Object getContext(Class clazz) { - Map contexts = (Map) contextsThreadLocal.get(); - Object context = contexts.get(clazz); - if (context==null) { - try { - context = clazz.newInstance(); - contexts.put(clazz, context); - } catch (Exception e) { - throw new RuntimeException("couldn't instantiate context '"+clazz.getName()+"'"); - } - } - return context; - } - - public static PersistenceContext getPersistenceContext() { - return (PersistenceContext) getContext(PersistenceContext.class); - } - - public static BpmContext getBpmContext() { - return (BpmContext) getContext(BpmContext.class); - } -} diff --git a/source/java/org/jbpm/webapp/context/PersistenceContext.java b/source/java/org/jbpm/webapp/context/PersistenceContext.java deleted file mode 100644 index 0cb090c8d6..0000000000 --- a/source/java/org/jbpm/webapp/context/PersistenceContext.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.context; - -import javax.naming.InitialContext; -import javax.rmi.PortableRemoteObject; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.hibernate.SessionFactory; -import org.jbpm.db.JbpmSession; -import org.jbpm.db.JbpmSessionFactory; -import org.jbpm.identity.hibernate.IdentitySession; - -public class PersistenceContext { - - static String jndiName = "java:/jbpm/SessionFactory"; - static JbpmSessionFactory jbpmSessionFactory = null; - static { - try { - InitialContext initialContext = new InitialContext(); - Object o = initialContext.lookup(jndiName); - SessionFactory sessionFactory = (SessionFactory) PortableRemoteObject.narrow(o, SessionFactory.class); - jbpmSessionFactory = new JbpmSessionFactory(null, sessionFactory); - } catch (Exception e) { - throw new RuntimeException("couldn't get the hibernate session factory from jndi entry '"+jndiName+"'", e); - } - } - - boolean isRollbackOnly; - JbpmSession jbpmSession; - IdentitySession identitySession; - - public void beginTransaction() { - isRollbackOnly = false; - log.debug("beginning transaction"); - jbpmSession = jbpmSessionFactory.openJbpmSessionAndBeginTransaction(); - identitySession = new IdentitySession(jbpmSession.getSession()); - } - - public void endTransaction() { - if (isRollbackOnly) { - log.debug("rolling back transaction"); - jbpmSession.rollbackTransactionAndClose(); - } else { - log.debug("committing transaction"); - jbpmSession.commitTransactionAndClose(); - } - } - - public void setRollbackOnly() { - isRollbackOnly = true; - } - - public IdentitySession getIdentitySession() { - return identitySession; - } - - public JbpmSession getJbpmSession() { - return jbpmSession; - } - - private static final Log log = LogFactory.getLog(PersistenceContext.class); -} diff --git a/source/java/org/jbpm/webapp/filter/AuthenticationFilter.java b/source/java/org/jbpm/webapp/filter/AuthenticationFilter.java deleted file mode 100644 index 4f93dac993..0000000000 --- a/source/java/org/jbpm/webapp/filter/AuthenticationFilter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.filter; - -import java.io.IOException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -import org.jbpm.JbpmContext; -import org.jbpm.webapp.bean.UserBean; - -public class AuthenticationFilter implements Filter { - - public void init(FilterConfig filterConfig) throws ServletException { - } - - public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { - HttpServletRequest request = (HttpServletRequest) servletRequest; - HttpSession session = request.getSession(); - UserBean userBean = null; - if (session!=null) { - userBean = (UserBean) session.getAttribute("userBean"); - } - if (userBean!=null) { - String actorId = userBean.getUserName(); - JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); - jbpmContext.setActorId(actorId); - } - filterChain.doFilter(servletRequest, servletResponse); - } - - public void destroy() { - } -} diff --git a/source/java/org/jbpm/webapp/filter/JbpmContextFilter.java b/source/java/org/jbpm/webapp/filter/JbpmContextFilter.java deleted file mode 100644 index b2ab089369..0000000000 --- a/source/java/org/jbpm/webapp/filter/JbpmContextFilter.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.filter; - -import java.io.IOException; -import java.io.Serializable; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.TransactionUtil; -import org.alfresco.service.transaction.TransactionService; -import org.jbpm.JbpmConfiguration; -import org.jbpm.JbpmContext; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -public class JbpmContextFilter implements Filter, Serializable -{ - - private static final long serialVersionUID = 1L; - - private ServletContext context; - - public void init(FilterConfig filterConfig) throws ServletException - { - this.context = filterConfig.getServletContext(); - } - - public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) - throws IOException, ServletException - { - WebApplicationContext wc = WebApplicationContextUtils.getRequiredWebApplicationContext(context); - final JbpmConfiguration jbpmConfig = (JbpmConfiguration) wc.getBean("jbpm_configuration"); - TransactionService trx = (TransactionService) wc.getBean("TransactionService"); - - TransactionUtil.executeInUserTransaction(trx, new TransactionUtil.TransactionWork() - { - public Object doWork() throws Exception - { - JbpmContext jbpmContext = jbpmConfig.createJbpmContext(); - try - { - String actorId = AuthenticationUtil.getCurrentUserName(); - if (actorId != null) - { - jbpmContext.setActorId(actorId); - } - filterChain.doFilter(servletRequest, servletResponse); - } - finally - { - jbpmContext.close(); - } - return null; - } - }); - } - - public void destroy() - { - } -} diff --git a/source/java/org/jbpm/webapp/filter/LogFilter.java b/source/java/org/jbpm/webapp/filter/LogFilter.java deleted file mode 100644 index 4cfa8db033..0000000000 --- a/source/java/org/jbpm/webapp/filter/LogFilter.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jbpm.webapp.filter; - -import java.io.IOException; -import java.util.Enumeration; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class LogFilter implements Filter { - - public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { - HttpServletRequest request = (HttpServletRequest) servletRequest; - - log.debug("request "+request.getRequestURL()); - - Enumeration enumeration = request.getParameterNames(); - while (enumeration.hasMoreElements()) { - String paramName = (String) enumeration.nextElement(); - log.debug("request parameter ["+paramName+"]="+request.getParameter(paramName)); - } - - HttpSession session = request.getSession(); - enumeration = session.getAttributeNames(); - while (enumeration.hasMoreElements()) { - String attributeName = (String) enumeration.nextElement(); - log.debug("session parameter ["+attributeName+"]="+session.getAttribute(attributeName)); - } - - filterChain.doFilter(servletRequest, servletResponse); - } - - public void init(FilterConfig filterConfig) throws ServletException { - } - - public void destroy() { - } - - private static final Log log = LogFactory.getLog(LogFilter.class); -} diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 1ab3c2d50e..d096fdc757 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -1952,7 +1952,7 @@ WorkflowBean org.alfresco.web.bean.workflow.WorkflowBean - session + request nodeService #{NodeService} @@ -1962,6 +1962,18 @@ #{WorkflowService} + + + + Backing bean used for the Workflow Console + WorkflowConsoleBean + org.alfresco.web.bean.workflow.WorkflowConsoleBean + session + + workflowInterpreter + #{workflowInterpreter} + + diff --git a/source/web/WEB-INF/faces-config-navigation.xml b/source/web/WEB-INF/faces-config-navigation.xml index 7ce5308028..da24a8adef 100644 --- a/source/web/WEB-INF/faces-config-navigation.xml +++ b/source/web/WEB-INF/faces-config-navigation.xml @@ -787,6 +787,16 @@ /jsp/admin/node-browser.jsp + + + + /jsp/workflow/workflow-console.jsp + + #{WorkflowConsoleBean.submitCommand} + success + /jsp/workflow/workflow-console.jsp + + diff --git a/source/web/WEB-INF/jbpm.tld b/source/web/WEB-INF/jbpm.tld deleted file mode 100644 index 03dd5ce333..0000000000 --- a/source/web/WEB-INF/jbpm.tld +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - 1.0 - 1.1 - jBPM tags - jBPM tags - - - - processimage - org.jbpm.webapp.tag.ProcessImageTag - empty - - task - true - true - - - - - processimageToken - org.jbpm.webapp.tag.ProcessImageTag - empty - - token - true - true - - - - diff --git a/source/web/WEB-INF/web.xml b/source/web/WEB-INF/web.xml index 36f93216c5..9d661e829b 100644 --- a/source/web/WEB-INF/web.xml +++ b/source/web/WEB-INF/web.xml @@ -16,7 +16,7 @@ javax.faces.CONFIG_FILES - /WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml,WEB-INF/faces-config-custom.xml,/WEB-INF/faces-config-enterprise.xml,/WEB-INF/faces-config-jbpm.xml + /WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml,WEB-INF/faces-config-custom.xml,/WEB-INF/faces-config-enterprise.xml @@ -97,17 +97,11 @@ org.alfresco.web.app.servlet.AdminAuthenticationFilter - - - JbpmContextFilter - org.jbpm.webapp.filter.JbpmContextFilter - - Authentication Filter /faces/* - + - - JbpmContextFilter - /faces/jbpm/* - - org.apache.myfaces.webapp.StartupServletContextListener @@ -197,6 +180,11 @@ org.alfresco.web.app.servlet.GuestDownloadContentServlet + + guestTemplateContent + org.alfresco.web.app.servlet.GuestTemplateContentServlet + + externalAccess org.alfresco.web.app.servlet.ExternalAccessServlet @@ -262,6 +250,11 @@ /guestDownload/* + + guestTemplateContent + /guestTemplate/* + + externalAccess /navigate/* diff --git a/source/web/index.jsp b/source/web/index.jsp index 699051315b..a9b2e386ec 100644 --- a/source/web/index.jsp +++ b/source/web/index.jsp @@ -16,6 +16,7 @@ License. --%> <%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %> +<%@ page import="org.alfresco.service.cmr.security.PermissionService" %> <%@ page import="org.alfresco.config.ConfigService" %> <%@ page import="org.alfresco.web.app.servlet.AuthenticationHelper" %> <%@ page import="org.alfresco.web.bean.NavigationBean" %> @@ -32,7 +33,7 @@ String location = configElement.getInitialLocation(); // override with the users preference if they have one User user = (User)session.getAttribute(AuthenticationHelper.AUTHENTICATION_USER); -if (user != null) +if (user != null && (user.getUserName().equals(PermissionService.GUEST_AUTHORITY) == false)) { String preference = (String)PreferencesService.getPreferences(user).getValue("start-location"); if (preference != null) diff --git a/source/web/jbpm/admin.jsp b/source/web/jbpm/admin.jsp deleted file mode 100644 index 5f614a7d8e..0000000000 --- a/source/web/jbpm/admin.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> - - - -Administration - - - - -TODO - -<%-- -(this page is not yet implemented) - -

Deploy process

- -    - - - -

Database Schema

- - - - - - - -

Scheduler

- - - - - - - - - - - - - - ---%> - -
diff --git a/source/web/jbpm/css/jbpm.css b/source/web/jbpm/css/jbpm.css deleted file mode 100644 index f835ebc084..0000000000 --- a/source/web/jbpm/css/jbpm.css +++ /dev/null @@ -1,106 +0,0 @@ -body, td, p { - font-family:verdana; - font-size:10pt; -} - -a { - color: rgb(110, 110, 110); - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -div.nav2 { - background-color:#5c5c4f; - color:#ffffff; - font-size: 12px; - font-weight: bold; - text-decoration: none; - line-height: 12px; - border: 0px; - margin-left: 0px; - margin-right: 1px; - margin-top: 1px; - margin-bottom: 0px; - padding-top:5px; - padding-bottom:5px; - width:174px; - cursor: pointer; -} - -div.innerNav { - position:relative; - left:10px; -} - -a.nav { - font-size: 12px; - font-weight: bold; - text-decoration: none; - line-height: 12px; - width:100%; - background-color:#5c5c4f; - color:#ffffff; - border: 0px; - margin-left: 0px; - margin-right: 1px; - margin-top: 1px; - margin-bottom: 0px; - padding-left:10px; - padding-right:10px; - padding-top:5px; - padding-bottom:5px; -} - -div.nav { - font-size: 12px; - font-weight: bold; - text-decoration: none; - line-height: 12px; - width:174; - background-color:#5c5c4f; - color:#ffffff; - border: 0px; - height: 20px; - margin-left: 0px; - margin-right: 1px; - margin-top: 1px; - margin-bottom: 0px; - vertical-align:middle; - padding-left:10px; - padding-top:5px; - padding-bottom:5px; -} - -a.ref { - padding: 5px; - color: rgb(110, 110, 110); - text-decoration: none; - font-size: 11px; - line-height: 18px; -} - -h1, h2, h3, h4, h5, h6 { - font-family:arial; - color:purple; - border-bottom:0px; - margin-bottom:0px; - padding-bottom:0px; -} - -td.tablecell { - padding-left:10px; - padding-right:10px; - background-color:#eeeeee; -} - -th.tableheader { - text-align:center; - text-weight:bold; - padding-right:10px; - padding-left:10px; - color:#ffffff; - background-color:#999999; -} diff --git a/source/web/jbpm/footer.jsp b/source/web/jbpm/footer.jsp deleted file mode 100644 index 91b78efbf3..0000000000 --- a/source/web/jbpm/footer.jsp +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/source/web/jbpm/header1.jsp b/source/web/jbpm/header1.jsp deleted file mode 100644 index a16e14b038..0000000000 --- a/source/web/jbpm/header1.jsp +++ /dev/null @@ -1,35 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ page import="org.jbpm.webapp.bean.*" %> - - - -JBoss jBPM - - - - - - - - - - - - diff --git a/source/web/jsp/roles/manage-invited-users.jsp b/source/web/jsp/roles/manage-invited-users.jsp index 2010add406..73d0306f24 100644 --- a/source/web/jsp/roles/manage-invited-users.jsp +++ b/source/web/jsp/roles/manage-invited-users.jsp @@ -85,13 +85,14 @@ + <%-- View mode settings + --%>
JBoss Inc. - - - - - - - - - - -
-
- Alfresco Web Client    - Docs    - Forums    - Wiki    - Download    - Contact       -
-
-

diff --git a/source/web/jbpm/header2.jsp b/source/web/jbpm/header2.jsp deleted file mode 100644 index cb865990f7..0000000000 --- a/source/web/jbpm/header2.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> - -

-
-
- - - - - + <%-- View mode settings + --%>
- - - - - - - -
green side
- - - -
-
- - diff --git a/source/web/jbpm/home.jsp b/source/web/jbpm/home.jsp deleted file mode 100644 index 1304beb2f7..0000000000 --- a/source/web/jbpm/home.jsp +++ /dev/null @@ -1,64 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> - - - - -Home - - - - -

Tasklist

- - - - - - - - - - - - - - - - - - - - - - - -

Start New Process Execution

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/source/web/jbpm/images/hdr_green_side.gif b/source/web/jbpm/images/hdr_green_side.gif deleted file mode 100644 index ec5d33d88b..0000000000 Binary files a/source/web/jbpm/images/hdr_green_side.gif and /dev/null differ diff --git a/source/web/jbpm/images/logo_green.gif b/source/web/jbpm/images/logo_green.gif deleted file mode 100644 index 3367b78e24..0000000000 Binary files a/source/web/jbpm/images/logo_green.gif and /dev/null differ diff --git a/source/web/jbpm/images/logo_red.gif b/source/web/jbpm/images/logo_red.gif deleted file mode 100644 index be6952d16d..0000000000 Binary files a/source/web/jbpm/images/logo_red.gif and /dev/null differ diff --git a/source/web/jbpm/images/logo_yellow.gif b/source/web/jbpm/images/logo_yellow.gif deleted file mode 100644 index 3e4fb26698..0000000000 Binary files a/source/web/jbpm/images/logo_yellow.gif and /dev/null differ diff --git a/source/web/jbpm/images/side_nav_green_btm.gif b/source/web/jbpm/images/side_nav_green_btm.gif deleted file mode 100644 index a3db50a6dc..0000000000 Binary files a/source/web/jbpm/images/side_nav_green_btm.gif and /dev/null differ diff --git a/source/web/jbpm/images/spacer.gif b/source/web/jbpm/images/spacer.gif deleted file mode 100644 index fc2560981e..0000000000 Binary files a/source/web/jbpm/images/spacer.gif and /dev/null differ diff --git a/source/web/jbpm/images/swoosh_green.gif b/source/web/jbpm/images/swoosh_green.gif deleted file mode 100644 index 253b13d6ac..0000000000 Binary files a/source/web/jbpm/images/swoosh_green.gif and /dev/null differ diff --git a/source/web/jbpm/inspect_instance.jsp b/source/web/jbpm/inspect_instance.jsp deleted file mode 100644 index b159f79943..0000000000 --- a/source/web/jbpm/inspect_instance.jsp +++ /dev/null @@ -1,190 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/jbpm.tld" prefix="jbpm" %> - -<%@ page isELIgnored="false" %> - - - - - -Inspect Instance - - - - -
- -: - -
-: - -
-: - - - - - -
-: - - - - - -
- -
- -

Tasks

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Variables

- - - - - - - - - - - - - - - - - - - -
- - Variable Name: - -
- Variable Value: - -
- -
- -
- -

Tokens

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - -
diff --git a/source/web/jbpm/inspect_instance_transitions.jsp b/source/web/jbpm/inspect_instance_transitions.jsp deleted file mode 100644 index 9a5c01f2a9..0000000000 --- a/source/web/jbpm/inspect_instance_transitions.jsp +++ /dev/null @@ -1,69 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/jbpm.tld" prefix="jbpm" %> - - - - - -Transitions - - - - -
-: - -
-: - -
-
- - -
- -

Available Transitions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - -
diff --git a/source/web/jbpm/layout.jsp b/source/web/jbpm/layout.jsp deleted file mode 100644 index 156f99e3b9..0000000000 --- a/source/web/jbpm/layout.jsp +++ /dev/null @@ -1,105 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %> - -<%@ page import="org.jbpm.webapp.bean.*" %> - - - -JBoss jBPM - - - - - - - - - - - - - -
JBoss Inc. - - - - - - - - - - -
-
- Docs    - Forums    - Wiki    - Download    - Contact       -
-
-

- - - -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> - -

-
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
green side
green side
-   -
- swoosh -
-
- - - - - - -
-
- - - - diff --git a/source/web/jbpm/monitor.jsp b/source/web/jbpm/monitor.jsp deleted file mode 100644 index b11d1fa7ee..0000000000 --- a/source/web/jbpm/monitor.jsp +++ /dev/null @@ -1,33 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> - - - - - -Monitoring - - - - -
- -

- - - - -

- - - -

- - Instance ID: - - - - - - -
diff --git a/source/web/jbpm/process_definitions.jsp b/source/web/jbpm/process_definitions.jsp deleted file mode 100644 index 12343e1105..0000000000 --- a/source/web/jbpm/process_definitions.jsp +++ /dev/null @@ -1,54 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> - - - - - -Process Definitions - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jbpm/process_instances.jsp b/source/web/jbpm/process_instances.jsp deleted file mode 100644 index 8f84fdbf82..0000000000 --- a/source/web/jbpm/process_instances.jsp +++ /dev/null @@ -1,71 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> - - - - - -Process Instances - - - - -
- -: - -
- -: - -
- -: - -
- -
- -

Instances

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/source/web/jbpm/process_list.jsp b/source/web/jbpm/process_list.jsp deleted file mode 100644 index 89a3db560b..0000000000 --- a/source/web/jbpm/process_list.jsp +++ /dev/null @@ -1,28 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> - - -  - -

- - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jbpm/process_view.jsp b/source/web/jbpm/process_view.jsp deleted file mode 100644 index 4ee6dc6978..0000000000 --- a/source/web/jbpm/process_view.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/jbpm.tld" prefix="jbpm" %> - -<%@ page isELIgnored="false" %> - -<% System.out.println(request.getParameter("taskInstanceId")); %> - - - default value - - -Setting the value: "Hello World!" - -

- - -<%-- --%> - -Process View -<%-- --%> - - - -<%-- --%> diff --git a/source/web/jbpm/search_instances.jsp b/source/web/jbpm/search_instances.jsp deleted file mode 100644 index dd653f8724..0000000000 --- a/source/web/jbpm/search_instances.jsp +++ /dev/null @@ -1,80 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> - - - - - -Search Instances - - - - - - - - - - -
- - - - - -
- -

- -
- -


-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jbpm/task.jsp b/source/web/jbpm/task.jsp deleted file mode 100644 index 55ed500db0..0000000000 --- a/source/web/jbpm/task.jsp +++ /dev/null @@ -1,74 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/jbpm.tld" prefix="jbpm" %> -<%@ page import="org.jbpm.webapp.bean.*" %> -<%@ page import="org.jbpm.taskmgmt.exe.*" %> - -<%@ page isELIgnored="false" %> - - - - -Task - - - - - - - -
- - - - -

- -
- - - - - - - - - - - - - -
- - - - - - - - - - - - -
 
- -
- - -
- - - - -
- -
-    - - -
- - -
diff --git a/source/web/jbpm/task_list.jsp b/source/web/jbpm/task_list.jsp deleted file mode 100644 index 7d3334c8f6..0000000000 --- a/source/web/jbpm/task_list.jsp +++ /dev/null @@ -1,20 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> - - - - - - - - - - - - - - - - - - diff --git a/source/web/jbpm/task_view.jsp b/source/web/jbpm/task_view.jsp deleted file mode 100644 index ec28f879a8..0000000000 --- a/source/web/jbpm/task_view.jsp +++ /dev/null @@ -1,70 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/jbpm.tld" prefix="jbpm" %> -<%@ page import="org.jbpm.webapp.bean.*" %> -<%@ page import="org.jbpm.taskmgmt.exe.*" %> - -<%@ page isELIgnored="false" %> - - - - - - - - - -
- - - - -

- -
- - - - - - - - - - - - - -
- - - - - - - - - - - - -
 
- -
- - -
- - - - -
- -
-    - - -
- -
diff --git a/source/web/jsp/admin/workflow-console.jsp b/source/web/jsp/admin/workflow-console.jsp new file mode 100644 index 0000000000..37b4e9e181 --- /dev/null +++ b/source/web/jsp/admin/workflow-console.jsp @@ -0,0 +1,102 @@ +<%-- + Copyright (C) 2005 Alfresco, Inc. + + Licensed under the Mozilla Public License version 1.1 + with a permitted attribution clause. You may obtain a + copy of the License at + + http://www.alfresco.org/legal/license.txt + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied. See the License for the specific + language governing permissions and limitations under the + License. +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> + + + + + + <%-- load a bundle of properties with I18N strings --%> + + + + + + + + + + +
+ + + + + +
+ +
+ +
+ + + + + + + + + + +
User:
Workflow Definition:
+ +
+ + + + + + + + + +
+ + + +
+
+ + + + + + + + +
+
+
+ ----- +
+
+
+ +
+ +
+ + diff --git a/source/web/jsp/roles/manage-content-users.jsp b/source/web/jsp/roles/manage-content-users.jsp index 4d59c638bc..701d910702 100644 --- a/source/web/jsp/roles/manage-content-users.jsp +++ b/source/web/jsp/roles/manage-content-users.jsp @@ -85,13 +85,14 @@
- <%-- View mode settings --%>
- <%-- View mode settings --%>