Search in sources :

Example 11 with ActivitiException

use of org.activiti.engine.ActivitiException in project Activiti by Activiti.

the class BpmnParse method getImporter.

protected XMLImporter getImporter(Import theImport) {
    if (this.importers.containsKey(theImport.getImportType())) {
        return this.importers.get(theImport.getImportType());
    } else {
        if (theImport.getImportType().equals("http://schemas.xmlsoap.org/wsdl/")) {
            Class<?> wsdlImporterClass;
            try {
                wsdlImporterClass = Class.forName("org.activiti.engine.impl.webservice.CxfWSDLImporter", true, Thread.currentThread().getContextClassLoader());
                XMLImporter newInstance = (XMLImporter) wsdlImporterClass.newInstance();
                this.importers.put(theImport.getImportType(), newInstance);
                return newInstance;
            } catch (Exception e) {
                throw new ActivitiException("Could not find importer for type " + theImport.getImportType());
            }
        }
        return null;
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) ActivitiException(org.activiti.engine.ActivitiException) XMLException(org.activiti.bpmn.exceptions.XMLException) MalformedURLException(java.net.MalformedURLException) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException)

Example 12 with ActivitiException

use of org.activiti.engine.ActivitiException in project Activiti by Activiti.

the class BpmnParse method createItemDefinitions.

protected void createItemDefinitions() {
    for (org.activiti.bpmn.model.ItemDefinition itemDefinitionElement : bpmnModel.getItemDefinitions().values()) {
        StructureDefinition structure = null;
        try {
            // it is a class
            Class<?> classStructure = ReflectUtil.loadClass(itemDefinitionElement.getStructureRef());
            structure = new ClassStructureDefinition(classStructure);
        } catch (ActivitiException e) {
            // it is a reference to a different structure
            structure = this.structures.get(itemDefinitionElement.getStructureRef());
        }
        ItemDefinition itemDefinition = new ItemDefinition(itemDefinitionElement.getId(), structure);
        if (StringUtils.isNotEmpty(itemDefinitionElement.getItemKind())) {
            itemDefinition.setItemKind(ItemKind.valueOf(itemDefinitionElement.getItemKind()));
        }
        itemDefinitions.put(itemDefinition.getId(), itemDefinition);
    }
}
Also used : ClassStructureDefinition(org.activiti.engine.impl.bpmn.data.ClassStructureDefinition) StructureDefinition(org.activiti.engine.impl.bpmn.data.StructureDefinition) ClassStructureDefinition(org.activiti.engine.impl.bpmn.data.ClassStructureDefinition) ActivitiException(org.activiti.engine.ActivitiException) ItemDefinition(org.activiti.engine.impl.bpmn.data.ItemDefinition)

Example 13 with ActivitiException

use of org.activiti.engine.ActivitiException in project Activiti by Activiti.

the class DefaultActivityBehaviorFactory method createBusinessRuleTaskActivityBehavior.

public ActivityBehavior createBusinessRuleTaskActivityBehavior(BusinessRuleTask businessRuleTask) {
    BusinessRuleTaskDelegate ruleActivity = null;
    if (StringUtils.isNotEmpty(businessRuleTask.getClassName())) {
        try {
            Class<?> clazz = Class.forName(businessRuleTask.getClassName());
            ruleActivity = (BusinessRuleTaskDelegate) clazz.newInstance();
        } catch (Exception e) {
            throw new ActivitiException("Could not instantiate businessRuleTask (id:" + businessRuleTask.getId() + ") class: " + businessRuleTask.getClassName(), e);
        }
    } else {
        ruleActivity = new BusinessRuleTaskActivityBehavior();
    }
    for (String ruleVariableInputObject : businessRuleTask.getInputVariables()) {
        ruleActivity.addRuleVariableInputIdExpression(expressionManager.createExpression(ruleVariableInputObject.trim()));
    }
    for (String rule : businessRuleTask.getRuleNames()) {
        ruleActivity.addRuleIdExpression(expressionManager.createExpression(rule.trim()));
    }
    ruleActivity.setExclude(businessRuleTask.isExclude());
    if (businessRuleTask.getResultVariableName() != null && businessRuleTask.getResultVariableName().length() > 0) {
        ruleActivity.setResultVariable(businessRuleTask.getResultVariableName());
    } else {
        ruleActivity.setResultVariable("org.activiti.engine.rules.OUTPUT");
    }
    return ruleActivity;
}
Also used : BusinessRuleTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.BusinessRuleTaskActivityBehavior) ActivitiException(org.activiti.engine.ActivitiException) ActivitiException(org.activiti.engine.ActivitiException) BusinessRuleTaskDelegate(org.activiti.engine.delegate.BusinessRuleTaskDelegate)

