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
Nested ClassesModifier and TypeClassDescriptionstatic enumTypes of CartElementstatic enumRights profiles -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringProperty name for cart authorstatic final StringProperty name for cart content elementsstatic final StringProperty name for cart last contributorstatic final StringProperty name for cart creation datestatic final StringProperty name for cart descriptionstatic final StringProperty name for cart documentationstatic final StringProperty name for cart last modification datestatic final StringProperty name for cart queries elementsstatic final StringProperty name for cart queries from directory elementsstatic final StringProperty name for cart query authorstatic final StringProperty name for cart query creation datestatic final StringProperty name for cart query descriptionstatic final StringProperty name for cart query idstatic final StringProperty name for cart query titlestatic final StringProperty name for cart resource elementsstatic final StringProperty name for cart titleFields inherited from class org.ametys.plugins.repository.jcr.DefaultAmetysObject
__VERSION_COMPARATOR, PROTECTED_PROPERTIESFields inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
ALTERNATIVE_SUFFIX, STATUS_SUFFIX -
Constructor Summary
ConstructorsConstructorDescriptionCart(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 cartvoidaddContent(String contentId) Add a content to the cartvoidaddQuery(String id, UserIdentity author, String title, String description, ZonedDateTime date) Add a query to the cartvoidaddQuery(UserIdentity author, String title, String description) Add a query to the cartvoidaddQueryFormDirectory(String queryId) Add a query from directory to the cartvoidaddResource(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 theDataHolderof 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 cartbooleanhasQueryFromDirectoryCartElement(String queryId) trueif the query cart element existvoidremoveElement(String elmtId, Cart.CartElementType elmtType) Delete an elementvoidsetAuthor(UserIdentity author) Set the author of this cart.voidsetContributor(UserIdentity contributor) Set the last contributor of this cart.voidsetCreationDate(ZonedDateTime creationDate) Set the date of the creation.voidsetDescription(String description) Set the description of this cart.voidsetDocumentation(String documentation) Set the documentation of this cart.voidsetLastModificationDate(ZonedDateTime lastModificationDate) Set the date of the last modification.voidSet 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, switchToRevisionMethods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChangesMethods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCodeMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
copyTo, copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAXMethods inherited from interface org.ametys.cms.data.ametysobject.ModelAwareDataAwareAmetysObject
getSystemPropertyExtensionPoint, indexData, indexDataMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelAwareDataAwareAmetysObject
dataToJSON, dataToJSONForEdition, dataToMap, dataToSAX, dataToSAXForEdition, getDataNames, getDefinition, getDifferences, getDifferences, getDifferences, getDifferences, getExternalValue, getLocalValue, getModel, getStatus, getValue, getValue, hasDefinition, hasDifferences, hasDifferences, hasDifferences, hasDifferences, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, hasValueOrEmptyMethods inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
dataToJSON, dataToJSON, dataToJSON, dataToMap, dataToMap, dataToMap, dataToSAX, dataToSAX, dataToSAX, getDataNames, getType, getValue, hasValue, hasValueOrEmpty, isMultipleMethods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChangesMethods inherited from interface org.ametys.plugins.repository.data.holder.ModifiableDataHolder
getRepositoryDataMethods inherited from interface org.ametys.cms.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getComposite, getComposite, getExternalComposite, getExternalComposite, getExternalRepeater, getExternalRepeater, getLocalComposite, getLocalComposite, getLocalRepeater, getLocalRepeater, getParentDataHolder, getRepeater, getRepeater, getRootDataHolderMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getRepositoryData, removeExternalizableMetadataIfExists, removeExternalValue, removeLocalValue, removeValue, 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 thisAmetysObjectparentPath- 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
trueif the query cart element exist- Parameters:
queryId- the query id- Returns:
trueif 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:DataAwareAmetysObjectReturns theDataHolderof thisAmetysObject.- Specified by:
getDataHolderin interfaceDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModelAwareDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModelAwareDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModifiableModelAwareDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModifiableModelAwareDataAwareAmetysObject- Returns:
- the
DataHolderof thisAmetysObject
-