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
Nested Classes Modifier and Type Class Description static class
Cart.CartElementType
Types of CartElementstatic class
Cart.CartProfile
Rights profiles
-
Field Summary
Fields Modifier and Type Field Description static String
AUTHOR
Attribute name for cart authorstatic String
CONTENT_CART_ELEMENTS
Attribute name for cart content elementsstatic String
DESCRIPTION
Attribute name for cart descriptionstatic String
QUERIES_CART_ELEMENTS
Attribute name for cart queries elementsstatic String
QUERIES_FROM_DIRECTORY_CART_ELEMENTS
Attribute name for cart queries from directory elementsstatic String
QUERY_AUTHOR_PROPERTY
Attribute name for cart query authorstatic String
QUERY_DATE_PROPERTY
Attribute name for cart query creation datestatic String
QUERY_DESCRIPTION_PROPERTY
Attribute name for cart query descriptionstatic String
QUERY_ID_PROPERTY
Attribute name for cart query idstatic String
QUERY_TITLE_PROPERTY
Attribute name for cart query titlestatic String
RESOURCE_CART_ELEMENTS
Attribute name for cart resource elementsstatic String
TITLE
Attribute name for cart title-
Fields 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
Constructors Constructor Description Cart(Node node, String parentPath, CartFactory factory)
Creates anCart
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 cartUserIdentity
getAuthor()
Get the author of the cartList<ContentElement>
getContentCartElements()
Get the contents of the cartModifiableModelAwareDataHolder
getDataHolder()
Returns theDataHolder
of thisAmetysObject
.String
getDescription()
Get the description of the cartList<CartElement>
getElements()
Get the elements of the cartList<QueryElement>
getQueryCartElements()
Get the queries of the cartList<QueryFromDirectoryElement>
getQueryFromDirectoryCartElements()
Get the resources of the cartList<ResourceElement>
getResourceCartElements()
Get the resources of the cartString
getTitle()
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
setTitle(String title)
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 Detail
-
TITLE
public static final String TITLE
Attribute name for cart title- See Also:
- Constant Field Values
-
DESCRIPTION
public static final String DESCRIPTION
Attribute name for cart description- See Also:
- Constant Field Values
-
AUTHOR
public static final String AUTHOR
Attribute name for cart author- See Also:
- Constant Field Values
-
CONTENT_CART_ELEMENTS
public static final String CONTENT_CART_ELEMENTS
Attribute name for cart content elements- See Also:
- Constant Field Values
-
RESOURCE_CART_ELEMENTS
public static final String RESOURCE_CART_ELEMENTS
Attribute name for cart resource elements- See Also:
- Constant Field Values
-
QUERIES_CART_ELEMENTS
public static final String QUERIES_CART_ELEMENTS
Attribute name for cart queries elements- See Also:
- Constant Field Values
-
QUERIES_FROM_DIRECTORY_CART_ELEMENTS
public static final String QUERIES_FROM_DIRECTORY_CART_ELEMENTS
Attribute name for cart queries from directory elements- See Also:
- Constant Field Values
-
QUERY_ID_PROPERTY
public static final String QUERY_ID_PROPERTY
Attribute name for cart query id- See Also:
- Constant Field Values
-
QUERY_DESCRIPTION_PROPERTY
public static final String QUERY_DESCRIPTION_PROPERTY
Attribute name for cart query description- See Also:
- Constant Field Values
-
QUERY_AUTHOR_PROPERTY
public static final String QUERY_AUTHOR_PROPERTY
Attribute name for cart query author- See Also:
- Constant Field Values
-
QUERY_TITLE_PROPERTY
public static final String QUERY_TITLE_PROPERTY
Attribute name for cart query title- See Also:
- Constant Field Values
-
QUERY_DATE_PROPERTY
public static final String QUERY_DATE_PROPERTY
Attribute name for cart query creation date- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Cart
public Cart(Node node, String parentPath, CartFactory factory)
Creates anCart
.- Parameters:
node
- the node backing thisAmetysObject
parentPath
- the parentPath in the Ametys hierarchyfactory
- the DefaultAmetysObjectFactory which created the AmetysObject
-
-
Method Detail
-
setTitle
public void setTitle(String title)
Set the title of this cart.- Parameters:
title
- the description
-
setDescription
public void setDescription(String description)
Set the description of this cart.- Parameters:
description
- the description
-
setAuthor
public void setAuthor(UserIdentity author)
Set the author of this cart.- Parameters:
author
- the author
-
getDescription
public String getDescription()
Get the description of the cart- Returns:
- The description
-
getAuthor
public UserIdentity getAuthor()
Get the author of the cart- Returns:
- The author
-
addContent
public void addContent(String contentId)
Add a content to the cart- Parameters:
contentId
- The content id
-
addResource
public void addResource(String resourceId)
Add a resource to the cart- Parameters:
resourceId
- The resource id
-
addQueryFormDirectory
public void addQueryFormDirectory(String queryId)
Add a query from directory to the cart- Parameters:
queryId
- The query id
-
addQuery
public void addQuery(UserIdentity author, String title, String description)
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
public void removeElement(String elmtId, Cart.CartElementType elmtType)
Delete an element- Parameters:
elmtId
- The id of element to removeelmtType
- The type of element to remove
-
_removeResource
protected void _removeResource(String resourceIdToRemove)
Remove a resource from the cart- Parameters:
resourceIdToRemove
- The id of the resource to remove
-
_removeContent
protected void _removeContent(String contentIdToRemove)
Remove a content from the cart- Parameters:
contentIdToRemove
- The id of the content to remove
-
_removeQueryFromDirectory
protected void _removeQueryFromDirectory(String queryIdToRemove)
Remove a query from directory from the cart- Parameters:
queryIdToRemove
- The id of the query from directory to remove
-
_removeQuery
protected void _removeQuery(String queryIdToRemove)
Remove a query from the cart- Parameters:
queryIdToRemove
- The id of the query to remove
-
getElements
public List<CartElement> getElements()
Get the elements of the cart- Returns:
- The elements of the cart
-
getContentCartElements
public List<ContentElement> getContentCartElements() throws RepositoryException
Get the contents of the cart- Returns:
- The elements of the cart
- Throws:
RepositoryException
- if an exception occurs while exploring the repository
-
getResourceCartElements
public List<ResourceElement> getResourceCartElements() throws RepositoryException
Get the resources of the cart- Returns:
- The elements of the cart
- Throws:
RepositoryException
- if an exception occurs while exploring the repository
-
getQueryFromDirectoryCartElements
public List<QueryFromDirectoryElement> getQueryFromDirectoryCartElements() throws RepositoryException
Get the resources of the cart- Returns:
- The elements of the cart
- Throws:
RepositoryException
- if an exception occurs while exploring the repository
-
hasQueryFromDirectoryCartElement
public boolean hasQueryFromDirectoryCartElement(String queryId)
true
if the query cart element exist- Parameters:
queryId
- the query id- Returns:
true
if the query cart element exist
-
getQueryCartElements
public List<QueryElement> getQueryCartElements() throws RepositoryException
Get the queries of the cart- Returns:
- The elements of the cart
- Throws:
RepositoryException
- if an exception occurs while exploring the repository
-
getDataHolder
public ModifiableModelAwareDataHolder 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
-
-