List of usage examples for com.liferay.portal.kernel.model GroupConstants DEFAULT_LIVE_GROUP_ID
long DEFAULT_LIVE_GROUP_ID
To view the source code for com.liferay.portal.kernel.model GroupConstants DEFAULT_LIVE_GROUP_ID.
Click Source Link
From source file:com.liferay.asset.service.test.AssetTagFinderTest.java
License:Open Source License
@Before public void setUp() throws Exception { _group = GroupTestUtil.addGroup();//from w ww .j av a2 s . co m Layout layout = LayoutTestUtil.addLayout(_group); Map<Locale, String> nameMap = new HashMap<>(); String name = RandomTestUtil.randomString(); nameMap.put(LocaleUtil.getDefault(), name); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId()); _scopeGroup = GroupLocalServiceUtil.addGroup(TestPropsValues.getUserId(), _group.getParentGroupId(), Layout.class.getName(), layout.getPlid(), GroupConstants.DEFAULT_LIVE_GROUP_ID, nameMap, RandomTestUtil.randomLocaleStringMap(), GroupConstants.TYPE_SITE_OPEN, true, GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION, StringPool.SLASH + FriendlyURLNormalizerUtil.normalize(name), false, true, serviceContext); }
From source file:com.liferay.dynamic.data.lists.internal.instance.lifecycle.AddDefaultSharedFormLayoutPortalInstanceLifecycleListener.java
License:Open Source License
protected Group addFormsGroup(long companyId) throws PortalException { long defaultUserId = _userLocalService.getDefaultUserId(companyId); Map<Locale, String> nameMap = new HashMap<>(); nameMap.put(LocaleUtil.getDefault(), GroupConstants.FORMS); return _groupLocalService.addGroup(defaultUserId, GroupConstants.DEFAULT_PARENT_GROUP_ID, null, 0, GroupConstants.DEFAULT_LIVE_GROUP_ID, nameMap, null, GroupConstants.TYPE_SITE_PRIVATE, true, GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION, GroupConstants.FORMS_FRIENDLY_URL, false, false, true, null);/*from ww w .ja v a 2 s. c o m*/ }
From source file:com.liferay.exportimport.lar.ExportImportHelperImpl.java
License:Open Source License
@Override public long[] getLayoutIds(Map<Long, Boolean> layoutIdMap) throws PortalException { return getLayoutIds(layoutIdMap, GroupConstants.DEFAULT_LIVE_GROUP_ID); }
From source file:com.liferay.exportimport.lar.ExportImportHelperImpl.java
License:Open Source License
@Override public long[] getLayoutIds(Map<Long, Boolean> layoutIdMap, long targetGroupId) throws PortalException { if (MapUtil.isEmpty(layoutIdMap)) { return new long[0]; }//w w w. j ava 2 s . c om List<Layout> layouts = new ArrayList<>(); for (Map.Entry<Long, Boolean> entry : layoutIdMap.entrySet()) { long plid = GetterUtil.getLong(String.valueOf(entry.getKey())); Layout layout = new LayoutImpl(); if (plid == 0) { layout.setPlid(LayoutConstants.DEFAULT_PLID); layout.setLayoutId(LayoutConstants.DEFAULT_PLID); layout.setParentLayoutId(LayoutConstants.DEFAULT_PARENT_LAYOUT_ID); } else { layout = _layoutLocalService.getLayout(plid); } if (!layouts.contains(layout)) { layouts.add(layout); } if (layout.getPlid() == LayoutConstants.DEFAULT_PLID) { continue; } List<Layout> parentLayouts = Collections.emptyList(); if (targetGroupId != GroupConstants.DEFAULT_LIVE_GROUP_ID) { parentLayouts = getMissingParentLayouts(layout, targetGroupId); } for (Layout parentLayout : parentLayouts) { if (!layouts.contains(parentLayout)) { layouts.add(parentLayout); } } boolean includeChildren = entry.getValue(); if (includeChildren) { for (Layout childLayout : layout.getAllChildren()) { if (!layouts.contains(childLayout)) { layouts.add(childLayout); } } } } return getLayoutIds(layouts); }
From source file:com.liferay.exportimport.lar.ExportImportHelperImpl.java
License:Open Source License
@Override public long[] getLayoutIds(PortletRequest portletRequest) throws PortalException { return getLayoutIds(getLayoutIdMap(portletRequest), GroupConstants.DEFAULT_LIVE_GROUP_ID); }
From source file:com.liferay.exportimport.lar.PortletDataContextImpl.java
License:Open Source License
protected Element doAddReferenceElement(ClassedModel referrerClassedModel, Element element, ClassedModel classedModel, String className, String binPath, String referenceType, boolean missing) { Element referenceElement = null; if (missing) { Element referencesElement = _missingReferencesElement; referenceElement = referencesElement.addElement("missing-reference"); } else {//from w ww. j a va 2 s . c o m Element referencesElement = element.element("references"); if (referencesElement == null) { referencesElement = element.addElement("references"); } referenceElement = referencesElement.addElement("reference"); } referenceElement.addAttribute("class-name", className); referenceElement.addAttribute("class-pk", String.valueOf(classedModel.getPrimaryKeyObj())); populateClassNameAttribute(classedModel, referenceElement); if (missing) { if (classedModel instanceof StagedModel) { referenceElement.addAttribute("display-name", StagedModelDataHandlerUtil.getDisplayName((StagedModel) classedModel)); } else { referenceElement.addAttribute("display-name", String.valueOf(classedModel.getPrimaryKeyObj())); } } if (classedModel instanceof StagedGroupedModel) { StagedGroupedModel stagedGroupedModel = (StagedGroupedModel) classedModel; referenceElement.addAttribute("group-id", String.valueOf(stagedGroupedModel.getGroupId())); try { Group group = GroupLocalServiceUtil.getGroup(stagedGroupedModel.getGroupId()); long liveGroupId = group.getLiveGroupId(); if (group.isStagedRemotely()) { liveGroupId = group.getRemoteLiveGroupId(); } if (liveGroupId == GroupConstants.DEFAULT_LIVE_GROUP_ID) { liveGroupId = group.getGroupId(); } referenceElement.addAttribute("live-group-id", String.valueOf(liveGroupId)); if (group.isLayout()) { try { Layout scopeLayout = LayoutLocalServiceUtil.getLayout(group.getClassPK()); referenceElement.addAttribute("scope-layout-uuid", scopeLayout.getUuid()); } catch (NoSuchLayoutException nsle) { if (_log.isWarnEnabled()) { _log.warn("Unable to find layout " + group.getClassPK(), nsle); } } } } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn("Unable to find group " + stagedGroupedModel.getGroupId()); } } } if (Validator.isNotNull(binPath)) { referenceElement.addAttribute("path", binPath); } referenceElement.addAttribute("type", referenceType); if (missing) { referenceElement.addAttribute("referrer-class-name", ExportImportClassedModelUtil.getClassName(referrerClassedModel)); if (referrerClassedModel instanceof PortletModel) { Portlet portlet = (Portlet) referrerClassedModel; referenceElement.addAttribute("referrer-display-name", portlet.getRootPortletId()); } else if (referrerClassedModel instanceof StagedModel) { StagedModel referrerStagedModel = (StagedModel) referrerClassedModel; referenceElement.addAttribute("referrer-display-name", StagedModelDataHandlerUtil.getDisplayName(referrerStagedModel)); } } if (classedModel instanceof StagedModel) { StagedModel stagedModel = (StagedModel) classedModel; referenceElement.addAttribute("uuid", stagedModel.getUuid()); referenceElement.addAttribute("company-id", String.valueOf(stagedModel.getCompanyId())); Map<String, String> referenceAttributes = StagedModelDataHandlerUtil.getReferenceAttributes(this, stagedModel); for (Map.Entry<String, String> referenceAttribute : referenceAttributes.entrySet()) { referenceElement.addAttribute(referenceAttribute.getKey(), referenceAttribute.getValue()); } } return referenceElement; }
From source file:com.liferay.exportimport.resources.importer.internal.util.BaseImporter.java
License:Open Source License
@Override public void afterPropertiesSet() throws Exception { User user = UserLocalServiceUtil.getDefaultUser(companyId); userId = user.getUserId();//from ww w. ja v a 2 s. co m 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(), new HashMap<Locale, String>(), 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) { int privateLayoutPageCount = group.getPrivateLayoutsPageCount(); int publicLayoutPageCount = group.getPublicLayoutsPageCount(); if ((privateLayoutPageCount != 0) || (publicLayoutPageCount != 0)) { existing = true; } } else { group = GroupLocalServiceUtil.addGroup(userId, GroupConstants.DEFAULT_PARENT_GROUP_ID, StringPool.BLANK, GroupConstants.DEFAULT_PARENT_GROUP_ID, GroupConstants.DEFAULT_LIVE_GROUP_ID, getMap(targetValue), null, GroupConstants.TYPE_SITE_OPEN, true, GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION, null, true, true, new ServiceContext()); } } targetClassPK = group.getGroupId(); } if (group != null) { groupId = group.getGroupId(); } }
From source file:com.liferay.portlet.configuration.web.internal.portlet.PortletConfigurationPortlet.java
License:Open Source License
protected Tuple getNewScope(ActionRequest actionRequest) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); Layout layout = themeDisplay.getLayout(); String[] scopes = StringUtil.split(ParamUtil.getString(actionRequest, "scope")); String scopeType = scopes[0]; long scopeGroupId = 0; String scopeName = null;/* w w w . jav a 2 s. co m*/ if (Validator.isNull(scopeType)) { scopeGroupId = layout.getGroupId(); } else if (scopeType.equals("company")) { scopeGroupId = themeDisplay.getCompanyGroupId(); scopeName = themeDisplay.translate("global"); } else if (scopeType.equals("layout")) { String scopeLayoutUuid = scopes[1]; Layout scopeLayout = _layoutLocalService.getLayoutByUuidAndGroupId(scopeLayoutUuid, layout.getGroupId(), layout.isPrivateLayout()); if (!scopeLayout.hasScopeGroup()) { Map<Locale, String> nameMap = new HashMap<>(); String name = String.valueOf(scopeLayout.getPlid()); nameMap.put(LocaleUtil.getDefault(), name); _groupLocalService.addGroup(themeDisplay.getUserId(), GroupConstants.DEFAULT_PARENT_GROUP_ID, Layout.class.getName(), scopeLayout.getPlid(), GroupConstants.DEFAULT_LIVE_GROUP_ID, nameMap, null, 0, true, GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION, null, false, true, null); } scopeGroupId = scopeLayout.getGroupId(); scopeName = scopeLayout.getName(themeDisplay.getLocale()); } else { throw new IllegalArgumentException("Scope type " + scopeType + " is invalid"); } return new Tuple(scopeGroupId, scopeName); }
From source file:com.liferay.site.admin.web.internal.portlet.SiteAdminPortlet.java
License:Open Source License
protected Group updateGroup(ActionRequest actionRequest) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long userId = portal.getUserId(actionRequest); long liveGroupId = ParamUtil.getLong(actionRequest, "liveGroupId"); long parentGroupId = ParamUtil.getLong(actionRequest, "parentGroupSearchContainerPrimaryKeys", GroupConstants.DEFAULT_PARENT_GROUP_ID); Map<Locale, String> nameMap = null; Map<Locale, String> descriptionMap = null; int type = 0; String friendlyURL = null;/*ww w.j ava 2s . co m*/ boolean inheritContent = false; boolean active = false; boolean manualMembership = true; int membershipRestriction = GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION; boolean actionRequestMembershipRestriction = ParamUtil.getBoolean(actionRequest, "membershipRestriction"); if (actionRequestMembershipRestriction && (parentGroupId != GroupConstants.DEFAULT_PARENT_GROUP_ID)) { membershipRestriction = GroupConstants.MEMBERSHIP_RESTRICTION_TO_PARENT_SITE_MEMBERS; } ServiceContext serviceContext = ServiceContextFactory.getInstance(Group.class.getName(), actionRequest); ServiceContextThreadLocal.pushServiceContext(serviceContext); Group liveGroup = null; if (liveGroupId <= 0) { // Add group nameMap = LocalizationUtil.getLocalizationMap(actionRequest, "name"); descriptionMap = LocalizationUtil.getLocalizationMap(actionRequest, "description"); type = ParamUtil.getInteger(actionRequest, "type"); friendlyURL = ParamUtil.getString(actionRequest, "friendlyURL"); manualMembership = ParamUtil.getBoolean(actionRequest, "manualMembership"); inheritContent = ParamUtil.getBoolean(actionRequest, "inheritContent"); active = ParamUtil.getBoolean(actionRequest, "active"); liveGroup = groupService.addGroup(parentGroupId, GroupConstants.DEFAULT_LIVE_GROUP_ID, nameMap, descriptionMap, type, manualMembership, membershipRestriction, friendlyURL, true, inheritContent, active, serviceContext); LiveUsers.joinGroup(themeDisplay.getCompanyId(), liveGroup.getGroupId(), userId); } else { // Update group liveGroup = groupLocalService.getGroup(liveGroupId); nameMap = LocalizationUtil.getLocalizationMap(actionRequest, "name", liveGroup.getNameMap()); descriptionMap = LocalizationUtil.getLocalizationMap(actionRequest, "description", liveGroup.getDescriptionMap()); type = ParamUtil.getInteger(actionRequest, "type", liveGroup.getType()); manualMembership = ParamUtil.getBoolean(actionRequest, "manualMembership", liveGroup.isManualMembership()); friendlyURL = ParamUtil.getString(actionRequest, "friendlyURL", liveGroup.getFriendlyURL()); inheritContent = ParamUtil.getBoolean(actionRequest, "inheritContent", liveGroup.getInheritContent()); active = ParamUtil.getBoolean(actionRequest, "active", liveGroup.getActive()); liveGroup = groupService.updateGroup(liveGroupId, parentGroupId, nameMap, descriptionMap, type, manualMembership, membershipRestriction, friendlyURL, inheritContent, active, serviceContext); if (type == GroupConstants.TYPE_SITE_OPEN) { List<MembershipRequest> membershipRequests = membershipRequestLocalService.search(liveGroupId, MembershipRequestConstants.STATUS_PENDING, QueryUtil.ALL_POS, QueryUtil.ALL_POS); for (MembershipRequest membershipRequest : membershipRequests) { membershipRequestService.updateStatus(membershipRequest.getMembershipRequestId(), themeDisplay.translate("your-membership-has-been-approved"), MembershipRequestConstants.STATUS_APPROVED, serviceContext); LiveUsers.joinGroup(themeDisplay.getCompanyId(), membershipRequest.getGroupId(), new long[] { membershipRequest.getUserId() }); } } } // Settings UnicodeProperties typeSettingsProperties = liveGroup.getTypeSettingsProperties(); String customJspServletContextName = ParamUtil.getString(actionRequest, "customJspServletContextName", typeSettingsProperties.getProperty("customJspServletContextName")); typeSettingsProperties.setProperty("customJspServletContextName", customJspServletContextName); typeSettingsProperties.setProperty("defaultSiteRoleIds", ListUtil.toString(getRoles(actionRequest), Role.ROLE_ID_ACCESSOR, StringPool.COMMA)); typeSettingsProperties.setProperty("defaultTeamIds", ListUtil.toString(getTeams(actionRequest), Team.TEAM_ID_ACCESSOR, StringPool.COMMA)); String[] analyticsTypes = PrefsPropsUtil.getStringArray(themeDisplay.getCompanyId(), PropsKeys.ADMIN_ANALYTICS_TYPES, StringPool.NEW_LINE); for (String analyticsType : analyticsTypes) { if (StringUtil.equalsIgnoreCase(analyticsType, "google")) { String googleAnalyticsId = ParamUtil.getString(actionRequest, "googleAnalyticsId", typeSettingsProperties.getProperty("googleAnalyticsId")); typeSettingsProperties.setProperty("googleAnalyticsId", googleAnalyticsId); } else { String analyticsScript = ParamUtil.getString(actionRequest, Sites.ANALYTICS_PREFIX + analyticsType, typeSettingsProperties.getProperty(analyticsType)); typeSettingsProperties.setProperty(Sites.ANALYTICS_PREFIX + analyticsType, analyticsScript); } } boolean trashEnabled = ParamUtil.getBoolean(actionRequest, "trashEnabled", GetterUtil.getBoolean(typeSettingsProperties.getProperty("trashEnabled"), true)); typeSettingsProperties.setProperty("trashEnabled", String.valueOf(trashEnabled)); int trashEntriesMaxAgeCompany = PrefsPropsUtil.getInteger(themeDisplay.getCompanyId(), PropsKeys.TRASH_ENTRIES_MAX_AGE); int trashEntriesMaxAgeGroup = ParamUtil.getInteger(actionRequest, "trashEntriesMaxAge"); if (trashEntriesMaxAgeGroup <= 0) { trashEntriesMaxAgeGroup = GetterUtil.getInteger( typeSettingsProperties.getProperty("trashEntriesMaxAge"), trashEntriesMaxAgeCompany); } if (trashEntriesMaxAgeGroup != trashEntriesMaxAgeCompany) { typeSettingsProperties.setProperty("trashEntriesMaxAge", String.valueOf(GetterUtil.getInteger(trashEntriesMaxAgeGroup))); } else { typeSettingsProperties.remove("trashEntriesMaxAge"); } int contentSharingWithChildrenEnabled = ParamUtil.getInteger(actionRequest, "contentSharingWithChildrenEnabled", GetterUtil.getInteger(typeSettingsProperties.getProperty("contentSharingWithChildrenEnabled"), Sites.CONTENT_SHARING_WITH_CHILDREN_DEFAULT_VALUE)); typeSettingsProperties.setProperty("contentSharingWithChildrenEnabled", String.valueOf(contentSharingWithChildrenEnabled)); UnicodeProperties formTypeSettingsProperties = PropertiesParamUtil.getProperties(actionRequest, "TypeSettingsProperties--"); typeSettingsProperties.putAll(formTypeSettingsProperties); // Virtual hosts LayoutSet publicLayoutSet = liveGroup.getPublicLayoutSet(); String publicVirtualHost = ParamUtil.getString(actionRequest, "publicVirtualHost", publicLayoutSet.getVirtualHostname()); layoutSetService.updateVirtualHost(liveGroup.getGroupId(), false, publicVirtualHost); LayoutSet privateLayoutSet = liveGroup.getPrivateLayoutSet(); String privateVirtualHost = ParamUtil.getString(actionRequest, "privateVirtualHost", privateLayoutSet.getVirtualHostname()); layoutSetService.updateVirtualHost(liveGroup.getGroupId(), true, privateVirtualHost); // Staging if (liveGroup.hasStagingGroup()) { Group stagingGroup = liveGroup.getStagingGroup(); friendlyURL = ParamUtil.getString(actionRequest, "stagingFriendlyURL", stagingGroup.getFriendlyURL()); groupService.updateFriendlyURL(stagingGroup.getGroupId(), friendlyURL); LayoutSet stagingPublicLayoutSet = stagingGroup.getPublicLayoutSet(); publicVirtualHost = ParamUtil.getString(actionRequest, "stagingPublicVirtualHost", stagingPublicLayoutSet.getVirtualHostname()); layoutSetService.updateVirtualHost(stagingGroup.getGroupId(), false, publicVirtualHost); LayoutSet stagingPrivateLayoutSet = stagingGroup.getPrivateLayoutSet(); privateVirtualHost = ParamUtil.getString(actionRequest, "stagingPrivateVirtualHost", stagingPrivateLayoutSet.getVirtualHostname()); layoutSetService.updateVirtualHost(stagingGroup.getGroupId(), true, privateVirtualHost); UnicodeProperties stagedGroupTypeSettingsProperties = stagingGroup.getTypeSettingsProperties(); stagedGroupTypeSettingsProperties.putAll(formTypeSettingsProperties); groupService.updateGroup(stagingGroup.getGroupId(), stagedGroupTypeSettingsProperties.toString()); } liveGroup = groupService.updateGroup(liveGroup.getGroupId(), typeSettingsProperties.toString()); // Layout set prototypes long privateLayoutSetPrototypeId = ParamUtil.getLong(actionRequest, "privateLayoutSetPrototypeId"); long publicLayoutSetPrototypeId = ParamUtil.getLong(actionRequest, "publicLayoutSetPrototypeId"); boolean privateLayoutSetPrototypeLinkEnabled = ParamUtil.getBoolean(actionRequest, "privateLayoutSetPrototypeLinkEnabled", privateLayoutSet.isLayoutSetPrototypeLinkEnabled()); boolean publicLayoutSetPrototypeLinkEnabled = ParamUtil.getBoolean(actionRequest, "publicLayoutSetPrototypeLinkEnabled", publicLayoutSet.isLayoutSetPrototypeLinkEnabled()); if ((privateLayoutSetPrototypeId == 0) && (publicLayoutSetPrototypeId == 0) && !privateLayoutSetPrototypeLinkEnabled && !publicLayoutSetPrototypeLinkEnabled) { long layoutSetPrototypeId = ParamUtil.getLong(actionRequest, "layoutSetPrototypeId"); int layoutSetVisibility = ParamUtil.getInteger(actionRequest, "layoutSetVisibility"); boolean layoutSetPrototypeLinkEnabled = ParamUtil.getBoolean(actionRequest, "layoutSetPrototypeLinkEnabled", layoutSetPrototypeId > 0); if (layoutSetVisibility == _LAYOUT_SET_VISIBILITY_PRIVATE) { privateLayoutSetPrototypeId = layoutSetPrototypeId; privateLayoutSetPrototypeLinkEnabled = layoutSetPrototypeLinkEnabled; } else { publicLayoutSetPrototypeId = layoutSetPrototypeId; publicLayoutSetPrototypeLinkEnabled = layoutSetPrototypeLinkEnabled; } } if (!liveGroup.isStaged() || liveGroup.isStagedRemotely()) { SitesUtil.updateLayoutSetPrototypesLinks(liveGroup, publicLayoutSetPrototypeId, privateLayoutSetPrototypeId, publicLayoutSetPrototypeLinkEnabled, privateLayoutSetPrototypeLinkEnabled); } else { SitesUtil.updateLayoutSetPrototypesLinks(liveGroup.getStagingGroup(), publicLayoutSetPrototypeId, privateLayoutSetPrototypeId, publicLayoutSetPrototypeLinkEnabled, privateLayoutSetPrototypeLinkEnabled); } themeDisplay.setSiteGroupId(liveGroup.getGroupId()); return liveGroup; }
From source file:com.liferay.site.demo.data.creator.internal.SiteDemoDataCreatorImpl.java
License:Open Source License
@Override public Group create(long companyId, String name) throws PortalException { Company company = _companyLocalService.fetchCompany(companyId); User user = company.getDefaultUser(); Map<Locale, String> nameMap = new HashMap<>(); nameMap.put(LocaleUtil.getDefault(), name); Map<Locale, String> descriptionMap = new HashMap<>(); int type = GroupConstants.TYPE_SITE_OPEN; String friendlyURL = StringPool.SLASH + FriendlyURLNormalizerUtil.normalize(name); boolean site = true; boolean active = true; boolean manualMembership = true; int membershipRestriction = GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION; Group group = _groupLocalService.addGroup(user.getUserId(), GroupConstants.DEFAULT_PARENT_GROUP_ID, null, 0, GroupConstants.DEFAULT_LIVE_GROUP_ID, nameMap, descriptionMap, type, manualMembership, membershipRestriction, friendlyURL, site, active, null); _groupIds.add(group.getGroupId());//from w ww .j a v a 2 s.c o m return group; }