/** * Produces an exact replica of this InFlowWorkItem */ public Object clone () { LaunchItem clone = new LaunchItem (); //clone.setLastModified // (Utils.copyString(getLastModified())); clone.setLastModified(Time.toIsoDate()); clone.setAttributes ((StringMapAttribute)getAttributes().clone()); clone.setWorkflowDefinitionUrl (Utils.copyString(getWorkflowDefinitionUrl())); clone.setDescriptionMap ((StringMapAttribute)getDescriptionMap().clone()); clone.setReplyTo(getReplyTo().copy()); return clone; }
/** * Simply launch a flow for the specified node. */ public static void launchFlow(String repository, String path, String flowName) throws Exception { try { // Get the references LaunchItem li = new LaunchItem(); // start activation if (repository != null) { li.addAttribute(Context.ATTRIBUTE_REPOSITORY, new StringAttribute(repository)); } if (path != null) { li.addAttribute(Context.ATTRIBUTE_PATH, new StringAttribute(path)); } launchFlow(li, flowName); // Launch the item } catch (Exception e) { log.error("Launching flow " + flowName + " failed", e); } }
/** * Given the URL of a process definition, launches an instance of * it in the embedded engine. */ public FlowExpressionId launch (final String flowUrl, final boolean async) throws LaunchException { final LaunchItem li = new LaunchItem(); li.setWorkflowDefinitionUrl(flowUrl); return launch(li, async); }
/** * Builds a launchitem * * @param wfdUrl the URL of the process definition to instantiate * @param replyTo the FlowExpressionId of an expression awaiting for this * flow to launch, execute and terminate * @param wi the workitem as given by the 'replyTo' expression */ public LaunchItem (final String wfdUrl, final FlowExpressionId replyTo, final InFlowWorkItem wi) { super(); this.workflowDefinitionUrl = wfdUrl; this.setReplyTo(replyTo); if (wi != null) this.setAttributes(wi.getAttributes()); }
LaunchItem li = new LaunchItem(); li.setWorkflowDefinitionUrl("field:__def__"); li.getAttributes().puts("__def__", sb.toString());
this.serviceParams); li.setLastModified(Time.toIsoDate()); LaunchItem li = new LaunchItem(); li.setWorkflowDefinitionUrl(this.url); li.setAttributes(new StringMapAttribute()); li.setLastModified(Time.toIsoDate());
protected LaunchItem decodeLaunchItem (org.jdom.Element elt) throws CodingException LaunchItem li = new LaunchItem(); li.setWorkflowDefinitionUrl (elt.getAttributeValue(WORKFLOW_DEFINITION_URL)); if (li.getWorkflowDefinitionUrl() == null) li.setWorkflowDefinitionUrl (elt.getAttributeValue(PROCESS_DEFINITION_URL)); .decode(dmElt, null); li.setDescriptionMap(smap);
@Override public void configure(LaunchItem launchItem, String workflowName) throws FlowDefinitionException { if(saveWorkflowDefinitionInWorkItem){ launchItem.setWorkflowDefinitionUrl(WorkflowConstants.ATTRIBUTE_WORKFLOW_DEFINITION_URL); String flowDef = readDefinition(workflowName); launchItem.getAttributes().puts(WorkflowConstants.ATTRIBUTE_DEFINITION, flowDef); connection.connect(); is = connection.getInputStream(); launchItem.setWorkflowDefinitionUrl(surl);
launchItem.setAttributes(attrs); launchItem.getAttributes().sput(WorkflowConstants.ATTRIBUTE_EDIT_DIALOG, getDialogName());
item.getAttributes().stringKeySet().iterator(); while (it.hasNext()) final Attribute currentAttribute = item.getAttribute(fieldName);
/** * This constructor is used at launch time, to turn a launchitem * into an InFlowWorkItem and start the flow. */ public InFlowWorkItem (final LaunchItem li) { super(); this.setAttributes(li.getAttributes()); this.setHistory(new java.util.ArrayList(0)); }
@Override public boolean execute(Context ctx) throws FlowDefinitionException { // Get the references LaunchItem li = new LaunchItem(); prepareLaunchItem(ctx, li); WorkflowUtil.launchFlow(li, getWorkflowName()); return true; }
li.addAttribute(Header.SUBJECT, new StringAttribute(line)); if(li.getAttribute(attr)==null) li.addAttribute(attr, new StringAttribute(value)); li.setAttribute(attr, new StringAttribute(value));
LaunchItem li = new LaunchItem(); li.setWorkflowDefinitionUrl("field:__definition__"); "</process-definition>"; li.getAttributes().puts("__definition__", flowDef); bean.setIntegers(new int[] { 3, 5, 8, 12 }); li.getAttributes().put("bean", AttributeUtils.java2owfe(bean));
/** * Loads (interprets / launches) a process definition given by its URL. * The launch is done synchronously, to ensure that definitions are * interpreted and bound before any further launches. */ protected void load (final String url) { if (log.isDebugEnabled()) log.debug("load() url is >"+url+"<"); try { final LaunchItem li = new LaunchItem(); li.setWorkflowDefinitionUrl(url); Definitions.getLauncher(this.getContext()).launch(li, false); // // async is set to false } catch (final Throwable t) { log.warn ("load() failed to load library at '"+url+"' "+t); if (log.isDebugEnabled()) { log.debug ("load() failed to load library at '"+url+"'", t); } } }
/** * Set a date stored in the repository into the list of attributes of the launch item. Ignore past activation dates * <ul> * <li>get utc calendar from repository</li> * <li>convert utc to local calendar</li> * <li>get string time for open wfe from local calendar</li> * <li>set string attribute of the launch item</li> * </ul> */ private void updateDateAttribute(Content node, LaunchItem launchItem, String attributeName) { final SimpleDateFormat sdf = new SimpleDateFormat(WorkflowConstants.OPENWFE_DATE_FORMAT); try { if (node.hasNodeData(attributeName)) { Calendar cd = node.getNodeData(attributeName).getDate(); // utc calendar from repository Calendar now = DateUtil.getCurrentUTCCalendar(); if (cd.before(now) && isActivationDate(attributeName)) { log.info("Ignoring past activation date:" + attributeName + " from node:" + node.getHandle()); } else { String date = sdf.format(new Date(DateUtil.getLocalCalendarFromUTC(cd).getTimeInMillis())); launchItem.getAttributes().puts(attributeName, date); } } } catch (Exception e) { log.warn("cannot set date:" + attributeName + " for node" + node.getHandle(), e); } }
final LaunchItem li = new LaunchItem (processUrl, parentId,
LaunchItem li = new LaunchItem(); li.setWorkflowDefinitionUrl("field:__definition__"); "</process-definition>"; li.getAttributes().puts("__definition__", flowDef);
LaunchItem li = new LaunchItem(); li.setWorkflowDefinitionUrl("field:__definition__"); "</process-definition>"; li.getAttributes().puts("__definition__", flowDef);