use of org.jbpm.workflow.core.WorkflowProcess in project jbpm by kiegroup.
the class CaseRuntimeDataServiceImpl method onDeploy.
/*
* Deploy and undeploy handling
*/
@Override
public void onDeploy(DeploymentEvent event) {
AbstractRuntimeManager runtimeManager = (AbstractRuntimeManager) event.getDeployedUnit().getRuntimeManager();
KieBase kieBase = runtimeManager.getEnvironment().getKieBase();
Collection<Process> processes = kieBase.getProcesses();
Map<String, DeployedAsset> mapProcessById = event.getDeployedUnit().getDeployedAssets().stream().collect(toMap(DeployedAsset::getId, asset -> asset));
for (Process process : processes) {
if (((WorkflowProcess) process).isDynamic()) {
String caseIdPrefix = collectCaseIdPrefix(process);
Collection<CaseMilestone> caseMilestones = collectMilestoness(process);
Collection<CaseStage> caseStages = collectCaseStages(event.getDeploymentId(), process.getId(), ((WorkflowProcess) process));
Collection<CaseRole> caseRoles = collectCaseRoles(process);
Collection<AdHocFragment> adHocFragments = collectAdHocFragments((WorkflowProcess) process);
Map<String, List<String>> dataAccessRestrictions = collectDataAccessRestrictions(process);
CaseDefinitionImpl caseDef = new CaseDefinitionImpl((ProcessAssetDesc) mapProcessById.get(process.getId()), caseIdPrefix, caseStages, caseMilestones, caseRoles, adHocFragments, dataAccessRestrictions);
availableCases.add(caseDef);
caseIdGenerator.register(caseIdPrefix);
}
}
// collect role information
Collection<DeployedAsset> assets = event.getDeployedUnit().getDeployedAssets();
List<String> roles = null;
for (DeployedAsset asset : assets) {
if (asset instanceof ProcessAssetDesc) {
// if it's not dynamic it's considered as not case definition
if (!((ProcessAssetDesc) asset).isDynamic()) {
availableProcesses.add((ProcessAssetDesc) asset);
}
if (roles == null) {
roles = ((ProcessAssetDesc) asset).getRoles();
}
}
}
if (roles == null) {
roles = Collections.emptyList();
}
deploymentRolesManager.addRolesForDeployment(event.getDeploymentId(), roles);
}
use of org.jbpm.workflow.core.WorkflowProcess in project jbpm by kiegroup.
the class SubProcessNodeBuilder method build.
@Override
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) {
super.build(process, processDescr, context, node);
WorkflowProcess wfProcess = (WorkflowProcess) process;
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("imports", wfProcess.getImports());
parameters.put("classloader", context.getConfiguration().getClassLoader());
for (DataAssociation dataAssociation : ((SubProcessNode) node).getInAssociations()) {
Transformation transformation = dataAssociation.getTransformation();
if (transformation != null) {
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
}
for (DataAssociation dataAssociation : ((SubProcessNode) node).getOutAssociations()) {
Transformation transformation = dataAssociation.getTransformation();
if (transformation != null) {
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
}
}
use of org.jbpm.workflow.core.WorkflowProcess in project jbpm by kiegroup.
the class WorkItemNodeBuilder method build.
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) {
super.build(process, processDescr, context, node);
WorkflowProcess wfProcess = (WorkflowProcess) process;
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("imports", wfProcess.getImports());
parameters.put("classloader", context.getConfiguration().getClassLoader());
for (DataAssociation dataAssociation : ((WorkItemNode) node).getInAssociations()) {
Transformation transformation = dataAssociation.getTransformation();
if (transformation != null) {
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
List<Assignment> assignments = dataAssociation.getAssignments();
if (assignments != null) {
for (Assignment assignment : assignments) {
ProcessDialect dialect = ProcessDialectRegistry.getDialect(assignment.getDialect());
dialect.getAssignmentBuilder().build(context, assignment, dataAssociation.getSources().get(0), dataAssociation.getTarget(), ((WorkItemNode) node), true);
}
}
}
for (DataAssociation dataAssociation : ((WorkItemNode) node).getOutAssociations()) {
Transformation transformation = dataAssociation.getTransformation();
if (transformation != null) {
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
List<Assignment> assignments = dataAssociation.getAssignments();
if (assignments != null) {
for (Assignment assignment : assignments) {
ProcessDialect dialect = ProcessDialectRegistry.getDialect(assignment.getDialect());
dialect.getAssignmentBuilder().build(context, assignment, dataAssociation.getSources().get(0), dataAssociation.getTarget(), ((WorkItemNode) node), false);
}
}
}
}
use of org.jbpm.workflow.core.WorkflowProcess in project jbpm by kiegroup.
the class ActionNodeBuilder method build.
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) {
super.build(process, processDescr, context, node);
ActionNode actionNode = (ActionNode) node;
DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
ActionDescr actionDescr = new ActionDescr();
actionDescr.setText(action.getConsequence());
actionDescr.setResource(processDescr.getResource());
ProcessDialect dialect = ProcessDialectRegistry.getDialect(action.getDialect());
dialect.getActionBuilder().build(context, action, actionDescr, (NodeImpl) node);
Transformation transformation = (Transformation) node.getMetaData().get("Transformation");
if (transformation != null) {
WorkflowProcess wfProcess = (WorkflowProcess) process;
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("imports", wfProcess.getImports());
parameters.put("classloader", context.getConfiguration().getClassLoader());
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
}
use of org.jbpm.workflow.core.WorkflowProcess in project jbpm by kiegroup.
the class EventNodeBuilder method build.
@Override
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) {
Transformation transformation = (Transformation) node.getMetaData().get("Transformation");
if (transformation != null) {
WorkflowProcess wfProcess = (WorkflowProcess) process;
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("imports", wfProcess.getImports());
parameters.put("classloader", context.getConfiguration().getClassLoader());
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
}
Aggregations