Package com.liferay.portal.model

Examples of com.liferay.portal.model.Portlet


    _application = application;
    _locale = locale;
  }

  public int compare(Object obj1, Object obj2) {
    Portlet portlet1 = (Portlet)obj1;
    Portlet portlet2 = (Portlet)obj2;

    String portlet1Title =
      PortalUtil.getPortletConfig(portlet1, _application).
        getResourceBundle(_locale).getString(
          WebKeys.JAVAX_PORTLET_TITLE);
View Full Code Here


    try {
      Iterator itr =
        PortletManagerUtil.getPortlets(_companyId).iterator();

      while (itr.hasNext()) {
        Portlet portlet = (Portlet)itr.next();

        String className = portlet.getIndexerClass();

        if (portlet.isActive() && className != null) {
          _log.debug("Re-indexing with " + className + " started");

          Indexer indexer = (Indexer)InstancePool.get(className);

          indexer.reIndex(indexIds);
View Full Code Here

  private void _editPortlet(ActionRequest req) throws Exception {
    String portletId = ParamUtil.getString(req, "portlet_id");

    String groupId = ParamUtil.getString(req, "group_id");

    Portlet portlet = PortletManagerUtil.getPortletById(
      PortalUtil.getCompanyId(req), groupId, portletId);

    if (portlet == null) {
      throw new NoSuchPortletException();
    }
View Full Code Here

      req, "portlet_default_prefs");
    boolean narrow = ParamUtil.getBoolean(req, "portlet_narrow");
    String roles = ParamUtil.getString(req, "portlet_roles");
    boolean active = ParamUtil.getBoolean(req, "portlet_active");

    Portlet portlet = PortletManagerUtil.getPortletById(
      PortalUtil.getCompanyId(req), portletId);

    PreferencesValidator prefsValidator =
      PortalUtil.getPreferencesValidator(portlet);
View Full Code Here

  private void _updatePortletIndex(ActionRequest req) throws Exception {
    String portletId = ParamUtil.getString(req, "portlet_id");

    String companyId = PortalUtil.getCompanyId(req);

    Portlet portlet =
      PortletManagerUtil.getPortletById(companyId, portletId);

    if (Validator.isNotNull(portlet.getIndexerClass())) {
      Indexer indexer =
        (Indexer)InstancePool.get(portlet.getIndexerClass());

      indexer.reIndex(new String[] {companyId});
    }

    // Session messages
View Full Code Here

    if (_pk == null) {
      throw new UnsupportedOperationException();
    }

    try {
      Portlet portlet =
        PortletManagerUtil.getPortletById(_companyId, _pk.portletId);

      PreferencesValidator prefsValidator =
        PortalUtil.getPreferencesValidator(portlet);
View Full Code Here

    try {
      Iterator itr = PortletManagerUtil.getPortlets(_companyId).iterator();

      while (itr.hasNext()) {
        Portlet portlet = (Portlet) itr.next();

        PortalUtil.destroyPortletInstance(portlet);
      }
    } catch (Exception e) {
      Logger.error(this, e.getMessage(), e);
View Full Code Here

    if (isPortletPath(path)) {
      try {
        String strutsPath = path.substring(
          1, path.lastIndexOf(StringPool.SLASH));

        Portlet portlet = PortletManagerUtil.getPortletByStrutsPath(
          companyId, strutsPath);

        if (portlet != null && portlet.isActive()) {
          defineObjects(req, res, portlet);
        }
      }
      catch (Exception e) {
        req.setAttribute(PageContext.EXCEPTION, e);
View Full Code Here

        // Check roles

        String strutsPath = path.substring(
          1, path.lastIndexOf(StringPool.SLASH));

        Portlet portlet = PortletManagerUtil.getPortletByStrutsPath(
          user.getCompanyId(), strutsPath);

        if (portlet != null && portlet.isActive()) {
//          if (!RoleLocalManagerUtil.hasRoles(user.getUserId(), portlet.getRolesArray())) {
//
//            throw new PrincipalException();
//          }
        }
        else if (portlet != null && !portlet.isActive()) {
          SessionErrors.add(
            req, PortletActiveException.class.getName());

          authorized = false;
        }
View Full Code Here

      // Portlet context wrapper

      Iterator itr1 = _portlets.iterator();

      while (itr1.hasNext()) {
        Portlet portlet = (Portlet)itr1.next();

        com.dotcms.repackage.javax.portlet.Portlet portletInstance =
          (com.dotcms.repackage.javax.portlet.Portlet)contextClassLoader.loadClass(
            portlet.getPortletClass()).newInstance();

        Indexer indexerInstance = null;
        if (Validator.isNotNull(portlet.getIndexerClass())) {
          indexerInstance = (Indexer)contextClassLoader.loadClass(
            portlet.getIndexerClass()).newInstance();
        }

        Scheduler schedulerInstance = null;
        if (Validator.isNotNull(portlet.getSchedulerClass())) {
          schedulerInstance = (Scheduler)contextClassLoader.loadClass(
            portlet.getSchedulerClass()).newInstance();
        }

        PreferencesValidator prefsValidator = null;
        if (Validator.isNotNull(portlet.getPreferencesValidator())) {
          prefsValidator =
            (PreferencesValidator)contextClassLoader.loadClass(
              portlet.getPreferencesValidator()).newInstance();

          try {
            if (GetterUtil.getBoolean(PropsUtil.get(
                PropsUtil.PREFERENCE_VALIDATE_ON_STARTUP))) {

              prefsValidator.validate(
                PortletPreferencesSerializer.fromDefaultXML(
                  portlet.getDefaultPreferences()));
            }
          }
          catch (Exception e1) {
            _log.warn(
              "Portlet with the name " + portlet.getPortletId() +
                " does not have valid default preferences");
          }
        }

        Map resourceBundles = null;

        if (Validator.isNotNull(portlet.getResourceBundle())) {
          resourceBundles = CollectionFactory.getHashMap();

          Iterator itr2 = portlet.getSupportedLocales().iterator();

          while (itr2.hasNext()) {
            String supportedLocale = (String)itr2.next();

            Locale locale = new Locale(supportedLocale);

            try {
              ResourceBundle resourceBundle =
                ResourceBundle.getBundle(
                  portlet.getResourceBundle(), locale,
                  contextClassLoader);

              resourceBundles.put(
                locale.getLanguage(), resourceBundle);
            }
            catch (MissingResourceException mre) {
              _log.warn(mre.getMessage());
            }
          }
        }

        Map customUserAttributes = CollectionFactory.getHashMap();

        Iterator itr2 =
          portlet.getCustomUserAttributes().entrySet().iterator();

        while (itr2.hasNext()) {
          Map.Entry entry = (Map.Entry)itr2.next();

          String attrName = (String)entry.getKey();
          String attrCustomClass = (String)entry.getValue();

          customUserAttributes.put(
            attrCustomClass,
            contextClassLoader.loadClass(
              attrCustomClass).newInstance());
        }

        PortletContextWrapper pcw = new PortletContextWrapper(
          portlet.getPortletId(), ctx, portletInstance,
          indexerInstance, schedulerInstance, prefsValidator,
          resourceBundles, customUserAttributes);

        PortletContextPool.put(portlet.getPortletId(), pcw);
      }

      // Portlet class loader

      String servletPath = ctx.getRealPath("/");
View Full Code Here

TOP

Related Classes of com.liferay.portal.model.Portlet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.