List of usage examples for com.liferay.portal.kernel.model LayoutSet getVirtualHostname
@Deprecated
public String getVirtualHostname();
From source file:com.liferay.exportimport.content.processor.base.BaseTextExportImportContentProcessor.java
License:Open Source License
protected String replaceExportHostname(long groupId, String url, StringBundler urlSB) throws PortalException { if (!HttpUtil.hasProtocol(url)) { return url; }//from ww w . ja va2 s . c om boolean secure = HttpUtil.isSecure(url); int serverPort = PortalUtil.getPortalServerPort(secure); if (serverPort == -1) { return url; } Group group = GroupLocalServiceUtil.getGroup(groupId); LayoutSet publicLayoutSet = group.getPublicLayoutSet(); String publicLayoutSetVirtualHostname = publicLayoutSet.getVirtualHostname(); String portalUrl = StringPool.BLANK; if (Validator.isNotNull(publicLayoutSetVirtualHostname)) { portalUrl = PortalUtil.getPortalURL(publicLayoutSetVirtualHostname, serverPort, secure); if (url.startsWith(portalUrl)) { if (secure) { urlSB.append(DATA_HANDLER_PUBLIC_LAYOUT_SET_SECURE_URL); } else { urlSB.append(DATA_HANDLER_PUBLIC_LAYOUT_SET_URL); } return url.substring(portalUrl.length()); } } LayoutSet privateLayoutSet = group.getPrivateLayoutSet(); String privateLayoutSetVirtualHostname = privateLayoutSet.getVirtualHostname(); if (Validator.isNotNull(privateLayoutSetVirtualHostname)) { portalUrl = PortalUtil.getPortalURL(privateLayoutSetVirtualHostname, serverPort, secure); if (url.startsWith(portalUrl)) { if (secure) { urlSB.append(DATA_HANDLER_PRIVATE_LAYOUT_SET_SECURE_URL); } else { urlSB.append(DATA_HANDLER_PRIVATE_LAYOUT_SET_URL); } return url.substring(portalUrl.length()); } } Company company = CompanyLocalServiceUtil.getCompany(group.getCompanyId()); String companyVirtualHostname = company.getVirtualHostname(); if (Validator.isNotNull(companyVirtualHostname)) { portalUrl = PortalUtil.getPortalURL(companyVirtualHostname, serverPort, secure); if (url.startsWith(portalUrl)) { if (secure) { urlSB.append(DATA_HANDLER_COMPANY_SECURE_URL); } else { urlSB.append(DATA_HANDLER_COMPANY_URL); } return url.substring(portalUrl.length()); } } portalUrl = PortalUtil.getPortalURL("localhost", serverPort, secure); if (url.startsWith(portalUrl)) { return url.substring(portalUrl.length()); } return url; }
From source file:com.liferay.exportimport.content.processor.base.BaseTextExportImportContentProcessor.java
License:Open Source License
protected String replaceImportLayoutReferences(PortletDataContext portletDataContext, String content) throws Exception { String companyPortalURL = StringPool.BLANK; String privateLayoutSetPortalURL = StringPool.BLANK; String publicLayoutSetPortalURL = StringPool.BLANK; Group group = GroupLocalServiceUtil.getGroup(portletDataContext.getScopeGroupId()); Company company = CompanyLocalServiceUtil.getCompany(group.getCompanyId()); LayoutSet privateLayoutSet = group.getPrivateLayoutSet(); LayoutSet publicLayoutSet = group.getPublicLayoutSet(); int serverPort = PortalUtil.getPortalServerPort(false); if (serverPort != -1) { if (Validator.isNotNull(company.getVirtualHostname())) { companyPortalURL = PortalUtil.getPortalURL(company.getVirtualHostname(), serverPort, false); }/*from w w w . j a va 2s .c om*/ if (Validator.isNotNull(privateLayoutSet.getVirtualHostname())) { privateLayoutSetPortalURL = PortalUtil.getPortalURL(privateLayoutSet.getVirtualHostname(), serverPort, false); } if (Validator.isNotNull(publicLayoutSet.getVirtualHostname())) { publicLayoutSetPortalURL = PortalUtil.getPortalURL(publicLayoutSet.getVirtualHostname(), serverPort, false); } } int secureSecurePort = PortalUtil.getPortalServerPort(true); String companySecurePortalURL = StringPool.BLANK; String privateLayoutSetSecurePortalURL = StringPool.BLANK; String publicLayoutSetSecurePortalURL = StringPool.BLANK; if (secureSecurePort != -1) { if (Validator.isNotNull(company.getVirtualHostname())) { companySecurePortalURL = PortalUtil.getPortalURL(company.getVirtualHostname(), secureSecurePort, true); } if (Validator.isNotNull(privateLayoutSet.getVirtualHostname())) { privateLayoutSetSecurePortalURL = PortalUtil.getPortalURL(privateLayoutSet.getVirtualHostname(), secureSecurePort, true); } if (Validator.isNotNull(publicLayoutSet.getVirtualHostname())) { publicLayoutSetSecurePortalURL = PortalUtil.getPortalURL(publicLayoutSet.getVirtualHostname(), secureSecurePort, true); } } StringBundler sb = new StringBundler(3); sb.append(VirtualLayoutConstants.CANONICAL_URL_SEPARATOR); sb.append(GroupConstants.CONTROL_PANEL_FRIENDLY_URL); sb.append(PropsValues.CONTROL_PANEL_LAYOUT_FRIENDLY_URL); content = StringUtil.replace(content, DATA_HANDLER_COMPANY_SECURE_URL, companySecurePortalURL); content = StringUtil.replace(content, DATA_HANDLER_COMPANY_URL, companyPortalURL); // Group friendly URLs while (true) { int groupFriendlyUrlPos = content.indexOf(DATA_HANDLER_GROUP_FRIENDLY_URL); if (groupFriendlyUrlPos == -1) { break; } int groupUuidPos = groupFriendlyUrlPos + DATA_HANDLER_GROUP_FRIENDLY_URL.length(); int endIndex = content.indexOf(StringPool.AT, groupUuidPos + 1); if (endIndex < (groupUuidPos + 1)) { content = StringUtil.replaceFirst(content, DATA_HANDLER_GROUP_FRIENDLY_URL, StringPool.BLANK, groupFriendlyUrlPos); continue; } String groupUuid = content.substring(groupUuidPos + 1, endIndex); Group groupFriendlyUrlGroup = GroupLocalServiceUtil.fetchGroupByUuidAndCompanyId(groupUuid, portletDataContext.getCompanyId()); if ((groupFriendlyUrlGroup == null) || groupUuid.startsWith(StringPool.SLASH)) { content = StringUtil.replaceFirst(content, DATA_HANDLER_GROUP_FRIENDLY_URL, group.getFriendlyURL(), groupFriendlyUrlPos); content = StringUtil.replaceFirst(content, StringPool.AT + groupUuid + StringPool.AT, StringPool.BLANK, content.indexOf(group.getFriendlyURL())); continue; } content = StringUtil.replaceFirst(content, DATA_HANDLER_GROUP_FRIENDLY_URL, StringPool.BLANK, groupFriendlyUrlPos); content = StringUtil.replaceFirst(content, StringPool.AT + groupUuid + StringPool.AT, groupFriendlyUrlGroup.getFriendlyURL(), groupFriendlyUrlPos); } content = StringUtil.replace(content, DATA_HANDLER_PATH_CONTEXT, PortalUtil.getPathContext()); content = StringUtil.replace(content, DATA_HANDLER_PRIVATE_GROUP_SERVLET_MAPPING, PropsValues.LAYOUT_FRIENDLY_URL_PRIVATE_GROUP_SERVLET_MAPPING); content = StringUtil.replace(content, DATA_HANDLER_PRIVATE_LAYOUT_SET_SECURE_URL, privateLayoutSetSecurePortalURL); content = StringUtil.replace(content, DATA_HANDLER_PRIVATE_LAYOUT_SET_URL, privateLayoutSetPortalURL); content = StringUtil.replace(content, DATA_HANDLER_PRIVATE_USER_SERVLET_MAPPING, PropsValues.LAYOUT_FRIENDLY_URL_PRIVATE_USER_SERVLET_MAPPING); content = StringUtil.replace(content, DATA_HANDLER_PUBLIC_LAYOUT_SET_SECURE_URL, publicLayoutSetSecurePortalURL); content = StringUtil.replace(content, DATA_HANDLER_PUBLIC_LAYOUT_SET_URL, publicLayoutSetPortalURL); content = StringUtil.replace(content, DATA_HANDLER_PUBLIC_SERVLET_MAPPING, PropsValues.LAYOUT_FRIENDLY_URL_PUBLIC_SERVLET_MAPPING); content = StringUtil.replace(content, DATA_HANDLER_SITE_ADMIN_URL, sb.toString()); return content; }
From source file:com.liferay.exportimport.internal.content.processor.LayoutReferencesExportImportContentProcessor.java
License:Open Source License
protected String replaceExportHostname(long groupId, String url, StringBundler urlSB) throws PortalException { if (!_http.hasProtocol(url)) { return url; }// w w w . j av a2s . co m boolean secure = _http.isSecure(url); int serverPort = _portal.getPortalServerPort(secure); if (serverPort == -1) { return url; } Group group = _groupLocalService.getGroup(groupId); LayoutSet publicLayoutSet = group.getPublicLayoutSet(); String publicLayoutSetVirtualHostname = publicLayoutSet.getVirtualHostname(); String portalUrl = StringPool.BLANK; if (Validator.isNotNull(publicLayoutSetVirtualHostname)) { portalUrl = _portal.getPortalURL(publicLayoutSetVirtualHostname, serverPort, secure); if (url.startsWith(portalUrl)) { if (secure) { urlSB.append(_DATA_HANDLER_PUBLIC_LAYOUT_SET_SECURE_URL); } else { urlSB.append(_DATA_HANDLER_PUBLIC_LAYOUT_SET_URL); } return url.substring(portalUrl.length()); } } LayoutSet privateLayoutSet = group.getPrivateLayoutSet(); String privateLayoutSetVirtualHostname = privateLayoutSet.getVirtualHostname(); if (Validator.isNotNull(privateLayoutSetVirtualHostname)) { portalUrl = _portal.getPortalURL(privateLayoutSetVirtualHostname, serverPort, secure); if (url.startsWith(portalUrl)) { if (secure) { urlSB.append(_DATA_HANDLER_PRIVATE_LAYOUT_SET_SECURE_URL); } else { urlSB.append(_DATA_HANDLER_PRIVATE_LAYOUT_SET_URL); } return url.substring(portalUrl.length()); } } Company company = _companyLocalService.getCompany(group.getCompanyId()); String companyVirtualHostname = company.getVirtualHostname(); if (Validator.isNotNull(companyVirtualHostname)) { portalUrl = _portal.getPortalURL(companyVirtualHostname, serverPort, secure); if (url.startsWith(portalUrl)) { if (secure) { urlSB.append(_DATA_HANDLER_COMPANY_SECURE_URL); } else { urlSB.append(_DATA_HANDLER_COMPANY_URL); } return url.substring(portalUrl.length()); } } portalUrl = _portal.getPortalURL("localhost", serverPort, secure); if (url.startsWith(portalUrl)) { return url.substring(portalUrl.length()); } return url; }
From source file:com.liferay.exportimport.internal.content.processor.LayoutReferencesExportImportContentProcessor.java
License:Open Source License
protected String replaceImportLayoutReferences(PortletDataContext portletDataContext, String content) throws Exception { String companyPortalURL = StringPool.BLANK; String privateLayoutSetPortalURL = StringPool.BLANK; String publicLayoutSetPortalURL = StringPool.BLANK; Group group = _groupLocalService.getGroup(portletDataContext.getScopeGroupId()); Company company = _companyLocalService.getCompany(group.getCompanyId()); LayoutSet privateLayoutSet = group.getPrivateLayoutSet(); LayoutSet publicLayoutSet = group.getPublicLayoutSet(); int serverPort = _portal.getPortalServerPort(false); if (serverPort != -1) { if (Validator.isNotNull(company.getVirtualHostname())) { companyPortalURL = _portal.getPortalURL(company.getVirtualHostname(), serverPort, false); }/* www.j a v a2 s .c om*/ if (Validator.isNotNull(privateLayoutSet.getVirtualHostname())) { privateLayoutSetPortalURL = _portal.getPortalURL(privateLayoutSet.getVirtualHostname(), serverPort, false); } if (Validator.isNotNull(publicLayoutSet.getVirtualHostname())) { publicLayoutSetPortalURL = _portal.getPortalURL(publicLayoutSet.getVirtualHostname(), serverPort, false); } } int secureSecurePort = _portal.getPortalServerPort(true); String companySecurePortalURL = StringPool.BLANK; String privateLayoutSetSecurePortalURL = StringPool.BLANK; String publicLayoutSetSecurePortalURL = StringPool.BLANK; if (secureSecurePort != -1) { if (Validator.isNotNull(company.getVirtualHostname())) { companySecurePortalURL = _portal.getPortalURL(company.getVirtualHostname(), secureSecurePort, true); } if (Validator.isNotNull(privateLayoutSet.getVirtualHostname())) { privateLayoutSetSecurePortalURL = _portal.getPortalURL(privateLayoutSet.getVirtualHostname(), secureSecurePort, true); } if (Validator.isNotNull(publicLayoutSet.getVirtualHostname())) { publicLayoutSetSecurePortalURL = _portal.getPortalURL(publicLayoutSet.getVirtualHostname(), secureSecurePort, true); } } StringBundler sb = new StringBundler(3); sb.append(VirtualLayoutConstants.CANONICAL_URL_SEPARATOR); sb.append(GroupConstants.CONTROL_PANEL_FRIENDLY_URL); sb.append(PropsValues.CONTROL_PANEL_LAYOUT_FRIENDLY_URL); content = StringUtil.replace(content, _DATA_HANDLER_COMPANY_SECURE_URL, companySecurePortalURL); content = StringUtil.replace(content, _DATA_HANDLER_COMPANY_URL, companyPortalURL); // Group friendly URLs while (true) { int groupFriendlyUrlPos = content.indexOf(_DATA_HANDLER_GROUP_FRIENDLY_URL); if (groupFriendlyUrlPos == -1) { break; } int groupUuidPos = groupFriendlyUrlPos + _DATA_HANDLER_GROUP_FRIENDLY_URL.length(); int endIndex = content.indexOf(StringPool.AT, groupUuidPos + 1); if (endIndex < (groupUuidPos + 1)) { content = StringUtil.replaceFirst(content, _DATA_HANDLER_GROUP_FRIENDLY_URL, StringPool.BLANK, groupFriendlyUrlPos); continue; } String groupUuid = content.substring(groupUuidPos + 1, endIndex); Group groupFriendlyUrlGroup = _groupLocalService.fetchGroupByUuidAndCompanyId(groupUuid, portletDataContext.getCompanyId()); if ((groupFriendlyUrlGroup == null) || groupUuid.startsWith(StringPool.SLASH)) { content = StringUtil.replaceFirst(content, _DATA_HANDLER_GROUP_FRIENDLY_URL, group.getFriendlyURL(), groupFriendlyUrlPos); content = StringUtil.replaceFirst(content, StringPool.AT + groupUuid + StringPool.AT, StringPool.BLANK, content.indexOf(group.getFriendlyURL())); continue; } content = StringUtil.replaceFirst(content, _DATA_HANDLER_GROUP_FRIENDLY_URL, StringPool.BLANK, groupFriendlyUrlPos); content = StringUtil.replaceFirst(content, StringPool.AT + groupUuid + StringPool.AT, groupFriendlyUrlGroup.getFriendlyURL(), groupFriendlyUrlPos); } content = StringUtil.replace(content, _DATA_HANDLER_PATH_CONTEXT, _portal.getPathContext()); content = StringUtil.replace(content, _DATA_HANDLER_PRIVATE_GROUP_SERVLET_MAPPING, PropsValues.LAYOUT_FRIENDLY_URL_PRIVATE_GROUP_SERVLET_MAPPING); content = StringUtil.replace(content, _DATA_HANDLER_PRIVATE_LAYOUT_SET_SECURE_URL, privateLayoutSetSecurePortalURL); content = StringUtil.replace(content, _DATA_HANDLER_PRIVATE_LAYOUT_SET_URL, privateLayoutSetPortalURL); content = StringUtil.replace(content, _DATA_HANDLER_PRIVATE_USER_SERVLET_MAPPING, PropsValues.LAYOUT_FRIENDLY_URL_PRIVATE_USER_SERVLET_MAPPING); content = StringUtil.replace(content, _DATA_HANDLER_PUBLIC_LAYOUT_SET_SECURE_URL, publicLayoutSetSecurePortalURL); content = StringUtil.replace(content, _DATA_HANDLER_PUBLIC_LAYOUT_SET_URL, publicLayoutSetPortalURL); content = StringUtil.replace(content, _DATA_HANDLER_PUBLIC_SERVLET_MAPPING, PropsValues.LAYOUT_FRIENDLY_URL_PUBLIC_SERVLET_MAPPING); content = StringUtil.replace(content, _DATA_HANDLER_SITE_ADMIN_URL, sb.toString()); return content; }
From source file:com.liferay.journal.util.impl.JournalUtil.java
License:Open Source License
private static void _populateTokens(Map<String, String> tokens, long articleGroupId, ThemeDisplay themeDisplay) throws PortalException { Layout layout = themeDisplay.getLayout(); Group group = layout.getGroup(); LayoutSet layoutSet = layout.getLayoutSet(); String friendlyUrlCurrent = null; if (layout.isPublicLayout()) { friendlyUrlCurrent = themeDisplay.getPathFriendlyURLPublic(); } else if (group.isUserGroup()) { friendlyUrlCurrent = themeDisplay.getPathFriendlyURLPrivateUser(); } else {//from w ww .j a v a2 s . com friendlyUrlCurrent = themeDisplay.getPathFriendlyURLPrivateGroup(); } String layoutSetFriendlyUrl = themeDisplay.getI18nPath(); String virtualHostname = layoutSet.getVirtualHostname(); if (Validator.isNull(virtualHostname) || !virtualHostname.equals(themeDisplay.getServerName())) { layoutSetFriendlyUrl = friendlyUrlCurrent + group.getFriendlyURL(); } tokens.put("article_group_id", String.valueOf(articleGroupId)); tokens.put("cdn_host", themeDisplay.getCDNHost()); tokens.put("company_id", String.valueOf(themeDisplay.getCompanyId())); tokens.put("friendly_url_current", friendlyUrlCurrent); tokens.put("friendly_url_private_group", themeDisplay.getPathFriendlyURLPrivateGroup()); tokens.put("friendly_url_private_user", themeDisplay.getPathFriendlyURLPrivateUser()); tokens.put("friendly_url_public", themeDisplay.getPathFriendlyURLPublic()); tokens.put("group_friendly_url", group.getFriendlyURL()); tokens.put("image_path", themeDisplay.getPathImage()); tokens.put("layout_set_friendly_url", layoutSetFriendlyUrl); tokens.put("main_path", themeDisplay.getPathMain()); tokens.put("portal_ctx", themeDisplay.getPathContext()); tokens.put("portal_url", HttpUtil.removeProtocol(themeDisplay.getURLPortal())); tokens.put("protocol", HttpUtil.getProtocol(themeDisplay.getURLPortal())); tokens.put("root_path", themeDisplay.getPathContext()); tokens.put("scope_group_id", String.valueOf(themeDisplay.getScopeGroupId())); tokens.put("site_group_id", String.valueOf(themeDisplay.getSiteGroupId())); tokens.put("theme_image_path", themeDisplay.getPathThemeImages()); _populateCustomTokens(tokens, themeDisplay.getCompanyId()); // Deprecated tokens tokens.put("friendly_url", themeDisplay.getPathFriendlyURLPublic()); tokens.put("friendly_url_private", themeDisplay.getPathFriendlyURLPrivateGroup()); tokens.put("group_id", String.valueOf(articleGroupId)); tokens.put("page_url", themeDisplay.getPathFriendlyURLPublic()); }
From source file:com.liferay.journal.util.impl.JournalUtil.java
License:Open Source License
private static void _populateTokens(Map<String, String> tokens, long articleGroupId, ThemeDisplayModel themeDisplayModel) throws Exception { Layout layout = LayoutLocalServiceUtil.getLayout(themeDisplayModel.getPlid()); Group group = layout.getGroup(); LayoutSet layoutSet = layout.getLayoutSet(); String friendlyUrlCurrent = null; if (layout.isPublicLayout()) { friendlyUrlCurrent = themeDisplayModel.getPathFriendlyURLPublic(); } else if (group.isUserGroup()) { friendlyUrlCurrent = themeDisplayModel.getPathFriendlyURLPrivateUser(); } else {//from w w w . j av a2 s . c o m friendlyUrlCurrent = themeDisplayModel.getPathFriendlyURLPrivateGroup(); } String layoutSetFriendlyUrl = themeDisplayModel.getI18nPath(); String virtualHostname = layoutSet.getVirtualHostname(); if (Validator.isNull(virtualHostname) || !virtualHostname.equals(themeDisplayModel.getServerName())) { layoutSetFriendlyUrl = friendlyUrlCurrent + group.getFriendlyURL(); } tokens.put("article_group_id", String.valueOf(articleGroupId)); tokens.put("cdn_host", themeDisplayModel.getCdnHost()); tokens.put("company_id", String.valueOf(themeDisplayModel.getCompanyId())); tokens.put("friendly_url_current", friendlyUrlCurrent); tokens.put("friendly_url_private_group", themeDisplayModel.getPathFriendlyURLPrivateGroup()); tokens.put("friendly_url_private_user", themeDisplayModel.getPathFriendlyURLPrivateUser()); tokens.put("friendly_url_public", themeDisplayModel.getPathFriendlyURLPublic()); tokens.put("group_friendly_url", group.getFriendlyURL()); tokens.put("image_path", themeDisplayModel.getPathImage()); tokens.put("layout_set_friendly_url", layoutSetFriendlyUrl); tokens.put("main_path", themeDisplayModel.getPathMain()); tokens.put("portal_ctx", themeDisplayModel.getPathContext()); tokens.put("portal_url", HttpUtil.removeProtocol(themeDisplayModel.getURLPortal())); tokens.put("protocol", HttpUtil.getProtocol(themeDisplayModel.getURLPortal())); tokens.put("root_path", themeDisplayModel.getPathContext()); tokens.put("scope_group_id", String.valueOf(themeDisplayModel.getScopeGroupId())); tokens.put("theme_image_path", themeDisplayModel.getPathThemeImages()); _populateCustomTokens(tokens, themeDisplayModel.getCompanyId()); // Deprecated tokens tokens.put("friendly_url", themeDisplayModel.getPathFriendlyURLPublic()); tokens.put("friendly_url_private", themeDisplayModel.getPathFriendlyURLPrivateGroup()); tokens.put("group_id", String.valueOf(articleGroupId)); tokens.put("page_url", themeDisplayModel.getPathFriendlyURLPublic()); }
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 a va 2 s. c o 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; }