Class QueryHelper
- java.lang.Object
-
- org.ametys.plugins.queriesdirectory.QueryHelper
-
public final class QueryHelper extends Object
Helper for manipulatingQuery
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
QueryHelper.ObjectToReturn
static class
QueryHelper.Visibility
The user and its groups for checking visibility
-
Constructor Summary
Constructors Modifier Constructor Description private
QueryHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
_appendGroupAccessCondition(StringBuilder query, String groupId, String groupDirectory, String accessNodeName)
private static void
_appendGroupsCondition(StringBuilder query, Set<GroupIdentity> groups, boolean readAccess)
private static void
_appendPrivatePredicate(StringBuilder query, String login, String populationId)
private static void
_appendPublicPredicate(StringBuilder query)
private static void
_appendSharedPredicate(StringBuilder query, String login, String populationId, Set<GroupIdentity> groups, boolean readAccess)
private static void
_appendUserAccessCondition(StringBuilder query, String login, String populationId, String accessNodeName)
private static void
_appendUserCondition(StringBuilder query, String login, String populationId)
private static StringBuilder
_getParentPath(QueryContainer queryContainer)
private static String
_getXPathQuery(QueryContainer queryContainer, boolean onlyDirectChildren, QueryHelper.ObjectToReturn objectToReturn, Optional<QueryHelper.Visibility> visibility, Optional<String> type, Boolean readAccess)
(package private) static String
getXPathForQueriesForAdministrator(QueryContainer queryContainer, boolean onlyDirectChildren, Optional<String> type)
Creates the XPath query to get all queries for administrator(package private) static String
getXPathForQueriesInReadAccess(QueryContainer queryContainer, boolean onlyDirectChildren, QueryHelper.Visibility visibility, Optional<String> type)
Creates the XPath query to get all queries in READ access(package private) static String
getXPathForQueriesInWriteAccess(QueryContainer queryContainer, boolean onlyDirectChildren, QueryHelper.Visibility visibility, Optional<String> type)
Creates the XPath query to get all queries in WRITE access(package private) static String
getXPathForQueryContainers(QueryContainer queryContainer)
Creates the XPath query to get all query containers
-
-
-
Constructor Detail
-
QueryHelper
private QueryHelper()
-
-
Method Detail
-
getXPathForQueryContainers
static String getXPathForQueryContainers(QueryContainer queryContainer)
Creates the XPath query to get all query containers- Parameters:
queryContainer
- TheQueryContainer
, defining the context from which getting children- Returns:
- The XPath query
-
getXPathForQueriesForAdministrator
static String getXPathForQueriesForAdministrator(QueryContainer queryContainer, boolean onlyDirectChildren, Optional<String> type)
Creates the XPath query to get all queries for administrator- Parameters:
queryContainer
- TheQueryContainer
, defining the context from which getting childrenonlyDirectChildren
-true
in order to have only direct child queries from parent path,false
otherwise to have all queries at any level underneath the parent pathtype
- The query type- Returns:
- The XPath query
-
getXPathForQueriesInReadAccess
static String getXPathForQueriesInReadAccess(QueryContainer queryContainer, boolean onlyDirectChildren, QueryHelper.Visibility visibility, Optional<String> type)
Creates the XPath query to get all queries in READ access- Parameters:
queryContainer
- TheQueryContainer
, defining the context from which getting childrenonlyDirectChildren
-true
in order to have only direct child queries from parent path,false
otherwise to have all queries at any level underneath the parent pathvisibility
- The user and its groups for checking visibilitytype
- The query type- Returns:
- The XPath query
-
getXPathForQueriesInWriteAccess
static String getXPathForQueriesInWriteAccess(QueryContainer queryContainer, boolean onlyDirectChildren, QueryHelper.Visibility visibility, Optional<String> type)
Creates the XPath query to get all queries in WRITE access- Parameters:
queryContainer
- TheQueryContainer
, defining the context from which getting childrenonlyDirectChildren
-true
in order to have only direct child queries from parent path,false
otherwise to have all queries at any level underneath the parent pathvisibility
- The user and its groups for checking visibilitytype
- The query type- Returns:
- The XPath query
-
_getParentPath
private static StringBuilder _getParentPath(QueryContainer queryContainer)
-
_getXPathQuery
private static String _getXPathQuery(QueryContainer queryContainer, boolean onlyDirectChildren, QueryHelper.ObjectToReturn objectToReturn, Optional<QueryHelper.Visibility> visibility, Optional<String> type, Boolean readAccess)
-
_appendPublicPredicate
private static void _appendPublicPredicate(StringBuilder query)
-
_appendPrivatePredicate
private static void _appendPrivatePredicate(StringBuilder query, String login, String populationId)
-
_appendSharedPredicate
private static void _appendSharedPredicate(StringBuilder query, String login, String populationId, Set<GroupIdentity> groups, boolean readAccess)
-
_appendUserCondition
private static void _appendUserCondition(StringBuilder query, String login, String populationId)
-
_appendGroupsCondition
private static void _appendGroupsCondition(StringBuilder query, Set<GroupIdentity> groups, boolean readAccess)
-
_appendUserAccessCondition
private static void _appendUserAccessCondition(StringBuilder query, String login, String populationId, String accessNodeName)
-
_appendGroupAccessCondition
private static void _appendGroupAccessCondition(StringBuilder query, String groupId, String groupDirectory, String accessNodeName)
-
-