throw BPMMessages.MESSAGES.couldNotLoadWorkItemHandlerClass(workItemHandlerModel.getModelConfiguration().getAttribute("class"));
}
WorkItemHandler workItemHandler = newWorkItemHandler(workItemHandlerClass, processRuntime, runtimeManager);
String name = workItemHandlerModel.getName();
if (workItemHandler instanceof SwitchYardServiceTaskHandler) {
SwitchYardServiceTaskHandler ssth = (SwitchYardServiceTaskHandler)workItemHandler;
if (name != null) {
ssth.setName(name);
} else {
name = ssth.getName();
}
ssth.setComponentName(componentName);
ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain, componentTNS));
ssth.setProcessRuntime(processRuntime);
}
if (name == null && workItemHandler instanceof AbstractHTWorkItemHandler) {
name = HUMAN_TASK;
}
if (name == null) {
throw BPMMessages.MESSAGES.couldNotUseNullNameToRegisterWorkItemHandler(workItemHandler.getClass().getName());
}
processRuntime.getWorkItemManager().registerWorkItemHandler(name, workItemHandler);
registeredNames.add(name);
}
}
for (Entry<String, Class<? extends WorkItemHandler>> entry : DEFAULT_HANDLERS.entrySet()) {
String name = entry.getKey();
if (!registeredNames.contains(name)) {
WorkItemHandler defaultHandler = newWorkItemHandler(entry.getValue(), processRuntime, runtimeManager);
if (defaultHandler instanceof SwitchYardServiceTaskHandler) {
SwitchYardServiceTaskHandler ssth = (SwitchYardServiceTaskHandler)defaultHandler;
ssth.setName(name);
ssth.setComponentName(componentName);
ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain, componentTNS));
ssth.setProcessRuntime(processRuntime);
}
processRuntime.getWorkItemManager().registerWorkItemHandler(name, defaultHandler);
registeredNames.add(name);
}
}