cancel
Showing results for 
Search instead for 
Did you mean: 

Getting KM Resources of a Group using Webdynpro java

Former Member
0 Kudos

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

   }

  }

}

Accepted Solutions (1)

Accepted Solutions (1)

SandipAgarwalla
Active Contributor
0 Kudos

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)



Former Member
0 Kudos

Hi Sandip,

Can you please just tell me whether it is possible to get the Resources which are directly assigned to the Groups, not via users.

If it is so can you please provide me some example.

Sharathmg
Active Contributor
0 Kudos

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

Answers (2)

Answers (2)

rami_reddy4
Participant
0 Kudos

Hi Mainak Ghosh,

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

Regards,

Ramireddy

rami_reddy4
Participant
0 Kudos

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.