org.opencms.ade.sitemap.shared
Class CmsDetailPageTable

java.lang.Object
  extended by org.opencms.ade.sitemap.shared.CmsDetailPageTable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class CmsDetailPageTable
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A data structure for managing the detail page ordering for different types in a given sitemap.

Since:
8.0.0
See Also:
Serialized Form

Nested Class Summary
static class CmsDetailPageTable.Status
          A type indicating the status of a page.
 
Constructor Summary
protected CmsDetailPageTable()
          Empty default constructor for serialization.
  CmsDetailPageTable(java.util.List<CmsDetailPageInfo> infos)
          Creates a detail page table from a list of detail page info bean.
 
Method Summary
 void add(CmsDetailPageInfo info)
          Adds a new detail page information bean to the detail page table.
 int bump(CmsUUID id)
          Moves the detail page information for a given page to the front of the detail pages for the same type.
 boolean contains(CmsUUID id)
          Returns true if the detail page table contains a page with a given id.
 CmsDetailPageTable copy()
          Copies the detail page table.
 CmsDetailPageInfo get(CmsUUID id)
          Returns the detail page info for a given page id.
 java.util.Collection<CmsUUID> getAllIds()
          Returns the page ids of all detail pages.
 CmsDetailPageInfo getBestDetailPage(java.lang.String type)
          Returns the detail page which is in front of the detail page list for the given type.
 java.util.List<CmsDetailPageInfo> getBestDetailPages()
          Returns a list which contains the best detail page for each type.
 java.util.List<CmsDetailPageInfo> getInfosForType(java.lang.String type)
          Returns the list of detail page info beans for a given type.
 CmsDetailPageTable.Status getStatus(CmsUUID id)
          Returns the page status for the page with the given id.
 boolean isDefaultDetailPage(CmsUUID id)
          Returns true if the page with the given id is the default detail page for its type.
 int move(CmsUUID id, int newPos)
          Changes the position of a detail page in the list of detail pages for its type.
 int remove(CmsUUID id)
          Removes the detail page with the given id.
 int size()
          The number of configured detail pages.
 java.util.List<CmsDetailPageInfo> toList()
          Returns a flat list containing all detail pages for all types which preserves the order of detail pages from each type list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsDetailPageTable

public CmsDetailPageTable(java.util.List<CmsDetailPageInfo> infos)
Creates a detail page table from a list of detail page info bean.

Parameters:
infos - the detail page info beans

CmsDetailPageTable

protected CmsDetailPageTable()
Empty default constructor for serialization.

Method Detail

add

public void add(CmsDetailPageInfo info)
Adds a new detail page information bean to the detail page table.

Parameters:
info - the detail page info to add

bump

public int bump(CmsUUID id)
Moves the detail page information for a given page to the front of the detail pages for the same type.

Parameters:
id - a page id
Returns:
the original position of the detail page entry in the list for the same type

contains

public boolean contains(CmsUUID id)
Returns true if the detail page table contains a page with a given id.

Parameters:
id - the page id
Returns:
true if the detail page table contains the page with the given id

copy

public CmsDetailPageTable copy()
Copies the detail page table.

Returns:
the copy of the detail page table

get

public CmsDetailPageInfo get(CmsUUID id)
Returns the detail page info for a given page id.

Parameters:
id - a page id
Returns:
the detail page info for the given page id

getAllIds

public java.util.Collection<CmsUUID> getAllIds()
Returns the page ids of all detail pages.

Returns:
the page ids of all detail pages

getBestDetailPage

public CmsDetailPageInfo getBestDetailPage(java.lang.String type)
Returns the detail page which is in front of the detail page list for the given type.

Parameters:
type - a resource type
Returns:
a detail page information bean

getBestDetailPages

public java.util.List<CmsDetailPageInfo> getBestDetailPages()
Returns a list which contains the best detail page for each type.

Returns:
the list of best detail pages for each type

getInfosForType

public java.util.List<CmsDetailPageInfo> getInfosForType(java.lang.String type)
Returns the list of detail page info beans for a given type.

Parameters:
type - the type for which the detail page beans should be retrieved
Returns:
the detail page beans for that type

getStatus

public CmsDetailPageTable.Status getStatus(CmsUUID id)
Returns the page status for the page with the given id.

Parameters:
id - the id for which the page status should be checked
Returns:
the status of the page with the given id

isDefaultDetailPage

public boolean isDefaultDetailPage(CmsUUID id)
Returns true if the page with the given id is the default detail page for its type.

Parameters:
id - a page id
Returns:
true if the detail page for the page id is the default detail page

move

public int move(CmsUUID id,
                int newPos)
Changes the position of a detail page in the list of detail pages for its type.

Parameters:
id - the page id
newPos - the position which the page should be moved to
Returns:
the original position of the detail page

remove

public int remove(CmsUUID id)
Removes the detail page with the given id.

Parameters:
id - the id of the detail page to remove
Returns:
the original position of the detail page in the list for its type

size

public int size()
The number of configured detail pages.

Returns:
the number of detail pages

toList

public java.util.List<CmsDetailPageInfo> toList()
Returns a flat list containing all detail pages for all types which preserves the order of detail pages from each type list.

Returns:
a list of all detail page info beans