Пример #1
0
  public Portlet get(String portletHandle) throws WSRPException {
    Portlet wsrpPortlet = null;

    try {
      wsrpPortlet = (Portlet) _consumerConfiguredPortlets.get(portletHandle);

      if (wsrpPortlet == null) {
        String companyId = WSRPUtil.getCompanyId();

        com.liferay.portal.model.Portlet liferayPortlet =
            PortletServiceUtil.getPortletById(companyId, portletHandle);

        if (liferayPortlet != null) {
          wsrpPortlet = _createProducerPortlet(liferayPortlet);
        }
      }
    } catch (Exception e) {
    }

    return wsrpPortlet;
  }
Пример #2
0
  public Iterator getAllProducerOfferedPortlets() {
    String companyId = WSRPUtil.getCompanyId();
    Iterator wsrpPortletsIt = null;
    List wsrpPortlets = new ArrayList();

    try {
      List liferayPortlets = PortletServiceUtil.getPortlets(companyId);

      for (int i = 0; i < liferayPortlets.size(); i++) {
        com.liferay.portal.model.Portlet liferayPortlet =
            (com.liferay.portal.model.Portlet) liferayPortlets.get(i);

        Portlet producerPortlet = _createProducerPortlet(liferayPortlet);

        wsrpPortlets.add(producerPortlet);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    return wsrpPortlets.iterator();
  }