提交 322f277b 编写于 作者: B Bassam Al-Sarori

latest from Activiti

上级 cdc7dc1f
......@@ -4,7 +4,7 @@
<property file="${user.home}/.activiti/build.properties" />
<property name="activiti.version" value="5.12-SNAPSHOT" />
<property name="activiti.version" value="5.13-SNAPSHOT" />
<property name="target.distro.root" value="target/zip/activiti-${activiti.version}" />
<property name="activiti.website" value="../../activiti-website" />
......
......@@ -16,17 +16,17 @@ This software package includes changed source code of the following libraries:
JUEL
* Location: http://juel.sourceforge.net/
* Included in activiti-engine-5.12-SNAPSHOT.jar in package org.activiti.engine.impl.juel
* Included in activiti-engine-5.12.jar in package org.activiti.engine.impl.juel
* License: Apache V2
Quartz
* Location: http://www.quartz-scheduler.org/
* CronExpression is included in activiti-engine-5.12-SNAPSHOT.jar in package org.activiti.engine.impl.calendar
* CronExpression is included in activiti-engine-5.12.jar in package org.activiti.engine.impl.calendar
* License: Apache V2
JSON
* Location: http://www.JSON.org/java
* Included in activiti-engine-5.12-SNAPSHOT.jar in package org.activiti.engine.impl.json
* Included in activiti-engine-5.12.jar in package org.activiti.engine.impl.json
* License:
===============================================================================
Copyright (c) 2002 JSON.org
......
......@@ -37,6 +37,18 @@
<h3>Release Notes - Activiti - Version 5.12</h3>
<h4>Highlights</h4>
<ul>
<li>Added new javascript-based diagram viewer to Explorer (thanks to Dmitry Farafonov)</li>
<li>Unified the BPMN parser and model for the Engine, Modeler and Designer</li>
<li>Added Activiti Kickstart to the Explorer to quickly create processes without deep BPMN knowledge</li>
<li>Simplified and extended the Activiti Camel module (thanks to Ryan Johnston)</li>
<li>Added first stage of reporting functionality to the Explorer via "reporting processes"</li>
<li>Added auto-layout module for Kickstart and BPMN import in Modeler (TBD) and Designer</li>
<li>Added script task and execution listeners</li>
<li>Lots of bug fixes</li>
</ul>
<h4>Important upgrade note</h4>
<p>
......@@ -44,11 +56,171 @@
</p>
<p>
Yes, we know many people relied on its capabilities, altough it was a class in an internal package. But do not worry:
Yes, we know many people relied on its capabilities, although it was a class in an internal package. But do not worry:
we have introduced a replacement in the <b>api package</b> that offers similar (and even more powerful) functionality.
The code is not backwards compatible, but the required changes should be minimal (eg the XML element is replaced by a
Java pojo representation of the element). Read more about it in the new 'Advanced' chapter of the userguide.
</p>
<h4>Bug fixes and various smaller improvements</h4>
<p>Check out the <a href="https://jira.codehaus.org/secure/ReleaseNote.jspa?projectId=12091&version=18879">Release notes</a> for more details</p>
<h2> Sub-task
</h2>
<ul>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1565'>ACT-1565</a>] - activiti-bpmn-converter BaseBpmnXMLConverter ignores defaultFlow for Gateways
</li>
</ul>
<h2> Bug
</h2>
<ul>
<li>[<a href='https://jira.codehaus.org/browse/ACT-863'>ACT-863</a>] - HistoricVariableUpdate#getValue() throws NPE for JPA entities
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-995'>ACT-995</a>] - Not possible to update/overwrite a JPA entity in workflow
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1025'>ACT-1025</a>] - Methods deleteDeployment(String deploymentId, ...) and deleteDeploymentCascade(String deploymentId, ...) do not throw an exception with passed a non-existent deployementId
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1026'>ACT-1026</a>] - Inclusive gateway isn&#39;t properly joining sequence flows coming from call activities
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1040'>ACT-1040</a>] - TaskManager.findTaskById does not utilize session cache
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1054'>ACT-1054</a>] - Unable to complete user task coming from parallel gateway
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1196'>ACT-1196</a>] - Invalid login screen localization on non-utf-8 based hosts
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1204'>ACT-1204</a>] - InclusiveGateway with two subprocesses does not join correctly
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1317'>ACT-1317</a>] - Wrong task event generated when setting assignee to null
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1345'>ACT-1345</a>] - method name orderByHistoricActivityInstanceStartTime in class HistoricTaskInstanceQuery should be orderByHistoricTaskInstanceStartTime
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1372'>ACT-1372</a>] - User Task with form: form will be not displayed if the value expression in next line used
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1377'>ACT-1377</a>] - removeVariables() in VariableScopeImpl does not consider parent scopes
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1414'>ACT-1414</a>] - ClassCastException when completing a referenced sub process after Boundary Event with cancelActivity = false
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1417'>ACT-1417</a>] - Fix Explorer session serialization
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1418'>ACT-1418</a>] - NullPointerException if throw a not catched exception/error
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1470'>ACT-1470</a>] - Import definition type fails with CxfWSDLImporter when using complex data types
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1477'>ACT-1477</a>] - In user guide error api for form property from history detail
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1479'>ACT-1479</a>] - activiti-engine has invalid symbolic name
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1486'>ACT-1486</a>] - The ability to add an attachment to a process instance is broken
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1494'>ACT-1494</a>] - Get garbled string when render form in chines
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1499'>ACT-1499</a>] - Form properties not initialized when null or empty
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1502'>ACT-1502</a>] - Custom font name in the engine for diagram
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1504'>ACT-1504</a>] - Cannot create new user and membership in JavaDelegate using identityService
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1512'>ACT-1512</a>] - HistoricVariableUpdates no longer returned when using postgres
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1516'>ACT-1516</a>] - BPMN Converter: Adding a listener to a script task produces erroneous XML content.
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1524'>ACT-1524</a>] - Variable update detection does not work for byte[]
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1528'>ACT-1528</a>] - All variables are deleted after delete a history processinstance
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1533'>ACT-1533</a>] - Undeployment of old process versions deletes jobs for TimerStartEvents
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1540'>ACT-1540</a>] - HistoricVariableInstance does not expose taskId, nor does HistoricVariableQuery expose querying based on taskId
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1546'>ACT-1546</a>] - Impossible to assign default flow on exclusive gateways
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1553'>ACT-1553</a>] - Refactor BpmnParse to use separate handlers for each bpmn element
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1555'>ACT-1555</a>] - ProgrammaticBeanLookup doesn&#39;t regard alternatives
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1556'>ACT-1556</a>] - BpmnDeployer creates duplicates identity links when deploying processes with initiation authorization active
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1579'>ACT-1579</a>] - Process engine can be DoS&#39;ed when deploying unsafe XML
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1586'>ACT-1586</a>] - ExecutionQuery returns wrong results when using multi instance on a receive task
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1596'>ACT-1596</a>] - Not generated boundary event in diagram created by Raphaël
</li>
</ul>
<h2> Improvement
</h2>
<ul>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1274'>ACT-1274</a>] - Remove SEVERE level logging for expected exception in taskservice.claim()
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1324'>ACT-1324</a>] - Add specific exceptions for common error scenarios (TaskNotFoundException if a task if not found etc)
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1463'>ACT-1463</a>] - Review rest-response codes and error-body response
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1498'>ACT-1498</a>] - IntermediateCatchEventActivitiBehaviour name does not match other ActivityBehavior&#39;s
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1505'>ACT-1505</a>] - Should throw an exception if the picture is not generated
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1561'>ACT-1561</a>] - Add the ability to register a TaskListener for all event types
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1568'>ACT-1568</a>] - Query API documentation out of sync with codebase
</li>
</ul>
<h2> New Feature
</h2>
<ul>
<li>[<a href='https://jira.codehaus.org/browse/ACT-432'>ACT-432</a>] - Terminate end event
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1164'>ACT-1164</a>] - Add possibility to hook in own implementation of BusinessRuleTask
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1493'>ACT-1493</a>] - Make DeploymentCache pluggable and allow to set cache limit
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1511'>ACT-1511</a>] - Extract ActivityBehavior and Task/ExecutionListener instantiation in a pluggable factory
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1518'>ACT-1518</a>] - Add generic simple workflow creator API to activiti
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1537'>ACT-1537</a>] - Allow to configure whether script variables are stored as process variables
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1569'>ACT-1569</a>] - Introduce process instance scope for signal events
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1571'>ACT-1571</a>] - Auto layout for BPMN 2.0 processes
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1572'>ACT-1572</a>] - Designer should generate XML with delegationExpression
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1574'>ACT-1574</a>] - Loop type for subprocess in Modeler
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1580'>ACT-1580</a>] - Add method to retrieve BpmnModel (Pojo version of BPMN 2.0 process) to RepositoryService
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1588'>ACT-1588</a>] - Native query support paging
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1593'>ACT-1593</a>] - Basic reporting for Explorer
</li>
</ul>
<h2> Task
</h2>
<ul>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1031'>ACT-1031</a>] - Rename JobQuery methods
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1397'>ACT-1397</a>] - Remove Account related service operations from IdentityService
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1465'>ACT-1465</a>] - Document services in userguide
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1538'>ACT-1538</a>] - Move BpmnParseListener to public API package
</li>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1581'>ACT-1581</a>] - Refactor ProcessDiagramGenerator to take BpmnModel as input instead of ProcessDefinitionEntity
</li>
</ul>
<h2> Wish
</h2>
<ul>
<li>[<a href='https://jira.codehaus.org/browse/ACT-1362'>ACT-1362</a>] - Extend JPAEntityMappings to support UUID as Id
</li>
</ul>
<h3>Release Notes - Activiti - Version 5.11</h3>
......
......@@ -10,7 +10,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<properties>
......
......@@ -30,6 +30,7 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
......@@ -76,6 +77,7 @@ import org.activiti.bpmn.model.SubProcess;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
/**
* @author Tijs Rademakers
......@@ -154,7 +156,21 @@ public class BpmnXMLConverter implements BpmnXMLConstants {
this.startEventFormTypes = startEventFormTypes;
}
public void validateModel(XMLStreamReader xtr) throws Exception {
public void validateModel(InputStreamProvider inputStreamProvider) throws Exception {
Schema schema = createSchema();
Validator validator = schema.newValidator();
validator.validate(new StreamSource(inputStreamProvider.getInputStream()));
}
public void validateModel(XMLStreamReader xmlStreamReader) throws Exception {
Schema schema = createSchema();
Validator validator = schema.newValidator();
validator.validate(new StAXSource(xmlStreamReader));
}
protected Schema createSchema() throws SAXException {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = null;
if (classloader != null) {
......@@ -168,12 +184,10 @@ public class BpmnXMLConverter implements BpmnXMLConstants {
if (schema == null) {
throw new XMLException("BPMN XSD could not be found");
}
Validator validator = schema.newValidator();
validator.validate(new StAXSource(xtr));
return schema;
}
public BpmnModel convertToBpmnModel(InputStreamProvider inputStreamProvider, boolean validateSchema) {
public BpmnModel convertToBpmnModel(InputStreamProvider inputStreamProvider, boolean validateSchema, boolean enableSafeBpmnXml) {
XMLInputFactory xif = XMLInputFactory.newInstance();
if (xif.isPropertySupported(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)) {
......@@ -195,7 +209,12 @@ public class BpmnXMLConverter implements BpmnXMLConstants {
try {
if (validateSchema) {
validateModel(xtr);
if (!enableSafeBpmnXml) {
validateModel(inputStreamProvider);
} else {
validateModel(xtr);
}
// The input stream is closed after schema validation
in = new InputStreamReader(inputStreamProvider.getInputStream(), "UTF-8");
......
......@@ -10,7 +10,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<build>
......
......@@ -10,7 +10,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<properties>
......
......@@ -12,7 +12,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<dependencies>
......
......@@ -11,7 +11,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
......
......@@ -11,7 +11,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
......
......@@ -11,7 +11,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<properties>
......
......@@ -10,7 +10,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
......
......@@ -11,7 +11,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<properties>
......
......@@ -10,7 +10,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<dependencies>
......
......@@ -49,7 +49,7 @@ package org.activiti.engine;
public interface ProcessEngine extends EngineServices {
/** the version of the activiti library */
public static String VERSION = "5.12-SNAPSHOT";
public static String VERSION = "5.13-SNAPSHOT";
/** The name as specified in 'process-engine-name' in
* the activiti.cfg.xml configuration file.
......
......@@ -35,14 +35,12 @@ public abstract class AbstractNativeQuery<T extends NativeQuery< ? , ? >, U> imp
private static final long serialVersionUID = 1L;
private static enum ResultType {
LIST, LIST_PAGE, SINGLE_RESULT, COUNT
LIST, SINGLE_RESULT, COUNT
}
protected transient CommandExecutor commandExecutor;
protected transient CommandContext commandContext;
protected int maxResults = Integer.MAX_VALUE;
protected int firstResult = 0;
protected ResultType resultType;
private Map<String, Object> parameters = new HashMap<String, Object>();
......@@ -90,17 +88,6 @@ public abstract class AbstractNativeQuery<T extends NativeQuery< ? , ? >, U> imp
}
return executeList(Context.getCommandContext(), getParameterMap(), 0, Integer.MAX_VALUE);
}
@SuppressWarnings("unchecked")
public List<U> listPage(int firstResult, int maxResults) {
this.firstResult =firstResult;
this.maxResults = maxResults;
this.resultType = ResultType.LIST_PAGE;
if (commandExecutor!=null) {
return (List<U>) commandExecutor.execute(this);
}
return executeList(Context.getCommandContext(), getParameterMap(), firstResult, maxResults);
}
public long count() {
this.resultType = ResultType.COUNT;
......@@ -113,21 +100,6 @@ public abstract class AbstractNativeQuery<T extends NativeQuery< ? , ? >, U> imp
public Object execute(CommandContext commandContext) {
if (resultType == ResultType.LIST) {
return executeList(commandContext, getParameterMap(), 0, Integer.MAX_VALUE);
} else if (resultType == ResultType.LIST_PAGE) {
Map<String, Object> parameterMap = getParameterMap();
parameterMap.put("resultType", "LIST_PAGE");
parameterMap.put("firstResult", firstResult);
parameterMap.put("maxResults", maxResults);
int firstRow = firstResult + 1;
parameterMap.put("firstRow", firstRow);
int lastRow = 0;
if(maxResults == Integer.MAX_VALUE) {
lastRow = maxResults;
}
lastRow = firstResult + maxResults + 1;
parameterMap.put("lastRow", lastRow);
return executeList(commandContext, parameterMap, firstResult, maxResults);
} else if (resultType == ResultType.SINGLE_RESULT) {
return executeSingleResult(commandContext);
} else {
......
......@@ -51,6 +51,7 @@ import org.activiti.engine.impl.bpmn.webservice.BpmnInterfaceImplementation;
import org.activiti.engine.impl.bpmn.webservice.MessageDefinition;
import org.activiti.engine.impl.bpmn.webservice.Operation;
import org.activiti.engine.impl.bpmn.webservice.OperationImplementation;
import org.activiti.engine.impl.context.Context;
import org.activiti.engine.impl.el.ExpressionManager;
import org.activiti.engine.impl.persistence.entity.DeploymentEntity;
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
......@@ -167,7 +168,13 @@ public class BpmnParse implements BpmnXMLConstants {
public BpmnParse execute() {
try {
BpmnXMLConverter converter = new BpmnXMLConverter();
bpmnModel = converter.convertToBpmnModel(streamSource, true);
boolean enableSafeBpmnXml = false;
if (Context.getProcessEngineConfiguration() != null) {
enableSafeBpmnXml = Context.getProcessEngineConfiguration().isEnableSafeBpmnXml();
}
bpmnModel = converter.convertToBpmnModel(streamSource, true, enableSafeBpmnXml);
createImports();
createItemDefinitions();
......
......@@ -336,6 +336,16 @@ public abstract class ProcessEngineConfigurationImpl extends ProcessEngineConfig
protected String databaseTablePrefix = "";
/**
* Set this to true if you want to have extra checks on the BPMN xml that is parsed.
* See http://www.jorambarrez.be/blog/2013/02/19/uploading-a-funny-xml-can-bring-down-your-server/
*
* Unfortuantely, this feature is not available on some platforms (JDK 6, JBoss),
* hence the reason why it is disabled by default. If your platform allows
* the use of StaxSource during XML parsing, do enable it.
*/
protected boolean enableSafeBpmnXml = false;
/**
* The following settings will determine the amount of entities loaded at once when the engine
* needs to load multiple entities (eg. when suspending a process definition with all its process instances).
......@@ -1930,5 +1940,13 @@ public abstract class ProcessEngineConfigurationImpl extends ProcessEngineConfig
public void setKnowledgeBaseCache(DeploymentCache<Object> knowledgeBaseCache) {
this.knowledgeBaseCache = knowledgeBaseCache;
}
public boolean isEnableSafeBpmnXml() {
return enableSafeBpmnXml;
}
public void setEnableSafeBpmnXml(boolean enableSafeBpmnXml) {
this.enableSafeBpmnXml = enableSafeBpmnXml;
}
}
\ No newline at end of file
......@@ -69,7 +69,7 @@ public class GetBpmnModelCmd implements Command<BpmnModel>, Serializable {
// Convert the bpmn 2.0 xml to a bpmn model
BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
return bpmnXMLConverter.convertToBpmnModel(new BytesStreamSource(resource.getBytes()), false); // no need to validate schema, it was already validated on deploy
return bpmnXMLConverter.convertToBpmnModel(new BytesStreamSource(resource.getBytes()), false, false); // no need to validate schema, it was already validated on deploy
}
}
......@@ -51,8 +51,4 @@ public interface NativeQuery<T extends NativeQuery< ? , ? >, U extends Object> {
/** Executes the query and get a list of entities as the result. */
List<U> list();
/** Executes the query and get a list of entities as the result. */
List<U> listPage(int firstResult, int maxResults);
}
......@@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY (
);
insert into ACT_GE_PROPERTY
values ('schema.version', '5.12-SNAPSHOT', 1);
values ('schema.version', '5.12', 1);
insert into ACT_GE_PROPERTY
values ('schema.history', 'create(5.12-SNAPSHOT)', 1);
values ('schema.history', 'create(5.12)', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
......
......@@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY (
);
insert into ACT_GE_PROPERTY
values ('schema.version', '5.12-SNAPSHOT', 1);
values ('schema.version', '5.12', 1);
insert into ACT_GE_PROPERTY
values ('schema.history', 'create(5.12-SNAPSHOT)', 1);
values ('schema.history', 'create(5.12)', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
......
......@@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY (
);
insert into ACT_GE_PROPERTY
values ('schema.version', '5.12-SNAPSHOT', 1);
values ('schema.version', '5.12', 1);
insert into ACT_GE_PROPERTY
values ('schema.history', 'create(5.12-SNAPSHOT)', 1);
values ('schema.history', 'create(5.12)', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
......
......@@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
insert into ACT_GE_PROPERTY
values ('schema.version', '5.12-SNAPSHOT', 1);
values ('schema.version', '5.12', 1);
insert into ACT_GE_PROPERTY
values ('schema.history', 'create(5.12-SNAPSHOT)', 1);
values ('schema.history', 'create(5.12)', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
......
......@@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY (
);
insert into ACT_GE_PROPERTY
values ('schema.version', '5.12-SNAPSHOT', 1);
values ('schema.version', '5.12', 1);
insert into ACT_GE_PROPERTY
values ('schema.history', 'create(5.12-SNAPSHOT)', 1);
values ('schema.history', 'create(5.12)', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
......
......@@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY (
);
insert into ACT_GE_PROPERTY
values ('schema.version', '5.12-SNAPSHOT', 1);
values ('schema.version', '5.12', 1);
insert into ACT_GE_PROPERTY
values ('schema.history', 'create(5.12-SNAPSHOT)', 1);
values ('schema.history', 'create(5.12)', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
......
......@@ -275,13 +275,7 @@
</select>
<select id="selectExecutionByNativeQuery" parameterType="java.util.Map" resultMap="executionResultMap">
<if test="resultType == 'LIST_PAGE'">
${limitBefore}
</if>
${sql}
<if test="resultType == 'LIST_PAGE'">
${limitAfter}
</if>
</select>
<select id="selectExecutionCountByNativeQuery" parameterType="java.util.Map" resultType="long">
......
......@@ -143,13 +143,7 @@
</sql>
<select id="selectHistoricActivityInstanceByNativeQuery" parameterType="java.util.Map" resultMap="historicActivityInstanceResultMap">
<if test="resultType == 'LIST_PAGE'">
${limitBefore}
</if>
${sql}
<if test="resultType == 'LIST_PAGE'">
${limitAfter}
</if>
</select>
<select id="selectHistoricActivityInstanceCountByNativeQuery" parameterType="java.util.Map" resultType="long">
......
......@@ -260,13 +260,7 @@
</sql>
<select id="selectHistoricProcessInstanceByNativeQuery" parameterType="java.util.Map" resultMap="historicProcessInstanceResultMap">
<if test="resultType == 'LIST_PAGE'">
${limitBefore}
</if>
${sql}
<if test="resultType == 'LIST_PAGE'">
${limitAfter}
</if>
</select>
<select id="selectHistoricProcessInstanceCountByNativeQuery" parameterType="java.util.Map" resultType="long">
......
......@@ -269,13 +269,7 @@
</sql>
<select id="selectHistoricTaskInstanceByNativeQuery" parameterType="java.util.Map" resultMap="historicTaskInstanceResultMap">
<if test="resultType == 'LIST_PAGE'">
${limitBefore}
</if>
${sql}
<if test="resultType == 'LIST_PAGE'">
${limitAfter}
</if>
</select>
<select id="selectHistoricTaskInstanceCountByNativeQuery" parameterType="java.util.Map" resultType="long">
......
......@@ -328,13 +328,7 @@
</sql>
<select id="selectTaskByNativeQuery" parameterType="java.util.Map" resultMap="taskResultMap">
<if test="resultType == 'LIST_PAGE'">
${limitBefore}
</if>
${sql}
<if test="resultType == 'LIST_PAGE'">
${limitAfter}
</if>
</select>
<select id="selectTaskCountByNativeQuery" parameterType="java.util.Map" resultType="long">
......
......@@ -485,7 +485,6 @@ public class HistoryServiceTest extends PluggableActivitiTestCase {
runtimeService.startProcessInstanceByKey("oneTaskProcess");
assertEquals(1, historyService.createNativeHistoricProcessInstanceQuery().sql("SELECT count(*) FROM " + managementService.getTableName(HistoricProcessInstance.class)).count());
assertEquals(1, historyService.createNativeHistoricProcessInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).list().size());
assertEquals(1, historyService.createNativeHistoricProcessInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).listPage(0, 1).size());
}
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
......@@ -493,7 +492,6 @@ public class HistoryServiceTest extends PluggableActivitiTestCase {
runtimeService.startProcessInstanceByKey("oneTaskProcess");
assertEquals(1, historyService.createNativeHistoricTaskInstanceQuery().sql("SELECT count(*) FROM " + managementService.getTableName(HistoricProcessInstance.class)).count());
assertEquals(1, historyService.createNativeHistoricTaskInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).list().size());
assertEquals(1, historyService.createNativeHistoricTaskInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).listPage(0, 1).size());
}
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
......@@ -501,7 +499,6 @@ public class HistoryServiceTest extends PluggableActivitiTestCase {
runtimeService.startProcessInstanceByKey("oneTaskProcess");
assertEquals(1, historyService.createNativeHistoricActivityInstanceQuery().sql("SELECT count(*) FROM " + managementService.getTableName(HistoricProcessInstance.class)).count());
assertEquals(1, historyService.createNativeHistoricActivityInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).list().size());
assertEquals(1, historyService.createNativeHistoricActivityInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(HistoricProcessInstance.class)).listPage(0, 1).size());
}
}
......@@ -22,6 +22,19 @@ import org.activiti.engine.impl.test.PluggableActivitiTestCase;
*/
public class DeployInvalidXmlTest extends PluggableActivitiTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
processEngineConfiguration.setEnableSafeBpmnXml(true); // Needs to be enabled to test this
}
@Override
protected void tearDown() throws Exception {
processEngineConfiguration.setEnableSafeBpmnXml(false); // set back to default
super.tearDown();
}
public void testDeployNonSchemaConformantXml() {
try {
repositoryService.createDeployment()
......@@ -30,6 +43,7 @@ public class DeployInvalidXmlTest extends PluggableActivitiTestCase {
.getId();
fail();
} catch (ActivitiException e) {
e.printStackTrace();
assertTextPresent("Could not validate XML with BPMN 2.0 XSD", e.getCause().getMessage());
}
......@@ -43,6 +57,7 @@ public class DeployInvalidXmlTest extends PluggableActivitiTestCase {
.getId();
fail();
} catch (ActivitiException e) {
e.printStackTrace();
assertTextPresent("Could not validate XML with BPMN 2.0 XSD", e.getCause().getMessage());
}
}
......
......@@ -1241,11 +1241,6 @@ public class ExecutionQueryTest extends PluggableActivitiTestCase {
assertEquals(executionCount, runtimeService.createNativeExecutionQuery().sql("SELECT * FROM " + managementService.getTableName(Execution.class)).list().size());
assertEquals(executionCount, runtimeService.createNativeExecutionQuery().sql("SELECT count(*) FROM " + managementService.getTableName(Execution.class)).count());
}
public void testNativeQueryPaging() {
assertEquals(5, runtimeService.createNativeExecutionQuery().sql("SELECT * FROM " + managementService.getTableName(Execution.class)).listPage(1, 5).size());
assertEquals(1, runtimeService.createNativeExecutionQuery().sql("SELECT * FROM " + managementService.getTableName(Execution.class)).listPage(2, 1).size());
}
@Deployment(resources={"org/activiti/engine/test/api/runtime/concurrentExecution.bpmn20.xml"})
public void testExecutionQueryWithProcessVariable() {
......
......@@ -1292,9 +1292,4 @@ public class ProcessInstanceQueryTest extends PluggableActivitiTestCase {
assertEquals(piCount, runtimeService.createNativeProcessInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(ProcessInstance.class)).list().size());
assertEquals(piCount, runtimeService.createNativeProcessInstanceQuery().sql("SELECT count(*) FROM " + managementService.getTableName(ProcessInstance.class)).count());
}
public void testNativeQueryPaging() {
assertEquals(5, runtimeService.createNativeProcessInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(ProcessInstance.class)).listPage(0, 5).size());
}
}
......@@ -890,13 +890,6 @@ public class TaskQueryTest extends PluggableActivitiTestCase {
assertEquals(6, taskService.createTaskQuery().orderByTaskId().taskName("testTask").desc().list().size());
}
public void testNativeQueryPaging() {
assertEquals("ACT_RU_TASK", managementService.getTableName(Task.class));
assertEquals("ACT_RU_TASK", managementService.getTableName(TaskEntity.class));
assertEquals(5, taskService.createNativeTaskQuery().sql("SELECT * FROM " + managementService.getTableName(Task.class)).listPage(0, 5).size());
assertEquals(2, taskService.createNativeTaskQuery().sql("SELECT * FROM " + managementService.getTableName(Task.class)).listPage(10, 12).size());
}
public void testNativeQuery() {
assertEquals("ACT_RU_TASK", managementService.getTableName(Task.class));
assertEquals("ACT_RU_TASK", managementService.getTableName(TaskEntity.class));
......
......@@ -28,6 +28,7 @@ import org.activiti.bpmn.model.StartEvent;
import org.activiti.bpmn.model.TimerEventDefinition;
import org.activiti.bpmn.model.UserTask;
import org.activiti.engine.impl.test.PluggableActivitiTestCase;
import org.activiti.engine.impl.util.io.InputStreamSource;
import org.activiti.engine.repository.Deployment;
......@@ -69,7 +70,7 @@ public class EventJavaTest extends PluggableActivitiTestCase {
byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
XMLInputFactory xif = XMLInputFactory.newInstance();
new BpmnXMLConverter().validateModel(xif.createXMLStreamReader(new ByteArrayInputStream(xml)));
new BpmnXMLConverter().validateModel(new InputStreamSource(new ByteArrayInputStream(xml)));
Deployment deployment = repositoryService.createDeployment().name("test").addString("test.bpmn20.xml", new String(xml)).deploy();
repositoryService.deleteDeployment(deployment.getId());
......
......@@ -11,7 +11,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<properties>
......@@ -132,6 +132,7 @@
<groupId>org.vaadin.addons</groupId>
<artifactId>dcharts-widget</artifactId>
<version>0.10.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
......
......@@ -229,14 +229,24 @@ public class EditorProcessDefinitionDetailPanel extends DetailPanel {
DownloadStream ds = null;
try {
BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
byte[] bpmnBytes = null;
String filename = null;
if (SimpleTableEditorConstants.TABLE_EDITOR_CATEGORY.equals(modelData.getCategory())) {
JsonConverter jsonConverter = new JsonConverter();
WorkflowDefinition workflowDefinition = jsonConverter.convertFromJson(editorNode);
filename = workflowDefinition.getName();
WorkflowDefinitionConversion conversion =
ExplorerApp.get().getWorkflowDefinitionConversionFactory().createWorkflowDefinitionConversion(workflowDefinition);
bpmnBytes = conversion.getbpm20Xml().getBytes("utf-8");
} else {
BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
BpmnModel model = jsonConverter.convertToBpmnModel(editorNode);
filename = model.getMainProcess().getId() + ".bpmn20.xml";
bpmnBytes = new BpmnXMLConverter().convertToXML(model);
}
ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
String filename = bpmnModel.getMainProcess().getId() + ".bpmn20.xml";
ds = new DownloadStream(in, "application/xml", filename);
// Need a file download POPUP
ds.setParameter("Content-Disposition", "attachment; filename=" + filename);
......@@ -256,7 +266,6 @@ public class EditorProcessDefinitionDetailPanel extends DetailPanel {
ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
byte[] bpmnBytes = null;
if (SimpleTableEditorConstants.TABLE_EDITOR_CATEGORY.equals(modelData.getCategory())) {
JsonConverter jsonConverter = new JsonConverter();
WorkflowDefinition workflowDefinition = jsonConverter.convertFromJson(modelNode);
......
......@@ -239,14 +239,19 @@ public class DefaultViewManager implements ViewManager, Serializable {
public void showRunReportPage() {
switchView(new RunReportsPage(), ViewManager.MAIN_NAVIGATION_REPORT, ReportsMenuBar.ENTRY_RUN_REPORTS);
}
public void showRunReportPage(String reportId) {
switchView(new RunReportsPage(reportId), ViewManager.MAIN_NAVIGATION_REPORT, ReportsMenuBar.ENTRY_RUN_REPORTS);
}
public void showSavedReportPage() {
switchView(new SavedReportsPage(), ViewManager.MAIN_NAVIGATION_REPORT, ReportsMenuBar.ENTRY_SAVED_REPORTS);
}
@Override
public void showSavedReportPage(String modelId) {
switchView(new SavedReportsPage(modelId), ViewManager.MAIN_NAVIGATION_REPORT, ReportsMenuBar.ENTRY_SAVED_REPORTS);
public void showSavedReportPage(String reportId) {
switchView(new SavedReportsPage(reportId), ViewManager.MAIN_NAVIGATION_REPORT, ReportsMenuBar.ENTRY_SAVED_REPORTS);
}
// Management
......
......@@ -476,5 +476,7 @@ public interface Messages {
String TIME_UNIT_YEAR = "time.unit.year";
String TIME_UNIT_YEARS = "time.unit.years";
String TIME_UNIT_JUST_NOW = "time.unit.just.now";
String MONTH_PREFIX = "month.";
}
......@@ -89,9 +89,11 @@ public interface ViewManager {
void showRunReportPage();
void showRunReportPage(String reportId);
void showSavedReportPage();
void showSavedReportPage(String modelId);
void showSavedReportPage(String reportId);
// Management
......
......@@ -54,7 +54,7 @@ public class LazyLoadingContainer implements Container.Indexed, Container.Sortab
}
public LazyLoadingContainer(LazyLoadingQuery lazyLoadingQuery) {
this(lazyLoadingQuery, 15);
this(lazyLoadingQuery, 30);
}
public boolean addContainerProperty(Object propertyId, Class< ? > type, Object defaultValue) throws UnsupportedOperationException {
......
......@@ -15,7 +15,11 @@ package org.activiti.explorer.demo;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.engine.IdentityService;
......@@ -24,9 +28,13 @@ import org.activiti.engine.RepositoryService;
import org.activiti.engine.identity.Group;
import org.activiti.engine.identity.Picture;
import org.activiti.engine.identity.User;
import org.activiti.engine.impl.ProcessEngineImpl;
import org.activiti.engine.impl.util.ClockUtil;
import org.activiti.engine.impl.util.IoUtil;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.Model;
import org.activiti.engine.runtime.Job;
import org.activiti.engine.task.Task;
import org.apache.commons.io.IOUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.node.ObjectNode;
......@@ -48,23 +56,33 @@ public class DemoDataGenerator implements ModelDataJsonConstants {
protected boolean createDemoUsersAndGroups;
protected boolean createDemoProcessDefinitions;
protected boolean createDemoModels;
protected boolean generateReportData;
public void init() {
this.identityService = processEngine.getIdentityService();
this.repositoryService = processEngine.getRepositoryService();
if (createDemoUsersAndGroups) {
LOGGER.info("Initializing demo groups");
initDemoGroups();
LOGGER.info("Initializing demo users");
initDemoUsers();
}
if (createDemoProcessDefinitions) {
LOGGER.info("Initializing demo process definitions");
initProcessDefinitions();
}
if (createDemoModels) {
LOGGER.info("Initializing demo models");
initModelData();
}
if (generateReportData) {
LOGGER.info("Initializing demo report data");
generateReportData();
}
}
public void setProcessEngine(ProcessEngine processEngine) {
......@@ -82,6 +100,10 @@ public class DemoDataGenerator implements ModelDataJsonConstants {
public void setCreateDemoModels(boolean createDemoModels) {
this.createDemoModels = createDemoModels;
}
public void setGenerateReportData(boolean generateReportData) {
this.generateReportData = generateReportData;
}
protected void initDemoGroups() {
String[] assignmentGroups = new String[] {"management", "sales", "marketing", "engineering"};
......@@ -187,8 +209,88 @@ public class DemoDataGenerator implements ModelDataJsonConstants {
.name(reportDeploymentName)
.addClasspathResource("org/activiti/explorer/demo/process/reports/taskDurationForProcessDefinition.bpmn20.xml")
.addClasspathResource("org/activiti/explorer/demo/process/reports/processInstanceOverview.bpmn20.xml")
.addClasspathResource("org/activiti/explorer/demo/process/reports/helpdeskFirstLineVsEscalated.bpmn20.xml")
.addClasspathResource("org/activiti/explorer/demo/process/reports/employeeProductivity.bpmn20.xml")
.deploy();
}
}
protected void generateReportData() {
if (generateReportData) {
// Report data is generated in background thread
Thread thread = new Thread(new Runnable() {
public void run() {
// We need to temporarily disable the job executor or it would interfere with the process execution
((ProcessEngineImpl) processEngine).getProcessEngineConfiguration().getJobExecutor().shutdown();
Random random = new Random();
Date now = new Date(new Date().getTime() - (24 * 60 * 60 * 1000));
ClockUtil.setCurrentTime(now);
for (int i=0; i<50; i++) {
if (random.nextBoolean()) {
processEngine.getRuntimeService().startProcessInstanceByKey("fixSystemFailure");
}
if (random.nextBoolean()) {
processEngine.getIdentityService().setAuthenticatedUserId("kermit");
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("customerName", "testCustomer");
variables.put("details", "Looks very interesting!");
variables.put("notEnoughInformation", false);
processEngine.getRuntimeService().startProcessInstanceByKey("reviewSaledLead", variables);
}
if (random.nextBoolean()) {
processEngine.getRuntimeService().startProcessInstanceByKey("escalationExample");
}
if (random.nextInt(100) < 20) {
now = new Date(now.getTime() - ((24 * 60 * 60 * 1000) - (60 * 60 * 1000)));
ClockUtil.setCurrentTime(now);
}
}
List<Job> jobs = processEngine.getManagementService().createJobQuery().list();
for (int i=0; i<jobs.size()/2; i++) {
ClockUtil.setCurrentTime(jobs.get(i).getDuedate());
processEngine.getManagementService().executeJob(jobs.get(i).getId());
}
List<Task> tasks = processEngine.getTaskService().createTaskQuery().list();
while (tasks.size() > 0) {
for (Task task : tasks) {
if (task.getAssignee() == null) {
String assignee = random.nextBoolean() ? "kermit" : "fozzie";
processEngine.getTaskService().claim(task.getId(), assignee);
}
ClockUtil.setCurrentTime(new Date(task.getCreateTime().getTime() + random.nextInt(60 * 60 * 1000)));
processEngine.getTaskService().complete(task.getId());
}
tasks = processEngine.getTaskService().createTaskQuery().list();
}
ClockUtil.reset();
((ProcessEngineImpl) processEngine).getProcessEngineConfiguration().getJobExecutor().start();
LOGGER.info("Demo report data generated");
}
});
thread.start();
}
}
protected void initModelData() {
......
......@@ -69,6 +69,7 @@ public class NavigatorManager implements InitializingBean, Serializable {
addNavigator(new AdministrationNavigator());
addNavigator(new MyProcessesNavigator());
addNavigator(new SavedReportNavigator());
addNavigator(new ReportNavigator());
}
}
......@@ -28,11 +28,13 @@ import org.activiti.engine.repository.ProcessDefinition;
*/
public class ReportingUtil {
public static Connection getCurrentDatabaseConnection() {
return Context.getCommandContext().getDbSqlSession().getSqlSession().getConnection();
}
public static ResultSet executeSelectSqlQuery(String sql) throws Exception {
Connection connection = getCurrentDatabaseConnection();
Statement select = connection.createStatement();
return select.executeQuery(sql);
......
......@@ -71,6 +71,8 @@ public abstract class AbstractTablePage extends AbstractPage {
}
table.setCurrentPageFirstItemIndex(pageIndex);
selectElement(selectedIndex);
} else {
table.setCurrentPageFirstItemIndex(0);
}
}
......
......@@ -85,7 +85,7 @@ public class DatabaseDetailPanel extends DetailPanel {
protected void addTableData() {
LazyLoadingQuery lazyLoadingQuery = new TableDataQuery(tableName, managementService);
LazyLoadingContainer lazyLoadingContainer = new LazyLoadingContainer(lazyLoadingQuery, 10);
LazyLoadingContainer lazyLoadingContainer = new LazyLoadingContainer(lazyLoadingQuery, 30);
if (lazyLoadingContainer.size() > 0) {
......
......@@ -67,7 +67,7 @@ public class DeploymentPage extends ManagementPage {
final Table deploymentTable = new Table();
LazyLoadingQuery deploymentListQuery = new DeploymentListQuery(deploymentFilter);
deploymentListContainer = new LazyLoadingContainer(deploymentListQuery, 10);
deploymentListContainer = new LazyLoadingContainer(deploymentListQuery, 30);
deploymentTable.setContainerDataSource(deploymentListContainer);
// Listener to change right panel when clicked on a deployment
......
......@@ -352,7 +352,7 @@ public class GroupDetailPanel extends DetailPanel implements MemberShipChangeLis
membersTable.setSelectable(false);
membersTable.setSortDisabled(false);
LazyLoadingContainer container = new LazyLoadingContainer(query, 10);
LazyLoadingContainer container = new LazyLoadingContainer(query, 30);
membersTable.setContainerDataSource(container);
membersTable.addContainerProperty("id", Button.class, null);
......
......@@ -73,7 +73,7 @@ public class GroupPage extends ManagementPage {
groupTable.setSizeFull();
groupListQuery = new GroupListQuery();
groupListContainer = new LazyLoadingContainer(groupListQuery, 20);
groupListContainer = new LazyLoadingContainer(groupListQuery, 30);
groupTable.setContainerDataSource(groupListContainer);
// Column headers
......
......@@ -76,7 +76,7 @@ public class GroupSelectionPopupWindow extends PopupWindow {
addComponent(groupTable);
GroupSelectionQuery query = new GroupSelectionQuery(identityService, userId);
LazyLoadingContainer container = new LazyLoadingContainer(query, 10);
LazyLoadingContainer container = new LazyLoadingContainer(query, 30);
groupTable.setContainerDataSource(container);
groupTable.addContainerProperty("id", String.class, null);
......
......@@ -389,7 +389,7 @@ public class UserDetailPanel extends DetailPanel implements MemberShipChangeList
groupTable.setWidth(100, UNITS_PERCENTAGE);
groupLayout.addComponent(groupTable);
groupContainer = new LazyLoadingContainer(groupsForUserQuery, 10);
groupContainer = new LazyLoadingContainer(groupsForUserQuery, 30);
groupTable.setContainerDataSource(groupContainer);
groupTable.addContainerProperty("id", Button.class, null);
......
......@@ -65,7 +65,7 @@ public class UserPage extends ManagementPage {
userTable = new Table();
userListQuery = new UserListQuery();
userListContainer = new LazyLoadingContainer(userListQuery, 20);
userListContainer = new LazyLoadingContainer(userListQuery, 30);
userTable.setContainerDataSource(userListContainer);
// Column headers
......
......@@ -65,7 +65,7 @@ public class JobPage extends ManagementPage {
final Table jobTable = new Table();
LazyLoadingQuery jobListQuery = new JobListQuery();
jobListContainer = new LazyLoadingContainer(jobListQuery, 10);
jobListContainer = new LazyLoadingContainer(jobListQuery, 30);
jobTable.setContainerDataSource(jobListContainer);
// Listener to change right panel when clicked on a deployment
......
......@@ -101,7 +101,7 @@ public class ProcessDefinitionPage extends AbstractTablePage {
LazyLoadingQuery lazyLoadingQuery = new ProcessDefinitionListQuery(repositoryService, definitionFilter);
this.processDefinitionContainer = new LazyLoadingContainer(lazyLoadingQuery, 10);
this.processDefinitionContainer = new LazyLoadingContainer(lazyLoadingQuery, 30);
processDefinitionTable.setContainerDataSource(processDefinitionContainer);
// Listener to change right panel when clicked on a task
......
......@@ -71,7 +71,7 @@ public abstract class ProcessInstancePage extends AbstractTablePage {
});
this.lazyLoadingQuery = createLazyLoadingQuery();
this.processInstanceListContainer = new LazyLoadingContainer(lazyLoadingQuery, 10);
this.processInstanceListContainer = new LazyLoadingContainer(lazyLoadingQuery, 30);
processInstanceTable.setContainerDataSource(processInstanceListContainer);
// Create column header
......
......@@ -20,7 +20,6 @@ import org.activiti.explorer.Messages;
import org.activiti.explorer.ui.process.simple.editor.listener.AddPropertyClickListener;
import org.activiti.explorer.ui.process.simple.editor.listener.DeletePropertyClickListener;
import com.vaadin.data.Item;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
......@@ -87,10 +86,7 @@ public class PropertyTable extends Table {
newItem.getItemProperty(ID_PROPERTY_NAME).setValue(propertyName == null ? DEFAULT_PROPERTY_NAME : propertyName);
// type
ComboBox typeComboBox = new ComboBox("", Arrays.asList(
i18nManager.getMessage(Messages.PROCESS_EDITOR_PROPERTY_TYPE_TEXT),
i18nManager.getMessage(Messages.PROCESS_EDITOR_PROPERTY_TYPE_NUMBER),
i18nManager.getMessage(Messages.PROCESS_EDITOR_PROPERTY_TYPE_DATE)));
ComboBox typeComboBox = new ComboBox("", Arrays.asList("text", "number", "date"));
typeComboBox.setNullSelectionAllowed(false);
if (propertyType == null) {
typeComboBox.setValue(typeComboBox.getItemIds().iterator().next());
......
......@@ -14,27 +14,30 @@ package org.activiti.explorer.ui.reports;
import org.dussan.vaadin.dcharts.DCharts;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.Reindeer;
/**
* @author Joram Barrez
*/
public class ChartComponent extends VerticalLayout {
private static final long serialVersionUID = 1L;
public ChartComponent(String description, String errorMessage) {
this(description, null, errorMessage);
}
public ChartComponent(String description, DCharts dCharts) {
this(description, dCharts, null);
public ChartComponent(String title) {
if (title != null) {
Label label = new Label(title);
label.addStyleName(Reindeer.LABEL_H2);
addComponent(label);
}
}
public ChartComponent(String description, DCharts dCharts, String errorMessage) {
public void addChart(String description, Component chart, String errorMessage) {
addComponent(new Label("&nbsp;", Label.CONTENT_XHTML));
addComponent(new Label("&nbsp;", Label.CONTENT_XHTML));
......@@ -43,18 +46,21 @@ public class ChartComponent extends VerticalLayout {
Label label = new Label(description);
label.addStyleName(Reindeer.LABEL_H2);
addComponent(label);
addComponent(new Label("&nbsp;", Label.CONTENT_XHTML));
}
// Chart
if (dCharts != null) {
dCharts.setWidth(600, UNITS_PIXELS);
dCharts.setHeight(500, UNITS_PIXELS);
addComponent(dCharts);
dCharts.show();
if (chart != null) {
if (chart instanceof DCharts) {
// DCharts doesn't know how to size itself
chart.setWidth(600, UNITS_PIXELS);
chart.setHeight(450, UNITS_PIXELS);
((DCharts) chart).show();
}
addComponent(chart);
}
// Error message
if (errorMessage != null) {
Label errorLabel = new Label(errorMessage);
......
......@@ -17,21 +17,33 @@ import java.util.Iterator;
import org.activiti.engine.ActivitiException;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.Messages;
import org.activiti.explorer.ui.mainlayout.ExplorerLayout;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.dussan.vaadin.dcharts.DCharts;
import org.dussan.vaadin.dcharts.base.elements.XYaxis;
import org.dussan.vaadin.dcharts.base.elements.XYseries;
import org.dussan.vaadin.dcharts.base.renderers.MarkerRenderer;
import org.dussan.vaadin.dcharts.data.DataSeries;
import org.dussan.vaadin.dcharts.data.Ticks;
import org.dussan.vaadin.dcharts.metadata.LegendPlacements;
import org.dussan.vaadin.dcharts.metadata.XYaxes;
import org.dussan.vaadin.dcharts.metadata.renderers.AxisRenderers;
import org.dussan.vaadin.dcharts.metadata.renderers.LabelRenderers;
import org.dussan.vaadin.dcharts.metadata.renderers.SeriesRenderers;
import org.dussan.vaadin.dcharts.metadata.styles.MarkerStyles;
import org.dussan.vaadin.dcharts.options.Axes;
import org.dussan.vaadin.dcharts.options.AxesDefaults;
import org.dussan.vaadin.dcharts.options.Highlighter;
import org.dussan.vaadin.dcharts.options.Legend;
import org.dussan.vaadin.dcharts.options.Options;
import org.dussan.vaadin.dcharts.options.Series;
import org.dussan.vaadin.dcharts.options.SeriesDefaults;
import com.vaadin.ui.Component;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
/**
* @author Joram Barrez
*/
......@@ -39,39 +51,97 @@ public class ChartGenerator {
public static final String CHART_TYPE_BAR_CHART = "barChart";
public static final String CHART_TYPE_PIE_CHART = "pieChart";
public static final String CHART_TYPE_LINE_CHART = "lineChart";
public static final String CHART_TYPE_LIST = "list";
public static ChartComponent generateChart(byte[] reportData) {
// Convert json to pojo
JsonNode jsonNode = convert(reportData);
JsonNode dataNode = jsonNode.get("data");
// Retrieve data
String description = jsonNode.get("description").getTextValue();
String[] names = new String[dataNode.size()];
Number[] values = new Number[dataNode.size()];
// Title
JsonNode titleNode = jsonNode.get("title");
String title = null;
if (titleNode != null) {
title = titleNode.getTextValue();
}
ChartComponent chartComponent = new ChartComponent(title);
int index = 0;
Iterator<String> fieldIterator = dataNode.getFieldNames();
while(fieldIterator.hasNext()) {
String field = fieldIterator.next();
names[index] = field;
values[index] = dataNode.get(field).getNumberValue();
index++;
// Retrieve data sets
JsonNode datasetsNode = jsonNode.get("datasets");
// If no data was returned
if (datasetsNode.size() == 0) {
chartComponent.addChart(null, null, ExplorerApp.get().getI18nManager().getMessage(Messages.REPORTING_ERROR_NOT_ENOUGH_DATA));
return chartComponent;
}
// Generate chart (or 'no data' message)
if (names.length > 0) {
DCharts chart = createChart(jsonNode, names, values);
return new ChartComponent(description, chart);
} else {
return new ChartComponent(description, ExplorerApp.get().getI18nManager().getMessage(Messages.REPORTING_ERROR_NOT_ENOUGH_DATA));
if (datasetsNode != null && datasetsNode.isArray()) {
Iterator<JsonNode> dataIterator = datasetsNode.iterator();
while (dataIterator.hasNext()) {
JsonNode datasetNode = dataIterator.next();
JsonNode descriptionNode = datasetNode.get("description");
String description = null;
if (descriptionNode != null) {
description = descriptionNode.getTextValue();
}
JsonNode dataNode = datasetNode.get("data");
if (dataNode == null || dataNode.size() == 0) {
chartComponent.addChart(description, null, ExplorerApp.get().getI18nManager().getMessage(Messages.REPORTING_ERROR_NOT_ENOUGH_DATA));
} else {
String[] names = new String[dataNode.size()];
Number[] values = new Number[dataNode.size()];
int index = 0;
Iterator<String> fieldIterator = dataNode.getFieldNames();
while(fieldIterator.hasNext()) {
String field = fieldIterator.next();
names[index] = field;
values[index] = dataNode.get(field).getNumberValue();
index++;
}
// Generate chart (or 'no data' message)
if (names.length > 0) {
Component chart = createChart(datasetNode, names, values);
chartComponent.addChart(description, chart, null);
} else {
chartComponent.addChart(description, null, ExplorerApp.get().getI18nManager().getMessage(Messages.REPORTING_ERROR_NOT_ENOUGH_DATA));
}
}
}
}
return chartComponent;
}
protected static DCharts createChart(JsonNode jsonNode, String[] names, Number[] values) {
String type = jsonNode.get("type").getTextValue();
DCharts chart = null;
protected static Component createChart(JsonNode dataNode, String[] names, Number[] values) {
String type = dataNode.get("type").getTextValue();
JsonNode xAxisNode = dataNode.get("xaxis");
String xAxis = null;
if (xAxisNode != null) {
xAxis = xAxisNode.getTextValue();
}
JsonNode yAxisNode = dataNode.get("yaxis");
String yAxis = null;
if (yAxisNode != null) {
yAxis = yAxisNode.getTextValue();
}
Component chart = null;
if (CHART_TYPE_BAR_CHART.equals(type)) {
DataSeries dataSeries = new DataSeries().add((Object[]) values);
......@@ -104,7 +174,66 @@ public class ChartGenerator {
options.setHighlighter(highlighter);
chart = new DCharts().setDataSeries(dataSeries).setOptions(options);
} else if (CHART_TYPE_LINE_CHART.equals(type)) {
AxesDefaults axesDefaults = new AxesDefaults().setLabelRenderer(LabelRenderers.CANVAS);
Axes axes = new Axes()
.addAxis(new XYaxis().setLabel(xAxis != null ? xAxis : "").setMin(names[0]).setMax(names[values.length - 1]).setDrawMajorTickMarks(true))
.addAxis(new XYaxis(XYaxes.Y).setLabel(yAxis != null ? yAxis : "").setDrawMajorTickMarks(true));
Options options = new Options().setAxesDefaults(axesDefaults).setAxes(axes);
DataSeries dataSeries = new DataSeries().newSeries();
for (int i=0; i<names.length; i++) {
// if (parseLong(names[i]) != null) {
// dataSeries.add(parseLong(names[i]), values[i]);
// } else if (parseDouble(names[i]) != null) {
// dataSeries.add(parseDouble(names[i]), values[i]);
// } else {
// dataSeries.add(names[i], values[i]);
// }
dataSeries.add(names[i], values[i]);
}
Series series = new Series().addSeries(
new XYseries().setShowLine(true).setMarkerOptions(new MarkerRenderer().setShadow(true).setSize(7).setStyle(MarkerStyles.CIRCLE)));
options.setSeries(series);
options.setAnimate(true);
options.setAnimateReplot(true);
Highlighter highlighter = new Highlighter().setShow(true);
options.setHighlighter(highlighter);
chart = new DCharts().setDataSeries(dataSeries).setOptions(options);
} else if (CHART_TYPE_LIST.equals(type)) {
GridLayout grid = new GridLayout(2, names.length);
grid.setSpacing(true);
for (int i=0; i<names.length; i++) {
String name = names[i];
Label nameLabel = new Label(name);
nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
grid.addComponent(nameLabel, 0, i);
Number value = values[i];
Label valueLabel = new Label(value + "");
grid.addComponent(valueLabel, 1, i);
}
chart = grid;
}
if (chart instanceof DCharts) {
// Needed, otherwise the chart will not be shown
((DCharts) chart).show();
}
return chart;
}
......@@ -117,6 +246,22 @@ public class ChartGenerator {
}
}
protected static Long parseLong(String s) {
try {
Long value = Long.parseLong(s);
return value;
} catch (NumberFormatException e) {
return null;
}
}
protected static Double parseDouble(String s) {
try {
Double value = Double.parseDouble(s);
return value;
} catch (NumberFormatException e) {
return null;
}
}
}
......@@ -15,15 +15,11 @@ package org.activiti.explorer.ui.reports;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.data.LazyLoadingContainer;
import org.activiti.explorer.data.LazyLoadingQuery;
import org.activiti.explorer.navigation.ActiveProcessDefinitionNavigator;
import org.activiti.explorer.navigation.SuspendedProcessDefinitionNavigator;
import org.activiti.explorer.navigation.ReportNavigator;
import org.activiti.explorer.navigation.UriFragment;
import org.activiti.explorer.ui.AbstractTablePage;
import org.activiti.explorer.ui.Images;
import org.activiti.explorer.ui.custom.ToolBar;
import org.activiti.explorer.ui.management.processdefinition.SuspendedProcessDefinitionDetailPanel;
import org.activiti.explorer.ui.management.processdefinition.SuspendedProcessDefinitionListQuery;
import org.activiti.explorer.ui.management.processdefinition.SuspendedProcessDefinitionPage;
import org.activiti.explorer.ui.util.ThemeImageColumnGenerator;
import com.vaadin.data.Item;
......@@ -39,10 +35,20 @@ public class RunReportsPage extends AbstractTablePage {
private static final long serialVersionUID = -5259331126409002997L;
protected String reportId;
protected Table reportTable;
protected LazyLoadingQuery reportListQuery;
protected LazyLoadingContainer reportListContainer;
public RunReportsPage(String reportId) {
this.reportId = reportId;
}
public RunReportsPage() {
this(null);
}
protected Table createList() {
reportTable = new Table();
......@@ -69,13 +75,13 @@ public class RunReportsPage extends AbstractTablePage {
setDetailComponent(new ReportDetailPanel(processDefinitionId, RunReportsPage.this));
// Update URL
// ExplorerApp.get().setCurrentUriFragment(
// new UriFragment(ActiveProcessDefinitionNavigator.ACTIVE_PROC_DEF_URI_PART, processDefinitionId));
ExplorerApp.get().setCurrentUriFragment(
new UriFragment(ReportNavigator.REPORT_URI_PART, processDefinitionId));
} else {
// Nothing selected
setDetailComponent(null);
ExplorerApp.get().setCurrentUriFragment(new UriFragment(ActiveProcessDefinitionNavigator.ACTIVE_PROC_DEF_URI_PART));
ExplorerApp.get().setCurrentUriFragment(new UriFragment(ReportNavigator.REPORT_URI_PART));
}
}
......@@ -87,5 +93,16 @@ public class RunReportsPage extends AbstractTablePage {
protected ToolBar createMenuBar() {
return new ReportsMenuBar();
}
@Override
protected void initUi() {
super.initUi();
if(reportId != null) {
selectElement(reportListContainer.getIndexForObjectId(reportId));
} else {
selectElement(0);
}
}
}
......@@ -72,6 +72,7 @@ public class SaveReportPopupWindow extends PopupWindow {
fieldLayout.addComponent(new Label(i18nManager.getMessage(Messages.REPORTING_SAVE_POPUP_NAME)));
nameField = new TextField();
nameField.setWidth(250, UNITS_PIXELS);
nameField.focus();
fieldLayout.addComponent(nameField);
}
......
......@@ -20,6 +20,7 @@ import org.activiti.engine.HistoryService;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricProcessInstanceQuery;
import org.activiti.engine.impl.identity.Authentication;
import org.activiti.explorer.data.AbstractLazyLoadingQuery;
import com.vaadin.data.Item;
......@@ -58,6 +59,7 @@ public class SavedReportsListQuery extends AbstractLazyLoadingQuery {
// using variables to find all completed reports. This is more robust and performant
return historyService.createHistoricProcessInstanceQuery()
.finished()
.startedBy(Authentication.getAuthenticatedUserId())
.variableValueNotEquals("reportData", null);
}
......
......@@ -93,7 +93,7 @@ public abstract class TaskPage extends AbstractTablePage {
taskTable.addListener(getListSelectionListener());
this.lazyLoadingQuery = createLazyLoadingQuery();
this.taskListContainer = new LazyLoadingContainer(lazyLoadingQuery, 10);
this.taskListContainer = new LazyLoadingContainer(lazyLoadingQuery, 30);
taskTable.setContainerDataSource(taskListContainer);
// Create column header
......
......@@ -262,7 +262,7 @@ process.delete.popup.message = Are you sure you want to delete this model from t
process.delete.popup.delete.button = Delete
#Reporting menu
reporting.menu.run.reports = Run reports
reporting.menu.run.reports = Generate reports
reporting.menu.saved.reports = Saved reports
reporting.save.popup.caption = Save this report
reporting.error.not.enough.data = Not enough data to generate this report
......@@ -449,3 +449,16 @@ time.unit.years={0} years
time.unit.future={0} from now
time.unit.past={0} ago
time.unit.just.now=Just now
month.0=January
month.1=February
month.2=March
month.3=April
month.4=May
month.5=June
month.6=July
month.7=August
month.8=September
month.9=October
month.10=November
month.11=December
\ No newline at end of file
......@@ -262,8 +262,14 @@ process.delete.popup.message = \u60a8\u786e\u5b9a\u4ece\u5f53\u524d\u5de5\u4f5c\
process.delete.popup.delete.button = \u5220\u9664
#Reporting menu
reporting.menu.run.reports = Run reports
reporting.menu.saved.reports = \u4fdd\u5b58\u7684\u62a5\u8868
reporting.menu.run.reports = \u8fd0\u884c\u62a5\u8868
reporting.menu.saved.reports = \u5df2\u4fdd\u5b58\u62a5\u8868
reporting.save.popup.caption = \u4fdd\u5b58
reporting.save.popup.name = \u540d\u79f0
reporting.save.popup.name.exists = \u540d\u79f0\u9519\u8bef: \u5df2\u7ecf\u5b58\u5728\u540c\u540d\u7684\u62a5\u8868\u3002
reporting.save.popup.name.too.long = \u9519\u8bef\u7684\u540d\u79f0: \u957f\u5ea6\u8d85\u8fc7\u9650\u5236\u3002
reporting.save.popup.name.empty = \u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a
reporting.report.created = \u5df2\u521b\u5efa: {0}
# Management menu
management.menu.database = \u6570\u636e\u5e93
......
......@@ -10,7 +10,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<dependencies>
......
......@@ -11,7 +11,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<properties>
......@@ -84,10 +84,29 @@
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-transcoder</artifactId>
<!-- Need to exclude this old version of xml-apis, as it causes exceptions on older JDK versions -->
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
<exclusion>
<artifactId>xalan</artifactId>
<groupId>xalan</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-bridge</artifactId>
<!-- Need to exclude this old version of xalan, as it causes exceptions on older JDK versions -->
<exclusions>
<exclusion>
<artifactId>xalan</artifactId>
<groupId>xalan</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
......
......@@ -10,7 +10,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
......
......@@ -11,7 +11,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<build>
......
......@@ -10,7 +10,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<properties>
......
......@@ -10,7 +10,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<dependencies>
......
......@@ -49,7 +49,7 @@ public class JsonConverter {
public static final String HUMAN_STEP_NAME = "name";
public static final String HUMAN_STEP_DESCRIPTION = "description";
public static final String HUMAN_STEP_ASSIGNEE = "assignee";
public static final String HUMAN_STEP_ASSIGNEE_TYPE = "type";
public static final String HUMAN_STEP_ASSIGNEE_TYPE = "assignee-type";
public static final String HUMAN_STEP_ASSIGNEE_TYPE_USER = "user";
public static final String HUMAN_STEP_ASSIGNEE_USER = "user";
public static final String HUMAN_STEP_ASSIGNEE_TYPE_USERS = "users";
......@@ -334,15 +334,22 @@ public class JsonConverter {
// Assignee
if (humanStepDefinition.getAssignee() != null) {
humanStepNode.put(HUMAN_STEP_ASSIGNEE, humanStepDefinition.getAssignee());
ObjectNode assigneeNode = objectMapper.createObjectNode();
assigneeNode.put(HUMAN_STEP_ASSIGNEE_USER, humanStepDefinition.getAssignee());
assigneeNode.put(HUMAN_STEP_ASSIGNEE_TYPE, HUMAN_STEP_ASSIGNEE_TYPE_USER);
humanStepNode.put(HUMAN_STEP_ASSIGNEE, assigneeNode);
}
// Candidate groups
if (humanStepDefinition.getCandidateGroups() != null && humanStepDefinition.getCandidateGroups().size() > 0) {
ObjectNode assigneeNode = objectMapper.createObjectNode();
ArrayNode groups = humanStepNode.putArray(HUMAN_STEP_GROUPS);
for (String group : humanStepDefinition.getCandidateGroups()) {
groups.add(group);
}
assigneeNode.put(HUMAN_STEP_ASSIGNEE_GROUPS, groups);
assigneeNode.put(HUMAN_STEP_ASSIGNEE_TYPE, HUMAN_STEP_ASSIGNEE_TYPE_GROUPS);
humanStepNode.put(HUMAN_STEP_ASSIGNEE, assigneeNode);
}
// Form
......
......@@ -123,11 +123,11 @@ public abstract class BaseStepDefinitionConverter<U extends StepDefinition, T> i
formProperty.setRequired(propertyDefinition.isRequired());
String type = null;
if (DefaultFormPropertyTypes.NUMBER.equals(propertyDefinition.getType())) {
if (DefaultFormPropertyTypes.NUMBER.equalsIgnoreCase(propertyDefinition.getType())) {
type = "long";
} else if (DefaultFormPropertyTypes.DATE.equals(propertyDefinition.getType())) {
} else if (DefaultFormPropertyTypes.DATE.equalsIgnoreCase(propertyDefinition.getType())) {
type = "date";
} else if (DefaultFormPropertyTypes.LIST.equals(propertyDefinition.getType())) {
} else if (DefaultFormPropertyTypes.LIST.equalsIgnoreCase(propertyDefinition.getType())) {
type = "enum";
......@@ -141,8 +141,8 @@ public abstract class BaseStepDefinitionConverter<U extends StepDefinition, T> i
formValues.add(formValue);
}
}
} else if (DefaultFormPropertyTypes.TEXT.equals(propertyDefinition.getType())){
type = "text";
} else if (DefaultFormPropertyTypes.TEXT.equalsIgnoreCase(propertyDefinition.getType())){
type = "string";
} else {
type = propertyDefinition.getType(); // just copy whatever the user provided
}
......
......@@ -17,7 +17,7 @@ package org.activiti.workflow.simple.converter.step;
*/
public interface DefaultFormPropertyTypes {
String TEXT = "string";
String TEXT = "text";
String NUMBER = "number";
......
......@@ -9,7 +9,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<dependencies>
......
......@@ -11,7 +11,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<properties>
......@@ -132,7 +132,7 @@
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
......@@ -141,7 +141,7 @@
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<executions>
<execution>
<phase>prepare-package</phase>
......@@ -175,6 +175,12 @@
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-modeler</artifactId>
<exclusions>
<exclusion>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
......@@ -208,6 +214,11 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
</dependency>
<!-- Vaadin addons -->
<!-- Must be defined both in activiti-explorer and activiti-webapp-explorer, as otherwise the gwt compiler won't find it -->
<dependency>
......
......@@ -11,7 +11,7 @@
<startEvent id="startevent1" name="Start" />
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="generateDataset" />
<scriptTask id="generateDataset" name="Execute script" scriptFormat="JavaScript" activiti:autoStoreVariables="false">
<scriptTask id="generateDataset" name="Execute script" scriptFormat="js" activiti:autoStoreVariables="false">
<script><![CDATA[
importPackage(java.sql);
......@@ -20,22 +20,53 @@
var result = ReportingUtil.executeSelectSqlQuery("SELECT PD.NAME_, PD.VERSION_ , count(*) FROM ACT_HI_PROCINST PI inner join ACT_RE_PROCDEF PD on PI.PROC_DEF_ID_ = PD.ID_ group by PROC_DEF_ID_");
/* JDK 7 only
var reportData = {};
reportData.type = "pieChart";
reportData.description = "Process instance overview (" + new java.util.Date() + ")";
reportData.data = {};
reportData.datasets = [];
var dataset = {};
dataset.type = "pieChart";
dataset.description = "Process instance overview (" + new java.util.Date() + ")";
dataset.data = {};
while (result.next()) { // process results one row at a time
var name = result.getString(1);
var version = result.getLong(2)
var count = result.getLong(2);
reportData.data[name + " (v" + version + ")"] = count;
var count = result.getLong(3);
dataset.data[name + " (v" + version + ")"] = count;
}
reportData.datasets.push(dataset);
var dataset2 = {};
dataset2.type="list";
dataset2.description = "List overview of process instances";
dataset2.data = dataset.data;
reportData.datasets.push(dataset2);
// Limitation! Cannot store / retrieve native json variables over multiple steps! TODO: discuss!
// We want to store the results as bytes as the string size is limited in the variables table
execution.setVariable("reportData", new java.lang.String(JSON.stringify(reportData)).getBytes("UTF-8"));
*/
/* JDK 6+ */
var reportData = new ReportData;
var dataset = reportData.newDataset();
dataset.type = "pieChart";
dataset.description = "Process instance overview (" + new java.util.Date() + ")";
while (result.next()) { // process results one row at a time
var name = result.getString(1);
var version = result.getLong(2);
var count = result.getLong(3);
dataset.add(name + " (v" + version + ")", count);
}
var dataset2 = reportData.newDataset();
dataset2.type="list";
dataset2.description = "List overview of process instances";
dataset2.data = dataset.data;
execution.setVariable("reportData", reportData.toBytes());
]]></script>
</scriptTask>
<sequenceFlow id="flow3" sourceRef="generateDataset" targetRef="theEnd" />
......
......@@ -19,7 +19,7 @@
</startEvent>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="generateDataset" />
<scriptTask id="generateDataset" name="Execute script" scriptFormat="JavaScript" activiti:autoStoreVariables="false">
<scriptTask id="generateDataset" name="Execute script" scriptFormat="js" activiti:autoStoreVariables="false">
<script><![CDATA[
importPackage(java.sql);
......@@ -30,21 +30,42 @@
var result = ReportingUtil.executeSelectSqlQuery("select NAME_, avg(DURATION_) from ACT_HI_TASKINST where PROC_DEF_ID_ = '" + processDefinition.getId() + "' and END_TIME_ is not null group by NAME_");
/* JDK 7
var reportData = {};
reportData.type = String(execution.getVariable("chartType"));
reportData.description = "Average task duration (in seconds) for process definition '" + processDefinition.getName() + "' (version " + processDefinition.getVersion() + ")";
reportData.data = {};
reportData.datasets = [];
var dataset = {};
dataset.type = String(execution.getVariable("chartType"));
dataset.description = "Average task duration (in seconds) for process definition '" + processDefinition.getName() + "' (version " + processDefinition.getVersion() + ")";
dataset.data = {};
while (result.next()) { // process results one row at a time
var name = result.getString(1);
var val = result.getLong(2) / 1000;
reportData.data[name] = val;
dataset.data[name] = val;
}
reportData.datasets.push(dataset);
// Limitation! Cannot store / retrieve native json variables over multiple steps! TODO: discuss!
// We want to store the results as bytes as the string size is limited in the variables table
execution.setVariable("reportData", new java.lang.String(JSON.stringify(reportData)).getBytes("UTF-8"));
*/
/* JDK 6+ */
var reportData = new ReportData();
var dataset = reportData.newDataset();
dataset.type = execution.getVariable("chartType");
dataset.description = "Average task duration (in seconds) for process definition '" + processDefinition.getName() + "' (version " + processDefinition.getVersion() + ")";
while (result.next()) { // process results one row at a time
var name = result.getString(1);
var val = result.getLong(2) / 1000;
dataset.add(name, val);
}
execution.setVariable("reportData", reportData.toBytes());
]]></script>
</scriptTask>
<sequenceFlow id="flow3" sourceRef="generateDataset" targetRef="theEnd" />
......
function org_activiti_explorer_CustomWidgetset(){var O='',vb='" for "gwt:onLoadErrorFn"',tb='" for "gwt:onPropertyErrorFn"',hb='"><\/script>',Y='#',Vb='.cache.html',$='/',Ob='2BADF336E827CE547D0FEF5C74C2A013',Pb='419702D66820E68BE89501603AAB106F',Qb='5B54A23C6184FE8742EF42E2474A2CE5',Rb='8C1AF52665FB58E2F0925361E8CDE162',Ub=':',nb='::',bc='<script defer="defer">org_activiti_explorer_CustomWidgetset.onInjectionDone(\'org.activiti.explorer.CustomWidgetset\')<\/script>',gb='<script id="',qb='=',Z='?',sb='Bad handler "',Sb='D391FCC6F662E7CD49FB7E5D0ABAF41D',ac='DOMContentLoaded',Tb='F6EDA597217FB283EE695EFC6E2195F3',ib='SCRIPT',fb='__gwt_marker_org.activiti.explorer.CustomWidgetset',jb='base',bb='baseUrl',S='begin',R='bootstrap',ab='clear.cache.gif',pb='content',Wb='dcharts/styles.css',X='end',Ib='gecko',Jb='gecko1_8',T='gwt.codesvr=',U='gwt.hosted=',V='gwt.hybrid',ub='gwt:onLoadErrorFn',rb='gwt:onPropertyErrorFn',ob='gwt:property',_b='head',Mb='hosted.html?org_activiti_explorer_CustomWidgetset',$b='href',Hb='ie6',Gb='ie8',Fb='ie9',wb='iframe',_='img',xb="javascript:''",Xb='link',Lb='loadExternalRefs',kb='meta',zb='moduleRequested',W='moduleStartup',Eb='msie',lb='name',Bb='opera',P='org.activiti.explorer.CustomWidgetset',db='org.activiti.explorer.CustomWidgetset.nocache.js',mb='org.activiti.explorer.CustomWidgetset::',yb='position:absolute;width:0;height:0;border:none',Yb='rel',Db='safari',cb='script',Nb='selectingPermutation',Q='startup',Zb='stylesheet',eb='undefined',Kb='unknown',Ab='user.agent',Cb='webkit';var l=window,m=document,n=l.__gwtStatsEvent?function(a){return l.__gwtStatsEvent(a)}:null,o=l.__gwtStatsSessionId?l.__gwtStatsSessionId:null,p,q,r,s=O,t={},u=[],v=[],w=[],x=0,y,z;n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:R,millis:(new Date).getTime(),type:S});if(!l.__gwt_stylesLoaded){l.__gwt_stylesLoaded={}}if(!l.__gwt_scriptsLoaded){l.__gwt_scriptsLoaded={}}function A(){var b=false;try{var c=l.location.search;return (c.indexOf(T)!=-1||(c.indexOf(U)!=-1||l.external&&l.external.gwtOnLoad))&&c.indexOf(V)==-1}catch(a){}A=function(){return b};return b}
function org_activiti_explorer_CustomWidgetset(){var O='',vb='" for "gwt:onLoadErrorFn"',tb='" for "gwt:onPropertyErrorFn"',hb='"><\/script>',Y='#',Vb='.cache.html',$='/',Ob='51F0F75F652C07C3D4A94041764E0BDF',Pb='7DCE794BC875B2EB158C471AAE605A9C',Qb='7FC8F9BA1880B9FD4242AAA23BDE00EC',Ub=':',nb='::',bc='<script defer="defer">org_activiti_explorer_CustomWidgetset.onInjectionDone(\'org.activiti.explorer.CustomWidgetset\')<\/script>',gb='<script id="',qb='=',Z='?',Rb='B30394F53E23EE027289EEE987984B57',Sb='BAA63810C9D1D3E7DD6472EDBD8A2016',sb='Bad handler "',ac='DOMContentLoaded',Tb='EF39561F1C79BACDED6EFD7217A4D4E3',ib='SCRIPT',fb='__gwt_marker_org.activiti.explorer.CustomWidgetset',jb='base',bb='baseUrl',S='begin',R='bootstrap',ab='clear.cache.gif',pb='content',Wb='dcharts/styles.css',X='end',Ib='gecko',Jb='gecko1_8',T='gwt.codesvr=',U='gwt.hosted=',V='gwt.hybrid',ub='gwt:onLoadErrorFn',rb='gwt:onPropertyErrorFn',ob='gwt:property',_b='head',Mb='hosted.html?org_activiti_explorer_CustomWidgetset',$b='href',Hb='ie6',Gb='ie8',Fb='ie9',wb='iframe',_='img',xb="javascript:''",Xb='link',Lb='loadExternalRefs',kb='meta',zb='moduleRequested',W='moduleStartup',Eb='msie',lb='name',Bb='opera',P='org.activiti.explorer.CustomWidgetset',db='org.activiti.explorer.CustomWidgetset.nocache.js',mb='org.activiti.explorer.CustomWidgetset::',yb='position:absolute;width:0;height:0;border:none',Yb='rel',Db='safari',cb='script',Nb='selectingPermutation',Q='startup',Zb='stylesheet',eb='undefined',Kb='unknown',Ab='user.agent',Cb='webkit';var l=window,m=document,n=l.__gwtStatsEvent?function(a){return l.__gwtStatsEvent(a)}:null,o=l.__gwtStatsSessionId?l.__gwtStatsSessionId:null,p,q,r,s=O,t={},u=[],v=[],w=[],x=0,y,z;n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:R,millis:(new Date).getTime(),type:S});if(!l.__gwt_stylesLoaded){l.__gwt_stylesLoaded={}}if(!l.__gwt_scriptsLoaded){l.__gwt_scriptsLoaded={}}function A(){var b=false;try{var c=l.location.search;return (c.indexOf(T)!=-1||(c.indexOf(U)!=-1||l.external&&l.external.gwtOnLoad))&&c.indexOf(V)==-1}catch(a){}A=function(){return b};return b}
function B(){if(p&&q){var b=m.getElementById(P);var c=b.contentWindow;if(A()){c.__gwt_getProperty=function(a){return G(a)}}org_activiti_explorer_CustomWidgetset=null;c.gwtOnLoad(y,P,s,x);n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:W,millis:(new Date).getTime(),type:X})}}
function C(){function e(a){var b=a.lastIndexOf(Y);if(b==-1){b=a.length}var c=a.indexOf(Z);if(c==-1){c=a.length}var d=a.lastIndexOf($,Math.min(c,b));return d>=0?a.substring(0,d+1):O}
function f(a){if(a.match(/^\w+:\/\//)){}else{var b=m.createElement(_);b.src=a+ab;a=e(b.src)}return a}
......@@ -12,6 +12,6 @@ function E(a){var b=t[a];return b==null?null:b}
function F(a,b){var c=w;for(var d=0,e=a.length-1;d<e;++d){c=c[a[d]]||(c[a[d]]=[])}c[a[e]]=b}
function G(a){var b=v[a](),c=u[a];if(b in c){return b}var d=[];for(var e in c){d[c[e]]=e}if(z){z(a,d,b)}throw null}
var H;function I(){if(!H){H=true;var a=m.createElement(wb);a.src=xb;a.id=P;a.style.cssText=yb;a.tabIndex=-1;m.body.appendChild(a);n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:W,millis:(new Date).getTime(),type:zb});a.contentWindow.location.replace(s+K)}}
v[Ab]=function(){var b=navigator.userAgent.toLowerCase();var c=function(a){return parseInt(a[1])*1000+parseInt(a[2])};if(function(){return b.indexOf(Bb)!=-1}())return Bb;if(function(){return b.indexOf(Cb)!=-1}())return Db;if(function(){return b.indexOf(Eb)!=-1&&m.documentMode>=9}())return Fb;if(function(){return b.indexOf(Eb)!=-1&&m.documentMode>=8}())return Gb;if(function(){var a=/msie ([0-9]+)\.([0-9]+)/.exec(b);if(a&&a.length==3)return c(a)>=6000}())return Hb;if(function(){return b.indexOf(Ib)!=-1}())return Jb;return Kb};u[Ab]={gecko1_8:0,ie6:1,ie8:2,ie9:3,opera:4,safari:5};org_activiti_explorer_CustomWidgetset.onScriptLoad=function(){if(H){q=true;B()}};org_activiti_explorer_CustomWidgetset.onInjectionDone=function(){p=true;n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:Lb,millis:(new Date).getTime(),type:X});B()};D();C();var J;var K;if(A()){if(l.external&&(l.external.initModule&&l.external.initModule(P))){l.location.reload();return}K=Mb;J=O}n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:R,millis:(new Date).getTime(),type:Nb});if(!A()){try{F([Gb],Ob);F([Fb],Pb);F([Hb],Qb);F([Db],Rb);F([Bb],Sb);F([Jb],Tb);J=w[G(Ab)];var L=J.indexOf(Ub);if(L!=-1){x=Number(J.substring(L+1));J=J.substring(0,L)}K=J+Vb}catch(a){return}}var M;function N(){if(!r){r=true;if(!__gwt_stylesLoaded[Wb]){var a=m.createElement(Xb);__gwt_stylesLoaded[Wb]=a;a.setAttribute(Yb,Zb);a.setAttribute($b,s+Wb);m.getElementsByTagName(_b)[0].appendChild(a)}B();if(m.removeEventListener){m.removeEventListener(ac,N,false)}if(M){clearInterval(M)}}}
v[Ab]=function(){var b=navigator.userAgent.toLowerCase();var c=function(a){return parseInt(a[1])*1000+parseInt(a[2])};if(function(){return b.indexOf(Bb)!=-1}())return Bb;if(function(){return b.indexOf(Cb)!=-1}())return Db;if(function(){return b.indexOf(Eb)!=-1&&m.documentMode>=9}())return Fb;if(function(){return b.indexOf(Eb)!=-1&&m.documentMode>=8}())return Gb;if(function(){var a=/msie ([0-9]+)\.([0-9]+)/.exec(b);if(a&&a.length==3)return c(a)>=6000}())return Hb;if(function(){return b.indexOf(Ib)!=-1}())return Jb;return Kb};u[Ab]={gecko1_8:0,ie6:1,ie8:2,ie9:3,opera:4,safari:5};org_activiti_explorer_CustomWidgetset.onScriptLoad=function(){if(H){q=true;B()}};org_activiti_explorer_CustomWidgetset.onInjectionDone=function(){p=true;n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:Lb,millis:(new Date).getTime(),type:X});B()};D();C();var J;var K;if(A()){if(l.external&&(l.external.initModule&&l.external.initModule(P))){l.location.reload();return}K=Mb;J=O}n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:R,millis:(new Date).getTime(),type:Nb});if(!A()){try{F([Db],Ob);F([Hb],Pb);F([Bb],Qb);F([Jb],Rb);F([Fb],Sb);F([Gb],Tb);J=w[G(Ab)];var L=J.indexOf(Ub);if(L!=-1){x=Number(J.substring(L+1));J=J.substring(0,L)}K=J+Vb}catch(a){return}}var M;function N(){if(!r){r=true;if(!__gwt_stylesLoaded[Wb]){var a=m.createElement(Xb);__gwt_stylesLoaded[Wb]=a;a.setAttribute(Yb,Zb);a.setAttribute($b,s+Wb);m.getElementsByTagName(_b)[0].appendChild(a)}B();if(m.removeEventListener){m.removeEventListener(ac,N,false)}if(M){clearInterval(M)}}}
if(m.addEventListener){m.addEventListener(ac,function(){I();N()},false)}var M=setInterval(function(){if(/loaded|complete/.test(m.readyState)){I();N()}},50);n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:R,millis:(new Date).getTime(),type:X});n&&n({moduleName:P,sessionId:o,subSystem:Q,evtGroup:Lb,millis:(new Date).getTime(),type:S});m.write(bc)}
org_activiti_explorer_CustomWidgetset();
\ No newline at end of file
......@@ -11,9 +11,12 @@
<bean id="demoDataGenerator" class="org.activiti.explorer.demo.DemoDataGenerator" init-method="init">
<property name="processEngine" ref="processEngine" />
<!-- Set following properties to false if certain demo data is not wanted -->
<property name="createDemoUsersAndGroups" value="true" />
<property name="createDemoProcessDefinitions" value="true" />
<property name="createDemoModels" value="true" />
<property name="generateReportData" value="true" />
</bean>
<bean id="dbProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
......@@ -42,7 +45,8 @@
<property name="customFormTypes">
<list>
<bean class="org.activiti.explorer.form.UserFormType"/>
<bean class="org.activiti.explorer.form.ProcessDefinitionFormType"/>
<bean class="org.activiti.explorer.form.ProcessDefinitionFormType"/>
<bean class="org.activiti.explorer.form.MonthFormType"/>
</list>
</property>
</bean>
......
......@@ -38,6 +38,7 @@
<bean class="org.activiti.explorer.ui.form.UserFormPropertyRenderer" />
<bean class="org.activiti.explorer.ui.form.BooleanFormPropertyRenderer" />
<bean class="org.activiti.explorer.ui.form.ProcessDefinitionFormPropertyRenderer" />
<bean class="org.activiti.explorer.ui.form.MonthFormPropertyRenderer" />
</list>
</property>
</bean>
......
......@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
<!--<script src="http://raphaeljs.com/raphael.js" type="text/javascript" charset="utf-8"></script>-->
<script src="js/jstools.js" type="text/javascript" charset="utf-8"></script>
<script src="js/raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery/jquery.js" type="text/javascript" charset="utf-8"></script>
......@@ -35,8 +35,6 @@
var DiagramGenerator = {};
var pb1;
$(document).ready(function(){
var diagrams = [];
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
......@@ -48,14 +46,14 @@ $(document).ready(function(){
var processDefinitionId = query_string["processDefinitionId"];
var processInstanceId = query_string["processInstanceId"];
//console.log("Initialize progress bar");
console.log("Initialize progress bar");
pb1 = new $.ProgressBar({
boundingBox: '#pb1',
label: 'Progressbar!',
on: {
complete: function() {
//console.log("Progress Bar COMPLETE");
console.log("Progress Bar COMPLETE");
this.set('label', 'complete!');
if (processInstanceId) {
ProcessDiagramGenerator.drawHighLights(processInstanceId);
......@@ -67,17 +65,45 @@ $(document).ready(function(){
},
value: 0
});
//console.log("Progress bar inited");
console.log("Progress bar inited");
ProcessDiagramGenerator.options = {
/*
processInstanceHighLightsUrl: "./activiti-rest/process-instance.php?id={processInstanceId}",
processDefinitionUrl: "./activiti-rest/process-difinition-diagram-layout.php?id={processDefinitionId}",
processDefinitionByKeyUrl: "./activiti-rest/process-definition.php?id={processDefinitionKey}",
*/
diagramBreadCrumbsId: "diagramBreadCrumbs",
diagramHolderId: "diagramHolder",
diagramInfoId: "diagramInfo"
diagramInfoId: "diagramInfo",
on: {
click: function(canvas, element, contextObject){
var mouseEvent = this;
console.log("[CLICK] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
if (contextObject.getProperty("type") == "callActivity") {
var processDefinitonKey = contextObject.getProperty("processDefinitonKey");
var processDefinitons = contextObject.getProperty("processDefinitons");
var processDefiniton = processDefinitons[0];
console.log("Load callActivity '" + processDefiniton.processDefinitionKey + "', contextObject: ", contextObject);
// Load processDefinition
ProcessDiagramGenerator.drawDiagram(processDefiniton.processDefinitionId);
}
},
rightClick: function(canvas, element, contextObject){
var mouseEvent = this;
console.log("[RIGHTCLICK] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
},
over: function(canvas, element, contextObject){
var mouseEvent = this;
//console.log("[OVER] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
// TODO: show tooltip-window with contextObject info
ProcessDiagramGenerator.showActivityInfo(contextObject);
},
out: function(canvas, element, contextObject){
var mouseEvent = this;
//console.log("[OUT] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);
ProcessDiagramGenerator.hideInfo();
}
}
};
var baseUrl = window.document.location.protocol + "//" + window.document.location.host + "/";
......
......@@ -11,15 +11,15 @@ var ActivitiRest = {
success: function(data, textStatus) {
var processDefinition = data;
if (!processDefinition) {
//console.error("Process definition '" + processDefinitionKey + "' not found");
console.error("Process definition '" + processDefinitionKey + "' not found");
} else {
callback.apply({processDefinitionId: processDefinition.id});
}
}
}).done(function(data, textStatus) {
//console.log("ajax done");
console.log("ajax done");
}).fail(function(jqXHR, textStatus, error){
//console.error('Get diagram layout['+processDefinitionKey+'] failure: ', textStatus, 'error: ', error, jqXHR);
console.error('Get diagram layout['+processDefinitionKey+'] failure: ', textStatus, 'error: ', error, jqXHR);
});
},
......@@ -34,16 +34,16 @@ var ActivitiRest = {
success: function(data, textStatus) {
var processDefinitionDiagramLayout = data;
if (!processDefinitionDiagramLayout) {
//console.error("Process definition diagram layout '" + processDefinitionId + "' not found");
console.error("Process definition diagram layout '" + processDefinitionId + "' not found");
return;
} else {
callback.apply({processDefinitionDiagramLayout: processDefinitionDiagramLayout});
}
}
}).done(function(data, textStatus) {
//console.log("ajax done");
console.log("ajax done");
}).fail(function(jqXHR, textStatus, error){
//console.log('Get diagram layout['+processDefinitionId+'] failure: ', textStatus, jqXHR);
console.log('Get diagram layout['+processDefinitionId+'] failure: ', textStatus, jqXHR);
});
},
......@@ -56,19 +56,19 @@ var ActivitiRest = {
cache: false,
async: true,
success: function(data, textStatus) {
//console.log("ajax returned data");
console.log("ajax returned data");
var highLights = data;
if (!highLights) {
//console.log("highLights not found");
console.log("highLights not found");
return;
} else {
callback.apply({highLights: highLights});
}
}
}).done(function(data, textStatus) {
//console.log("ajax done");
console.log("ajax done");
}).fail(function(jqXHR, textStatus, error){
//console.log('Get HighLights['+processInstanceId+'] failure: ', textStatus, jqXHR);
console.log('Get HighLights['+processInstanceId+'] failure: ', textStatus, jqXHR);
});
}
};
\ No newline at end of file
......@@ -75,11 +75,9 @@ var ProcessDiagramGenerator = {
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = activityImpl.getProperty("name");
//processDiagramCanvas.drawLabel(label, activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), {wrapWidth: 80});
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// message catch
......@@ -91,11 +89,9 @@ var ProcessDiagramGenerator = {
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingMessageEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = activityImpl.getProperty("name");
//processDiagramCanvas.drawLabel(label, activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), {wrapWidth: 80});
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// multiple catch
......@@ -107,11 +103,9 @@ var ProcessDiagramGenerator = {
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingMultipleEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = activityImpl.getProperty("name");
//processDiagramCanvas.drawLabel(label, activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), {wrapWidth: 80});
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
......@@ -123,6 +117,10 @@ var ProcessDiagramGenerator = {
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawThrowingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// message throw
......@@ -133,10 +131,9 @@ var ProcessDiagramGenerator = {
processDiagramCanvas.drawThrowingMessageEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
var label = activityImpl.getProperty("name");
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// multiple throw
......@@ -147,10 +144,9 @@ var ProcessDiagramGenerator = {
processDiagramCanvas.drawThrowingMultipleEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
var label = activityImpl.getProperty("name");
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// none throw
......@@ -160,6 +156,10 @@ var ProcessDiagramGenerator = {
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawThrowingNoneEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// end event
......@@ -179,11 +179,9 @@ var ProcessDiagramGenerator = {
processDiagramCanvas.drawErrorEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
var label = activityImpl.getProperty("name");
//processDiagramCanvas.drawLabel(label, activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), {wrapWidth: 80});
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// message end event
......@@ -194,11 +192,9 @@ var ProcessDiagramGenerator = {
processDiagramCanvas.drawMessageEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
var label = activityImpl.getProperty("name");
//processDiagramCanvas.drawLabel(label, activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), {wrapWidth: 80});
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// signal end event
......@@ -209,11 +205,9 @@ var ProcessDiagramGenerator = {
processDiagramCanvas.drawSignalEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
var label = activityImpl.getProperty("name");
//processDiagramCanvas.drawLabel(label, activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), {wrapWidth: 80});
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// multiple end event
......@@ -224,11 +218,9 @@ var ProcessDiagramGenerator = {
processDiagramCanvas.drawMultipleEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
var label = activityImpl.getProperty("name");
//processDiagramCanvas.drawLabel(label, activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), {wrapWidth: 80});
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// terminate end event
......@@ -239,11 +231,9 @@ var ProcessDiagramGenerator = {
processDiagramCanvas.drawTerminateEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
var label = activityImpl.getProperty("name");
//processDiagramCanvas.drawLabel(label, activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), {wrapWidth: 80});
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// error start event
......@@ -253,6 +243,10 @@ var ProcessDiagramGenerator = {
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawErrorStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// task
......@@ -378,13 +372,9 @@ var ProcessDiagramGenerator = {
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingTimerEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = activityImpl.getProperty("name");
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
//processDiagramCanvas.drawLabel(label, activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), {wrapWidth: 80});
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// Boundary catch error
......@@ -396,12 +386,9 @@ var ProcessDiagramGenerator = {
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingErrorEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = activityImpl.getProperty("name");
//processDiagramCanvas.drawLabel(label, activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), {wrapWidth: 80});
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// Boundary signal event
......@@ -413,11 +400,9 @@ var ProcessDiagramGenerator = {
var isInterrupting = activityImpl.getProperty("isInterrupting");
processDiagramCanvas.drawCatchingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
var label = activityImpl.getProperty("name");
//processDiagramCanvas.drawLabel(label, activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), {wrapWidth: 80});
var boxX = activityImpl.getX() + .5 + activityImpl.getWidth()/2;
var boxY = activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING;
processDiagramCanvas.drawLabel(label, boxX, boxY);
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
if (label)
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
};
// timer catch event
......@@ -464,6 +449,45 @@ var ProcessDiagramGenerator = {
processDiagramCanvas.setConextObject(activityImpl);
processDiagramCanvas.drawCollapsedCallActivity(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
};
$(document).ready(function(){
// Protect right click on SVG elements (and on canvas too)
document.body.oncontextmenu = function(event) {
if (window.event.srcElement.tagName == "shape" || window.event.srcElement.tagName == "DIV" && window.event.srcElement.parentElement.className == "diagram") {
// IE DIAGRAM CANVAS OR SHAPE DETECTED!
return false;
}
return (!Object.isSVGElement(window.event.srcElement));
};
});
},
getActivitiLabel:function(activityImpl){
/*
TODO: Label object should be in activityImpl and looks like:
{
x: 250,
y: 250,
width: 80,
height: 30
}
And then:
if (!activityImpl.label)
return null;
var label = activityImpl.label;
label.text = activityImpl.name;
return label;
*/
// But now default label for all events is:
return {
text: activityImpl.getProperty("name"),
x: activityImpl.getX() + .5 + activityImpl.getWidth()/2,
y: activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING,
width: 100,
height: 0
};
},
generateDiagram: function(processDefinitionDiagramLayout){
......@@ -1021,6 +1045,12 @@ var ProcessDiagramGenerator = {
diagramInfo.html(tpl);
},
hideInfo: function(){
var diagramInfo = $("#" + this.options.diagramInfoId);
if (!diagramInfo) return;
diagramInfo.html("");
},
vvoid: function(){}
};
......
......@@ -10,7 +10,7 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
</parent>
<build>
......
......@@ -8,7 +8,7 @@
<artifactId>activiti-root</artifactId>
<packaging>pom</packaging>
<version>5.12-SNAPSHOT</version>
<version>5.13-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.framework.version>3.1.2.RELEASE</spring.framework.version>
......@@ -515,6 +515,12 @@
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.3.0</version>
</dependency>
<!-- Camel integration -->
<dependency>
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册