Skip to Content
author's profile photo Former Member
Former Member

Portal Application Java / IView : Setting a property

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2008 at 06:04 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 11:27 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • 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!

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.