if (wfs == null) {
if (logger.isDebugEnabled()) {
logger.debug ("Creating connection to workflow service");
}
// Get workflow service
WorkflowServiceFactory wfsf
= WorkflowServiceFactory.newInstance ();
Object req = FacesContext.getCurrentInstance()
.getExternalContext().getRequest();
if (req instanceof PortletRequest) {
String wejn = ((PortletRequest)req).getPreferences()
.getValue("workflowEngineJndiName", "");
if (wejn != null && wejn.length() > 0) {
wfsf.setProperty("de.danet.an.workflow.engine", wejn);
}
String icf = ((PortletRequest)req).getPreferences()
.getValue("initialContextFactory", "");
String icu = ((PortletRequest)req).getPreferences()
.getValue("initialContextUrl", "");
if (icf != null && icf.length() > 0
|| icu != null && icu.length() > 0) {
Hashtable env = new Hashtable ();
if (icf != null && icf.length() > 0) {
env.put(Context.INITIAL_CONTEXT_FACTORY, icf);
}
if (icu != null && icu.length() > 0) {
env.put(Context.PROVIDER_URL, icu);
}
wfsf.setProperty
("javax.naming.InitialContext.Environment", env);
}
}
wfs = wfsf.newWorkflowService();
}
return wfs;
} catch (FactoryConfigurationError e) {
logger.error (e.getMessage(), e);
throw new EvaluationException (e.getMessage(), e);