本文整理汇总了Java中org.kie.api.runtime.process.WorkItem类的典型用法代码示例。如果您正苦于以下问题:Java WorkItem类的具体用法?Java WorkItem怎么用?Java WorkItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorkItem类属于org.kie.api.runtime.process包,在下文中一共展示了WorkItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeWorkItem
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
String implementation = getImplementation(workItem.getParameters());
if (IMPLEMENTATION_SWITCHYARD.equalsIgnoreCase(implementation)) {
super.executeWorkItem(workItem, manager);
} else {
ServiceTaskHandler sth;
ProcessRuntime runtime = getProcessRuntime();
if (runtime instanceof KieSession) {
sth = new ServiceTaskHandler((KieSession)runtime);
} else {
sth = new ServiceTaskHandler();
}
sth.setClassLoader(getClass().getClassLoader());
sth.executeWorkItem(workItem, manager);
}
}
示例2: executeWorkItem
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
String implementation = getImplementation(workItem.getParameters());
if (IMPLEMENTATION_SWITCHYARD.equalsIgnoreCase(implementation)) {
super.executeWorkItem(workItem, manager);
} else {
ServiceTaskHandler sth;
ProcessRuntime runtime = getProcessRuntime();
if (runtime instanceof KieSession) {
sth = new ServiceTaskHandler((KieSession)runtime);
} else {
sth = new ServiceTaskHandler();
}
sth.setClassLoader(getClass().getClassLoader());
sth.executeWorkItem(workItem, manager);
}
}
示例3: send
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
private Map<String, Object> send(WorkItem workItem) throws URISyntaxException {
if (context == null) {
context = CamelContextService.getInstance();
}
ProducerTemplate template = context.createProducerTemplate();
Map<String, Object> params = new HashMap<String, Object>(workItem.getParameters());
// filtering out TaskName
params.remove("TaskName");
Processor processor = requestMapper.mapToRequest(params);
URI uri = uriConverter.toURI(params);
String s;
try {
s = URLDecoder.decode(uri.toString(), "UTF-8");
} catch (UnsupportedEncodingException e) {
s = uri.toString();
}
Endpoint endpoint = context.getEndpoint(s);
Exchange exchange = template.send(endpoint, processor);
return this.responseMapper.mapFromResponse(exchange);
}
示例4: executeWorkItem
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
@Override
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
long processInstanceId = workItem.getProcessInstanceId();
String nextApprover = (String) workItem.getParameter(SimpleWFService.NEXT_APPROVER);
String notificationType = (String) workItem.getParameter(NOTIFICATION_TYPE);
String approvalDenier = (String) workItem.getParameter(SimpleWFService.APPROVAL_DENIER);
SimpleApproval approval = simpleApprovalDAO.findSimpleApproval(processInstanceId);
String originator = approval.getCreatedBy();
String replyTo = getReplyTo(notificationType, originator, approvalDenier);
String subjectPrefix = getSubjectPrefix(notificationType);
String applicationUrl = propertyService.getString("mail.application.url");
String emailSubject = subjectPrefix + approval.getSubject();
Map<String, String> data = new HashMap<String, String>();
String taskUrl = getTaskUrl(applicationUrl, processInstanceId);
data.put("taskUrl", taskUrl);
data.put("taskSubject", approval.getSubject());
data.put("rejector", approvalDenier);
data.put("originator", originator);
Set<String> toSet = getToSet(nextApprover, notificationType, approval, originator);
String templateFileName = getTemplate(notificationType);
emailService.sendMessage(replyTo, emailSubject, data, toSet, templateFileName);
manager.completeWorkItem(workItem.getId(), null);
}
示例5: abortWorkItem
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
// Get local id mapping to task UUID
String taskId;
synchronized (mItemIdMap) {
taskId = mItemIdMap.remove(workItem.getId());
}
if (taskId != null) {
Afm.get(mUrl).abortTask(taskId);
}
manager.abortWorkItem(workItem.getId());
}
示例6: executeWorkItem
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
public void executeWorkItem(final WorkItem workItem, final WorkItemManager manager) {
String url = mUrl;
String appId = mAppId;
String secret = mSecret;
String masterVariantId = mMasterVariantId;
String variantId = String.valueOf(workItem.getParameter("variant_id"));
String alert = String.valueOf(workItem.getParameter("alert"));
String sound = String.valueOf(workItem.getParameter("sound"));
String testId = null;
final String deploymentId = ((WorkItemImpl) workItem).getDeploymentId();
EngineHolder engine = null;
try {
engine = new EngineHolder(deploymentId);
testId = Util.processId(engine.getEngine(), workItem);
} finally {
if (engine != null) {
engine.close();
}
}
PushNotification notification;
notification = new PushNotification(masterVariantId, variantId, alert, sound);
Jups jups;
jups = new Jups(url, appId, secret);
String result = jups.send(notification, testId);
Map<String, Object> results = new HashMap<String, Object>();
results.put("result", result);
manager.completeWorkItem(workItem.getId(), results);
}
示例7: testCustomExecuteFail
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testCustomExecuteFail() throws Exception {
CommandContext commandContext = new CommandContext();
WorkItem workItem = new WorkItemImpl();
commandContext.setData(Constants.WORKITEM, workItem);
updateDeployment.customExecute(commandContext);
}
示例8: executeWorkItem
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
@Override
public void executeWorkItem(org.kie.api.runtime.process.WorkItem workItem, org.kie.api.runtime.process.WorkItemManager workItemManager) {
Map<String, Object> results = null;
try {
results = this.send(workItem);
} catch (Exception e) {
handleException(e);
}
workItemManager.completeWorkItem(workItem.getId(), results);
}
示例9: unmarshallObject
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
@Override
public WorkItem unmarshallObject(MarshalledData marshalledData) throws Exception {
// Setup env/context/stream
Environment env = EnvironmentFactory.newEnvironment();
ByteArrayInputStream bais = new ByteArrayInputStream(marshalledData.byteArray);
MarshallerReaderContext context = new MarshallerReaderContext(bais, null, null, null, null, env);
// Unmarshall
WorkItem unmarshalledWorkItem = InputMarshaller.readWorkItem(context);
context.close();
return unmarshalledWorkItem;
}
示例10: itemId
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
public static String itemId(RuntimeEngine engine, WorkItem workItem) {
org.kie.api.definition.process.Process process = engine.getKieSession().getProcessInstance(workItem.getProcessInstanceId()).getProcess();
String data = process.getId() + process.getPackageName() + process.getVersion() + workItem.getProcessInstanceId() + workItem.getId();
return UUID.nameUUIDFromBytes(data.getBytes()).toString();
}
示例11: processId
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
public static String processId(RuntimeEngine engine, WorkItem workItem) {
org.kie.api.definition.process.Process process = engine.getKieSession().getProcessInstance(workItem.getProcessInstanceId()).getProcess();
String data = process.getId() + process.getPackageName() + process.getVersion() + workItem.getProcessInstanceId();
return UUID.nameUUIDFromBytes(data.getBytes()).toString();
}
示例12: abortWorkItem
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
manager.abortWorkItem(workItem.getId());
}
示例13: executeWorkItem
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
@Override
public void executeWorkItem(WorkItem workItem, WorkItemManager workItemManager) {
_holder.setValue("handler executed");
workItemManager.completeWorkItem(workItem.getId(), null);
}
示例14: abortWorkItem
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
@Override
public void abortWorkItem(WorkItem workItem, WorkItemManager workItemManager) {}
示例15: executeWorkItem
import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
@Override
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
System.out.println(workItem);
System.out.println(manager);
}