Package org.uengine.kernel

Examples of org.uengine.kernel.ProcessDefinition


    logInst("getActivityInstanceProperty", new Object[]{instanceId, tracingTag, propertyName});
    try{     
      if(instanceId==null) return null; //guard against illegal requests

      ProcessInstance instance = getInstance(instanceId);
      ProcessDefinition definition = instance.getProcessDefinition();
      Activity activity = definition.getActivity(tracingTag);
      propertyName = propertyName.substring(0,1).toUpperCase() + propertyName.substring(1);//.toLowerCase();
      //the pattern of instance property (stateful) is 'getXXX(instance)'
      Object returnVal;
      try{
        returnVal = activity.getClass().getMethod("get" + propertyName, new Class[]{ProcessInstance.class}).invoke(activity, new Object[]{instance});
View Full Code Here


         
        valueType = value.getClass();
      }      

      ProcessInstance instance = getInstance(instanceId);
      ProcessDefinition definition = instance.getProcessDefinition();
     
      if(definition==null)
        throw new UEngineException("Can't find the definition for instance '" + instance.getInstanceId() + "'");
       
      Activity activity = definition.getActivity(tracingTag);

      if(activity==null)
        throw new UEngineException("No such activity with tracing tag : " + tracingTag + " in definition '" + definition.getId() + "'");

      propertyName = propertyName.substring(0,1).toUpperCase() + propertyName.substring(1);//.toLowerCase();
      //the pattern of instance property (stateful) setting method is 'setXXX(instance, value)'                       
      activity.getClass().getMethod("set" + propertyName, new Class[]{ProcessInstance.class, valueType}).invoke(activity, new Object[]{instance, value});
    }catch(Exception e){
View Full Code Here

     
      if(parameters.length!=parameterTypes.length)
        throw new UEngineException("invalid parameter length");

      ProcessInstance instance = getInstance(instanceId);
      ProcessDefinition definition = instance.getProcessDefinition();
     
      if(definition==null)
        throw new UEngineException("Can't find the definition for instance '" + instance.getInstanceId() + "'");
       
      Activity activity = definition.getActivity(tracingTag);

      if(activity==null)
        throw new UEngineException("No such activity with tracing tag : " + tracingTag + " in definition '" + definition.getId() + "'");

      Class[] actualParameterTypes = new Class[parameterTypes.length+1];
      actualParameterTypes[0] = ProcessInstance.class;
      System.arraycopy(parameterTypes, 0, actualParameterTypes, 1, parameterTypes.length);
View Full Code Here

    if(pdvid.startsWith("[")){
      String definitionAlias = pdvid.substring(1, pdvid.indexOf("]"));
      pdvid = getProcessDefinitionProductionVersionByAlias(definitionAlias);
    }   
   
    ProcessDefinition pd = ProcessDefinitionFactory.getInstance(getTransactionContext()).getDefinition(pdvid);
   
/*    if(pd.isAdhoc())
      pd = ProcessDefinitionFactory.getDefinition(name, false);*/
   
    return pd;
View Full Code Here

  private void changeProcessDefinitionImpl(String instanceId, Object definition) throws RemoteException{
    try{
      ProcessInstance instance = getInstance(instanceId);
     
      ProcessDefinition processDefinition = null;
      if(definition instanceof String){
        ByteArrayInputStream is = new ByteArrayInputStream(((String)definition).getBytes("UTF-8"));
        processDefinition = (ProcessDefinition) ProcessDefinitionFactory.getActivity(is);
      }else{
        processDefinition = (ProcessDefinition)definition;
View Full Code Here

 
  public void setFault(String instanceId, String tracingTag, Exception fault) throws RemoteException{
    try{
      ProcessInstance instance = getInstance(instanceId);
 
      ProcessDefinition definition = instance.getProcessDefinition();
      Activity activity = definition.getActivity(tracingTag);
      activity.fireFault(instance, fault);
     
    }catch(Exception e){
      e.printStackTrace();
      throw new RemoteException("ProcessManagerError:"+e.getMessage(), e);
View Full Code Here

    }
  }

  public ActivityReference getInitiatorHumanActivityReference(String pdvid) throws RemoteException {
    try{
      ProcessDefinition pd = (ProcessDefinition)getDefinition(pdvid);
      return pd.getInitiatorHumanActivityReference(getTransactionContext());
    }catch(Exception e){
      throw new RemoteException("ProcessManagerError:"+e.getMessage(), e);
    }
  }
View Full Code Here

    Enumeration keys = newDefVerIdList.keys();
    while (keys.hasMoreElements()) {
      String key = (String) keys.nextElement(); // Old DefId
      String defVerId = (String) newDefVerIdList.get(key); // New
     
      ProcessDefinition pd=null;
      String fullFileName="";
      try{
        fullFileName = DEFINITION_ROOT + defVerId + ".process";
        pd = ProcessDefinitionFactory.getDefinition(new FileInputStream(fullFileName));
      }catch (Exception e) {
        continue;
      }
                   
      //sub-process
      ActivityForLoop forLoop = new ActivityForLoop() {
        public void logic(Activity act) {
          try {
            if (act instanceof SubProcessActivity) {
              SubProcessActivity spAct = (SubProcessActivity) act;

              String oldAlias = (spAct.getDefinitionId().split("@")[0]).substring(1,(spAct.getDefinitionId().split("@")[0]).length() - 1);
              String oldDefVerId = spAct.getDefinitionId().split("@")[1];

              String newAlias = (String) newAliasListTmp.get(oldAlias);
              String newpdvId = (String) newDefVerIdListTmp.get(oldDefVerId);

              String newdefVerid = "[" + newAlias + "]@"+ newpdvId;
              spAct.setDefinitionId(newdefVerid);
            }
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
      };
      forLoop.run(pd);

      //form
      ProcessVariable[] pvs = pd.getProcessVariables();
      if (pvs != null) {
        for (int j = 0; j < pvs.length; j++) {
          Object dv = pvs[j].getDefaultValue();
          if (dv instanceof org.uengine.contexts.HtmlFormContext) {
            String formDefId = ((org.uengine.contexts.HtmlFormContext) dv).getFormDefId();// "[alias]@defverid"
View Full Code Here

    return (ProcessDefinition.class == cls);
  }
 
  public void serialize(Object sourceObj, OutputStream os, Hashtable extendedContext) throws Exception{
    Adapter apt = new ProcessDefinitionAdapter();
    ProcessDefinition proc = (ProcessDefinition)apt.convert(sourceObj, extendedContext);
    GlobalContext.serialize(proc, os, String.class);
    //GlobalContext.serialize(proc, new PrintStream(System.out), String.class);
  }
View Full Code Here

  }

  public String flowChartTransform(String definitionXml) throws Exception{
    //try{
      Hashtable options = new Hashtable();
      ProcessDefinition definition = (ProcessDefinition) GlobalContext.deserialize(definitionXml, ProcessDefinition.class);

      //XStreamSerializer serializer = new XStreamSerializer();
      //ByteArrayInputStream bis = new ByteArrayInputStream(definitionXml.getBytes("UTF-8"));

      //ProcessDefinition definition = (ProcessDefinition) GlobalContext.deserialize(definitionXml, null);
View Full Code Here

TOP

Related Classes of org.uengine.kernel.ProcessDefinition

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.