gt:         Group liveGroup = getLiveGroup();
context: /**
   * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
   *
   * This library is free software; you can redistribute it and/or modify it under
   * the terms of the GNU Lesser General Public License as published by the Free
   * Software Foundation; either version 2.1 of the License, or (at your option)
   * any later version.
   *
   * This library is distributed in the hope that it will be useful, but WITHOUT
   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
   * details.
   */
  package com.liferay.portal.model.impl;
  
  import com.liferay.portal.kernel.exception.PortalException;
  import com.liferay.portal.kernel.exception.SystemException;
  ///-import com.liferay.portal.kernel.language.LanguageUtil;
  import org.kmworks.liferay.portal.kernel.language.LanguageUtil; ///+
  import com.liferay.portal.kernel.log.Log;
  import com.liferay.portal.kernel.log.LogFactoryUtil;
  import com.liferay.portal.kernel.staging.StagingConstants;
  import com.liferay.portal.kernel.staging.StagingUtil;
  import com.liferay.portal.kernel.util.GetterUtil;
  import com.liferay.portal.kernel.util.HtmlUtil;
  import com.liferay.portal.kernel.util.LocaleUtil;
  import com.liferay.portal.kernel.util.StringBundler;
  import com.liferay.portal.kernel.util.StringPool;
  import com.liferay.portal.kernel.util.StringUtil;
  import com.liferay.portal.kernel.util.UnicodeProperties;
  import com.liferay.portal.kernel.util.Validator;
  import com.liferay.portal.model.Company;
  import com.liferay.portal.model.Group;
  import com.liferay.portal.model.GroupConstants;
  import com.liferay.portal.model.GroupWrapper;
  import com.liferay.portal.model.Layout;
  import com.liferay.portal.model.LayoutConstants;
  import com.liferay.portal.model.LayoutPrototype;
  import com.liferay.portal.model.LayoutSet;
  import com.liferay.portal.model.LayoutSetPrototype;
  import com.liferay.portal.model.Organization;
  import com.liferay.portal.model.Portlet;
  import com.liferay.portal.model.PortletConstants;
  import com.liferay.portal.model.RoleConstants;
  import com.liferay.portal.model.User;
  import com.liferay.portal.model.UserGroup;
  import com.liferay.portal.model.UserPersonalSite;
  import com.liferay.portal.security.permission.ActionKeys;
  import com.liferay.portal.security.permission.PermissionChecker;
  import com.liferay.portal.service.GroupLocalServiceUtil;
  import com.liferay.portal.service.LayoutLocalServiceUtil;
  import com.liferay.portal.service.LayoutSetLocalServiceUtil;
  import com.liferay.portal.service.PortletLocalServiceUtil;
  import com.liferay.portal.service.RoleLocalServiceUtil;
  import com.liferay.portal.service.permission.LayoutPermissionUtil;
  import com.liferay.portal.theme.ThemeDisplay;
  import com.liferay.portal.util.PortalUtil;
  import com.liferay.portal.util.PropsValues;
  
  import java.io.IOException;
  
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Locale;
  import java.util.Map;
  
  /**
   * Represents either a site or a generic resource container.
   *
   * <p>
   * Groups are most used in Liferay as a resource container for permissioning and
   * content scoping purposes. For instance, an site is group, meaning that it can
   * contain layouts, web content, wiki entries, etc. However, a single layout can
   * also be a group containing its own unique set of resources. An example of
   * this would be a site that has several distinct wikis on different layouts.
   * Each of these layouts would have its own group, and all of the nodes in the
   * wiki for a certain layout would be associated with that layout's group. This
   * allows users to be given different permissions on each of the wikis, even
   * though they are all within the same site. In addition to sites and layouts,
   * users and organizations are also groups.
   * </p>
   *
   * <p>
   * Groups also have a second, partially conflicting purpose in Liferay. For
   * legacy reasons, groups are also the model used to represent sites (known as
   * communities before Liferay v6.1). Confusion may arise from the fact that a
   * site group is both the resource container and the site itself, whereas a
   * layout or organization would have both a primary model and an associated
   * group.
   * </p>
   *
   * @author Brian Wing Shun Chan
   */
  public class GroupImpl extends GroupBaseImpl {
  
    public GroupImpl() {
    }
  
    @Override
    public void clearStagingGroup() {
      _stagingGroup = null;
    }
  
    @Override
    public List<Group> getAncestors() throws PortalException, SystemException {
      Group group = null;
  
      if (isStagingGroup()) {
        group = getLiveGroup();
  		}
  		else {
        group = this;
      }
  
      List<Group> groups = new ArrayList<Group>();
  
      while (!group.isRoot()) {
        group = group.getParentGroup();
  
        groups.add(group);
      }
  
      return groups;
    }
  
    @Override
    public List<Group> getChildren(boolean site) throws SystemException {
      return GroupLocalServiceUtil.getGroups(
              getCompanyId(), getGroupId(), site);
    }
  
    @Override
    public List<Group> getChildrenWithLayouts(boolean site, int start, int end)
            throws SystemException {
  
      return GroupLocalServiceUtil.getLayoutsGroups(
              getCompanyId(), getGroupId(), site, start, end);
    }
  
    @Override
    public int getChildrenWithLayoutsCount(boolean site)
            throws SystemException {
  
      return GroupLocalServiceUtil.getLayoutsGroupsCount(
              getCompanyId(), getGroupId(), site);
    }
  
    @Override
    public long getDefaultPrivatePlid() {
      return getDefaultPlid(true);
    }
  
    @Override
    public long getDefaultPublicPlid() {
      return getDefaultPlid(false);
    }
  
    @Override
    public String getDescriptiveName() throws PortalException, SystemException {
      return getDescriptiveName(LocaleUtil.getDefault());
    }
  
    @Override
    public String getDescriptiveName(Locale locale)
            throws PortalException, SystemException {
  
      return GroupLocalServiceUtil.getGroupDescriptiveName(this, locale);
    }
  
    @Override
    public String getIconURL(ThemeDisplay themeDisplay) {
      String iconURL = themeDisplay.getPathThemeImages() + "/common/";
  
      if (isCompany()) {
        iconURL = iconURL.concat("global.png");
  		}
  		else if (isLayout()) {
        iconURL = iconURL.concat("page.png");
  		}
  		else if (isOrganization()) {
        iconURL = iconURL.concat("organization_icon.png");
  		}
  		else if (isUser()) {
        iconURL = iconURL.concat("user_icon.png");
  		}
  		else {
        iconURL = iconURL.concat("site_icon.png");
      }
  
      return iconURL;
    }
  
    @Override
    public String getLayoutRootNodeName(boolean privateLayout, Locale locale) {
      String pagesName = null;
  
      if (isLayoutPrototype() || isLayoutSetPrototype() || isUserGroup()) {
        pagesName = "pages";
  		}
  		else if (privateLayout) {
        if (isUser()) {
          pagesName = "my-dashboard";
  			}
  			else {
          pagesName = "private-pages";
        }
  		}
  		else {
        if (isUser()) {
          pagesName = "my-profile";
  			}
  			else {
          pagesName = "public-pages";
        }
      }
  
      return LanguageUtil.get(locale, pagesName);
    }
  
    @Override
    public Group getLiveGroup() {
      if (!isStagingGroup()) {
        return null;
      }
  
      try {
        if (_liveGroup == null) {
          _liveGroup = GroupLocalServiceUtil.getGroup(getLiveGroupId());
  
          if (_liveGroup instanceof GroupImpl) {
  					GroupImpl groupImpl = (GroupImpl)_liveGroup;
  
            groupImpl._stagingGroup = this;
  				}
  				else {
            _liveGroup = new GroupWrapper(_liveGroup) {
  
              @Override
              public Group getStagingGroup() {
                return GroupImpl.this;
              }
  
            };
          }
        }
  
        return _liveGroup;
  		}
  		catch (Exception e) {
        _log.error("Error getting live group for " + getLiveGroupId(), e);
  
        return null;
      }
    }
  
    @Override
    public String getLiveParentTypeSettingsProperty(String key) {
  		UnicodeProperties typeSettingsProperties =
  			getParentLiveGroupTypeSettingsProperties();
  
      return typeSettingsProperties.getProperty(key);
    }
  
    @Override
    public long getOrganizationId() {
      if (isOrganization()) {
        if (isStagingGroup()) {
  