Package org.uengine.util

Examples of org.uengine.util.MeasuringContext


      }     
    }
  }
 
  public void applyChanges() throws Exception{
    MeasuringContext mc = new MeasuringContext("EJBProcessInstance:applyChanges()");
   
    ProcessInstanceDAO procInsDAO = getProcessInstanceDAO();
    procInsDAO.getImplementationObject().setTableName("BPM_PROCINST");
    procInsDAO.getImplementationObject().setKeyField("INSTID");
    procInsDAO.setModDate(GlobalContext.getNow(getProcessTransactionContext()).getTime());
   
    if(isNew){
      procInsDAO.getImplementationObject().createInsertSql();
    }else{
      procInsDAO.getImplementationObject().createUpdateSql();
    }
   
   
    //TODO Checking for dirty field is needed
    procInsDAO.update();

    mc.printElapsedTime(this);

    if(modifiedKeyMap!=null){
      //System.out.println("modifiedKeyMap.size() ===========================> " + modifiedKeyMap.size());
//changed to let the variable/property values persist so that the history of data change can be stored
      if(modifiedKeyMap.size() > 0)
        getProcessVariableDAOFacade().deleteValue(getInstanceId(), modifiedKeyMap.keySet().iterator());

      ProcessVariableDAO pvd = getProcessVariableDAOFacade().createProcessVariableDAOForBatchInsert();
      for(Iterator iterator = modifiedKeyMap.keySet().iterator(); iterator.hasNext();){
        String fullKey = (String)iterator.next();
       
        String[] scopeAndKey = (String[])modifiedKeyMap.get(fullKey);
        String scope = scopeAndKey[0];
        String key = scopeAndKey[1];
       
        boolean isProperty = isProperty(fullKey);
       
        Serializable cachedValue = (isProperty ? this.getProperty(scope, key) : this.getSourceValue(scope, key));
        if(cachedValue instanceof IndexedProcessVariableMap){
          ProcessVariableValue multipleValue = (ProcessVariableValue)getMultiple(scope, key);
          multipleValue.beforeFirst();
          int i=0;
          do{
            setImpl(scope, key, multipleValue.getValue(), i, true, false, true, pvd, false);
            i++;
          }while(multipleValue.next());
        }
        else
          setImpl(scope, key, cachedValue, 0, false, false, true, pvd, isProperty);
      }
     
      pvd.updateBatch();
    }

    mc.printElapsedTime(this);

    setCaching(false);
   
    if(modifiedRoleMappings!=null){
      RoleMappingDAOType rmDAOFacade = RoleMappingDAOType.getInstance(ptc);

      if(modifiedRoleMappings.size() > 0)       
        rmDAOFacade.removeRoleMappings(getInstanceId(), modifiedRoleMappings.keySet().iterator());
               
      RoleMappingDAO roleMappingDAO = rmDAOFacade.createDAOForInsertRoleMappingBatch();
     
      for(Iterator iterator = modifiedRoleMappings.keySet().iterator(); iterator.hasNext();){
        String roleName = (String)iterator.next();
        RoleMapping rm = (RoleMapping)cachedRoleMappings.get(roleName);
       
//(new Exception("[EJBProcessInstance:putRoleMappingImpl] instanceId = " + instanceId + "; RoleName = " + roleName)).printStackTrace();

        putRoleMappingImpl(roleName, rm, true, roleMappingDAO);
      }
     
      roleMappingDAO.updateBatch();
    }
   
    mc.printElapsedTime(this);

  }
View Full Code Here

TOP

Related Classes of org.uengine.util.MeasuringContext

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.