Quantcast
Channel: SCN: Message List - Java SDK Application Development
Viewing all articles
Browse latest Browse all 2284

Re: BO 4.1 Universe Metadata extraction using Java SL SDK

$
0
0

Hi,

 

You will have to create a recursive function to retrieve all sub folders. Once you get all folders in a list you can loop it to get children and then do an instance check and retrieve Dimension, Measures etc. accordingly. This is one of the way to do it

 

 

public  class FolderService {


List folderList = new ArrayList<Folder>();


public List<Folder> getChildren(List<BlItem> blItems) {


if(blItems!= null) {


     for (BlItem blItem : blItems) {


          if(blItem instanceof Folder){

               classList.add(f);

 

          List<BlItem> kids = f.getChildren();

          if(kids != null) getChildren(kids);


} elsereturnnull;


returnfolderList;

}

public class DemoTest {

 

public static void main(String args[]){

...

...

 

RootFolder rootFolder = businessLayer.getRootFolder();

FolderService folderService = new FolderService();

 

// The below list has all subfolders .

List<Folder> allFolders = folderService.getChildren(rootFolder.getChildren());

for(Folder f: allFolders){

List<BlItem> objectsList = f.getChildren();

 

for(BlItem item : objectsList) {

 

//Do instance check for all (Dimension, Folder , Measures etc.)

if(blItem instanceof Dimension){

Dimension d = (Dimension)item;

}

....

....

....

....

}}}}


Viewing all articles
Browse latest Browse all 2284


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>