cancel
Showing results for 
Search instead for 
Did you mean: 

Portal Application Java / IView : Setting a property

Former Member
0 Kudos

Hi!

Please help me to solve this problem!

I have got an IView with a Height of 200; now i have to modify this value with a Portal Application.

Here comes the code....:

if (request.getComponentContext().getProfile().isPersonalizableProperty("com.sap.portal.iview.Height")){

System.err.println("Original Value "+request.getComponentContext().getProfile().getProperty("com.sap.portal.iview.Height"));

System.err.println("Setting");

request.getComponentContext().getProfile().setProperty("com.sap.portal.iview.Height","100");

System.err.println("Checkpoint");

request.getComponentContext().getProfile().store();

System.err.println("New Value "+request.getComponentContext().getProfile().getProperty("com.sap.portal.iview.Height"));

}

}

Now:

1)Deploy

2)IView Preview

LOG :

Orignal Value 200

Setting

Checkpoint

New Value 200

The new value should be 100....not 200.....

Where is the mistake?!???!

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Fabio,

You need to include the related jar files so that you can define them. The required jars are:

com.sap.portal.pcm.admin.apiservice_api.jar

com.sap.portal.pcd.glservice_api.jar

Let me know if you want me to email you the jar fils.

Thanks.

Former Member
0 Kudos

Thanks, now it works.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

I have tried the code on my end and i was able to change the height property value.

Check this code here i have created a portal application project:

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,

IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);

env.put(Context.SECURITY_PRINCIPAL, request.getUser());

env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);

InitialContext iCtx = null;

iCtx = new InitialContext(env);

IiView result;

result =(IiView) iCtx.lookup("pcd:portal_content/Test1/com.local.New1");

result.putAttribute("com.sap.portal.iview.Height","100");

result.save();

and also you have to include the references in the portalapp.xml

Let me know for more information.

Hope this helps you.

Thanks.

Former Member
0 Kudos

Hi Aparna and thanks for your kind answer!

How did you define Constants and PcmConstants ?

detlev_beutner
Active Contributor
0 Kudos

Hi Fabio,

> How did you define Constants and PcmConstants ?

These are:

- com.sap.portal.directory.Constants

- com.sap.portal.pcm.admin.PcmConstants

Use ClassLocator (if you don't know it, search on SDN for more info) to reference the corresponding JARs.

Hope it helps

Detlev

PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!