Currently Being Moderated

Being able to set iView properties at runtime is a particularly useful thing. I was originally forced to think about a method to achieve this back in the EP5 days when I needed a way to easily determine some iView properties "on the fly". I wanted to be able to have one iView that was assigned to everyone in the portal but I wanted the iView to behave differently based on the groups a user belonged to.

The solution I came up with was much like the one proposed by Detlev Beutner at SAP Tech Ed 06 in the SDN session Implementing Dynamic iView Properties, but I think differs just enough to warrant this blog. In essence the architecture is the same. Firstly you create an iView (proxy iView) that "fronts" the target iView you want your users to see. In this proxy iView you can include logic to determine the values of any iView properties you wish to set at runtime. This is where I implemented the logic based on my users group membership.

The main difference is that rather then passing these values through as part of the URL request string (?param1=x&param2=y) you manipulate the component profile of the target iView directly in the proxy iView and then redirect the user to the target after setting the parameter values you require.

The code looks something like this...

//Get the context and profile for the target iView IPortalComponentContext ctx = request.getComponentContext("pcd://contentlib/com.company.iview.name"); IPortalComponentProfile profile = ctx.getProfile(); //Set the property values you want profile.setProperty("param1", "value1"); //Store the component profile for the user profile.store(); //Forward user to target component... (this is just an example) response.write("");

This approach was much easier then creating multiple roles with different iView parameter configurations. It yields the same results as the method covered at SAP Tech Ed, but differs slightly in how the parameters are set. I recommend you take a closer look at the SAP Tech Ed session mentioned above and see if you can use the code here too. It should allow you to set any type of iView property.

Comments

Actions

Filter Blog

By author:
By date:
By tag: