Package org.opencms.ui.favorites
Class CmsFavoriteEntry
- java.lang.Object
-
- org.opencms.ui.favorites.CmsFavoriteEntry
-
public class CmsFavoriteEntry extends java.lang.Object
Represents an entry in the favorite location list.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsFavoriteEntry.Type
Represents the type of the favorite.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
JSON_DETAIL
JSON key.static java.lang.String
JSON_PROJECT
JSON key.static java.lang.String
JSON_SITEROOT
JSON key.static java.lang.String
JSON_STRUCTUREID
JSON key.static java.lang.String
JSON_TITLE
JSON key.static java.lang.String
JSON_TYPE
JSON key.
-
Constructor Summary
Constructors Constructor Description CmsFavoriteEntry()
Creates a new entry.CmsFavoriteEntry(JSONObject obj)
Creates a new entry from a JSON object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCustomTitle()
Gets the custom title.CmsUUID
getDetailId()
Gets the detail id.CmsUUID
getProjectId()
Gets the project id.java.lang.String
getSiteRoot()
Gets the site root.CmsUUID
getStructureId()
Gets the structure idCmsFavoriteEntry.Type
getType()
Gets the type.static CmsUUID
readId(JSONObject obj, java.lang.String key)
Reads a UUID from a JSON object.void
setCustomTitle(java.lang.String title)
Sets the custom title.void
setDetailId(CmsUUID detailId)
Sets the detail id.void
setProjectId(CmsUUID projectId)
Sets the project id.void
setSiteRoot(java.lang.String siteRoot)
Sets the site root.void
setStructureId(CmsUUID structureId)
Sets the structure id.void
setType(CmsFavoriteEntry.Type type)
Sets the type.JSONObject
toJson()
Converts this object to JSON.java.lang.String
updateContextAndGetFavoriteUrl(CmsObject cms)
Prepares the CmsObject for jumping to this favorite location, and returns the appropriate URL.
-
-
-
Field Detail
-
JSON_DETAIL
public static final java.lang.String JSON_DETAIL
JSON key.- See Also:
- Constant Field Values
-
JSON_PROJECT
public static final java.lang.String JSON_PROJECT
JSON key.- See Also:
- Constant Field Values
-
JSON_SITEROOT
public static final java.lang.String JSON_SITEROOT
JSON key.- See Also:
- Constant Field Values
-
JSON_STRUCTUREID
public static final java.lang.String JSON_STRUCTUREID
JSON key.- See Also:
- Constant Field Values
-
JSON_TITLE
public static final java.lang.String JSON_TITLE
JSON key.- See Also:
- Constant Field Values
-
JSON_TYPE
public static final java.lang.String JSON_TYPE
JSON key.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsFavoriteEntry
public CmsFavoriteEntry()
Creates a new entry.
-
CmsFavoriteEntry
public CmsFavoriteEntry(JSONObject obj)
Creates a new entry from a JSON object.- Parameters:
obj
- the JSON object
-
-
Method Detail
-
readId
public static CmsUUID readId(JSONObject obj, java.lang.String key)
Reads a UUID from a JSON object. Returns null if the JSON value for the given key is not present or not a valid UUID- Parameters:
obj
- the JSON objectkey
- the JSON key- Returns:
- the UUID
-
getCustomTitle
public java.lang.String getCustomTitle()
Gets the custom title.- Returns:
- the custom title
-
getDetailId
public CmsUUID getDetailId()
Gets the detail id.- Returns:
- the detail id
-
getProjectId
public CmsUUID getProjectId()
Gets the project id.- Returns:
- the project id
-
getSiteRoot
public java.lang.String getSiteRoot()
Gets the site root.- Returns:
- the site root
-
getStructureId
public CmsUUID getStructureId()
Gets the structure id- Returns:
- the structure id
-
getType
public CmsFavoriteEntry.Type getType()
Gets the type.- Returns:
- the type
-
setCustomTitle
public void setCustomTitle(java.lang.String title)
Sets the custom title.- Parameters:
title
- the custom title
-
setDetailId
public void setDetailId(CmsUUID detailId)
Sets the detail id.- Parameters:
detailId
- the detail id
-
setProjectId
public void setProjectId(CmsUUID projectId)
Sets the project id.- Parameters:
projectId
- the project id
-
setSiteRoot
public void setSiteRoot(java.lang.String siteRoot)
Sets the site root.- Parameters:
siteRoot
- the site root
-
setStructureId
public void setStructureId(CmsUUID structureId)
Sets the structure id.- Parameters:
structureId
- the structure id
-
setType
public void setType(CmsFavoriteEntry.Type type)
Sets the type.- Parameters:
type
- the type
-
toJson
public JSONObject toJson() throws JSONException
Converts this object to JSON.- Returns:
- the JSON representation
- Throws:
JSONException
- if JSON operations fail
-
updateContextAndGetFavoriteUrl
public java.lang.String updateContextAndGetFavoriteUrl(CmsObject cms) throws CmsException
Prepares the CmsObject for jumping to this favorite location, and returns the appropriate URL.- Parameters:
cms
- the CmsObject to initialize for jumping to the favorite- Returns:
- the link for the favorite location
- Throws:
CmsException
- if something goes wrong
-
-