public class Cart extends DefaultAmetysObject<CartFactory>
| Modifier and Type | Class and Description |
|---|---|
static class |
Cart.CartElementType
Types of CartElement
|
static class |
Cart.CartProfile
Rights profiles
|
static class |
Cart.Visibility
Visibility of a Cart
|
| Modifier and Type | Field and Description |
|---|---|
private static Logger |
_logger |
private static String |
AUTHOR |
private static String |
CONTENT_CART_ELEMENTS |
private static String |
DESCRIPTION |
private static String |
GROUPS |
private static String |
PROFILE_READ_ACCESS |
private static String |
PROFILE_WRITE_ACCESS |
private static String |
QUERIES_CART_ELEMENTS |
private static String |
QUERY_AUTHOR_PROPERTY |
private static String |
QUERY_DATE_PROPERTY |
private static String |
QUERY_DESCRIPTION_PROPERTY |
private static String |
QUERY_ID_PROPERTY |
private static String |
QUERY_TITLE_PROPERTY |
private static String |
RESOURCE_CART_ELEMENTS |
private static String |
TITLE |
private static String |
USERS |
private static String |
VISIBILITY |
PROTECTED_PROPERTIES| Constructor and Description |
|---|
Cart(Node node,
String parentPath,
CartFactory factory)
Creates an
Cart. |
| Modifier and Type | Method and Description |
|---|---|
private Node |
_getOrCreateNode(Node parent,
String name,
String type) |
private Node |
_getOrCreateQueriesNode() |
protected void |
_removeContent(String contentIdToRemove)
Remove a content from the cart
|
protected void |
_removeQuery(String queryIdToRemove)
Remove a query from the cart
|
protected void |
_removeResource(String resourceIdToRemove)
Remove a resource from the cart
|
void |
addContent(String contentId)
Add a content to the cart
|
void |
addQuery(UserIdentity author,
String title,
String description)
Add a query to the cart
|
void |
addResource(String resourceId)
Add a resource to the cart
|
boolean |
canRead(UserIdentity user)
Determines if an user has READ access to this cart.
|
boolean |
canWrite(UserIdentity user)
Determines if an user has WRITE access to this cart.
|
UserIdentity |
getAuthor()
Get the author of the cart
|
List<ContentElement> |
getContentCartElements()
Get the contents of the cart
|
String |
getDescription()
Get the description of the cart
|
List<CartElement> |
getElements()
Get the elements of the cart
|
Set<GroupIdentity> |
getGrantedGroups(Cart.CartProfile profile)
Get the granted groups
|
Set<UserIdentity> |
getGrantedUsers(Cart.CartProfile profile)
Get the granted users
|
List<QueryElement> |
getQueryCartElements()
Get the queries of the cart
|
List<ResourceElement> |
getResourceCartElements()
Get the resources of the cart
|
String |
getTitle()
Get the title of the cart
|
Cart.Visibility |
getVisibility()
Get the visibility of the cart
|
void |
removeElement(String elmtId,
Cart.CartElementType elmtType)
Delete an element
|
void |
setAuthor(UserIdentity author)
Set the author of this cart.
|
void |
setDescription(String description)
Set the description of this cart.
|
void |
setGrantedGroups(Cart.CartProfile profile,
Set<GroupIdentity> groups)
Set the granted groups
|
void |
setGrantedUsers(Cart.CartProfile profile,
Set<UserIdentity> users)
Set the granted users
|
void |
setTitle(String title)
Set the title of this cart.
|
void |
setVisibility(Cart.Visibility visibility)
Set the cart visibility
|
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, addLabel, checkpoint, copyNode, getAllLabels, getAllowedGroups, getAllowedProfilesForAnonymous, getAllowedProfilesForAnyConnectedUser, getAllowedProfilesForGroups, getAllowedProfilesForUser, getAllowedProfilesForUsers, getAllowedUsers, getAllRevisions, getBaseNode, getBaseVersion, getDeniedGroups, getDeniedProfilesForAnonymous, getDeniedProfilesForAnyConnectedUser, getDeniedProfilesForGroups, getDeniedProfilesForUser, getDeniedProfilesForUsers, getDeniedUsers, getLabels, getLabels, getNode, getRevision, getRevisionTimestamp, getRevisionTimestamp, getUnversionedMetadataHolder, getVersionHistory, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers, removeLabel, restoreFromLabel, restoreFromNode, restoreFromRevision, switchToLabel, switchToRevision_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChangesequals, hashCode, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetMetadataHolderneedsSave, rename, revertChanges, saveChangesequals, getId, getName, getParent, getParentPath, getPath, hashCodeprivate static final String TITLE
private static final String DESCRIPTION
private static final String AUTHOR
private static final String VISIBILITY
private static final String PROFILE_READ_ACCESS
private static final String PROFILE_WRITE_ACCESS
private static final String GROUPS
private static final String USERS
private static final String CONTENT_CART_ELEMENTS
private static final String RESOURCE_CART_ELEMENTS
private static final String QUERIES_CART_ELEMENTS
private static final String QUERY_ID_PROPERTY
private static final String QUERY_DESCRIPTION_PROPERTY
private static final String QUERY_AUTHOR_PROPERTY
private static final String QUERY_TITLE_PROPERTY
private static final String QUERY_DATE_PROPERTY
public Cart(Node node, String parentPath, CartFactory factory)
Cart.node - the node backing this AmetysObjectparentPath - the parentPath in the Ametys hierarchyfactory - the DefaultAmetysObjectFactory which created the AmetysObjectpublic void setTitle(String title)
title - the descriptionpublic void setDescription(String description)
description - the descriptionpublic void setAuthor(UserIdentity author)
author - the authorpublic void setVisibility(Cart.Visibility visibility)
visibility - the visibilitypublic String getDescription()
public UserIdentity getAuthor()
public Cart.Visibility getVisibility()
public Set<UserIdentity> getGrantedUsers(Cart.CartProfile profile)
profile - the cart's profilepublic Set<GroupIdentity> getGrantedGroups(Cart.CartProfile profile)
profile - the cart's profilepublic boolean canRead(UserIdentity user)
user - The usertrue if the user has read access, false otherwisepublic boolean canWrite(UserIdentity user)
user - The usertrue if the user has write access, false otherwisepublic void setGrantedUsers(Cart.CartProfile profile, Set<UserIdentity> users)
profile - the cart's profileusers - the granted userspublic void setGrantedGroups(Cart.CartProfile profile, Set<GroupIdentity> groups)
profile - the cart's profilegroups - the granted groupspublic void addContent(String contentId)
contentId - The content idpublic void addResource(String resourceId)
resourceId - The resource idpublic void addQuery(UserIdentity author, String title, String description)
author - The author of the querytitle - The title of the querydescription - The query as stringprivate Node _getOrCreateQueriesNode() throws RepositoryException
RepositoryExceptionpublic void removeElement(String elmtId, Cart.CartElementType elmtType)
elmtId - The id of element to removeelmtType - The type of element to removeprotected void _removeResource(String resourceIdToRemove)
resourceIdToRemove - The id of the resource to removeprotected void _removeContent(String contentIdToRemove)
contentIdToRemove - The id of the content to removeprotected void _removeQuery(String queryIdToRemove)
queryIdToRemove - The id of the query to removepublic List<CartElement> getElements()
public List<ContentElement> getContentCartElements() throws RepositoryException
RepositoryException - if an exception occurs while exploring the repositorypublic List<ResourceElement> getResourceCartElements() throws RepositoryException
RepositoryException - if an exception occurs while exploring the repositorypublic List<QueryElement> getQueryCartElements() throws RepositoryException
RepositoryException - if an exception occurs while exploring the repositoryprivate Node _getOrCreateNode(Node parent, String name, String type) throws RepositoryException
RepositoryException