Package com.liferay.portal.model

Examples of com.liferay.portal.model.Group


    User creatorUser = UserLocalServiceUtil.getUserById(
      request.getUserId());

    int requestType = request.getType();

    Group group = null;

    String className = request.getClassName();

    if (className.equals(Group.class.getName())) {
      group = GroupLocalServiceUtil.getGroup(request.getClassPK());
    }
    else {
      Organization organization =
        OrganizationLocalServiceUtil.getOrganization(
          request.getClassPK());

      group = organization.getGroup();
    }

    // Title

    String title = StringPool.BLANK;

    if (requestType == MembersRequestKeys.ADD_MEMBER) {
      StringBuilder sb = new StringBuilder();

      sb.append("<a href=\"");
      sb.append(themeDisplay.getPortalURL());
      sb.append(themeDisplay.getPathFriendlyURLPublic());
      sb.append(StringPool.SLASH);
      sb.append(creatorUser.getScreenName());
      sb.append("/profile\">");
      sb.append(creatorUserName);
      sb.append("</a>");

      String creatorUserNameURL = sb.toString();

      sb = new StringBuilder();

      sb.append("<a href=\"");
      sb.append(themeDisplay.getPortalURL());
      sb.append(themeDisplay.getPathFriendlyURLPublic());
      sb.append(group.getFriendlyURL());
      sb.append("/profile\">");
      sb.append(group.getDescriptiveName());
      sb.append("</a>");

      String organizationNameURL = sb.toString();

      title = themeDisplay.translate(
View Full Code Here


    // Title

    Organization organization =
      OrganizationLocalServiceUtil.getOrganization(activity.getClassPK());

    Group group = organization.getGroup();

    String title = StringPool.BLANK;

    if (activityType == MembersActivityKeys.ADD_MEMBER) {
      StringBuilder sb = new StringBuilder();

      sb.append("<a href=\"");
      sb.append(link);
      sb.append("\">");
      sb.append(creatorUserName);
      sb.append("</a>");

      String creatorUserNameURL = sb.toString();

      sb = new StringBuilder();

      sb.append("<a href=\"");
      sb.append(themeDisplay.getPortalURL());
      sb.append(themeDisplay.getPathFriendlyURLPublic());
      sb.append(group.getFriendlyURL());
      sb.append("/profile\">");
      sb.append(HtmlUtil.escape(organization.getName()));
      sb.append("</a>");

      String organizationNameURL = sb.toString();
View Full Code Here

  public void afterPropertiesSet() throws Exception {
    User user = UserLocalServiceUtil.getDefaultUser(companyId);

    userId = user.getUserId();

    Group group = null;

    if (targetClassName.equals(LayoutSetPrototype.class.getName())) {
      LayoutSetPrototype layoutSetPrototype = getLayoutSetPrototype(
        companyId, targetValue);

      if (layoutSetPrototype != null) {
        existing = true;
      }
      else {
        layoutSetPrototype =
          LayoutSetPrototypeLocalServiceUtil.addLayoutSetPrototype(
            userId, companyId, getTargetValueMap(),
            StringPool.BLANK, true, true, new ServiceContext());
      }

      group = layoutSetPrototype.getGroup();

      targetClassPK = layoutSetPrototype.getLayoutSetPrototypeId();
    }
    else if (targetClassName.equals(Group.class.getName())) {
      if (targetValue.equals(GroupConstants.GUEST)) {
        group = GroupLocalServiceUtil.getGroup(
          companyId, GroupConstants.GUEST);

        List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(
          group.getGroupId(), false,
          LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, false, 0, 1);

        if (!layouts.isEmpty()) {
          Layout layout = layouts.get(0);

          LayoutTypePortlet layoutTypePortlet =
            (LayoutTypePortlet)layout.getLayoutType();

          List<String> portletIds = layoutTypePortlet.getPortletIds();

          if (portletIds.size() != 2) {
            existing = true;
          }

          for (String portletId : portletIds) {
            if (!portletId.equals("47") &&
              !portletId.equals("58")) {

              existing = true;
            }
          }
        }
      }
      else {
        group = GroupLocalServiceUtil.fetchGroup(
          companyId, targetValue);

        if (group != null) {
          existing = true;
        }
        else {
          group = GroupLocalServiceUtil.addGroup(
            userId, GroupConstants.DEFAULT_PARENT_GROUP_ID,
            StringPool.BLANK,
            GroupConstants.DEFAULT_PARENT_GROUP_ID,
            GroupConstants.DEFAULT_LIVE_GROUP_ID, targetValue,
            StringPool.BLANK, GroupConstants.TYPE_SITE_OPEN, true,
            GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION, null,
            true, true, new ServiceContext());
        }
      }

      targetClassPK = group.getGroupId();
    }

    if (group != null) {
      groupId = group.getGroupId();
    }
  }
View Full Code Here

    if (isCompanyGroup()) {
      return;
    }

    Group group = null;

    if (targetClassName.equals(LayoutSetPrototype.class.getName())) {
      LayoutSetPrototype layoutSetPrototype = getLayoutSetPrototype(
        companyId, targetValue);

      if (layoutSetPrototype != null) {
        existing = true;
      }
      else {
        layoutSetPrototype =
          LayoutSetPrototypeLocalServiceUtil.addLayoutSetPrototype(
            userId, companyId, getTargetValueMap(),
            StringPool.BLANK, true, true, new ServiceContext());
      }

      group = layoutSetPrototype.getGroup();

      targetClassPK = layoutSetPrototype.getLayoutSetPrototypeId();
    }
    else if (targetClassName.equals(Group.class.getName())) {
      if (targetValue.equals(GroupConstants.GLOBAL)) {
        group = GroupLocalServiceUtil.getCompanyGroup(companyId);
      }
      else if (targetValue.equals(GroupConstants.GUEST)) {
        group = GroupLocalServiceUtil.getGroup(
          companyId, GroupConstants.GUEST);

        List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(
          group.getGroupId(), false,
          LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, false, 0, 1);

        if (!layouts.isEmpty()) {
          Layout layout = layouts.get(0);

          LayoutTypePortlet layoutTypePortlet =
            (LayoutTypePortlet)layout.getLayoutType();

          List<String> portletIds = layoutTypePortlet.getPortletIds();

          if (portletIds.size() != 2) {
            existing = true;
          }

          for (String portletId : portletIds) {
            if (!portletId.equals("47") &&
              !portletId.equals("58")) {

              existing = true;
            }
          }
        }
      }
      else {
        group = GroupLocalServiceUtil.fetchGroup(
          companyId, targetValue);

        if (group != null) {
          existing = true;
        }
        else {
          group = GroupLocalServiceUtil.addGroup(
            userId, GroupConstants.DEFAULT_PARENT_GROUP_ID,
            StringPool.BLANK,
            GroupConstants.DEFAULT_PARENT_GROUP_ID,
            GroupConstants.DEFAULT_LIVE_GROUP_ID, targetValue,
            StringPool.BLANK, GroupConstants.TYPE_SITE_OPEN, true,
            GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION, null,
            true, true, new ServiceContext());
        }
      }

      targetClassPK = group.getGroupId();
    }

    if (group != null) {
      groupId = group.getGroupId();
    }
  }
View Full Code Here

    return targetValueMap;
  }


  public boolean isCompanyGroup() throws Exception {
    Group group = GroupLocalServiceUtil.fetchGroup(groupId);

    if (group == null) {
      return false;
    }

    return group.isCompany();
  }
View Full Code Here

          importer.setResourcesDir(_RESOURCES_DIR);
        }
        else if ((templatePaths != null) && !templatePaths.isEmpty()) {
          importer = getResourceImporter();

          Group group = GroupLocalServiceUtil.getCompanyGroup(
            company.getCompanyId());

          importer.setGroupId(group.getGroupId());
          importer.setResourcesDir(_TEMPLATES_DIR);
        }
        else {
          String resourcesDir = pluginPackageProperties.getProperty(
            "resources-importer-external-dir");
View Full Code Here

    UserLocalServiceUtil.addGroupUsers(groupId, userIds);
  }

  protected void setupBridgeDemosSite(long companyId, long userId) throws Exception {
    Group site = getSiteForSetup(companyId, userId, "Bridge Demos");
    long groupId = site.getGroupId();
    addAllUsersToSite(companyId, groupId);

    for (PortalPage portalPage : TestPages.BRIDGE_DEMO_PAGES) {
      setupPrivatePage(companyId, userId, groupId, portalPage);
    }
View Full Code Here

      setupPrivatePage(companyId, userId, groupId, portalPage);
    }
  }

  protected void setupBridgeIssuesSite(long companyId, long userId) throws Exception {
    Group site = getSiteForSetup(companyId, userId, "Bridge Issues");
    long groupId = site.getGroupId();
    addAllUsersToSite(companyId, groupId);

    for (PortalPage portalPage : TestPages.BRIDGE_ISSUE_PAGES) {
      setupPublicPage(companyId, userId, groupId, portalPage);
    }
View Full Code Here

      setupPublicPage(companyId, userId, groupId, portalPage);
    }
  }

  protected void setupBridgeTCKSite(long companyId, long userId) throws Exception, DocumentException {
    Group site = getSiteForSetup(companyId, userId, "Bridge TCK");
    long groupId = site.getGroupId();
    addAllUsersToSite(companyId, groupId);

    URL configFileURL = getClass().getClassLoader().getResource("pluto-portal-driver-config.xml");
    Document document = SAXReaderUtil.read(configFileURL);
    Element rootElement = document.getRootElement();
View Full Code Here

      new PortalPage("Resource Response Wrapper",
        "chapter6_2_1TestsusesConfiguredResourceResponseWrapperTestportlet_WAR_bridgetckresponsewrapperportlet"));
  }

  protected void setupGuestSite(long companyId, long userId) throws Exception {
    Group site = getSiteForSetup(companyId, userId, "Guest");
    long groupId = site.getGroupId();
    addAllUsersToSite(companyId, groupId);

    for (PortalPage portalPage : TestPages.GUEST_PAGES) {
      setupPublicPage(companyId, userId, groupId, portalPage);
    }
View Full Code Here

TOP

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

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.