当前位置: 首页>>代码示例>>Java>>正文


Java WorkItem类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:21,代码来源:StandardSwitchYardServiceTaskHandler.java

示例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);
    }
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:19,代码来源:StandardSwitchYardServiceTaskHandler.java

示例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);
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:23,代码来源:CamelHandler.java

示例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);
}
 
开发者ID:awizen,项目名称:gangehi,代码行数:33,代码来源:MySendTaskHandler.java

示例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());
}
 
开发者ID:SLAMon,项目名称:SLAMon,代码行数:12,代码来源:SLAMonWorkItemHandler.java

示例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);
    }
 
开发者ID:SLAMon,项目名称:SLAMon,代码行数:38,代码来源:SLAMonJupsHandler.java

示例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);
}
 
开发者ID:indigo-dc,项目名称:orchestrator,代码行数:8,代码来源:UpdateDeploymentTest.java

示例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);
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:11,代码来源:CamelHandler.java

示例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;
}
 
开发者ID:mrietveld,项目名称:gimcrack,代码行数:15,代码来源:KieGimcrack.java

示例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();
}
 
开发者ID:SLAMon,项目名称:SLAMon,代码行数:6,代码来源:Util.java

示例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();
}
 
开发者ID:SLAMon,项目名称:SLAMon,代码行数:6,代码来源:Util.java

示例12: abortWorkItem

import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
    manager.abortWorkItem(workItem.getId());
}
 
开发者ID:SLAMon,项目名称:SLAMon,代码行数:4,代码来源:SLAMonJupsHandler.java

示例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);
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:6,代码来源:ReuseHandler.java

示例14: abortWorkItem

import org.kie.api.runtime.process.WorkItem; //导入依赖的package包/类
@Override
public void abortWorkItem(WorkItem workItem, WorkItemManager workItemManager) {}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:3,代码来源:ReuseHandler.java

示例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);
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:6,代码来源:BPMModelTests.java


注:本文中的org.kie.api.runtime.process.WorkItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。