cancel
Showing results for 
Search instead for 
Did you mean: 

PCD Object Properties

Former Member
0 Kudos
262

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

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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

Former Member
0 Kudos

Thanks Yasir, this was what I needed.

Sorry guys, but I think he should get the goodies!!! Thanks for trying though.

detlev_beutner
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos
		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.

detlev_beutner
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Yasir,

could you send me your code, please? I have to do a similar task and unfortunately, I'm quite inexpierenced and could use some examples.

Thank you!

Tobias

Message was edited by: Tobias Neumann - email adress removed

Answers (3)

Answers (3)

detlev_beutner
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Detlev,

sorry, i didn't realize people RSS feed. I like the solution you have suggested as well.

Prakash

Former Member
0 Kudos

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"...

detlev_beutner
Active Contributor
0 Kudos

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...

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Detlev and all,

just came across your useful code. Thanks for sharing!

The IPcmEditObject works fine on sps12, but it is marked as "deprecated". And it seems to be an undocumented feature. Anyone knows a replacement that's supported by SAP?

Thanks

Wilfried

detlev_beutner
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Gaurav,

Thanks for repeating what i have already suggested.

Former Member
0 Kudos

Hi Nirav,

You do the following.

IPortalComponentContext myContext = request.getComponentContext("PCD url of the object");
IPortalComponentProfile profile = ctxt.getProfile();
String componentype = profile.getProperty("ComponentType");