Package org.ametys.plugins.cart
Class Cart
- All Implemented Interfaces:
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
Attribute name for cart authorstatic final String
Attribute name for cart content elementsstatic final String
Attribute name for cart descriptionstatic final String
Attribute name for cart queries elementsstatic final String
Attribute name for cart queries from directory elementsstatic final String
Attribute name for cart query authorstatic final String
Attribute name for cart query creation datestatic final String
Attribute name for cart query descriptionstatic final String
Attribute name for cart query idstatic final String
Attribute name for cart query titlestatic final String
Attribute name for cart resource elementsstatic final String
Attribute 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 cartReturns theDataHolder
of thisAmetysObject
.Get the description of the cartGet the elements 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
setDescription
(String description) Set the description of this cart.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, dataToSAX, dataToSAX
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelAwareDataAwareAmetysObject
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, dataToMap, dataToMap, dataToMap, dataToMap, dataToSAX, dataToSAX, dataToSAX, dataToSAX, dataToSAXForEdition, 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.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getComposite, getComposite, getExternalComposite, getExternalComposite, getExternalRepeater, getExternalRepeater, getLocalComposite, getLocalComposite, getLocalRepeater, getLocalRepeater, getParentDataHolder, getRepeater, getRepeater, getRepositoryData, getRootDataHolder, removeExternalizableMetadataIfExists, removeExternalValue, removeLocalValue, removeValue, setComments, setExternalValue, setLocalValue, setStatus, setValue, synchronizeValues, synchronizeValues, synchronizeValues, synchronizeValues
-
Field Details
-
TITLE
Attribute name for cart title- See Also:
-
DESCRIPTION
Attribute name for cart description- See Also:
-
AUTHOR
Attribute name for cart author- See Also:
-
CONTENT_CART_ELEMENTS
Attribute name for cart content elements- See Also:
-
RESOURCE_CART_ELEMENTS
Attribute name for cart resource elements- See Also:
-
QUERIES_CART_ELEMENTS
Attribute name for cart queries elements- See Also:
-
QUERIES_FROM_DIRECTORY_CART_ELEMENTS
Attribute name for cart queries from directory elements- See Also:
-
QUERY_ID_PROPERTY
Attribute name for cart query id- See Also:
-
QUERY_DESCRIPTION_PROPERTY
Attribute name for cart query description- See Also:
-
QUERY_AUTHOR_PROPERTY
Attribute name for cart query author- See Also:
-
QUERY_TITLE_PROPERTY
Attribute name for cart query title- See Also:
-
QUERY_DATE_PROPERTY
Attribute 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 description
-
setDescription
Set the description of this cart.- Parameters:
description
- the description
-
setAuthor
Set the author of this cart.- Parameters:
author
- the author
-
getTitle
Get the title of the cart- Returns:
- The title
-
getDescription
Get the description of the cart- Returns:
- The description
-
getAuthor
Get the author of the cart- Returns:
- The author
-
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 interfaceModifiableModelAwareDataAwareAmetysObject
- Returns:
- the
DataHolder
of thisAmetysObject
-