on 05-30-2005 1:47 PM
Hi,
Is there are API or service by which I can get all properties of any pcd object from the object id? Or is there a way I can find out the type (role, workset, etc) of the pcd object from its id?
Nirav
Hi Nirav,
Yah I have done this I have developed a search application in which i search for roles related to users and then all object which are assigned to that Role or even single object like Page, Iview or workset.
There is Property 'com.sap.portal.pcd.gl.ObjectClass' which classifies certain objects like iviews, pages, worksets etc.
(e.g. com.sap.portal.pcd.gl.ObjectClass[iview]==com.sapportals.portal.iview)
So what you have to do to get iviews,pages or workset inside a role by means of Jndi?
You search on the context role for contexts which property com.sap.portal.pcd.gl.ObjectClass
has the value 'com.sapportals.portal.iview(pages,workset)'.
That's all!
Let me know if you need help to find Roles as well... I will send you the codes of my application may be it will help you...
Regards
Yasir Noman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nirav,
> I think he should get the goodies
If that was the solution for you - feel free to reward him 10 points. But please - reward some...
If you want to appreciate the other answers, it is absolutely OK to reward 6 / 2 points for the others, too.
I really promise that the points won't be debited from your bank account afterwards! Come on guy
Best regards
Detlev
Sorry guys....awarded points now. But seriously, your bank account doesn't get credited either with em. Kidding, I realize that it adds up to one reputation in the SDN and points should be awarded. I'll be more careful next time.
The rivalry between Detlev and Gaurav is interesting....but come on guys, call it even now!!!
Nirav
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
//Getting the current user (could this be the problem
//Do I need the pcd user?
IUser user = request.getUser();
env.put(Context.SECURITY_PRINCIPAL, user);
IPcdObjectFactory pcdObjectFactory = ((IPcdGlService) PortalRuntime.getRuntimeResources().getService(IPcdGlService.KEY)).getPcdObjectFactory();
IPcdContext pcdContext;
try {
pcdContext = pcdObjectFactory.getInitialContext(env);
IPcmEditObject pcmObj;
try {
pcmObj = (IPcmEditObject) pcdContext.lookupLink(pcdPath);
Hi Yasir, Detlev,
I thought the problem would be solved but im stuck again.
Please check the code above cause the lookup fails.
Hi Nirav,
> //Getting the current user (could this be the problem
> //Do I need the pcd user?
This can be the problem. The user object must have the right to access the PCD object. If you are running this code with users without access rights, it will fail. This is the reason why I also gave the service user access...
Hope it helps
Detlev
Hi Nirav,
Prakash suggested a way where you get this information quite easy for an iView, but this is no real access to PCD or to other PCD objects. I have just opened an OSS message about this problem, that these values may differ, even if no personalization is activated.
Yasir showed the right direction for PCD access.
Mainly, this is pure JNDI, a code fragment is:
try {
serviceUser = (IUser)AccessController.doPrivileged(new PrivilegedExceptionAction(){
public Object run() throws Exception {
IUserManagementEngine umService = (IUserManagementEngine)
PortalRuntime.getRuntimeResources().getService("com.sap.portal.usermanagement.user_management_engine");
IServiceUserFactory serviceUserFactory = umService.getServiceUserFactory();
return serviceUserFactory.getServiceUser(PCD_USER);
}
});
} catch (Exception e) {
e.printStackTrace();
}
env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Context.SECURITY_PRINCIPAL, serviceUser);
pcmSrv = pcdFactory.getInitialContext(env);
IPcmEditObject pcmObj = (IPcmEditObject) pcmSrv.lookup(pcdPath);
If you take this ...Edit... object, you can also modify it. Taking the service user as shown gives you access to everything, so take care ...
Hope it helps
Detlev
PS: Prakash: Gaurav posted his solution 17 minutes later --- sometimes I also have messages open for half an hour, for using RSS feeds and answering about ten messages at the same time. On the other hand, Gaurav is the strange guy who thinks rewarding points will end up in debit the sum from his bank account, see https://forums.sdn.sap.com/thread.jspa?threadID=31472 Strange people in a strange world
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Detlev
I dont understand why ppl here are sooo much always concerned about getting points. Is the lure of getting points and being at the top each day is so intense that it cant be resisted and each time when we get an opportunity, we have to mock others down.???
I have always rewared points where ever my problem has been solved or i have got good hints.
Wherever i didnt awarded that means it was not solved even a little bit and i am still struggling with it. and the post to which you pointed now is again the same. I dont understand this, this is simply ridiculous.
I have no bad feeling against anybody, but dont understand why ppl here force others to have bad feelings..You dont have any right to personally comment on anybody. i can also go after each user and keep pointing out threads to them..you are a nice techie but also try to be a nice person.
Just today i read the SDN weblog regarding getting points(where ppl were getting points just for helping others sign-in). and i share the same idea that SDN should be a place to share valuable info and help the ppl who are in problem and keep following others and keep pointing every other person...com'on man..
I am not a very old member of SDN and before this i was also posting in www.sap.com discussion forums. It was also having the points system and that was awsome. but it closed down.do you know why? Its because ppl use to get points for each posts (dosent matter valuable or not)and then ppl just started saying "hi-hello" there. now nobody posts there...
Regarding the solution which u gave, i was also looking for the same, thanx but hey should i open up new thread so that it can be rewarded!!
or should i say "Strange people in SDN"...
Hi Gaurav,
> ppl here are sooo much always concerned
> about getting points
That's not the point. The point rewarding system here is installed and it's not only a nice kind of getting some recognition for somebodies efforts to help each other but at the same time increases everybodies participation on the whole. Think of it, you are one of the beneficiaries!
> each time when we get an opportunity,
> we have to mock others down.???
If you would have read only some of my postings, you would know that I'm very hard driven by the spirit of helping each other instead of "mocking others down". There have been quite(!) a few people where I didn't understand the behaviour and where I wrote something about it. You have been one of them, and you have been somehow on the top, for being very "resistant against learning".
> and the post to which you pointed now is again the same.
You are really strange. Thank god everybody is able to click it
> Regarding the solution which u gave,
> i was also looking for the same, thanx
> but hey should i open up new thread
> so that it can be rewarded!!
No, you had asked this question in the thread where I gave the link (if you have the uneliminatable whish to reward points to me, you can, in that thread). I asked you to be a bit more responsive(!), that is rewarding points OR just saying what's the matter with the answer. And you didn't reply to me nor to the other people helping you
SDN is one of the greatest communities I know, and it is all together very friendly, as I think most times I am as well as 99,9% of other people are in here. It is very active and becoming more and more famous from day to day. Some people are around here just in the spirit of helping each other, Prakash is one, I am some other of these guys. Others are trying to help if they can, too. Each person trying to help is more than welcome. All I ask for is some kind of gratitude; it is quite unfriendly to throw in a question, and when people care about the question (and care about you!), you have gone. Maybe consumed the answer, but no "thanks", no response, no feedback. If you travel around in the world and ask someone for the way to the central station, getting the answer "to the left, second street on the right..." -- are you turning around, walking away, without getting something like "thanks" over your lips? Do I really expect too much? C'mon...
> You dont have any right to
> personally comment on anybody.
Oh, I think here you are wrong. I definitely have. You definitely have, too. If you don't understand the very small request I'm positioning in here, you may shout as loud as you like "Detlev is cuckoo!". People will have the possibility to make a mind of their's own...
So long, relax
Detlev
PS: Strange, I tried to defend you against Prakash's reproval, and you hit me to the ground... Strange people in a strange world...
Sorry it's my fault. I should have realized that there could be concurrent exact answers for the same question.
Gaurav, i don't think all of us concerned about points all of the time but Detlev is correct to point out inviduals who are getting the benefit of SDN's forum but forget to reward points. If you are new invidual then it is prefectly understandble but if you are pretty regular users then you should realize that if you want help then you have to acknowledge the other person as well. You know what .. forget rewarding points.. even a thank you would work fine.
Hi Wilfried,
> Thanks for sharing!
You're welcome!
> it seems to be an undocumented feature
It is! But the pity is, that almost everything concerning the PCD is undocumented. The only official APIDoc is https://media.sdn.sap.com/javadocs/NW04/SP12/pcd/index.html - but if you have a look at it, it's not very much...
Hope it helps
Detlev
Hi again,
good news!
I found out that IPcmEditObject is not needed at all. This works:
DirContext dc = (DirContext)(new InitialContext(env)).lookup("pcd:portal_content/....");
IPcdAttributes pcdAttrs = (IPcdAttributes)dc.getAttributes("");
I agree, the APIDoc has some room for improvements...
Regards
Wilfried
Hi Niarv,
IPortalComponentContext myContext = request.getComponentContext("pcd:portal_content/com.sap.folder.xxx/xxxxxx");
IPortalComponentProfile profile = myContext.getProfile();
String property = profile.getProperty("xxx");
Regards
Gaurav Gandhi
PS:Award points if solved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nirav,
You do the following.
IPortalComponentContext myContext = request.getComponentContext("PCD url of the object");
IPortalComponentProfile profile = ctxt.getProfile();
String componentype = profile.getProperty("ComponentType");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
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.