Package org.uengine.util.export

Examples of org.uengine.util.export.UEngineArchive


   
    try {
      Vector subDefinition = getSubDefinitionsDeeply(getDefinition(mainPdr.getId()));
      subDefinition.add(mainPdr.getId());
     
      UEngineArchive ua = new UEngineArchive();
      for(int i=0; i < subDefinition.size() ;i++){
        String subDefVerId = (String)subDefinition.get(i);
        ProcessDefinitionRemote pdr = getProcessDefinitionRemote(subDefVerId);
       
        in = ProcessDefinitionFactory.getInstance(getTransactionContext()).getResourceStream(pdr.getId());
        String objType="";
        if(pdr.getObjType()==null){
          if(pdr.isFolder())   objType="folder";
          else  objType="process";
        }else{
          objType = pdr.getObjType();
        }
        boolean isRoot=false;
        if(mainPdr.getId().equals(subDefVerId)){
          isRoot=true;
        }
       
        String defName = pdr.getName().toString();
        ZipEntryMapper entryMapper = new ZipEntryMapper(defName,subDefVerId,pdr.getAlias(), objType,pdr.getVersion(),in);
        zipEntryMapperList.add(entryMapper);
       
        ua.setDefinitionList(defName, pdr.getAlias(), pdr.getBelongingDefinitionId(), subDefVerId, objType, "","", pdr.getParentFolder(), pdr.getId(), isRoot);
      }
     
      writeZip(filePath, zipEntryMapperList, ua);
     
    } catch (Exception e) {
View Full Code Here


    }
  }
   
  public void exportProcessDefinitionbyDefinitionId(String defId, boolean ExportAllVersion) throws Exception {
    try{
      UEngineArchive ua = new UEngineArchive();
      Hashtable options = new Hashtable();
     
      ProcessDefinitionRemote pdr = getProcessDefinitionRemoteByDefinitionId(defId);
      String defName = pdr.getName().getText();
     
      ua.setDefinitionList(defName, "", pdr.getBelongingDefinitionId(), String.valueOf(pdr.getVersion()), ZipEntryMapper.TYPE_FOLDER, defName, "", "-1", pdr.getId(), true);
     
      options.put(UEngineArchive.UENGINE_ARCHIVE, (UEngineArchive)ua);
      options.put(UEngineArchive.SUB_PROC, new Hashtable());
     
      String rootDirectory = TEMP_DIRECTORY + defName + File.separatorChar;
View Full Code Here

      throw new RemoteException("ProcessManagerError:"+e.getMessage(), e);
    }
  }
 
  private Hashtable setFormsForExport(String rootDirectory,Hashtable options) throws Exception {
    UEngineArchive ua = (UEngineArchive) options.get(UEngineArchive.UENGINE_ARCHIVE);

    for (int i=0; i<ua.getDefinitionList().size(); i++) {
      DefinitionArchive da = (DefinitionArchive)ua.getDefinitionList().get(i);
      if(!"process".equals(da.getObjectType())) continue;
     
      String subDefVerId = da.getId();
      ProcessVariable[] pvs = null;
      try {
        pvs = getProcessDefinition(subDefVerId).getProcessVariables();
      } catch (Exception ex) {
        System.out.println("Exception subDefVerId : " + subDefVerId);
        continue;
      }

      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"
            if (UEngineUtil.isNotEmpty(formDefId)) {
              String formAlias = formDefId.substring(1, formDefId.indexOf("]"));
              String defVerId = getProcessDefinitionProductionVersionByAlias(formAlias);
              ProcessDefinitionRemote formPdr = getProcessDefinitionRemote(defVerId);
             
              if (!ua.containKeys(formPdr.getBelongingDefinitionId()) ) {
                      //_SubProc folder create
                ua.setDefinitionList("_Form","", "_Form", "", ZipEntryMapper.TYPE_FOLDER ,"_Form" ,"", ua.getMainProcessDefinition().getBelongingId(), "", false);

                String fileName = ZipEntryMapper.ENTRY_SEPARATOR+formPdr.getName().getText()+ZipEntryMapper.ENTRY_SEPARATOR+formPdr.getAlias()+ZipEntryMapper.ENTRY_SEPARATOR+formPdr.getId()+ZipEntryMapper.ENTRY_SEPARATOR+formPdr.getObjType();
                String desc = formPdr.getDescription() == null ? "" : formPdr.getDescription().getText();
               
                ua.setDefinitionList(formPdr.getName().getText(), formPdr.getAlias(), formPdr.getBelongingDefinitionId(), String.valueOf(formPdr.getVersion()), formPdr.getObjType(),fileName,desc , "_Form", formPdr.getId(), false);
                getFilePathNFileCopy(formPdr, rootDirectory + File.separatorChar + "_Form" + File.separatorChar, false);
              }
            }
          }
        }
View Full Code Here

    for (int i=0; i<pdrs.length; i++) {
      ProcessDefinitionRemote pdr = pdrs[i];
     
      if(!pdr.getParentFolder().equals(processDefinition)) continue;
     
      UEngineArchive ua = (UEngineArchive)options.get(UEngineArchive.UENGINE_ARCHIVE);
     
      if (pdr.isFolder()) { //folder
        ua.setDefinitionList(pdr.getName().getText(), "", pdr.getBelongingDefinitionId(), String.valueOf(pdr.getVersion()), ZipEntryMapper.TYPE_FOLDER, pdr.getName().getText(), "", pdr.getParentFolder(), pdr.getId(), false);
        options.put(UEngineArchive.UENGINE_ARCHIVE, (UEngineArchive)ua);
        String temp = parentDirectory;
        parentDirectory = parentDirectory + pdr.getName() + File.separatorChar;
        File f = new File( TEMP_DIRECTORY + parentDirectory );
        f.mkdirs();

        setDefinitionsForExport(pdr.getId(), pdrs, parentDirectory, options, ExportAllVersion);
       
        parentDirectory = temp;
      } else if (pdr.isProduction() ) { //process or form
        ua.setDefinitionList(pdr.getName().getText(), pdr.getAlias(), pdr.getBelongingDefinitionId(), String.valueOf(pdr.getVersion()), pdr.getObjType(), pdr.getName().getText()+ZipEntryMapper.ENTRY_SEPARATOR+pdr.getAlias()+ZipEntryMapper.ENTRY_SEPARATOR+pdr.getId()+ZipEntryMapper.ENTRY_SEPARATOR+pdr.getObjType(), pdr.getDescription() == null ? "" : pdr.getDescription().getText(), pdr.getParentFolder(), pdr.getId(), false);
        options.put(UEngineArchive.UENGINE_ARCHIVE, (UEngineArchive)ua);
        getFilePathNFileCopy(pdr, parentDirectory);
       
        if (pdr.getObjType().equals("process")) {
          //sub process
View Full Code Here

    return options;
  }
   
  private Hashtable setSubProcessesForExport(String rootDirectory, Hashtable options) throws Exception  {
   
    UEngineArchive ua = (UEngineArchive)options.get(UEngineArchive.UENGINE_ARCHIVE);
    Hashtable subDefinition = (Hashtable)options.get(UEngineArchive.SUB_PROC);
   
    Enumeration keys = subDefinition.keys();
    while (keys.hasMoreElements()) {
      String key = (String) keys.nextElement();
      String subDefVerId = (String) subDefinition.get(key);
     
      ProcessDefinitionRemote pdr = getProcessDefinitionRemote(subDefVerId);
      pdr.setObjType("process");
     
      if ( !ua.containKeys(pdr.getBelongingDefinitionId())) {
              //_SubProc folder create
        ua.setDefinitionList("_SubProc","", "_SubProc", "", ZipEntryMapper.TYPE_FOLDER ,"_SubProc" ,"", ua.getMainProcessDefinition().getBelongingId(), "", false);
       
        //add sub-process
        String fileName = ZipEntryMapper.ENTRY_SEPARATOR+pdr.getName().getText()+ZipEntryMapper.ENTRY_SEPARATOR+pdr.getAlias()+ZipEntryMapper.ENTRY_SEPARATOR+pdr.getId()+ZipEntryMapper.ENTRY_SEPARATOR+pdr.getObjType();
        String desc = pdr.getDescription() == null ? "" : pdr.getDescription().getText();
        ua.setDefinitionList(pdr.getName().getText(), pdr.getAlias(), pdr.getBelongingDefinitionId(), String.valueOf(pdr.getVersion()), pdr.getObjType(),fileName ,desc, "_SubProc" , pdr.getId(), false);
       
        getFilePathNFileCopy(pdr, rootDirectory + File.separatorChar + "_SubProc" + File.separatorChar, false);
      }
    }
     
View Full Code Here

    Hashtable result = new Hashtable();

    Hashtable inputStreamList = expandFiles(is);
    String key = "manifest.xml";
    String manifestXml = (String) inputStreamList.get(key);
    UEngineArchive ua = (UEngineArchive) GlobalContext.deserialize(manifestXml);
    ProcessDefinitionRemote[] pds = listProcessDefinitionRemotesLight();
    boolean[] duplication = new boolean[ua.getDefinitionList().size()];

    for (int i = 0; i < ua.getDefinitionList().size(); i++) {
      DefinitionArchive da = (DefinitionArchive) ua.getDefinitionList().get(i);
      ProcessDefinitionRemote pdr = null;
      for (int j = 0; j < pds.length; j++) {
        pdr = pds[j];
        if (da.getAlias().equals(pdr.getAlias()) && UEngineUtil.isNotEmpty(da.getAlias())) {
          duplication[i] = true;
View Full Code Here

      Hashtable newDefVerIdList = new Hashtable();
      Hashtable newAliasList = new Hashtable();
     
      Hashtable inputStreamList = expandFiles(loadedZipFile);
     
      UEngineArchive ua = (UEngineArchive)GlobalContext.deserialize((String)inputStreamList.get("manifest.xml"));
     
      //step1 : import root-folder
      String newRootFolderName = editedUa.getMainProcessDefinition().getName();
      String newRootFolderId = addFolder(newRootFolderName, parentFolder);
     
      String oldRootFolderId = ua.getMainProcessDefinition().getBelongingId();
      newDefIdList.put(oldRootFolderId, newRootFolderId);
         
      //step2 : import child-folder
      importFolder(newRootFolderId, oldRootFolderId, ua,editedUa, newDefIdList);
     
View Full Code Here

TOP

Related Classes of org.uengine.util.export.UEngineArchive

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.