diff --git a/source/java/org/alfresco/web/app/servlet/AdminAuthenticationFilter.java b/source/java/org/alfresco/web/app/servlet/AdminAuthenticationFilter.java index 0201922a0e..cdb315cbc8 100644 --- a/source/java/org/alfresco/web/app/servlet/AdminAuthenticationFilter.java +++ b/source/java/org/alfresco/web/app/servlet/AdminAuthenticationFilter.java @@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory; /** * This servlet filter is used to restrict direct URL access to administration - * resource in the web client, for example the admin and jBPM consoles. + * resource in the web client, for example the admin console. * * @author gavinc * @deprecated 5.0 not exposed in web-client web.xml diff --git a/source/java/org/alfresco/web/app/servlet/JBPMDeployProcessServlet.java b/source/java/org/alfresco/web/app/servlet/JBPMDeployProcessServlet.java deleted file mode 100644 index fa8f49f7b6..0000000000 --- a/source/java/org/alfresco/web/app/servlet/JBPMDeployProcessServlet.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * #%L - * Alfresco Repository WAR Community - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco 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 3 of the License, or - * (at your option) any later version. - * - * Alfresco 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 Alfresco. If not, see . - * #L% - */ -package org.alfresco.web.app.servlet; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; - -import javax.servlet.ServletException; -import javax.servlet.UnavailableException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.workflow.jbpm.JBPMEngine; -import org.alfresco.service.ServiceRegistry; -import org.alfresco.service.cmr.workflow.WorkflowDefinition; -import org.alfresco.service.cmr.workflow.WorkflowDeployment; -import org.alfresco.service.cmr.workflow.WorkflowException; -import org.alfresco.service.cmr.workflow.WorkflowService; -import org.alfresco.util.PropertyCheck; -import org.apache.commons.fileupload.DiskFileUpload; -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileUpload; -import org.apache.commons.fileupload.FileUploadException; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - - -/** - * Servlet for handling process deployments from jBPM process designer. - * - * @author davidc - * @deprecated 5.0 not exposed in web-client web.xml - */ -public class JBPMDeployProcessServlet extends HttpServlet -{ - private static final long serialVersionUID = 8002539291245090187L; - private static final String BEAN_GLOBAL_PROPERTIES = "global-properties"; - private static final String PROP_ENABLED = "system.workflow.deployservlet.enabled"; - - @Override - public void init() throws ServletException - { - // Render this servlet permanently unavailable if its enablement property is not set - WebApplicationContext wc = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()); - Properties globalProperties = (Properties) wc.getBean(BEAN_GLOBAL_PROPERTIES); - String enabled = globalProperties.getProperty(PROP_ENABLED); - if (!PropertyCheck.isValidPropertyString(enabled) || !Boolean.parseBoolean(enabled)) - { - throw new UnavailableException("system.workflow.deployservlet.enabled=false"); - } - } - - @Override - public void service(HttpServletRequest request, HttpServletResponse response) throws IOException - { - try - { - response.setContentType("text/html"); - InputStream deploymentArchive = getDeploymentArchive(request); - WorkflowDefinition workflowDef = deployArchive(deploymentArchive); - response.getWriter().println("Deployed archive " + workflowDef.title + " successfully"); - } - catch(IOException e) - { - // NOTE: according to original jBPM deployment servlet - response.getWriter().println("IOException"); - } - catch(FileUploadException e) - { - // NOTE: according to original jBPM deployment servlet - response.getWriter().println("FileUploadException"); - } - } - - /** - * Retrieve the JBPM Process Designer deployment archive from the request - * - * @param request the request - * @return the input stream onto the deployment archive - * @throws WorkflowException - * @throws FileUploadException - * @throws IOException - */ - private InputStream getDeploymentArchive(HttpServletRequest request) - throws FileUploadException, IOException - { - if (!FileUpload.isMultipartContent(request)) - { - throw new FileUploadException("Not a multipart request"); - } - - GPDUpload fileUpload = new GPDUpload(); - List list = fileUpload.parseRequest(request); - Iterator iterator = list.iterator(); - if (!iterator.hasNext()) - { - throw new FileUploadException("No process file in the request"); - } - - FileItem fileItem = (FileItem) iterator.next(); - if (fileItem.getContentType().indexOf("application/x-zip-compressed") == -1) - { - throw new FileUploadException("Not a process archive"); - } - - return fileItem.getInputStream(); - } - - - /** - * Deploy the jBPM process archive to the Alfresco Repository - * - * @param deploymentArchive the archive to deploy - * @return the deployed workflow definition - */ - private WorkflowDefinition deployArchive(InputStream deploymentArchive) - { - WebApplicationContext wc = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()); - WorkflowService workflowService = (WorkflowService)wc.getBean(ServiceRegistry.WORKFLOW_SERVICE.getLocalName()); - WorkflowDeployment deployment = workflowService.deployDefinition(JBPMEngine.ENGINE_ID, deploymentArchive, MimetypeMap.MIMETYPE_ZIP); - return deployment.definition; - } - - - /** - * NOTE: Workaround... - * - * The JBPM process designer (as of 3.1.2) issues a request with a multi-part line - * delimited by ",". It should be ":" according to the HTTP specification which - * the commons file-upload is adhering to. - * - * @author davidc - */ - @SuppressWarnings("deprecation") - private class GPDUpload extends DiskFileUpload - { - @Override - protected byte[] getBoundary(String contentType) - { - return super.getBoundary(contentType.replace(",", ";")); - } - } -} \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java index a97eb37acc..f890c3471c 100644 --- a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java +++ b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java @@ -47,7 +47,6 @@ import org.alfresco.repo.policy.BehaviourFilter; import org.alfresco.repo.publishing.PublishingEventHelper; import org.alfresco.repo.workflow.WorkflowModel; import org.alfresco.repo.workflow.activiti.ActivitiConstants; -import org.alfresco.repo.workflow.jbpm.JBPMEngine; import org.alfresco.service.cmr.dictionary.PropertyDefinition; import org.alfresco.service.cmr.invitation.InvitationService; import org.alfresco.service.cmr.repository.InvalidNodeRefException; @@ -820,7 +819,6 @@ public class StartWorkflowWizard extends BaseWizardBean { publishingWorkflows = new ArrayList(2); - publishingWorkflows.add(JBPMEngine.ENGINE_ID + "$" + PublishingEventHelper.WORKFLOW_DEFINITION_NAME); publishingWorkflows.add(ActivitiConstants.ENGINE_ID + "$" + PublishingEventHelper.WORKFLOW_DEFINITION_NAME); } diff --git a/source/java/org/alfresco/web/ui/repo/tag/JBPMProcessImageTag.java b/source/java/org/alfresco/web/ui/repo/tag/JBPMProcessImageTag.java deleted file mode 100644 index 23011a0c67..0000000000 --- a/source/java/org/alfresco/web/ui/repo/tag/JBPMProcessImageTag.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * #%L - * Alfresco Repository WAR Community - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco 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 3 of the License, or - * (at your option) any later version. - * - * Alfresco 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 Alfresco. If not, see . - * #L% - */ -/* - * 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; - } - -}