on 05-23-2011 10:33 AM
Hi All,
I want to read InfoView MyFavourites from SAP Business Objects to SAP Portal using Iviews. From SDN of below mentioned URL [http://wiki.sdn.sap.com/wiki/display/Snippets/ReadInfoViewfavoritesfromthe+portal?focusedCommentId=235802852&#comment-235802852 ] i got code to read InfoView MyFavourties folder.
This code is working fine in order to retrieve MyFavourites of login user (Enterprise User passed in Coding for Authorization).
But I want to retrieve the MyFavourites of request.getUser() (i.e Portal Login User) and using common Enterprise User to connect and read InfoView Favourites.
I have choosen this option due to below reasons.
1. Tried to connect through secWinAD but could not connect showing below Error Message.
Error - Active Directory Authentication failed to log you on. Please contact your system administrator to make sure you are a member of a valid mapped group and try again. If you are not a member of the default domain, enter your user name as UserName@DNS_DomainName, and then try again. (FWM 00006)
2. When I tried to connect through Enterprise Login authentication It worked well and is showing contents of favorites.
Could you please help me out to get this done. I was expecting to make a function something like....
....../////////
populateInfoViewFavorites(user, boSys.getDesc(), boSys.getId(), root);
/* User = request.getUser()
Actual user used for Authentication to log on and read favourites should be hard coded common enterprise User.
*/
///////////........///////
Note: Please suggest me if there would be any other best practice / easier way of making it possible. Am I trying for correct solution?
Hope you understand my requirement. Awaiting for some solution. Thanks in advance.
Regards
Ganesh Kumar
You could look at using Trusted Authentication since you will know the username. Otherwise, I believe you can do a query like "SELECT * FROM CI_SYSTEMOBJECTS WHERE SI_KIND = 'FavoriteFolder' AND SI_NAME = 'Username'" Once you have the favoritesfolder object, you could do a second query using that ID as the SI_PARENTID to retrieve all content contained in it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adam
Even though your answer seems to be logical It could not really help me out to implement the solution.
Can i have any sample code snippet for the same specifying what kind of changes do I need to make in my program. My current code can be available from the URL available in my Post earlier.
Awaiting for some solution. Thanks in Advance.
Regards
Ganesh Kumar
Edited by: bvdrsgk on May 24, 2011 7:27 AM
Hi All,
I got a code snippet to connect through trusted authentication in order to fix this issue of Enterprise Authentication. Even though there are no compilation errors. While running this program through Iview i m getting exception / error mentioned below:
VSJ authentication was not performed for this request this is at the line
////////////////////////////
credExtractor = new CredExtractor(httpReq);
/////////////////////////////
from the code given below.
Could you please let me know the reason behind this issue ? Any kind of solution for this is much appreciable.
Thanks in advance.
Ganesh Kumar
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
package com.pro.abc;
import javax.servlet.http.HttpServletRequest;
import org.ietf.jgss.GSSCredential;
import org.ietf.jgss.GSSManager;
import com.businessobjects.sdk.credential.CredExtractor;
import com.crystaldecisions.sdk.framework.CrystalEnterprise;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
import com.crystaldecisions.sdk.occa.infostore.ISortDimension;
import com.crystaldecisions.sdk.occa.infostore.SearchPattern;
import com.crystaldecisions.sdk.occa.infostore.SortType;
import com.crystaldecisions.sdk.plugin.CeKind;
import com.crystaldecisions.sdk.plugin.desktop.folder.IFolder;
import com.crystaldecisions.sdk.plugin.desktop.shortcut.IShortcut;
import com.sapportals.portal.prt.component.AbstractPortalComponent;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
public class InfoviewFavorites extends AbstractPortalComponent {
public void doContent(
IPortalComponentRequest request,
IPortalComponentResponse response) {
HttpServletRequest httpReq = request.getServletRequest();
String cms = "boserver.company.com";
String auth = "secWinAD";
String infoViewHostPort = "boserver:8080";
String outString = "";
String docIdS = request.getParameter("iDocID");
IFolder fav = null;
int top = 0;
String logonToken = null;
GSSCredential creds = null;
GSSManager manager = null;
CredExtractor credExtractor = null;
try
{
credExtractor = new CredExtractor(httpReq);
}
catch (Exception e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
outString += e1.getMessage() + e1.getLocalizedMessage();
}
String str = null;
try {
outString += "<P></P><H4>InfoView Favorites</H4>";
IEnterpriseSession enterpriseSession = null;
outString += " 1 ";
creds = credExtractor.GetCredential();
outString += " 2 ";
manager = credExtractor.GetManager();
outString += " 3 ";
enterpriseSession = CrystalEnterprise.getSessionMgr().logon(creds, manager, cms, auth);
outString += " 4";
IInfoStore iStore =
(IInfoStore) enterpriseSession.getService("InfoStore");
outString += " 5 ";
top = iStore.getMyFavoritesFolder().getID();
if (docIdS!=null) {
Integer docId = new Integer(docIdS);
outString += "<p>Folder: " + enterpriseSession.getUserInfo().getUserID();
int propertySet = IInfoObject.PropertySet.ALL;
SortType sortType = new SortType();
sortType.addSortDimension(ISortDimension.NAME_ASC);
SearchPattern searchPattern = new SearchPattern();
searchPattern.setID(docId.intValue());
IInfoObjects objects =
iStore.find(propertySet, searchPattern, sortType);
for(int j = 0; j < objects.size(); j++)
{
fav = (IFolder) objects.get(j);
outString += fav.getTitle();
if (fav.getParentID()==top) {
outString += " <a href="http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/infoview.showmenu">Up</a>";
} else {
outString = " <a href="http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/infoview.showmenu?idocid="fav.getParentID()+"">Up</a>";
}
}
} else {
fav = iStore.getMyFavoritesFolder();
}
............
............
.............
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.