List of usage examples for com.liferay.portal.kernel.model GroupConstants GUEST
String GUEST
To view the source code for com.liferay.portal.kernel.model GroupConstants GUEST.
Click Source Link
From source file:com.liferay.announcements.uad.exporter.test.AnnouncementsEntryUADEntityExporterTest.java
License:Open Source License
private FileEntry _getFileEntry(long companyId, String uadEntityId) throws Exception { Group guestGroup = _groupLocalService.getGroup(companyId, GroupConstants.GUEST); Repository repository = PortletFileRepositoryUtil.getPortletRepository(guestGroup.getGroupId(), AnnouncementsPortletKeys.ANNOUNCEMENTS); Folder folder = PortletFileRepositoryUtil.getPortletFolder(repository.getRepositoryId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, "UADExport"); return PortletFileRepositoryUtil.getPortletFileEntry(guestGroup.getGroupId(), folder.getFolderId(), uadEntityId + ".json"); }
From source file:com.liferay.bookmarks.uad.exporter.test.BookmarksEntryUADEntityExporterTest.java
License:Open Source License
private FileEntry _getFileEntry(long companyId, String uadEntityId) throws Exception { Group guestGroup = _groupLocalService.getGroup(companyId, GroupConstants.GUEST); Repository repository = PortletFileRepositoryUtil.getPortletRepository(guestGroup.getGroupId(), BookmarksPortletKeys.BOOKMARKS); Folder folder = PortletFileRepositoryUtil.getPortletFolder(repository.getRepositoryId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, "UADExport"); return PortletFileRepositoryUtil.getPortletFileEntry(guestGroup.getGroupId(), folder.getFolderId(), uadEntityId + ".json"); }
From source file:com.liferay.calendar.notification.impl.NotificationTemplateContextFactory.java
License:Open Source License
public static NotificationTemplateContext getInstance(NotificationType notificationType, NotificationTemplateType notificationTemplateType, CalendarBooking calendarBooking, User user) throws Exception { CalendarBooking parentCalendarBooking = calendarBooking.getParentCalendarBooking(); Calendar calendar = parentCalendarBooking.getCalendar(); NotificationTemplateContext notificationTemplateContext = new NotificationTemplateContext(); CalendarNotificationTemplate calendarNotificationTemplate = CalendarNotificationTemplateLocalServiceUtil .fetchCalendarNotificationTemplate(calendar.getCalendarId(), notificationType, notificationTemplateType); notificationTemplateContext.setCalendarNotificationTemplate(calendarNotificationTemplate); notificationTemplateContext.setCompanyId(calendarBooking.getCompanyId()); notificationTemplateContext.setGroupId(calendarBooking.getGroupId()); notificationTemplateContext.setCalendarId(calendar.getCalendarId()); notificationTemplateContext.setNotificationTemplateType(notificationTemplateType); notificationTemplateContext.setNotificationType(notificationType); // Attributes Map<String, Serializable> attributes = new HashMap<>(); TimeZone userTimezone = user.getTimeZone(); Format dateFormatDateTime = FastDateFormatFactoryUtil.getDateTime(user.getLocale(), CalendarUtil.getCalendarBookingDisplayTimeZone(calendarBooking, userTimezone)); String userTimezoneDisplayName = userTimezone.getDisplayName(false, TimeZone.SHORT, user.getLocale()); String endTime = dateFormatDateTime.format(calendarBooking.getEndTime()) + StringPool.SPACE + userTimezoneDisplayName;//from w w w. j ava 2 s . c o m attributes.put("endTime", endTime); attributes.put("location", calendarBooking.getLocation()); Group group = GroupLocalServiceUtil.getGroup(user.getCompanyId(), GroupConstants.GUEST); String portalURL = _getPortalURL(group.getCompanyId(), group.getGroupId()); attributes.put("portalURL", portalURL); PortletConfig portletConfig = getPortletConfig(); ResourceBundle resourceBundle = portletConfig.getResourceBundle(user.getLocale()); attributes.put("portletName", LanguageUtil.get(resourceBundle, "javax.portlet.title.".concat(CalendarPortletKeys.CALENDAR))); String startTime = dateFormatDateTime.format(calendarBooking.getStartTime()) + StringPool.SPACE + userTimezoneDisplayName; attributes.put("startTime", startTime); attributes.put("title", calendarBooking.getTitle(user.getLocale())); String calendarBookingURL = _getCalendarBookingURL(user, calendarBooking.getCalendarBookingId()); attributes.put("url", calendarBookingURL); notificationTemplateContext.setAttributes(attributes); return notificationTemplateContext; }
From source file:com.liferay.calendar.notification.impl.NotificationTemplateContextFactory.java
License:Open Source License
private static String _getCalendarBookingURL(User user, long calendarBookingId) throws PortalException { Group group = GroupLocalServiceUtil.getGroup(user.getCompanyId(), GroupConstants.GUEST); Layout layout = LayoutLocalServiceUtil.fetchLayout(group.getDefaultPublicPlid()); String portalURL = _getPortalURL(group.getCompanyId(), group.getGroupId()); String layoutActualURL = PortalUtil.getLayoutActualURL(layout); String url = portalURL + layoutActualURL; String namespace = PortalUtil.getPortletNamespace(CalendarPortletKeys.CALENDAR); url = HttpUtil.addParameter(url, namespace + "mvcPath", "/view_calendar_booking.jsp"); url = HttpUtil.addParameter(url, "p_p_id", CalendarPortletKeys.CALENDAR); url = HttpUtil.addParameter(url, "p_p_lifecycle", "0"); url = HttpUtil.addParameter(url, "p_p_state", WindowState.MAXIMIZED.toString()); url = HttpUtil.addParameter(url, namespace + "calendarBookingId", calendarBookingId); return url;//from w w w . ja v a2 s. c o m }
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 w ww .ja v a 2s . com 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(); } }