KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > portletcontainer > impl > PortletDataImp


1 /*
2  * Copyright 2001-2003 The eXo platform SARL All rights reserved.
3  * Please look at license.txt in info directory for more license detail.
4  *
5  * Created on 6 janv. 2004
6  */

7 package org.exoplatform.services.portletcontainer.impl;
8
9 import java.util.List JavaDoc;
10 import java.util.Locale JavaDoc;
11 import java.util.ResourceBundle JavaDoc;
12 import org.exoplatform.container.PortalContainer;
13 import org.exoplatform.services.portletcontainer.impl.portletAPIImp.bundle.ResourceBundleManager;
14 import org.exoplatform.services.portletcontainer.pci.PortletData;
15 import org.exoplatform.services.portletcontainer.pci.model.*;
16
17
18 /**
19  * @author Mestrallet Benjamin
20  * benjmestrallet@users.sourceforge.net
21  */

22 public class PortletDataImp implements PortletData {
23
24   private List JavaDoc userAttributes_;
25   private Portlet portlet_;
26   private UserDataConstraint userDataConstraintType_;
27
28   public PortletDataImp(Portlet portlet,
29                         UserDataConstraint userDataConstraintType,
30                         List JavaDoc userAttributes) {
31     this.portlet_ = portlet;
32     this.userDataConstraintType_ = userDataConstraintType;
33     this.userAttributes_ = userAttributes;
34   }
35
36   public Portlet getWrappedPortletTyped() { return portlet_; }
37
38   public List JavaDoc getDisplayName() { return portlet_.getDisplayName(); }
39
40   public List JavaDoc getSecurityRoleRef() { return portlet_.getSecurityRoleRef(); }
41
42   public List JavaDoc getInitParam() { return portlet_.getInitParam(); }
43
44   public ResourceBundle JavaDoc getPortletInfo(Locale JavaDoc locale) {
45     ResourceBundleManager manager = (ResourceBundleManager)PortalContainer.getInstance().
46     getComponentInstanceOfType(ResourceBundleManager.class);
47     try {
48       return manager.lookupBundle(portlet_, locale);
49     } catch (Exception JavaDoc e) {
50       return null;
51     }
52   }
53
54   public List JavaDoc getSupports() { return portlet_.getSupports(); }
55
56   public List JavaDoc getDescription() { return portlet_.getDescription(); }
57   
58   public String JavaDoc getDescription(String JavaDoc lang) { return portlet_.getDescription(lang) ; }
59
60   public boolean isCacheGlobal() {
61     if ("true".equalsIgnoreCase(portlet_.getGlobalCache())) {
62       return true;
63     }
64     return false;
65   }
66
67   public String JavaDoc getExpirationCache() {
68     String JavaDoc s = portlet_.getExpirationCache(); ;
69     if(s == null) return "" ;
70     return s ;
71   }
72
73   public String JavaDoc getPortletName() { return portlet_.getPortletName(); }
74
75   public List JavaDoc getSupportedLocale() { return portlet_.getSupportedLocale(); }
76
77   public ExoPortletPreferences getPortletPreferences() {
78     return portlet_.getPortletPreferences();
79   }
80
81   public boolean isSecure() {
82     if (userDataConstraintType_ != null) return true;
83     return false;
84   }
85
86   public List JavaDoc getUserAttributes() { return userAttributes_; }
87 }
Popular Tags