Package org.ametys.plugins.cart
Class Cart
- All Implemented Interfaces:
ModelAwareDataAwareAmetysObject
,ModifiableModelAwareDataAwareAmetysObject
,IndexableDataHolder
,ModifiableIndexableDataHolder
,ACLAmetysObject
,AmetysObject
,DataAwareAmetysObject
,ModelAwareDataAwareAmetysObject
,ModifiableModelAwareDataAwareAmetysObject
,DataHolder
,ModelAwareDataHolder
,ModifiableDataHolder
,ModifiableModelAwareDataHolder
,JCRAmetysObject
,MetadataAwareAmetysObject
,ModifiableMetadataAwareAmetysObject
,ModifiableACLAmetysObject
,ModifiableAmetysObject
,RemovableAmetysObject
,DataAndVersionAwareAmetysObject
,ModifiableDataAwareVersionableAmetysObject
,VersionableAmetysObject
,VersionAwareAmetysObject
public class Cart
extends DefaultAmetysObject<CartFactory>
implements ModifiableModelAwareDataAwareAmetysObject
Class representing a cart, backed by a JCR node.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Types of CartElementstatic enum
Rights profiles -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Property name for cart authorstatic final String
Property name for cart content elementsstatic final String
Property name for cart last contributorstatic final String
Property name for cart creation datestatic final String
Property name for cart descriptionstatic final String
Property name for cart documentationstatic final String
Property name for cart last modification datestatic final String
Property name for cart queries elementsstatic final String
Property name for cart queries from directory elementsstatic final String
Property name for cart query authorstatic final String
Property name for cart query creation datestatic final String
Property name for cart query descriptionstatic final String
Property name for cart query idstatic final String
Property name for cart query titlestatic final String
Property name for cart resource elementsstatic final String
Property name for cart titleFields inherited from class org.ametys.plugins.repository.jcr.DefaultAmetysObject
PROTECTED_PROPERTIES
Fields inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
ALTERNATIVE_SUFFIX, COMMENTS_SUFFIX, STATUS_SUFFIX
-
Constructor Summary
ConstructorDescriptionCart
(javax.jcr.Node node, String parentPath, CartFactory factory) Creates anCart
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
_removeContent
(String contentIdToRemove) Remove a content from the cartprotected void
_removeQuery
(String queryIdToRemove) Remove a query from the cartprotected void
_removeQueryFromDirectory
(String queryIdToRemove) Remove a query from directory from the cartprotected void
_removeResource
(String resourceIdToRemove) Remove a resource from the cartvoid
addContent
(String contentId) Add a content to the cartvoid
addQuery
(String id, UserIdentity author, String title, String description, ZonedDateTime date) Add a query to the cartvoid
addQuery
(UserIdentity author, String title, String description) Add a query to the cartvoid
addQueryFormDirectory
(String queryId) Add a query from directory to the cartvoid
addResource
(String resourceId) Add a resource to the cartGet the author of the cartGet the contents of the cartGet the last contributor of the cartGet the date of the last modification of the cartReturns theDataHolder
of thisAmetysObject
.Get the description of the cartGet the documentation of the cartGet the elements of the cartGet the date of the last modification of the cartGet the queries of the cartGet the resources of the cartGet the resources of the cartgetTitle()
Get the title of the cartboolean
hasQueryFromDirectoryCartElement
(String queryId) true
if the query cart element existvoid
removeElement
(String elmtId, Cart.CartElementType elmtType) Delete an elementvoid
setAuthor
(UserIdentity author) Set the author of this cart.void
setContributor
(UserIdentity contributor) Set the last contributor of this cart.void
setCreationDate
(ZonedDateTime creationDate) Set the date of the creation.void
setDescription
(String description) Set the description of this cart.void
setDocumentation
(String documentation) Set the documentation of this cart.void
setLastModificationDate
(ZonedDateTime lastModificationDate) Set the date of the last modification.void
Set the title of this cart.Methods inherited from class org.ametys.plugins.repository.jcr.DefaultAmetysObject
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, addLabel, checkpoint, copyNode, disallowInheritance, getAllLabels, getAllRevisions, getBaseNode, getBaseVersion, getLabels, getLabels, getNode, getProfilesForAnonymousAndAnyConnectedUser, getProfilesForGroups, getProfilesForUsers, getRevision, getRevisionTimestamp, getRevisionTimestamp, getUnversionedDataHolder, getVersionHistory, isInheritanceDisallowed, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers, removeLabel, restoreFromLabel, restoreFromNode, restoreFromRevision, switchToLabel, switchToRevision
Methods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
Methods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCode
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX
Methods inherited from interface org.ametys.cms.data.ametysobject.ModelAwareDataAwareAmetysObject
getSystemPropertyExtensionPoint, indexData, indexData
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelAwareDataAwareAmetysObject
dataToJSON, dataToJSONForEdition, dataToMap, dataToSAX, dataToSAXForEdition, getComments, getDataNames, getDefinition, getExternalValue, getLocalValue, getModel, getStatus, getValue, getValue, hasComments, hasDefinition, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, hasValueOrEmpty
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
commentsToSAX, dataToJSON, dataToJSON, dataToJSON, dataToMap, dataToMap, dataToMap, dataToSAX, dataToSAX, dataToSAX, getDataNames, getType, getValue, hasValue, hasValueOrEmpty, isMultiple
Methods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChanges
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModifiableDataHolder
getRepositoryData
Methods inherited from interface org.ametys.cms.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getComposite, getComposite, getExternalComposite, getExternalComposite, getExternalRepeater, getExternalRepeater, getLocalComposite, getLocalComposite, getLocalRepeater, getLocalRepeater, getParentDataHolder, getRepeater, getRepeater, getRootDataHolder
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getRepositoryData, removeExternalizableMetadataIfExists, removeExternalValue, removeLocalValue, removeValue, setComments, setExternalValue, setLocalValue, setStatus, setValue, synchronizeValues, synchronizeValues, synchronizeValues, synchronizeValues
-
Field Details
-
TITLE
Property name for cart title- See Also:
-
DESCRIPTION
Property name for cart description- See Also:
-
DOCUMENTATION
Property name for cart documentation- See Also:
-
AUTHOR
Property name for cart author- See Also:
-
CONTRIBUTOR
Property name for cart last contributor- See Also:
-
CREATIONDATE
Property name for cart creation date- See Also:
-
LASTMODIFICATIONDATE
Property name for cart last modification date- See Also:
-
CONTENT_CART_ELEMENTS
Property name for cart content elements- See Also:
-
RESOURCE_CART_ELEMENTS
Property name for cart resource elements- See Also:
-
QUERIES_CART_ELEMENTS
Property name for cart queries elements- See Also:
-
QUERIES_FROM_DIRECTORY_CART_ELEMENTS
Property name for cart queries from directory elements- See Also:
-
QUERY_ID_PROPERTY
Property name for cart query id- See Also:
-
QUERY_DESCRIPTION_PROPERTY
Property name for cart query description- See Also:
-
QUERY_AUTHOR_PROPERTY
Property name for cart query author- See Also:
-
QUERY_TITLE_PROPERTY
Property name for cart query title- See Also:
-
QUERY_DATE_PROPERTY
Property name for cart query creation date- See Also:
-
-
Constructor Details
-
Cart
Creates anCart
.- Parameters:
node
- the node backing thisAmetysObject
parentPath
- the parentPath in the Ametys hierarchyfactory
- the DefaultAmetysObjectFactory which created the AmetysObject
-
-
Method Details
-
setTitle
Set the title of this cart.- Parameters:
title
- the title
-
setDescription
Set the description of this cart.- Parameters:
description
- the description
-
setDocumentation
Set the documentation of this cart.- Parameters:
documentation
- the documentation
-
setAuthor
Set the author of this cart.- Parameters:
author
- the author
-
setContributor
Set the last contributor of this cart.- Parameters:
contributor
- the last contributor
-
setCreationDate
Set the date of the creation.- Parameters:
creationDate
- the last modification date to set.
-
setLastModificationDate
Set the date of the last modification.- Parameters:
lastModificationDate
- the last modification date to set.
-
getTitle
Get the title of the cart- Returns:
- The title
-
getDescription
Get the description of the cart- Returns:
- The description
-
getDocumentation
Get the documentation of the cart- Returns:
- The documentation
-
getAuthor
Get the author of the cart- Returns:
- The author
-
getContributor
Get the last contributor of the cart- Returns:
- The contributor
-
getCreationDate
Get the date of the last modification of the cart- Returns:
- The date
-
getLastModificationDate
Get the date of the last modification of the cart- Returns:
- The date
-
addContent
Add a content to the cart- Parameters:
contentId
- The content id
-
addResource
Add a resource to the cart- Parameters:
resourceId
- The resource id
-
addQueryFormDirectory
Add a query from directory to the cart- Parameters:
queryId
- The query id
-
addQuery
Add a query to the cart- Parameters:
author
- The author of the querytitle
- The title of the querydescription
- The query as string
-
addQuery
public void addQuery(String id, UserIdentity author, String title, String description, ZonedDateTime date) Add a query to the cart- Parameters:
id
- The id of the queryauthor
- The author of the querytitle
- The title of the querydescription
- The query as stringdate
- The creation date of the query
-
removeElement
Delete an element- Parameters:
elmtId
- The id of element to removeelmtType
- The type of element to remove
-
_removeResource
Remove a resource from the cart- Parameters:
resourceIdToRemove
- The id of the resource to remove
-
_removeContent
Remove a content from the cart- Parameters:
contentIdToRemove
- The id of the content to remove
-
_removeQueryFromDirectory
Remove a query from directory from the cart- Parameters:
queryIdToRemove
- The id of the query from directory to remove
-
_removeQuery
Remove a query from the cart- Parameters:
queryIdToRemove
- The id of the query to remove
-
getElements
Get the elements of the cart- Returns:
- The elements of the cart
-
getContentCartElements
Get the contents of the cart- Returns:
- The elements of the cart
- Throws:
javax.jcr.RepositoryException
- if an exception occurs while exploring the repository
-
getResourceCartElements
Get the resources of the cart- Returns:
- The elements of the cart
- Throws:
javax.jcr.RepositoryException
- if an exception occurs while exploring the repository
-
getQueryFromDirectoryCartElements
public List<QueryFromDirectoryElement> getQueryFromDirectoryCartElements() throws javax.jcr.RepositoryExceptionGet the resources of the cart- Returns:
- The elements of the cart
- Throws:
javax.jcr.RepositoryException
- if an exception occurs while exploring the repository
-
hasQueryFromDirectoryCartElement
true
if the query cart element exist- Parameters:
queryId
- the query id- Returns:
true
if the query cart element exist
-
getQueryCartElements
Get the queries of the cart- Returns:
- The elements of the cart
- Throws:
javax.jcr.RepositoryException
- if an exception occurs while exploring the repository
-
getDataHolder
Description copied from interface:DataAwareAmetysObject
Returns theDataHolder
of thisAmetysObject
.- Specified by:
getDataHolder
in interfaceDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModelAwareDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModelAwareDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModifiableModelAwareDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModifiableModelAwareDataAwareAmetysObject
- Returns:
- the
DataHolder
of thisAmetysObject
-