Package org.uengine.persistence.processdefinitionversion

Examples of org.uengine.persistence.processdefinitionversion.ProcessDefinitionVersionRepositoryHomeLocal


 
 
  public ProcessDefinitionRemote[] listProcessDefinitionRemotesLight() throws RemoteException{
    try{
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());
      ProcessDefinitionVersionRepositoryHomeLocal pdihr = GlobalContext.createProcessDefinitionVersionRepositoryHomeLocal(getTransactionContext());

      Collection definitions = pdhr.findAllProcessDefinitions();
     
      Vector processDefinitionRemotes = new Vector();     
      for(Iterator iter = definitions.iterator(); iter.hasNext();){
        ProcessDefinitionRepositoryLocal pdrl = ((ProcessDefinitionRepositoryLocal)iter.next());
        ProcessDefinitionRemote pdr = new ProcessDefinitionRemote();
        pdr.setId(pdrl.getDefId().toString());
        pdr.setFolder(pdrl.getIsFolder());
        pdr.setParentFolder(pdrl.getParentFolder().toString());
        pdr.setName(TextContext.createInstance());
        pdr.getName().setText(pdrl.getName());
        pdr.setBelongingDefinitionId(pdr.getId());
        pdr.setAlias(pdrl.getAlias());
        pdr.setVisible(pdrl.getIsVisible());
       
        pdr.objType = pdrl.getObjType();
       
        if(!org.uengine.util.UEngineUtil.isNotEmpty(pdr.objType)) {
          pdr.objType = "process";
        }

       
        String definitionGroupId = pdr.getBelongingDefinitionId();
        String objType = pdr.getObjType();

        if(!pdr.isFolder()){
          int productionVersion = pdrl.getProdVer();
          //Object[] nameAndVersion = UEngineUtil.getProcessNameAndVersion(pdr.getName());
          //String name = (String)nameAndVersion[0];
         
          Collection versions = pdihr.findAllVersions(new Long(pdr.getId()));
          for(Iterator iter2 = versions.iterator(); iter2.hasNext();){           
            ProcessDefinitionVersionRepositoryLocal pdirl = ((ProcessDefinitionVersionRepositoryLocal)iter2.next());
           
            pdr = new ProcessDefinitionRemote();
            pdr.setId(pdirl.getDefVerId().toString());
View Full Code Here


  }
 
  public ProcessDefinitionRemote[] findAllVersions(String pdid ) throws RemoteException{
    try{
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());
      ProcessDefinitionVersionRepositoryHomeLocal pdihr = GlobalContext.createProcessDefinitionVersionRepositoryHomeLocal(getTransactionContext());
     
      String productionVersion = "-1";
      try{
        productionVersion = getProcessDefinitionProductionVersion(pdid);
      }catch(RemoteException e){}
     
      Vector processDefinitionRemotes = new Vector();
      ProcessDefinitionRemote pdr = null;
     
      if(pdid.startsWith("[")){
        String definitionAlias = pdid.substring(1, pdid.indexOf("]"));
        pdid = getProcessDefinitionIdByAlias(definitionAlias);
      }   
   
      Collection versions = pdihr.findAllVersions(new Long(pdid));
      for(Iterator iter2 = versions.iterator(); iter2.hasNext();){   
        ProcessDefinitionVersionRepositoryLocal pdirl = ((ProcessDefinitionVersionRepositoryLocal)iter2.next());
       
        pdr = new ProcessDefinitionRemote();
        pdr.setId(pdirl.getDefVerId().toString());
View Full Code Here

    try{
      if(pdvid.indexOf("@")>-1){
        pdvid = ProcessDefinition.splitDefinitionAndVersionId(pdvid)[1];
      }
     
      ProcessDefinitionVersionRepositoryHomeLocal pdvhr = GlobalContext.createProcessDefinitionVersionRepositoryHomeLocal(getTransactionContext());
      ProcessDefinitionVersionRepositoryLocal pdvlr = pdvhr.findByPrimaryKey(new Long(pdvid));
     
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());
      ProcessDefinitionRepositoryLocal pdlr = pdhr.findByPrimaryKey(pdvlr.getDefId());
     
      pdlr.setProdVer(pdvlr.getVer().intValue());
View Full Code Here

      ProcessDefinitionFactory pdf = ProcessDefinitionFactory.getInstance(getTransactionContext());
      ProcessDefinition pd = pdf.getDefinition(pdvid);
      pd.setName(newName);

      //rename process definition version
      ProcessDefinitionVersionRepositoryHomeLocal pdvhr = GlobalContext.createProcessDefinitionVersionRepositoryHomeLocal(tc);   
      ProcessDefinitionVersionRepositoryLocal pdvr = pdvhr.findByPrimaryKey(new Long(pdvid));
      pdvr.setDefName(newName);
         
      //restore upd file
      String path = null;
      String def = (String)pdvr.getFilePath();
View Full Code Here

    }
  }
 
  public ProcessDefinitionRemote getProcessDefinitionRemote(String pdvid) throws RemoteException{
    try{
      ProcessDefinitionVersionRepositoryHomeLocal pdvrhl = GlobalContext.createProcessDefinitionVersionRepositoryHomeLocal(getTransactionContext());
      ProcessDefinitionVersionRepositoryLocal pdvrl = pdvrhl.findByPrimaryKey(new Long(pdvid));
     
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());
      ProcessDefinitionRepositoryLocal pdl = pdhr.findByPrimaryKey(pdvrl.getDefId());
      int productionVersion = pdl.getProdVer();
     
View Full Code Here

  }
 
  private void getFilePathNFileCopy(ProcessDefinitionRemote pdr, String parentDirectory, boolean isSub) throws Exception {
    ProcessManagerBean pmb = this;
    ProcessTransactionContext tc = pmb.getTransactionContext();
    ProcessDefinitionVersionRepositoryHomeLocal pdvhr = GlobalContext.createProcessDefinitionVersionRepositoryHomeLocal(tc);
    ProcessDefinitionVersionRepositoryLocal pdvr;

    pdvr = pdvhr.findByPrimaryKey(new Long(pdr.getId()));
    String def = (String) pdvr.getFilePath();
    if (def.startsWith("LINK:")) {
      File f = new File(TEMP_DIRECTORY + parentDirectory);
      if (!f.exists())
        f.mkdirs();
View Full Code Here

  protected ProcessDefinition getDefinitionObject(String pdvid, boolean fromCompiledFile) throws Exception{
    return (ProcessDefinition)getDefinitionSourceImpl(pdvid, fromCompiledFile, true);
 
 
  public String getResourcePath(String resourceId) throws Exception{
    ProcessDefinitionVersionRepositoryHomeLocal pdvhr = GlobalContext.createProcessDefinitionVersionRepositoryHomeLocal(tc);   
   
    ProcessDefinitionVersionRepositoryLocal pdvr;
    try{
      pdvr = pdvhr.findByPrimaryKey(new Long(resourceId));
    }catch(ObjectNotFoundException onfe){
      throw new UEngineException("No such Resource Version id [" + resourceId + "]", onfe);
    }
   
    String def = (String)pdvr.getFilePath();
View Full Code Here

   
    return null;
  }
 
  protected Object getDefinitionSourceImpl(String pdvid, boolean fromCompilationVersion, boolean shouldBeObjectResult) throws Exception{
    ProcessDefinitionVersionRepositoryHomeLocal pdvhr = GlobalContext.createProcessDefinitionVersionRepositoryHomeLocal(tc);   
   
    ProcessDefinitionVersionRepositoryLocal pdvr;
    try{
      pdvr = pdvhr.findByPrimaryKey(new Long(pdvid));
    }catch(ObjectNotFoundException onfe){
      throw new UEngineException("No such Process Definition version id [" + pdvid + "]", onfe);
    }
   
    String def = (String)pdvr.getFilePath();
View Full Code Here

  public void removeDefinition(String pdvid) throws Exception{
//    Object[] nameAndVersion = UEngineUtil.getProcessNameAndVersion(pdid);
//    String name = (String)nameAndVersion[0];
//    int version = ((Integer)nameAndVersion[1]).intValue();
   
    ProcessDefinitionVersionRepositoryHomeLocal pdvh = GlobalContext.createProcessDefinitionVersionRepositoryHomeLocal(tc);
    ProcessDefinitionVersionRepositoryLocal pdvl = pdvh.findByPrimaryKey(new Long(pdvid));
    Long pdid = pdvl.getDefId();   
   
    try{
      ProcessDefinitionVersionRepositoryLocal pdir = pdvh.findByPrimaryKey(new Long(pdvid));
      //don't remove to prevent danggling instances
      //pdir.remove();
      pdir.setIsDeleted(true);
     
      Collection versions = pdvh.findAllVersions(pdid);
      //force to remove the definition if there's no more version.
      if(!versions.iterator().hasNext()) throw new ObjectNotFoundException();
    }catch(javax.ejb.ObjectNotFoundException e){
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(tc);   
      ProcessDefinitionRepositoryLocal pdr = pdhr.findByPrimaryKey(pdid);
View Full Code Here

    modifiedDate.set(Calendar.MILLISECOND, 0)//ignore millisecond for some database. e.g. Oracle
     
    //create a version
    if(pdvid==null)
      pdvid = ""+UniqueKeyGenerator.issueProcessDefinitionVersionKey(tc);     
    ProcessDefinitionVersionRepositoryHomeLocal pdvhr;
    ProcessDefinitionVersionRepositoryLocal pdvr = null;
    pdvhr = GlobalContext.createProcessDefinitionVersionRepositoryHomeLocal(tc);
    if(!overwrite){
      if(version!=-1){
        Collection existingVersions = pdvhr.findByDefinitionAndVersion(new Long(belongingPdid), new Long(version));
        if(existingVersions.iterator().hasNext()){
          pdvr = (ProcessDefinitionVersionRepositoryLocal)existingVersions.iterator().next();
          pdvid = ""+pdvr.getDefVerId();
//          throw new UEngineException("There is same version already exists. Choose another version.");
         
          //FIXME: implement for non-ejb version.
          if(!"org.uengine.kernel.DefaultProcessInstance".equals(GlobalContext.getPropertyString("processinstance.class"))){
            ProcessInstanceDAOType pidaotype = ProcessInstanceDAOType.getInstance(tc);
            ProcessInstanceDAO existingInstances = pidaotype.findByDefinitionVersion(pdvr.getDefVerId());
            if(existingInstances.size()>0){
              throw new UEngineException("There is some instances belonged to this definition already exists. Choose another version number.");
            }
          }
          overwrite = true;
          verifyModifiedDateWhenOverwriting = false;
         
        }       
      }
     
      if(pdvr==null){
        pdvr = pdvhr.create(new Long(pdvid));
        pdvr.setVer(new Long(version));
        pdvr.setDefId(new Long(belongingPdid));
        pdvr.setDefName(name);
      }
     
    }else{
      pdvr = pdvhr.findByPrimaryKey(new Long(pdvid));
    }
   
    String fullFileName;
    String relativeFileName;
    if(overwrite){
View Full Code Here

TOP

Related Classes of org.uengine.persistence.processdefinitionversion.ProcessDefinitionVersionRepositoryHomeLocal

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.