Skip to Content
avatar image
Former Member

Getting KM Resources of a Group using Webdynpro java

Hi Experts,

I want to display the KM Resources of a Group using Webdynpro java (NW 7.0 ehp1).

So can any one please suggest me whether it is possible or not, and if it is possible so please provide me some coding examples.

I have tried with a logic that, first I extracted the users of that Group and then tried to display in the table, but that is not fullflling requiremtn.

I just want to display the KM resources directly from the Group.

Also I have tried to do this directly but I'm getting error when I am tring to declare the " 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.

for(int i=0; i<wdContext.nodeGroups().size(); i++)  /// 

{

  if(wdContext.nodeGroups().isMultiSelected(i))

  {

   String logonId = wdContext.nodeGroups().getElementAt(i).getAttributeAsText("groupId");

   try

   {

    IPublicResourceAppsComp.IGroupsElement groupsElement = null;

    IPublicResourceAppsComp.IGroupResourcesElement groupResourcesElement = null;

   

    IGroupFactory groupFact = UMFactory.getGroupFactory();

    IGroupSearchFilter groupFilt = groupFact.getGroupSearchFilter();

    groupFilt.setUniqueName(logonId, ISearchAttribute.LIKE_OPERATOR, false);

    ISearchResult result = groupFact.searchGroups(groupFilt);

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

    {

     while(result.hasNext())

     {

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

      IGroup thisGroup = groupFact.getGroup(uniqId);

//      com.sapportals.portal.security.usermanagement.IGroup ep5Group = UMFactory.getGroupFactory().getEP5Group(thisGroup);

      IResourceContext resourceContext = new ResourceContext(ep5Group);

      String resourceID = wdContext.currentContextElement().getCurrentFolder();

      RID rid = RID.getRID(resourceID);

      com.sapportals.wcm.repository.IResource resource = com.sapportals.wcm.repository.ResourceFactory.getInstance().getResource(rid, resourceContext);

      if(resource.isCollection()== true)

      {

       ICollection collection = (ICollection)resource;

       IResourceList resourceList = collection.getChildren();

       if(resourceList.size()>0)

       {

        IResourceListIterator resourceListIterator = resourceList.listIterator();

        

       }

      }

     }

    }

   }catch (Exception e) {

    // TODO: handle exception

   }

  }

}

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Sep 25, 2012 at 01:10 PM

    ResourceContext is defined for Iuser inly, not iGroup

          IResourceContext resourceContext = new ResourceContext(ep5Group);

    this will nto work, you should use


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



    Add comment
    10|10000 characters needed characters exceeded

    • If its not through users, then try to get the users in the group and get one list.

      Then, use the code to get the resources linked to users(obtained from the group ). This way, you get the resources linked to a group.

      Regards,

      Sharath

  • Sep 18, 2013 at 11:00 AM

    Hi Mainak, did you complete your task. I have also got the simillar kind of task.

    My task is, first get the all groups from UME and after that based on the group we need to display all KM folder/documents etc.. associated that selected group.

    Now I have complted the first part to get all groups from UME. Now  I want display the KM resources directly from the Group.

    if you have code, can you please provide me the code.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 19, 2013 at 09:06 AM

    Hi Mainak Ghosh,

    did you try to get the KM Resouces using group selection using Web dynpro java?

    Regards,

    Ramireddy

    Add comment
    10|10000 characters needed characters exceeded