Hi,
we have implemented a new CustomizationManager (by extending the default
CustomizationManagerService), we have defined "scopes" associated to the
instances, if the scope is 'window' the customization is associated to the window
(and not the user), so you can edit the preferences (with the customized portlet editor)
for a window, and everybody that access that window will see the portlet customized with
the same preferences.
We need this feature to allow portal managers to define portlets (and portals) that will
be accessed by anonymous users.
Here is our code:
| public class ScopeCustomizationManager extends CustomizationManagerService {
| @Override
| public Instance getInstance(Window window, User user) throws IllegalArgumentException
{
| if (window == null) {
| throw new IllegalArgumentException("No window provided");
| }
|
| Content content = window.getContent();
|
| String instanceId = ((PortletContent) content).getInstanceRef();
| if (instanceId == null) {
| return null;
| }
|
| Instance instance = getInstanceContainer().getDefinition(instanceId);
| if (instance != null) {
| String scope = null;
| try {
| Object scopePropertyValue =
instance.getProperties().get("sharingScope");
| if (scopePropertyValue != null && (scopePropertyValue instanceof List)) {
| List valuesList = (List) scopePropertyValue;
| if (valuesList.size() > 0) {
| Object v = valuesList.get(0);
| if (v instanceof String) {
| scope = (String) v;
| }
| }
| }
| } catch (PortletInvokerException e) {
| e.printStackTrace();
| }
| if (scope == null || scope.equals("user")) {
| return super.getInstance(window, user);
| }
|
| if (user != null && isDashboard(window, user)) {
| String dashboardId = window.getId().toString();
|
| instance = instance.getCustomization(dashboardId);
| } else if (scope.equals("window")) {
| instance = instance.getCustomization(window.getId().toString());
| } else if (scope.equals("portal")) {
| instance =
instance.getCustomization(window.getPage().getPortal().getId().toString());
| } else {
| instance = super.getInstance(window, user);
| }
| }
|
| return instance;
| }
|
| }
|
Maybe somebody on the JBoss Portal Team may give us an opinion about this feature, and our
implementation, we think it's a very important feature for an enterprise portal.
Thanks in advance,
Martin
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4197711#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...