DrupalCustom

FreewayContentSelectionAction

Aug 13th, 2012
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.69 KB | None | 0 0
  1.   public String doDefaultXmlFreeway() throws Exception
  2.         {
  3.             ArrayList pageList = new ArrayList();
  4.             String currTimeStamp ="";
  5.            
  6.             int version = 0;
  7.             String srcLang = "TBDS";
  8.             String tarLang = "TBDT";
  9.             String title = "";
  10.             String content = "";
  11.            
  12.             File tempFolder = new File("C://ConfluenceTemp");
  13.             if(!tempFolder.exists()){
  14.                 System.out.println("Folder does not exist >> ");
  15.                 tempFolder.mkdir();
  16.             }
  17.             else{
  18.                 System.out.println("The folder exists must clean first");
  19.                 deleteDir(tempFolder);
  20.                 tempFolder.mkdir();
  21.             }
  22.                        
  23.             exportType = ImportExportManagerExtended.TYPE_FREEWAY;
  24.             System.out.println("The contents to be exported >> " + getContentToBeExported().size());
  25.             System.out.println("The contents available >> " + getContentTree().size());
  26.  
  27.             for(int i = 0; i < getContentToBeExported().size(); i ++)
  28.             {  
  29.             System.out.println("Content To Be Exported " + (String)getContentToBeExported().get(i));
  30.             innerlist.add((String)getContentToBeExported().get(i));
  31.                        
  32.             }
  33.  
  34.             ArrayList test = (ArrayList)contentTree.getPages();
  35.             for(int j =0;j<innerlist.size(); j++){
  36.  
  37.                 String stemp = innerlist.get(j).toString();
  38.                 long idvalue = Long.parseLong(stemp);
  39.                
  40.                 System.out.println("This is id value :"+idvalue);
  41.             System.out.println("CONTENT " + pageManager.getPage(idvalue));
  42.             Page testPage = pageManager.getPage(idvalue);
  43.             System.out.println("Content:: " + testPage.getContent());
  44.             System.out.println("Title:: " + testPage.getTitle());
  45.             System.out.println("ID here:: " + testPage.getId());
  46.             System.out.println("Version:: " + testPage.getVersion());
  47.            
  48.             version = testPage.getVersion();
  49.             title = testPage.getTitle();
  50.             content = testPage.getContent();
  51.            
  52.             //1. Write the contents whilst they are in the loop.That means creating  XML's at a temporary location in a folder: For now we create a folder in C:           
  53.             //Parameters pageid,version,Time, Title, content file,
  54.            
  55.             currTimeStamp = getCurrentTimestamp();
  56.             WriteXMLFile xmlWrite = new WriteXMLFile();
  57.             xmlWrite.createXmlFile(idvalue,version,currTimeStamp,srcLang,tarLang,title,content);
  58.            
  59.             //2. Zip that folder
  60.             ZipXmlFolder zipfldr = new ZipXmlFolder();
  61.             zipfldr.zipXmlFolderAction("C://ConfluenceTemp");
  62.              
  63.             //3. Navigate onto the next page
  64.  
  65.                    
  66.             }
  67.              
  68.            
  69.             return doDefault();
  70.             //return SUCCESS;
  71.             // return Action.SUCCESS;
  72.         }
Add Comment
Please, Sign In to add comment