RESOURCE
- the resource class typeGROUP
- the resource group class typepublic abstract class A_CmsPublishGroupHelper<RESOURCE,GROUP>
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
static class |
A_CmsPublishGroupHelper.GroupAge
An enum representing the age of a publish list resource.
|
class |
A_CmsPublishGroupHelper.SortingComparator
Comparator used for sorting publish resources.
|
限定符和类型 | 字段和说明 |
---|---|
protected static int |
GROUP_SESSIONS_GAP
The gap between session groups.
|
构造器和说明 |
---|
A_CmsPublishGroupHelper(java.util.Locale locale)
Creates a new publish group helper for a given locale.
|
限定符和类型 | 方法和说明 |
---|---|
java.util.Map<java.lang.Long,java.lang.Integer> |
computeDays(java.util.List<java.lang.Long> sortedDates)
Given a descending list of dates represented as longs, this method computes a map from the dates
to their age in (local) days.
|
java.util.Map<java.lang.Long,java.lang.Integer> |
computeDaysForResources(java.util.List<RESOURCE> resources)
Computes a map from modification date to number of (local) days since the modification date.
|
protected abstract GROUP |
createGroup(java.lang.String name,
java.util.List<RESOURCE> resources)
Creates a named group of resources.
|
protected abstract long |
getDateLastModified(RESOURCE res)
Gets the last modification date of a resource.
|
int |
getDayDifference(long first,
long second)
Gets the difference in days between to dates given as longs.
|
java.util.List<GROUP> |
getGroups(java.util.List<RESOURCE> resources)
Splits a list of resources into groups.
|
java.util.List<java.lang.Long> |
getModificationDates(java.util.List<RESOURCE> resources)
Given a list of resources, this method returns a list of their modification dates.
|
java.lang.String |
getPublishGroupName(java.util.List<RESOURCE> resources,
A_CmsPublishGroupHelper.GroupAge age)
Returns the localized name for a given publish group based on its age.
|
protected abstract java.lang.String |
getRootPath(RESOURCE res)
Gets the root path of a resource.
|
java.util.Calendar |
getStartOfDay(long time)
Returns a calendar object representing the start of the day in which a given time lies.
|
java.util.List<java.util.List<RESOURCE>> |
partitionMediumResources(java.util.List<RESOURCE> resources,
java.util.Map<java.lang.Long,java.lang.Integer> days)
Computes publish groups for a list of resources with age "medium".
|
java.util.Map<A_CmsPublishGroupHelper.GroupAge,java.util.List<RESOURCE>> |
partitionPublishResourcesByAge(java.util.List<RESOURCE> resources,
java.util.Map<java.lang.Long,java.lang.Integer> days)
Partitions a list of resources by their age in (local) days since the last modification.
|
java.util.List<java.util.List<RESOURCE>> |
partitionYoungResources(java.util.List<RESOURCE> resources)
Partitions the list of young resources into publish groups.
|
protected static final int GROUP_SESSIONS_GAP
public A_CmsPublishGroupHelper(java.util.Locale locale)
locale
- the locale to usepublic java.util.Map<java.lang.Long,java.lang.Integer> computeDays(java.util.List<java.lang.Long> sortedDates)
sortedDates
- a descending list of dates represented as longspublic java.util.Map<java.lang.Long,java.lang.Integer> computeDaysForResources(java.util.List<RESOURCE> resources)
resources
- a list of resourcespublic int getDayDifference(long first, long second)
The first date must be later than the second date.
first
- the first datesecond
- the second datepublic java.util.List<GROUP> getGroups(java.util.List<RESOURCE> resources)
resources
- the list of resourcespublic java.util.List<java.lang.Long> getModificationDates(java.util.List<RESOURCE> resources)
resources
- a list of resourcespublic java.lang.String getPublishGroupName(java.util.List<RESOURCE> resources, A_CmsPublishGroupHelper.GroupAge age)
resources
- the resources of the publish groupage
- the age of the publish grouppublic java.util.Calendar getStartOfDay(long time)
time
- a long representing a timepublic java.util.List<java.util.List<RESOURCE>> partitionMediumResources(java.util.List<RESOURCE> resources, java.util.Map<java.lang.Long,java.lang.Integer> days)
resources
- the list of resourcesdays
- a map from modification dates to the number of days since the modificationpublic java.util.Map<A_CmsPublishGroupHelper.GroupAge,java.util.List<RESOURCE>> partitionPublishResourcesByAge(java.util.List<RESOURCE> resources, java.util.Map<java.lang.Long,java.lang.Integer> days)
resources
- the list of resources to partitiondays
- the map from modification dates to the number of (local) days since the modificationpublic java.util.List<java.util.List<RESOURCE>> partitionYoungResources(java.util.List<RESOURCE> resources)
resources
- the list of resources to partitionprotected abstract GROUP createGroup(java.lang.String name, java.util.List<RESOURCE> resources)
name
- the name of the groupresources
- the resources which should be put in the groupprotected abstract long getDateLastModified(RESOURCE res)
res
- the resourceprotected abstract java.lang.String getRootPath(RESOURCE res)
res
- the resource