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;
}
}
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);
}
}
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;
}
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);
}
}
}
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);
}
}
}
Aggregations