Retrieve all subscriptions for a KM document
Retrieve all subscriptions for a KM document
Steps to be carried out in portal:
- 1. Launch SAP Enterprise and login with user ID having system admin role
- 2. Navigate to System Configuration –> Content Management –> Repository Managers –> CM Repository
- 3. Select any working repository and click on “Edit” to add service “Subscription” from the list as shown below
- 4. Save the changes.
- 5. Save the settings.
- 6. Add few documents to the repository selected.
- 7. Navigate to http://<host>:<port>/irj/go/km/docs/<repository path>.
- 8. Select the context menu for the document and click “Details”. Then select Subscription and enter the details and click on “Save Subscription” to subscribe to the document.
Steps to create the application in NWDS:
- 1. Launch NWDS and navigate to Enterprise Portal perspective.
- 2. Choose File à New à Project.
- 3. Select “Portal Application” from the wizard and click “Next”.
- 4. Enter the project name and the location where the project need to be saved.
- 5. Click on “Finish” and a new project with the name given in step 4 is displayed.
- 6. Right click on the created project àNew àOther
- 7. Select Portal application from the right hand side menu item as shown below
- 8. Click on “Next” and select the project.
- 9. Click on “Next” and select “Abstract Portal Component” under portal component as shown below.
- 10. Click on “Next” and fill in the required details and click on “Finish”.
- 11. Once the component is created double click to open in NWDS.
- 12. Copy the below code and paste it in the doContent() method
IResourceFactory resourceFactory = null;
RID rid = null;
IResourceContext resourceContext = null;
IResource resource = null;
ISubscriptionManager subscriptionManager = null;
ISubscriptionList subscriptionList=null;
try
{
rid = RID.getRID("<Path of the KM document>");
resourceFactory = ResourceFactory.getInstance();
resourceContext =
ResourceFactory.getInstance().getServiceContext("subscription_service");
resource = resourceFactory.getResource(rid, resourceContext);
subscriptionManager =
SubscriptionUtils.getSubscriptionManager(resource);
if(subscriptionManager!= null)
{
if(resourceContext!= null && rid != null)
{
subscriptionList =
subscriptionManager.getSubscriptions(resourceContext,rid,true);
for (int i = 0; i < subscriptionList.size(); i++)
{
response.write("details"+subscription.get(i));
}
}
}
}
- 13. Add the missing imports and add any required jars and deploy the application on the portal. The application will list out all the subscription for a document
- 14. Location of the required jars can be found at http://sapjarfinder.com/
Be the first to leave a comment
You must be Logged on to comment or reply to a post.