Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
piyush_kumar6
Active Contributor

Hello Friends,

I have implemented the custom Portal favorite application which can be very handy if you have implemented Federated Portal Network (FPN). This custom application will give access to consumer as well as producer favorites (In FPN Scenario) on the same page in consumer Portal. So in this way we can avoid the two portal favorite windows on consumer portal.

In my case  Enterprise Portal (EP) is the Consumer Portal and the BI Portal is the Producer Portal.

Note: I assume SDN members who are following this blog, know the Par application development using Abstract Portal Component and reading KM documents from Par file .

Symptom /Problem Details:

When we use a Federated Portal Network where the Enterprise Portal (EP) is the Consumer Portal and the BI Portal is the Producer Portal.  Users access BI Reports from the Enterprise Portal (Consumer Portal) through RRA or RDL.
BI Report’s “Save As" functionality allows us to save a BI report as a   "KM Bookmark” which will be available in Portal Favorite list, But when we save BI reports as favorite it gets saved in Producer Portal  and we do not see the bookmarks in Consumer Portal Favorite list. So if we want to access the BI bookmarks then we need to have two Favorite windows in our Consumer Portal as shown in below picture.

              Image -1

Because of this we often face issue as Customers are not ready to accept two Favorite windows in Portal.  :cry: :cry:           Even it creates confusion for End Users  :???: :???: .

Solution:

This solution is mainly dived in two steps:

  1. WebDAV Repository creation
  2. Par Application development , Which will read the bookmarks from created repository

1. WebDAV Repository creation:

To Create KM repository for Producer Portal in Consumer Portal, we need to created

  1. First we create HTTP System
  2. Then we create Cache for the WebDAV Repository
  3. At last step we create WebDAV Repository Manager

  1. Creating  a Http system  - SAP Help URL
  2. Creating a Cache for the WebDAV Repository - SAP Help URL
  3. Creating a WebDAV Repository Manager - SAP Help URL

2. Par Application development:

This is the final step of proposed solution;in this step we create the par application which will read the bookmarks from created repository.

Note:

  • While creating Par application we select Abstract Portal Component
  • In portalapp.xml we need to use com.sap.portal.htmlb, com.sap.km.application,usermanagement, knowledgemanagement as Sharing Reference.

Development overview:

After creating par project/Object, get the logged in user

IUseruser=request.getUser();
com.sapportals.portal.security.usermanagement.IUserep5User=
WPUMFactory.getUserFactory().getEP5User(user);
Stringuid=request.getUser().getUniqueName();

After getting logged in user we need to read the Consumer bookmarks and producer bookmarks (Which is now available in Consumer KM repository, by following step 1 “WebDAV Repository creation”

As we know Portal Bookmarks/Favorites path will be fixed - /userhome/user_id/favorites

So using the uid from above code read the Consumer bookmarks from below path

favLoc = “/userhome/"+uid+"/favorites”;

And suppose we created the WebDAV Repository called “producer_home” in Consumer Portal from Step 1 then read the Producer bookmarks from below path

favLoc = "/producer_home/"+uid+"/favorites";

Code for reading bookmarks from KM:

ResourceContextctxt = null;
RID resRid = RID.getRID(favLoc);                       
ICollectioncurrentFolder = null;           
currentFolder = (ICollection) com.sapportals.wcm.repository.ResourceFactory.getInstance().
                            getResource(resRid, ctxt);   
if(currentFolder != null)
{               
    IResourceList children = null;
    children = currentFolder.getChildren();               
    IResourceListIterator it = children.listIterator();
      while (it.hasNext())
      {                                                                          
        com.sapportals.wcm.repository.IResourcechildRes = it.next();
        try{                                       
                IPropertyMaphm = childRes.getProperties();                                   
                IPropertyIteratoriter = hm.iterator();                                   
                IPropertyNamepropName = null;                                   
                String uri = "";
                while(iter.hasNext())
                    {
                        propName = ((IProperty)iter.next()).getPropertyName();
                        if(propName.getName().equalsIgnoreCase("contentlink"))
                        {
                            uri = ((IProperty)childRes.getProperty(propName)).getStringValue();
                            String strFavName = childRes.getDisplayName();
                     //Here uri will hold the url for bookmark and strFavName will hold display name of bookmark
  response.write("Here create the Hyper link -- where href = uri and display name= strFavName");
                            break;
                         }
                    }
            }   
        catch (Exception e)
         {                                   
            //response.write(e.getLocalizedMessage());
            //response.write(e.toString());
            e.printStackTrace();
         }

Output:

     

                                                         Image -2

In above image we can see that BI bookmarks as well as Consumer portal bookmarks are available in same page. We can compare BI bookmarks from Image -1

Functionality which are different from Standard Portal Favorite Application

As Standard Portal Favorite Application is for one Portal only i.e. all the favorite get stored at same server itself and for our scenario Consumer favorite gets stored at Consumer server and BI reports which comes from Producer Portal gets stored at Producer portal.

So here in our custom application we will have two menus for “Organize Favorites” functionality.  One menu will point to Consumer maintenance window and other menu will point to Producer maintenance window (Created KM Repository). Which is shown in above image (Organize Portal Favorites & Organize BI Favorite Reports)

We use below code to add Context Menu Option to Tray

/*

* Tray Menu Option for Consumer

*/

      response.write("<script defer=\"defer\">");
      response.write("try {");
      response.write("if (!window.pageSupport) { ");
      response.write("if (parent.pageSupport) {");
      response.write("varmyId = parent.pageSupport.getIvuId(self);");
      response.write("parent.pageSupport.ivuAddTrayOption(myId , \"Organize Portal favourites\" ,
                     \"addTrayOptionEditFavorite()\");");
      response.write("} }");       
      response.write("  } catch(e){ }");
      response.write("</script>");
      response.write("<script> ");
      response.write("function addTrayOptionEditFavorite() {window.open('"+manageConsumer+"',
                      'myFavWin' ,'toolbar=no, status=no, menubar=no,resizable=yes, scrollbars=yes,
                       width=800, height=600'); }");
      response.write("</script> ");

Where

manageConsumer="/irj/go/km/navigation/userhome/"+uid+"/favorites?StartUri=/userhome/"+uid+"/
                                   favorites&rndLayoutSet=PortalFavoritesMaintenance&layoutSetMode=exclusive";

/*

* Tray Menu Option for Producer

*/

response.write("<script defer=\"defer\">");
response.write("try {");
response.write("if (!window.pageSupport) { ");
response.write("if (parent.pageSupport) {");
response.write("varmyId = parent.pageSupport.getIvuId(self);");
response.write("parent.pageSupport.ivuAddTrayOption(myId , \"Organize BI favourite Reports\" ,
                \"addTrayOptionEditFavoritePro()\");");
response.write("} }");       
response.write("  } catch(e){ }");
response.write("</script>");
response.write("<script> ");
response.write("function addTrayOptionEditFavoritePro() {window.open('"+manageProducer+"',
                'myFavWin' ,'toolbar=no, status=no, menubar=no,resizable=yes,
                 scrollbars=yes, width=800, height=600'); }");
response.write("</script> ");

Where

manageProducer="/irj/go/km/navigation/producer_home/"+uid+"/favorites?StartUri=/ producer_home/"
                  +uid+"/favorites&rndLayoutSet= PortalFavoritesMaintenance&layoutSetMode=exclusive";

______Piyush_______

13 Comments
Labels in this area