public class Query extends DefaultAmetysObject<QueryFactory> implements MovableAmetysObject
Modifier and Type | Class and Description |
---|---|
static class |
Query.QueryProfile
Rights profiles
|
static class |
Query.Type
Type of a Query
|
static class |
Query.Visibility
Visibility of a Query
|
Modifier and Type | Field and Description |
---|---|
static String |
AUTHOR
Property name for query author
|
static String |
CONTENT
Property name for query content
|
static String |
DESCRIPTION
Property name for query description
|
static String |
GROUPS
Property name for query groups
|
static String |
LASTMODIFICATIONDATE
Property name for query last modification date
|
static String |
PROFILE_READ_ACCESS
Property name for query read access
|
static String |
PROFILE_WRITE_ACCESS
Property name for query write access
|
static String |
TITLE
Property name for query title
|
static String |
TYPE
Property name for query type
|
static String |
USERS
Property name for query users
|
static String |
VISIBILITY
Property name for query visibility
|
PROTECTED_PROPERTIES
Constructor and Description |
---|
Query(Node node,
String parentPath,
QueryFactory factory)
Creates an
Query . |
Modifier and Type | Method and Description |
---|---|
private Node |
_getOrCreateNode(Node parent,
String name,
String type) |
boolean |
canMoveTo(AmetysObject newParent)
Test if a move can be a success or if it is impossible (e.g.
|
boolean |
canRead(UserIdentity user)
Determines if an user has READ access to this query.
|
boolean |
canWrite(UserIdentity user)
Determines if an user has WRITE access to this query.
|
UserIdentity |
getAuthor()
Get the author of the query
|
String |
getContent()
Get the content of the query
|
String |
getDescription()
Get the description of the query
|
Set<GroupIdentity> |
getGrantedGroups(Query.QueryProfile profile)
Get the granted groups
|
Set<UserIdentity> |
getGrantedUsers(Query.QueryProfile profile)
Get the granted users
|
Date |
getLastModificationDate()
Get the date of the last modification of the query
|
String |
getTitle()
Get the title of the query
|
String |
getType()
Get the type of the query
|
Query.Visibility |
getVisibility()
Get the visibility of the query
|
void |
moveTo(AmetysObject newParent,
boolean renameIfExist)
Move the current object as a new child of the given object.
|
void |
orderBefore(AmetysObject siblingNode)
Order a node before another sibling node (or as the last node)
|
void |
setAuthor(UserIdentity author)
Set the author of this query.
|
void |
setContent(String content)
Set the content of this query.
|
void |
setDescription(String description)
Set the description of this query.
|
void |
setGrantedGroups(Query.QueryProfile profile,
Set<GroupIdentity> groups)
Set the granted groups
|
void |
setGrantedUsers(Query.QueryProfile profile,
Set<UserIdentity> users)
Set the granted users
|
void |
setLastModificationDate(Date lastModificationDate)
Set the date of the last modification.
|
void |
setTitle(String title)
Set the title of this query.
|
void |
setType(String type)
Set the type of this query.
|
void |
setVisibility(Query.Visibility visibility)
Set the query 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, saveChanges
equals, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
equals, getId, getName, getParent, getParentPath, getPath, hashCode
getMetadataHolder
needsSave, rename, revertChanges, saveChanges
public static final String TITLE
public static final String TYPE
public static final String DESCRIPTION
public static final String CONTENT
public static final String AUTHOR
public static final String LASTMODIFICATIONDATE
public static final String VISIBILITY
public static final String PROFILE_READ_ACCESS
public static final String PROFILE_WRITE_ACCESS
public static final String GROUPS
public static final String USERS
public Query(Node node, String parentPath, QueryFactory factory)
Query
.node
- the node backing this AmetysObject
parentPath
- the parentPath in the Ametys hierarchyfactory
- the DefaultAmetysObjectFactory which created the AmetysObjectpublic void setTitle(String title)
title
- the descriptionpublic void setType(String type)
type
- the descriptionpublic void setDescription(String description)
description
- the descriptionpublic void setContent(String content)
content
- the contentpublic void setAuthor(UserIdentity author)
author
- the authorpublic void setLastModificationDate(Date lastModificationDate)
lastModificationDate
- the last modification date to set.public void setVisibility(Query.Visibility visibility)
visibility
- the visibilitypublic String getDescription()
public String getContent()
public UserIdentity getAuthor()
public Query.Visibility getVisibility()
public Set<UserIdentity> getGrantedUsers(Query.QueryProfile profile)
profile
- teh query profilepublic Set<GroupIdentity> getGrantedGroups(Query.QueryProfile profile)
profile
- the query 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(Query.QueryProfile profile, Set<UserIdentity> users)
profile
- the query profileusers
- the granted userspublic void setGrantedGroups(Query.QueryProfile profile, Set<GroupIdentity> groups)
profile
- the query profilegroups
- the granted groupsprivate Node _getOrCreateNode(Node parent, String name, String type) throws RepositoryException
RepositoryException
public Date getLastModificationDate()
public boolean canMoveTo(AmetysObject newParent) throws AmetysRepositoryException
MovableAmetysObject
canMoveTo
in interface MovableAmetysObject
newParent
- See moveTo.AmetysRepositoryException
- if an error occurs.public void moveTo(AmetysObject newParent, boolean renameIfExist) throws AmetysRepositoryException, RepositoryIntegrityViolationException
MovableAmetysObject
moveTo
in interface MovableAmetysObject
newParent
- The new parent for the current object. Can not be null. Can not be a child of the current node. Must be a TraversableAmetyObject.renameIfExist
- true to rename moved page if a page with same name already existAmetysRepositoryException
- if an error occurs.RepositoryIntegrityViolationException
- if a page with the same name already exists.public void orderBefore(AmetysObject siblingNode) throws AmetysRepositoryException
MovableAmetysObject
orderBefore
in interface MovableAmetysObject
siblingNode
- The node that will be the next sibling node of the current node. Must have the same parent as the current node. Can be null to set the current node as the last node.AmetysRepositoryException
- if an error occurs.