Example 14 with ActivitiException

use of org.activiti.engine.ActivitiException in project Activiti by Activiti.

the class ProcessEngineConfigurationImpl method initSqlSessionFactory.

protected void initSqlSessionFactory() {
    if (sqlSessionFactory == null) {
        InputStream inputStream = null;
        try {
            inputStream = getMyBatisXmlConfigurationSteam();
            // update the jdbc parameters to the configured ones...
            Environment environment = new Environment("default", transactionFactory, dataSource);
            Reader reader = new InputStreamReader(inputStream);
            Properties properties = new Properties();
            properties.put("prefix", databaseTablePrefix);
            String wildcardEscapeClause = "";
            if ((databaseWildcardEscapeCharacter != null) && (databaseWildcardEscapeCharacter.length() != 0)) {
                wildcardEscapeClause = " escape '" + databaseWildcardEscapeCharacter + "'";
            }
            properties.put("wildcardEscapeClause", wildcardEscapeClause);
            if (databaseType != null) {
                properties.put("limitBefore", DbSqlSessionFactory.databaseSpecificLimitBeforeStatements.get(databaseType));
                properties.put("limitAfter", DbSqlSessionFactory.databaseSpecificLimitAfterStatements.get(databaseType));
                properties.put("limitBetween", DbSqlSessionFactory.databaseSpecificLimitBetweenStatements.get(databaseType));
                properties.put("limitOuterJoinBetween", DbSqlSessionFactory.databaseOuterJoinLimitBetweenStatements.get(databaseType));
                properties.put("orderBy", DbSqlSessionFactory.databaseSpecificOrderByStatements.get(databaseType));
                properties.put("limitBeforeNativeQuery", ObjectUtils.toString(DbSqlSessionFactory.databaseSpecificLimitBeforeNativeQueryStatements.get(databaseType)));
            }
            Configuration configuration = initMybatisConfiguration(environment, reader, properties);
            sqlSessionFactory = new DefaultSqlSessionFactory(configuration);
        } catch (Exception e) {
            throw new ActivitiException("Error while building ibatis SqlSessionFactory: " + e.getMessage(), e);
        } finally {
            IoUtil.closeSilently(inputStream);
        }
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) InputStreamReader(java.io.InputStreamReader) ProcessEngineConfiguration(org.activiti.engine.ProcessEngineConfiguration) Configuration(org.apache.ibatis.session.Configuration) InputStream(java.io.InputStream) DefaultSqlSessionFactory(org.apache.ibatis.session.defaults.DefaultSqlSessionFactory) Environment(org.apache.ibatis.mapping.Environment) InputStreamReader(java.io.InputStreamReader) Reader(java.io.Reader) Properties(java.util.Properties) ActivitiException(org.activiti.engine.ActivitiException) SQLException(java.sql.SQLException)

Example 15 with ActivitiException

use of org.activiti.engine.ActivitiException in project Activiti by Activiti.

the class ProcessEngineConfigurationImpl method initDatabaseType.

public void initDatabaseType() {
    Connection connection = null;
    try {
        connection = dataSource.getConnection();
        DatabaseMetaData databaseMetaData = connection.getMetaData();
        String databaseProductName = databaseMetaData.getDatabaseProductName();
        log.debug("database product name: '{}'", databaseProductName);
        databaseType = databaseTypeMappings.getProperty(databaseProductName);
        if (databaseType == null) {
            throw new ActivitiException("couldn't deduct database type from database product name '" + databaseProductName + "'");
        }
        log.debug("using database type: {}", databaseType);
    } catch (SQLException e) {
        log.error("Exception while initializing Database connection", e);
    } finally {
        try {
            if (connection != null) {
                connection.close();
            }
        } catch (SQLException e) {
            log.error("Exception while closing the Database connection", e);
        }
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) SQLException(java.sql.SQLException) Connection(java.sql.Connection) DatabaseMetaData(java.sql.DatabaseMetaData)

Aggregations

ActivitiException (org.activiti.engine.ActivitiException)247 Deployment (org.activiti.engine.test.Deployment)38 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)36 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)35 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)31 IOException (java.io.IOException)28 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)23 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)21 ArrayList (java.util.ArrayList)20 TaskQuery (org.activiti.engine.task.TaskQuery)16 HashMap (java.util.HashMap)14 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)14 Task (org.activiti.engine.task.Task)14 ByteArrayOutputStream (java.io.ByteArrayOutputStream)13 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)12 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)10 ObjectOutputStream (java.io.ObjectOutputStream)10 Date (java.util.Date)10 RestVariable (org.activiti.rest.service.api.engine.variable.RestVariable)10 JobExecutor (org.activiti.engine.impl.jobexecutor.JobExecutor)9