Skip to Content

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.

pastedImage_4.png

              Image -1

Because of this we often face issue as Customers are not ready to accept two Favorite windows in Portal.  😥 😥           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 RepositorySAP Help URL
  3. Creating a WebDAV Repository ManagerSAP 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:

      Fav_App.png

                                                         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_______

To report this post you need to login first.

13 Comments

You must be Logged on to comment or reply to a post.

  1. Amit Bagati

    Interesting to have solution for this scenario. This will be really a out of box solution for customers using FPN. Great job and well done!!

    (0) 
    1. Piyush kumar Post author

      Hello Archana,

      If you have values in list/map then just print the list using response.write(…..). at last of your function. so when you create the iView from par it will show the list in group.

      Regards,

      Piyush

      (0) 
      1. Archana Vallakati

        Thanks Piyush..Thanks a lot..I have the same situation with Application Integration..I have done with the first step and developed APC with both the favorites in a list..now I know the next step.. 🙂

        (0) 
        1. Archana Vallakati

          Hi Piyush,

          How did you get the look and feel for the favorites window you created similar to Portal Favorites? Will it is possible for you to share the code?

          Thanks,

          Archana V

          (0) 
          1. Piyush kumar Post author

            Hello Archana,

            I don’t have code now.. M in different project now.

            For getting the same look & feel you can use same color code in your have code where you define html tags for creating table and show Favorites link.

            Like < body class =”your css class- which have same color code”>

                   < td class =”your css class- which have same color code”>

            Regards,

            Piyush

            (0) 
            1. Archana Vallakati

              Thanks Piyush. Trying the same since couple of days!! Need that folder open close functionality and my favorites are coming like links directly.

              Anyhow thanks for your blog. It really helped me a lot.

              Thanks,

              Archana V

              (0) 

Leave a Reply