Skip to Content

Get the KM Resources of a Group using Webdynpro java

Hi Experts.

I want to display the KM Resources (fodler,sub folders, document etc...) of selected Group using Webdynpro java (NWDS 7.0.1).

First I have extracted the all Groups in table using Webdynpro java. Next I have tried to get the KM Resources using selected Group from table.

But I am getting compile time error messages

IResourceContext resourceContext = new ResourceContext(ep5Group);". The error is "The constructor ResourceContext(IGroup) is undefined"

Please help me. 

Here I have attached the coding which I had tried.

 

groupFact = UMFactory.getGroupFactory();

IGroupSearchFilter groupFilt = groupFact.getGroupSearchFilter();

groupFilt.setUniqueName("*", ISearchAttribute.LIKE_OPERATOR, false);

ISearchResult result = groupFact.searchGroups(groupFilt);

 

  if(result.getState() == ISearchResult.SEARCH_RESULT_OK) {  

   wdComponentAPI.getMessageManager().reportSuccess("result:" +result.size());

   while(result.hasNext()) {

    String uniqId = (String)result.next();

    IGroup thisGroup = groupFact.getGroup(uniqId);

   

    com.sapportals.portal.security.usermanagement.IGroup ep5Group  = null;

    ep5Group = (com.sapportals.portal.security.usermanagement.IGroup)UMFactory.getGroupFactory().getGroup(thisGroup.getDisplayName());    

    IResourceContext context = new ResourceContext(ep5Group);   

    RID rid = RID.getRID("/documents/CCElectronics Content/Folder View/");

    IResource resource = ResourceFactory.getInstance().getResource(rid, context);

    if(resource.isCollection() == true) {

          ICollection collection = (ICollection)resource;

          IResourceList resourceList = collection.getChildren();

  

          if(resourceList.size()>0) {

                IResourceListIterator resourceListIterator = resourceList.listIterator();

                for(IResourceListIterator itr = collection.getChildren().listIterator(); itr.hasNext();) {

                      IResource res = (IResource)itr.next();

                      wdComponentAPI.getMessageManager().reportSuccess("KM Content1:" + res.getDisplayName());

                      wdComponentAPI.getMessageManager().reportSuccess("KM Content2:" + res.getDisplayName(true));      

      }

         

     }

    }  

   } 

  }     

} catch (Exception e) {

  // TODO Auto-generated catch block

  e.printStackTrace();

}

Regards,

Ramireddy

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Sep 25, 2013 at 09:13 AM

    Reddy,

    ResourceContext is defined for Iuser inly, not iGroup

    IResourceContext resourceContext = new ResourceContext(ep5Group);

    this will not work, you should use

    ResourceContext getInstance(com.sap.security.api.IUser user, Locale fallbackLocale)

    Hope this helps!!

    Regards

    Vijay Kalluri

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 10, 2013 at 07:21 AM

    Done.

    Add comment
    10|10000 characters needed characters exceeded