Class BasketItem
- java.lang.Object
-
- org.silverpeas.core.webapi.selection.BasketItem
-
- All Implemented Interfaces:
Serializable
,Nameable
,SilverpeasResource
public class BasketItem extends Object implements SilverpeasResource, Serializable
Item in theSelectionBasket
. It is the web entity representing in the more generic way a Silverpeas resource, whatever it is. It requires the unique identifier of the resource to be set. The item is complete if and only if its name, its creation data and its last modification data are set, as any others properties are optional and depend on the represented resource.- Author:
- mmoquillon
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
static BasketItem
from(SilverpeasResource resource)
Date
getCreationDate()
Gets the date at which the resource has been created.User
getCreator()
Gets the user that has created the resource.String
getDescription()
Gets the description about the object in Silverpeas.<T extends ResourceIdentifier>
TgetIdentifier()
Gets the unique identifier of this resource.Date
getLastUpdateDate()
Gets the date at which the resource has been lastly updated.User
getLastUpdater()
Gets the user that has lastly updated the resource.String
getName()
Gets the name of the object in Silverpeas.String
getPermalink()
Gets the URI at which the resource referred by this item can be always found in Silverpeas.String
getThumbnailURI()
Gets the URI of the thumbnail of this item.String
getType()
Gets the type of the item in Silverpeas.int
hashCode()
boolean
isComplete()
Is the data of the Silverpeas resource represented by thisBasketItem
complete?boolean
isComponentInstance()
Is this item represent an instance of a Silverpeas application?boolean
isContribution()
Is thisBasketItem
instance represent a contribution in Silverpeas?boolean
isPlanned()
Is thisBasketItem
instance represents a bean in Silverpeas planned in a period of time?boolean
isSpace()
Is this item represent a collaborative space in Silverpeas?<T extends Contribution>
TtoContribution()
Finds the contribution that is mapped by thisBasketItem
instance.<T extends SilverpeasResource>
TtoResource()
Finds the resource in Silverpeas that is mapped by thisBasketItem
instance.
-
-
-
Method Detail
-
from
public static BasketItem from(SilverpeasResource resource)
-
getName
public String getName()
Description copied from interface:Nameable
Gets the name of the object in Silverpeas.
-
getDescription
public String getDescription()
Description copied from interface:Nameable
Gets the description about the object in Silverpeas.- Specified by:
getDescription
in interfaceNameable
- Returns:
- a short description about the object.
-
getIdentifier
public <T extends ResourceIdentifier> T getIdentifier()
Description copied from interface:SilverpeasResource
Gets the unique identifier of this resource.- Specified by:
getIdentifier
in interfaceSilverpeasResource
- Returns:
- the
ResourceIdentifier
object representing the unique identifier of the resource.
-
getCreationDate
public Date getCreationDate()
Description copied from interface:SilverpeasResource
Gets the date at which the resource has been created.- Specified by:
getCreationDate
in interfaceSilverpeasResource
- Returns:
- the date of creation of the resource.
-
getLastUpdateDate
public Date getLastUpdateDate()
Description copied from interface:SilverpeasResource
Gets the date at which the resource has been lastly updated. If the resource doesn't have such an information, then this method should return the date of the resource creation.- Specified by:
getLastUpdateDate
in interfaceSilverpeasResource
- Returns:
- the date of the last update of the resource.
-
getCreator
public User getCreator()
Description copied from interface:SilverpeasResource
Gets the user that has created the resource.- Specified by:
getCreator
in interfaceSilverpeasResource
- Returns:
- a
User
in Silverpeas.
-
getLastUpdater
public User getLastUpdater()
Description copied from interface:SilverpeasResource
Gets the user that has lastly updated the resource. If the resource doesn't have such an information, then this method should return the user that has created the resource.- Specified by:
getLastUpdater
in interfaceSilverpeasResource
- Returns:
- a
User
in Silverpeas.
-
getThumbnailURI
public String getThumbnailURI()
Gets the URI of the thumbnail of this item.- Returns:
- either the URI of a thumbnail or null if the item has no thumbnail or doesn't support thumbnails.
-
getPermalink
public String getPermalink()
Gets the URI at which the resource referred by this item can be always found in Silverpeas.- Returns:
- the permalink of this item in Silverpeas or null if the item doesn't support permalinks.
-
getType
public String getType()
Gets the type of the item in Silverpeas.- Returns:
- the item type.
-
isSpace
public boolean isSpace()
Is this item represent a collaborative space in Silverpeas?- Returns:
- true if this object represents a space in Silverpeas. False otherwise.
-
isComponentInstance
public boolean isComponentInstance()
Is this item represent an instance of a Silverpeas application?- Returns:
- true if this object represents a component instance. False otherwise.
-
isContribution
public boolean isContribution()
Is thisBasketItem
instance represent a contribution in Silverpeas?- Returns:
- true if this object represents a contribution in Silverpeas. False if it represents an organisational resource in Silverpeas (application instance, space, ...)
-
isPlanned
public boolean isPlanned()
Is thisBasketItem
instance represents a bean in Silverpeas planned in a period of time?- Returns:
- true if this object is planned in a period of time. False otherwise.
-
isComplete
public boolean isComplete()
Is the data of the Silverpeas resource represented by thisBasketItem
complete? The data are considered completed if and only if the name, the creation data and the last update data of the represented resource are set.- Returns:
- true if this item represents completely the Silverpeas resource.
-
toContribution
public <T extends Contribution> T toContribution()
Finds the contribution that is mapped by thisBasketItem
instance. If no contributions exists with the identifier of this object or if this object doesn't represent a contribution, then aNotFoundException
is thrown.- Returns:
- the contribution in Silverpeas that is related by this
BasketItem
instance.
-
toResource
public <T extends SilverpeasResource> T toResource()
Finds the resource in Silverpeas that is mapped by thisBasketItem
instance. If there is no resources nor no contributions in Silverpeas mapped by this object, then aNotFoundException
is thrown.- Returns:
- the Silverpeas resource mapped by this object. It can be either a contribution or a collaborative space or an application instance.
-
-