public static Date getLastPublishDate( PortletDataContext portletDataContext, PortletPreferences jxPortletPreferences) throws PortalException { String range = MapUtil.getString( portletDataContext.getParameterMap(), RANGE); if (range.equals(RANGE_FROM_LAST_PUBLISH_DATE)) { Date portletLastPublishDate = getLastPublishDate( jxPortletPreferences); if (portletLastPublishDate == null) { return null; } // This is a valid scenario in case of group level portlets if (portletDataContext.getStartDate() == null) { return portletLastPublishDate; } if (portletLastPublishDate.before( portletDataContext.getStartDate())) { return portletLastPublishDate; } } return portletDataContext.getStartDate(); }
public static void updateLastPublishDate( String portletId, PortletPreferences portletPreferences, DateRange dateRange, Date lastPublishDate) { Date originalLastPublishDate = getLastPublishDate(portletPreferences); if (!isValidDateRange(dateRange, originalLastPublishDate)) { return; } if (lastPublishDate == null) { lastPublishDate = new Date(); } try { portletPreferences.setValue( _LAST_PUBLISH_DATE, String.valueOf(lastPublishDate.getTime())); portletPreferences.store(); } catch (UnsupportedOperationException uoe) { if (_log.isDebugEnabled()) { _log.debug( "Not updating the portlet setup for " + portletId + " because no setup was returned for the current page"); } } catch (Exception e) { _log.error(e, e); } }
public static void updateLastPublishDate( long groupId, boolean privateLayout, DateRange dateRange, Date lastPublishDate) throws PortalException { LayoutSet layoutSet = LayoutSetLocalServiceUtil.getLayoutSet( groupId, privateLayout); Date originalLastPublishDate = getLastPublishDate(layoutSet); if (!isValidDateRange(dateRange, originalLastPublishDate)) { return; } if (lastPublishDate == null) { lastPublishDate = new Date(); } UnicodeProperties settingsProperties = layoutSet.getSettingsProperties(); settingsProperties.setProperty( _LAST_PUBLISH_DATE, String.valueOf(lastPublishDate.getTime())); LayoutSetLocalServiceUtil.updateSettings( layoutSet.getGroupId(), layoutSet.isPrivateLayout(), settingsProperties.toString()); }
lastPublishDate = getLastPublishDate(portletPreferences); groupId, privateLayout); lastPublishDate = getLastPublishDate(layoutSet);
Date portletLastPublishDate = ExportImportDateUtil.getLastPublishDate( portletDataContext, jxPortletPreferences);