Package org.uengine.persistence.processdefinition

Examples of org.uengine.persistence.processdefinition.ProcessDefinitionRepositoryLocal


      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());
            pdr.setFolder(false);
            pdr.setParentFolder(pdrl.getParentFolder().toString());
            pdr.setName(TextContext.createInstance())
            pdr.getName().setText(pdrl.getName());
            pdr.setVersion(pdirl.getVer().intValue());
            pdr.setBelongingDefinitionId(definitionGroupId);
            pdr.setObjType(objType);
            pdr.setAlias(pdrl.getAlias());
            pdr.setVisible(pdrl.getIsVisible());
           
            if(pdirl.getVer().intValue() == productionVersion)
              pdr.setProduction(true);

            processDefinitionRemotes.add(pdr);
View Full Code Here


     
      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());
      pdlr.setProdVerId(new Long(pdvid));
     
      if(pdlr.getObjType()==null){
        ProcessDefinition definition = getProcessDefinition(pdvid);
        String shortDescription = definition.getShortDescription();
        if(shortDescription!=null){
          pdlr.setDescription(shortDescription);
        }
      }
     
    }catch(Exception e){
      e.printStackTrace();
View Full Code Here

      if(pdid.startsWith("[")){
        String definitionAlias = pdid.substring(1, pdid.indexOf("]"));
        return getProcessDefinitionProductionVersionByAlias(definitionAlias);
      }
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());
      ProcessDefinitionRepositoryLocal pdlr = pdhr.findByPrimaryKey(new Long(pdid));
     
      Long productionVersionId = pdlr.getProdVerId();
      if(productionVersionId==null || ((Long)productionVersionId).longValue()==-1)
        throw new RemoteException("ProcessManagerError: There's no production. Make sure you have chosen a version of the process definition as production at least once.");
             
      return productionVersionId.toString();
    } catch(ObjectNotFoundException onfe) {
View Full Code Here

 
  public String getProcessDefinitionProductionVersionByName(String pdName) throws RemoteException{
    log("getProcessDefinitionProductionVersionByName", new Object[]{pdName});
    try{
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());
      ProcessDefinitionRepositoryLocal pdlr = pdhr.findByName(pdName);
     
      if(pdlr==null)
        throw new RemoteException("ProcessManagerError: There's no such process definition named '" + pdName + "'");
     
      Long productionVersionId = pdlr.getProdVerId();
      if(productionVersionId==null || ((Long)productionVersionId).longValue()==-1)
        throw new RemoteException("ProcessManagerError: There's no production. Make sure you have chosen a version of the process definition as production at least once.");
             
      return productionVersionId.toString();
    }catch(ObjectNotFoundException onfe){
View Full Code Here

 
  public String getProcessDefinitionProductionVersionByAlias(String alias) throws RemoteException{
    log("getProcessDefinitionProductionVersionByAlias", new Object[]{alias});
    try{
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());
      ProcessDefinitionRepositoryLocal pdlr = pdhr.findByAlias(alias);
     
      if(pdlr==null)
        throw new RemoteException("ProcessManagerError: There's no such process definition aliased '" + alias + "'");
     
      Long productionVersionId = pdlr.getProdVerId();
      if(productionVersionId==null || ((Long)productionVersionId).longValue()==-1)
        throw new RemoteException("ProcessManagerError: There's no production. Make sure you have chosen a version of the process definition as production at least once.");
             
      return productionVersionId.toString();
    }catch(ObjectNotFoundException onfe){
View Full Code Here

 
  public String getProcessDefinitionIdByAlias(String alias) throws RemoteException{
    log("getProcessDefinitionIdByAlias", new Object[]{alias});
    try{
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());
      ProcessDefinitionRepositoryLocal pdlr = pdhr.findByAlias(alias);
     
      return pdlr.getDefId().toString();
    }catch(ObjectNotFoundException onfe){
      UEngineException ue = new UEngineException("No such processdefinition with alias '" + alias +"'.", onfe);
      throw new RemoteException("ProcessManagerError:" + ue.getMessage(), ue);
    }catch(Exception e){
      e.printStackTrace();
View Full Code Here

      }
      if(!UEngineUtil.isNotEmpty(parentFolder)){
        parentFolder = "-1";
      }
     
      ProcessDefinitionRepositoryLocal pdr = null;
     
      try {
        pdr = pdhr.findByNameSameLevel(folderName, new Long(parentFolder), "folder");
      } catch (Exception e) {
        pdr = pdhr.create(UniqueKeyGenerator.issueProcessDefinitionKey(getTransactionContext()));
        pdr.setName(folderName);
        pdr.setParentFolder(new Long(parentFolder));
        pdr.setIsFolder(true);
        pdr.setObjType("folder");
      }
     
      return ""+pdr.getDefId();
    }catch(Exception e){
      e.printStackTrace();     
      throw new RemoteException("ProcessManagerError:"+e.getMessage(), e);
    }
  }
View Full Code Here

 
  public void moveFolder(String pdid, String parentFolder) throws RemoteException{
    log("moveFolder", new Object[]{pdid, parentFolder});
    try{
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());     
      ProcessDefinitionRepositoryLocal pdr = pdhr.findByPrimaryKey(new Long(pdid));
     
      //if there is no parent folder, this will occur an exception to break this try~catch block
      if(parentFolder!=null && !parentFolder.equals("-1")){
        pdhr.findByPrimaryKey(new Long(parentFolder));
      }
      if(!UEngineUtil.isNotEmpty(parentFolder)){
        parentFolder = "-1";
      }
     
      pdr.setParentFolder(new Long(parentFolder));
     
    }catch(Exception e){
      e.printStackTrace();
      throw new RemoteException("ProcessManagerError:"+e.getMessage(), e);
    }
View Full Code Here

  public void setVisibleProcessDefinition(String pdid, boolean isVisible) throws RemoteException{
    log("setHiddenProcessDefinition", new Object[]{pdid, new Boolean(isVisible)});
    try{
     
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(getTransactionContext());     
      ProcessDefinitionRepositoryLocal pdr = pdhr.findByPrimaryKey(new Long(pdid));

      pdr.setIsVisible(isVisible);
     
    }catch(Exception e){
      e.printStackTrace();
      throw new RemoteException("ProcessManagerError:"+e.getMessage(), e);
    }
View Full Code Here

  public void renameProcessDefinition(String pdid, String newName) throws RemoteException{
    log("renameProcessDefinition", new Object[]{pdid, newName});
    try{
      ProcessTransactionContext tc = getTransactionContext();
      ProcessDefinitionRepositoryHomeLocal pdhr = GlobalContext.createProcessDefinitionRepositoryHomeLocal(tc);     
      ProcessDefinitionRepositoryLocal pdr = pdhr.findByPrimaryKey(new Long(pdid));
      pdr.setName(newName);
     
      //2011.1.11 add by yookjy
      //rename upd
      String pdvid = String.valueOf(pdr.getProdVerId());
      ProcessDefinitionFactory pdf = ProcessDefinitionFactory.getInstance(getTransactionContext());
      ProcessDefinition pd = pdf.getDefinition(pdvid);
      pd.setName(newName);

      //rename process definition version
View Full Code Here

TOP

Related Classes of org.uengine.persistence.processdefinition.ProcessDefinitionRepositoryLocal

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.