Step 2a: Creating the Portfolio object

Create the portfolio object associating the different document objects created.
/* Creating the portfolio object */ 
Portfolio pf = new Portfolio(); 
pf.setName("SamplePortfolio"); 
pf.setComment("Sample portfolio"); 
pf.setDesc("Sample portfolio "); 
pf.setLcat(getCategoryObject("SubCategory",1)); 
pf.setUcat(getCategoryObject("MainCategory",0)); 
pf.setNavigator(navDoc); 
pf.setCover(coverDoc); 
 
/* Create the folders and associate the documents with it */ 
PortfolioFolder folder = new PortfolioFolder(); 
List<PortfolioDocument> docList = new ArrayList<PortfolioDocument>(); 
docList.add(ltrDoc); 
folder.setName("root"); 
folder.setSubFolders(null); 
folder.setDesc("root folder"); 
folder.setDocuments(docList); 
pf.setRootFolder(folder);

Now that the portfolio object is created with all its properties set, persist the object using the createPortfolio API.

public Portfolio createPortfolio(Portfolio portfolio)

// Ethnio survey code removed