Package org.huihoo.workflow.xpdl

Examples of org.huihoo.workflow.xpdl.WorkflowCondition


*/
public class ConditionUtils
{
  public static final String getScriptFile(Options options,WorkflowTransition workflowTransition)
  {
    WorkflowCondition condition=workflowTransition.getCondition();
    if(condition!=null && condition instanceof ScriptCondition)
    {
      return options.getScriptDir()  + File.separator+ condition.getContent();
    }
    return null;
  }
View Full Code Here


    return null;
  }
 
  public static final String getScriptConent(Options options,WorkflowTransition workflowTransition)
  {
    WorkflowCondition condition=workflowTransition.getCondition();
    if(condition!=null && condition instanceof XCDATACondition)
    {
      return condition.getContent();
    }
    return null;
  }
View Full Code Here

    WorkflowWork workflowWork,
    WorkflowTransition workflowTransition,
    RuntimeContext paramContext)
    throws ScriptException
  {
    WorkflowCondition condition = workflowTransition.getCondition();   
   
    if (condition==null || condition.getContent()==null ||condition.getContent().trim().length()==0)
    {
      //transition unconditionally
      return true;
    }

    ScriptWrapper wrapper = (ScriptWrapper) rctxt.getScriptWrapper(workflowTransition);
    if (wrapper == null)
    {
      if(condition instanceof ScriptCondition)
      {
        // First check if the requested script exists, to avoid
        // creating unnecessary directories and files.
        String sciptURI=condition.getContent();
        File scriptFile = new File(options.getScriptDir(),sciptURI);
       
        if (!scriptFile.exists() || !scriptFile.isFile())
        {
          throw new ScriptException("script not found : "+sciptURI);
View Full Code Here

      WorkflowTransition transition = null;

      for (int j = 0; j < tran_size; ++j)
      {
        transition = (WorkflowTransition) transitions.get(j);
        WorkflowCondition condition = transition.getCondition();
        if (condition != null && condition.getContent() != null)
        {
          ExtendedAttribute attribute = transition.findExtendedAttribute(XPDLGlobals.CONDITION_TYPE);
          if (attribute != null)
          {
            ConditionType ctype = ConditionType.parse(attribute.getValue());
            if (ConditionType.CONDITION_SCRIPT.equals(ctype))
            {
              transition.setCondition(new ScriptCondition(condition.getContent()));
            }

            transition.removeExtendedAttribute(XPDLGlobals.CONDITION_TYPE);
          }
        }
View Full Code Here

          context.clear();
        }
        transition = (WorkflowTransition) transList.get(i);
        context = genParameterConext(caseContext, transition);

        WorkflowCondition conditon = transition.getCondition();
        if (conditon == null)
        {
          log.debug("[filterOutTransition_xorSplit] ACCEPT transition:" + transition.getInfo() + " | condition: " + conditon);
          outTrans.add(transition);
          break;
View Full Code Here

        }
       
        transition = (WorkflowTransition) transList.get(i);
        context = genParameterConext(caseContext, transition);

        WorkflowCondition conditon = transition.getCondition();
        if (conditon == null)
        {
          outTrans.add(transition);
          log.debug("[filterOutTransition_orSplit] ACCEPT transition:" + transition.getInfo() + " | condition: " + conditon);
        }
View Full Code Here

    }
  }
  protected static void serializeCondition(WorkflowTransition transition, Writer out, String nsPrefix, int ident_unit)
    throws XPDLSerializerException, IOException
  {
    WorkflowCondition condition=transition.getCondition();
    transition.removeExtendedAttribute(XPDLGlobals.CONDITION_TYPE);
   
    if (condition != null && condition.getContent() != null)
    {
      transition.addExtendedAttribute(new ExtendedAttribute(XPDLGlobals.CONDITION_TYPE,condition.getType().getType()));
     
      if(ConditionType.CONDITION_SCRIPT.equals(condition.getType()))
      {
        pushIdent(out, ident_unit);
        out.write("<" + nsPrefix + "Condition>");
        out.write(condition.getContent());
        out.write("</" + nsPrefix + "Condition>");
        newLine(out);
      }
      else
      {
        pushIdent(out, ident_unit);
        out.write("<" + nsPrefix + "Condition>");
        out.write("<![CDATA[");
        out.write(condition.getContent());
        out.write("]]>");
        out.write("</" + nsPrefix + "Condition>");
        newLine(out);
      }
    }
View Full Code Here

   * @param checkClass If true, check against .class file,
   *                   if false, check against .java file.
   */
  public boolean isOutDated(boolean checkClass)
  {   
    WorkflowCondition condition=ctxt.getCondition();
   
    if(condition==null)
    {
      return false;
    }
   
    if(!(condition instanceof ScriptCondition))
    {
      return true;
    }
   
     
    long wfsRealLastModified = 0;
    String scriptFilePath=options.getScriptDir() + File.separator + condition.getContent();
    try
    {
      File scriptFile=new File(scriptFilePath);
      if (!scriptFile.exists())
      {
View Full Code Here

    }
  }

  private String genScriptUUID(WorkflowTransition workflowTransition)
  {
    WorkflowCondition condition=workflowTransition.getCondition();
    if(condition!=null && condition instanceof ScriptCondition)
    {
      return workflowTransition.getUUID()+"."+condition.getContent();
    }
   
    return workflowTransition.getUUID();
  }
View Full Code Here

  {
    if (!isOutDated(compileClass))
    {
      return true;
    }
    WorkflowCondition condition=ctxt.getCondition();
    if(condition!=null && condition instanceof ScriptCondition)
    {
      return compileFile((ScriptCondition)condition,compileClass);
    }
    else if(condition!=null && condition instanceof XCDATACondition)
View Full Code Here

TOP

Related Classes of org.huihoo.workflow.xpdl.WorkflowCondition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.