use of io.automatiko.engine.workflow.bpmn2.core.Bpmn2Import in project jbpm by kiegroup.
the class WebServiceWorkItemHandler method getWSClient.
@SuppressWarnings("unchecked")
protected Client getWSClient(WorkItem workItem, String interfaceRef) {
if (clients.containsKey(interfaceRef)) {
return clients.get(interfaceRef);
}
synchronized (this) {
if (clients.containsKey(interfaceRef)) {
return clients.get(interfaceRef);
}
String importLocation = (String) workItem.getParameter("Url");
String importNamespace = (String) workItem.getParameter("Namespace");
if (importLocation != null && importLocation.trim().length() > 0 && importNamespace != null && importNamespace.trim().length() > 0) {
Client client = getDynamicClientFactory().createClient(importLocation, new QName(importNamespace, interfaceRef), getInternalClassLoader(), null);
clients.put(interfaceRef, client);
return client;
}
long processInstanceId = ((WorkItemImpl) workItem).getProcessInstanceId();
WorkflowProcessImpl process = ((WorkflowProcessImpl) ksession.getProcessInstance(processInstanceId).getProcess());
List<Bpmn2Import> typedImports = (List<Bpmn2Import>) process.getMetaData("Bpmn2Imports");
if (typedImports != null) {
Client client = null;
for (Bpmn2Import importObj : typedImports) {
if (WSDL_IMPORT_TYPE.equalsIgnoreCase(importObj.getType())) {
try {
client = getDynamicClientFactory().createClient(importObj.getLocation(), new QName(importObj.getNamespace(), interfaceRef), getInternalClassLoader(), null);
clients.put(interfaceRef, client);
return client;
} catch (Exception e) {
logger.error("Error when creating WS Client", e);
continue;
}
}
}
}
}
return null;
}
use of io.automatiko.engine.workflow.bpmn2.core.Bpmn2Import in project automatiko-engine by automatiko-io.
the class Bpmn2ImportHandler method start.
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
final String type = attrs.getValue("importType");
final String location = attrs.getValue("location");
final String namespace = attrs.getValue("namespace");
ProcessBuildData buildData = (ProcessBuildData) parser.getData();
if (type != null && location != null && namespace != null) {
List<Bpmn2Import> typedImports = (List<Bpmn2Import>) buildData.getMetaData("Bpmn2Imports");
if (typedImports == null) {
typedImports = new ArrayList<Bpmn2Import>();
buildData.setMetaData("Bpmn2Imports", typedImports);
}
typedImports.add(new Bpmn2Import(type, location, namespace));
}
return null;
}
use of io.automatiko.engine.workflow.bpmn2.core.Bpmn2Import in project jbpm by kiegroup.
the class ServiceTaskHandler method getWSClient.
@SuppressWarnings("unchecked")
protected synchronized Client getWSClient(WorkItem workItem, String interfaceRef) {
if (clients.containsKey(interfaceRef)) {
return clients.get(interfaceRef);
}
long processInstanceId = ((WorkItemImpl) workItem).getProcessInstanceId();
WorkflowProcessImpl process = ((WorkflowProcessImpl) ksession.getProcessInstance(processInstanceId).getProcess());
List<Bpmn2Import> typedImports = (List<Bpmn2Import>) process.getMetaData("Bpmn2Imports");
if (typedImports != null) {
Client client = null;
for (Bpmn2Import importObj : typedImports) {
if (WSDL_IMPORT_TYPE.equalsIgnoreCase(importObj.getType())) {
try {
client = dcf.createClient(importObj.getLocation(), new QName(importObj.getNamespace(), interfaceRef), getInternalClassLoader(), null);
clients.put(interfaceRef, client);
logger.info("WS Client is created for {" + importObj.getNamespace() + "}" + interfaceRef);
return client;
} catch (Exception e) {
logger.info("Error when creating WS Client. You can ignore this error as long as a client is eventually created", e);
continue;
}
}
}
}
return null;
}
Aggregations