Class QueriesRestController
- java.lang.Object
-
- org.neotropic.kuwaiba.northbound.rest.aem.QueriesRestController
-
- All Implemented Interfaces:
QueriesRestOpenApi
@RestController @RequestMapping("/v2.1.1/scripted-queries/") public class QueriesRestController extends Object implements QueriesRestOpenApi
Queries Rest Controller.- Author:
- Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description QueriesRestController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
createQuery(String name, long ownerId, String structure, String description, String sessionId)
Creates a Query.String
createScriptedQueriesPool(String name, String description, String sessionId)
Creates a scripted queries pool.String
createScriptedQuery(String id, String name, String description, String script, boolean enabled, String sessionId)
Creates a scripted query.String
createScriptedQueryParameter(String id, String name, String description, String type, boolean mandatory, Object defaultValue, String sessionId)
Creates a scripted query parameter.void
deleteQuery(long id, String sessionId)
Deletes a Query.void
deleteScriptedQueriesPool(String id, String sessionId)
Deletes a scripted queries pool.void
deleteScriptedQuery(String id, String sessionId)
Deletes an scripted query given the id.void
deleteScriptedQueryParameter(String id, String sessionId)
Deletes a scripted query parameter.List<ResultRecord>
executeQuery(ExtendedQuery query, String sessionId)
Used to perform complex queries.ScriptedQueryResult
executeScriptedQuery(String id, List<TransientScriptedQueryParameter> parameters, String sessionId)
Executes the scripted query.List<CompactQuery>
getQueries(boolean showPublic, String sessionId)
Gets all queries.CompactQuery
getQuery(long id, String sessionId)
Gets a single query.List<ScriptedQuery>
getScriptedQueries(String filterName, boolean ignoreDisabled, int skip, int limit, String sessionId)
Gets a set of scripted queries.List<ScriptedQuery>
getScriptedQueriesByPoolId(String id, String filterName, boolean ignoreDisabled, int skip, int limit, String sessionId)
Gets a set of scripted queries in a scripted queries pool the its id.List<ScriptedQuery>
getScriptedQueriesByPoolName(String name, String filterName, boolean ignoreDisabled, int skip, int limit, String sessionId)
Gets a set of scripted queries in a scripted queries pool the its name.ScriptedQueriesPool
getScriptedQueriesPool(String id, String sessionId)
Gets a scripted queries pool.ScriptedQueriesPool
getScriptedQueriesPoolByName(String name, String sessionId)
Gets a scripted queries pool given the name.int
getScriptedQueriesPoolCount(String filterName, String sessionId)
Counts the scripted queries pools.List<ScriptedQueriesPool>
getScriptedQueriesPools(String filterName, int skip, int limit, String sessionId)
Gets a set of scripted queries pools.ScriptedQuery
getScriptedQuery(String id, String sessionId)
Gets a scripted query given its id.int
getScriptedQueryCount(String filterName, String sessionId)
Counts the scripted queries.int
getScriptedQueryCountByPoolId(String id, String filterName, boolean ignoreDisabled, String sessionId)
Counts the scripted queries filter by name in a scripted queries pool.int
getScriptedQueryCountByPoolName(String name, String filterName, String sessionId)
Counts the scripted queries filter by name in a scripted queries pool.ScriptedQueryParameter
getScriptedQueryParameter(String id, String sessionId)
Gets an scripted query parameter.List<ScriptedQueryParameter>
getScriptedQueryParameters(String id, String sessionId)
Gets the scripted query parameters.ChangeDescriptor
saveQuery(long id, String name, long ownerId, String structure, String description, String sessionId)
Updates an existing query.void
updateScriptedQueriesPool(String id, String name, String description, String sessionId)
Updates a scripted queries pool.void
updateScriptedQuery(String id, String name, String description, String script, boolean enabled, String sessionId)
Updates a scripted query given its id.void
updateScriptedQueryParameter(String id, String name, String description, String type, boolean mandatory, Object defaultValue, String sessionId)
Updates a scripted query parameter.
-
-
-
Field Detail
-
PATH
public static final String PATH
Path that includes the Kuwaiba version and the module id- See Also:
- Constant Field Values
-
-
Method Detail
-
createScriptedQueriesPool
@RequestMapping(method=POST, value="createScriptedQueriesPool/{name}/{description}/{sessionId}", produces="application/json") public String createScriptedQueriesPool(@PathVariable("name") String name, @PathVariable("description") String description, @PathVariable("sessionId") String sessionId)
Creates a scripted queries pool.- Specified by:
createScriptedQueriesPool
in interfaceQueriesRestOpenApi
- Parameters:
name
- Scripted queries pool name.description
- Scripted queries pool description.sessionId
- The session token id.- Returns:
- The scripted queries pool id.
-
updateScriptedQueriesPool
@RequestMapping(method=PUT, value="updateScriptedQueriesPool/{id}/{name}/{description}/{sessionId}", produces="application/json") public void updateScriptedQueriesPool(@PathVariable("id") String id, @PathVariable("name") String name, @PathVariable("description") String description, @PathVariable("sessionId") String sessionId)
Updates a scripted queries pool.- Specified by:
updateScriptedQueriesPool
in interfaceQueriesRestOpenApi
- Parameters:
id
- Scripted queries pool id.name
- Scripted queries pool name.description
- Scripted queries pool description.sessionId
- The session token id.
-
deleteScriptedQueriesPool
@RequestMapping(method=DELETE, value="deleteScriptedQueriesPool/{id}/{sessionId}", produces="application/json") public void deleteScriptedQueriesPool(@PathVariable("id") String id, @PathVariable("sessionId") String sessionId)
Deletes a scripted queries pool.- Specified by:
deleteScriptedQueriesPool
in interfaceQueriesRestOpenApi
- Parameters:
id
- Scripted queries pool id.sessionId
- The session token id.
-
getScriptedQueriesPoolByName
@RequestMapping(method=GET, value="getScriptedQueriesPoolByName/{name}/{sessionId}", produces="application/json") public ScriptedQueriesPool getScriptedQueriesPoolByName(@PathVariable("name") String name, @PathVariable("sessionId") String sessionId)
Gets a scripted queries pool given the name.- Specified by:
getScriptedQueriesPoolByName
in interfaceQueriesRestOpenApi
- Parameters:
name
- Scripted queries pool name.sessionId
- The session token id.- Returns:
- A scripted queries pool.
-
getScriptedQueriesPool
@RequestMapping(method=GET, value="getScriptedQueriesPool/{id}/{sessionId}", produces="application/json") public ScriptedQueriesPool getScriptedQueriesPool(@PathVariable("id") String id, @PathVariable("sessionId") String sessionId)
Gets a scripted queries pool.- Specified by:
getScriptedQueriesPool
in interfaceQueriesRestOpenApi
- Parameters:
id
- Scripted queries pool id.sessionId
- The session token id.- Returns:
- A scripted queries pool.
-
getScriptedQueriesPoolCount
@RequestMapping(method=GET, value="getScriptedQueriesPoolCount/{filterName}/{sessionId}", produces="application/json") public int getScriptedQueriesPoolCount(@PathVariable("filterName") String filterName, @PathVariable("sessionId") String sessionId)
Counts the scripted queries pools.- Specified by:
getScriptedQueriesPoolCount
in interfaceQueriesRestOpenApi
- Parameters:
filterName
- Scripted queries pool name to filter.sessionId
- The session token id.- Returns:
- The size of scripted queries pools.
-
getScriptedQueriesPools
@RequestMapping(method=GET, value="getScriptedQueriesPools/{filterName}/{skip}/{limit}/{sessionId}", produces="application/json") public List<ScriptedQueriesPool> getScriptedQueriesPools(@PathVariable("filterName") String filterName, @PathVariable("skip") int skip, @PathVariable("limit") int limit, @PathVariable("sessionId") String sessionId)
Gets a set of scripted queries pools.- Specified by:
getScriptedQueriesPools
in interfaceQueriesRestOpenApi
- Parameters:
filterName
- Filter by scripted queries pool name.skip
- Result skip.limit
- Result limit.sessionId
- The session token id.- Returns:
- A set of scripted queries pools.
-
getScriptedQueryCountByPoolId
@RequestMapping(method=GET, value="getScriptedQueryCountByPoolId/{id}/{filterName}/{ignoreDisabled}/{sessionId}", produces="application/json") public int getScriptedQueryCountByPoolId(@PathVariable("id") String id, @PathVariable("filterName") String filterName, @PathVariable("ignoreDisabled") boolean ignoreDisabled, @PathVariable("sessionId") String sessionId)
Counts the scripted queries filter by name in a scripted queries pool.- Specified by:
getScriptedQueryCountByPoolId
in interfaceQueriesRestOpenApi
- Parameters:
id
- Scripted queries pool id.filterName
- Filter by scripted query name.ignoreDisabled
- True to ignore disabled scripted queries.sessionId
- The session token id.- Returns:
- The size of scripted queries.
-
getScriptedQueriesByPoolId
@RequestMapping(method=GET, value="getScriptedQueriesByPoolId/{id}/{filterName}/{ignoreDisabled}/{skip}/{limit}/{sessionId}", produces="application/json") public List<ScriptedQuery> getScriptedQueriesByPoolId(@PathVariable("id") String id, @PathVariable("filterName") String filterName, @PathVariable("ignoreDisabled") boolean ignoreDisabled, @PathVariable("skip") int skip, @PathVariable("limit") int limit, @PathVariable("sessionId") String sessionId)
Gets a set of scripted queries in a scripted queries pool the its id.- Specified by:
getScriptedQueriesByPoolId
in interfaceQueriesRestOpenApi
- Parameters:
id
- Scripted queries pool id.filterName
- Scripted query name filter.ignoreDisabled
- True to return all scripted queries. False to return the enabled only.skip
- Result skip.limit
- Result limit.sessionId
- The session token id.- Returns:
- A set of scripted queries in a scripted queries pool.
-
getScriptedQueryCountByPoolName
@RequestMapping(method=GET, value="getScriptedQueryCountByPoolName/{name}/{filterName}/{sessionId}", produces="application/json") public int getScriptedQueryCountByPoolName(@PathVariable("name") String name, @PathVariable("filterName") String filterName, @PathVariable("sessionId") String sessionId)
Counts the scripted queries filter by name in a scripted queries pool.- Specified by:
getScriptedQueryCountByPoolName
in interfaceQueriesRestOpenApi
- Parameters:
name
- Scripted queries pool name.filterName
- Scripted query name to filter.sessionId
- The session token id.- Returns:
- The size of scripted queries.
-
getScriptedQueriesByPoolName
@RequestMapping(method=GET, value="getScriptedQueriesByPoolName/{name}/{filterName}/{ignoreDisabled}/{skip}/{limit}/{sessionId}", produces="application/json") public List<ScriptedQuery> getScriptedQueriesByPoolName(@PathVariable("name") String name, @PathVariable("filterName") String filterName, @PathVariable("ignoreDisabled") boolean ignoreDisabled, @PathVariable("skip") int skip, @PathVariable("limit") int limit, @PathVariable("sessionId") String sessionId)
Gets a set of scripted queries in a scripted queries pool the its name.- Specified by:
getScriptedQueriesByPoolName
in interfaceQueriesRestOpenApi
- Parameters:
name
- Scripted queries pool name.filterName
- Scripted query name filter.ignoreDisabled
- True to return all scripted queries. False to return the enabled only.skip
- Result skip.limit
- Result limit.sessionId
- The session token id.- Returns:
- A set of scripted queries in a scripted queries pool.
-
createScriptedQuery
@RequestMapping(method=POST, value="createScriptedQuery/{id}/{name}/{description}/{script}/{enabled}/{sessionId}", produces="application/json") public String createScriptedQuery(@PathVariable("id") String id, @PathVariable("name") String name, @PathVariable("description") String description, @PathVariable("script") String script, @PathVariable("enabled") boolean enabled, @PathVariable("sessionId") String sessionId)
Creates a scripted query.- Specified by:
createScriptedQuery
in interfaceQueriesRestOpenApi
- Parameters:
id
- Scripted queries pool id.name
- Scripted query name.description
- Scripted query description.script
- Scripted query script.enabled
- True to enable the Scripted query.sessionId
- The session token id.- Returns:
- The scripted query id.
-
updateScriptedQuery
@RequestMapping(method=PUT, value="updateScriptedQuery/{id}/{name}/{description}/{script}/{enabled}/{sessionId}", produces="application/json") public void updateScriptedQuery(@PathVariable("id") String id, @PathVariable("name") String name, @PathVariable("description") String description, @PathVariable("script") String script, @PathVariable("enabled") boolean enabled, @PathVariable("sessionId") String sessionId)
Updates a scripted query given its id.- Specified by:
updateScriptedQuery
in interfaceQueriesRestOpenApi
- Parameters:
id
- The scripted query id.name
- New scripting query name.description
- New scripting query description.script
- New query script.enabled
- New value, true to enable the scripting query.sessionId
- The session token id.
-
deleteScriptedQuery
@RequestMapping(method=DELETE, value="deleteScriptedQuery/{id}/{sessionId}", produces="application/json") public void deleteScriptedQuery(@PathVariable("id") String id, @PathVariable("sessionId") String sessionId)
Deletes an scripted query given the id.- Specified by:
deleteScriptedQuery
in interfaceQueriesRestOpenApi
- Parameters:
id
- The scripting query id.sessionId
- The session token id.
-
getScriptedQuery
@RequestMapping(method=GET, value="getScriptedQuery/{id}/{sessionId}", produces="application/json") public ScriptedQuery getScriptedQuery(@PathVariable("id") String id, @PathVariable("sessionId") String sessionId)
Gets a scripted query given its id.- Specified by:
getScriptedQuery
in interfaceQueriesRestOpenApi
- Parameters:
id
- The scripted query id.sessionId
- The session token id.- Returns:
- A scripted query.
-
getScriptedQueryCount
@RequestMapping(method=GET, value="getScriptedQueryCount/{filterName}/{sessionId}", produces="application/json") public int getScriptedQueryCount(@PathVariable("filterName") String filterName, @PathVariable("sessionId") String sessionId)
Counts the scripted queries.- Specified by:
getScriptedQueryCount
in interfaceQueriesRestOpenApi
- Parameters:
filterName
- Scripted query name to filter.sessionId
- The session token id.- Returns:
- The size of scripted queries.
-
getScriptedQueries
@RequestMapping(method=GET, value="getScriptedQueries/{filterName}/{ignoreDisabled}/{skip}/{limit}/{sessionId}", produces="application/json") public List<ScriptedQuery> getScriptedQueries(@PathVariable("filterName") String filterName, @PathVariable("ignoreDisabled") boolean ignoreDisabled, @PathVariable("skip") int skip, @PathVariable("limit") int limit, @PathVariable("sessionId") String sessionId)
Gets a set of scripted queries.- Specified by:
getScriptedQueries
in interfaceQueriesRestOpenApi
- Parameters:
filterName
- Scripted query name to filter.ignoreDisabled
- True to return all scripted queries. False to return the enabled only.skip
- Result skip.limit
- Result limit.sessionId
- The session token id.- Returns:
- A set of scripted queries.
-
executeScriptedQuery
@RequestMapping(method=PUT, value="executeScriptedQuery/{id}/{sessionId}", produces="application/json") public ScriptedQueryResult executeScriptedQuery(@PathVariable("id") String id, @RequestBody List<TransientScriptedQueryParameter> parameters, @PathVariable("sessionId") String sessionId)
Executes the scripted query.- Specified by:
executeScriptedQuery
in interfaceQueriesRestOpenApi
- Parameters:
id
- The scripted query class id.parameters
- The scripted query parameters.sessionId
- The session token id.- Returns:
- The result of execute the scripted query.
-
createScriptedQueryParameter
@RequestMapping(method=POST, value="createScriptedQueryParameter/{id}/{name}/{description}/{type}/{mandatory}/{sessionId}", produces="application/json") public String createScriptedQueryParameter(@PathVariable("id") String id, @PathVariable("name") String name, @PathVariable("description") String description, @PathVariable("type") String type, @PathVariable("mandatory") boolean mandatory, @RequestBody Object defaultValue, @PathVariable("sessionId") String sessionId)
Creates a scripted query parameter.- Specified by:
createScriptedQueryParameter
in interfaceQueriesRestOpenApi
- Parameters:
id
- The scripted query id.name
- The scripted query parameter name.description
- The scripted query parameter description.type
- The scripted query parameter type.mandatory
- True scripted query parameter is mandatory.defaultValue
- The scripted query parameter default value.sessionId
- The session token id.- Returns:
- The scripted query parameter id.
-
updateScriptedQueryParameter
@RequestMapping(method=PUT, value="updateScriptedQueryParameter/{id}/{name}/{description}/{type}/{mandatory}/{sessionId}", produces="application/json") public void updateScriptedQueryParameter(@PathVariable("id") String id, @PathVariable("name") String name, @PathVariable("description") String description, @PathVariable("type") String type, @PathVariable("mandatory") boolean mandatory, @RequestBody Object defaultValue, @PathVariable("sessionId") String sessionId)
Updates a scripted query parameter.- Specified by:
updateScriptedQueryParameter
in interfaceQueriesRestOpenApi
- Parameters:
id
- The scripted query parameter id.name
- The scripted query parameter name.description
- The scripted query parameter description.type
- The scripted query parameter type.mandatory
- True if the scripted query parameter is mandatory.defaultValue
- The scripted query parameter default value.sessionId
- The session token id.
-
deleteScriptedQueryParameter
@RequestMapping(method=DELETE, value="deleteScriptedQueryParameter/{id}/{sessionId}", produces="application/json") public void deleteScriptedQueryParameter(@PathVariable("id") String id, @PathVariable("sessionId") String sessionId)
Deletes a scripted query parameter.- Specified by:
deleteScriptedQueryParameter
in interfaceQueriesRestOpenApi
- Parameters:
id
- The id of the scripted query parameter to delete.sessionId
- The session token id.
-
getScriptedQueryParameter
@RequestMapping(method=GET, value="getScriptedQueryParameter/{id}/{sessionId}", produces="application/json") public ScriptedQueryParameter getScriptedQueryParameter(@PathVariable("id") String id, @PathVariable("sessionId") String sessionId)
Gets an scripted query parameter.- Specified by:
getScriptedQueryParameter
in interfaceQueriesRestOpenApi
- Parameters:
id
- The scripted query parameter id.sessionId
- The session token id.- Returns:
- The scripted query parameter.
-
getScriptedQueryParameters
@RequestMapping(method=GET, value="getScriptedQueryParameters/{id}/{sessionId}", produces="application/json") public List<ScriptedQueryParameter> getScriptedQueryParameters(@PathVariable("id") String id, @PathVariable("sessionId") String sessionId)
Gets the scripted query parameters.- Specified by:
getScriptedQueryParameters
in interfaceQueriesRestOpenApi
- Parameters:
id
- The scripted query id.sessionId
- The session token id.- Returns:
- The scripted query parameters.
-
createQuery
@RequestMapping(method=POST, value="createQuery/{name}/{ownerId}/{structure}/{description}/{sessionId}", produces="application/json") public long createQuery(@PathVariable("name") String name, @PathVariable("ownerId") long ownerId, @PathVariable("structure") String structure, @PathVariable("description") String description, @PathVariable("sessionId") String sessionId)
Creates a Query.- Specified by:
createQuery
in interfaceQueriesRestOpenApi
- Parameters:
name
- The name of the query.ownerId
- The if of the user that will own the query. Use -1 to make it public.structure
- The structure of the query as string Base64, from the XML document:<query version="" logicalconnector="" limit=""> <class name=""> <visibleattributes> <attribute name=""> </attribute> </visibleattributes> <filters> <filter attribute="" condition=""> </filter> </filters> </class> </query>
description
- The description of the query.sessionId
- The session token id.- Returns:
- The id of the newly created query.
-
saveQuery
@RequestMapping(method=PUT, value="saveQuery/{id}/{name}/{ownerId}/{structure}/{description}/{sessionId}", produces="application/json") public ChangeDescriptor saveQuery(@PathVariable("id") long id, @PathVariable("name") String name, @PathVariable("ownerId") long ownerId, @PathVariable("structure") String structure, @PathVariable("description") String description, @PathVariable("sessionId") String sessionId)
Updates an existing query.- Specified by:
saveQuery
in interfaceQueriesRestOpenApi
- Parameters:
id
- The id of the query.name
- The name of the query. Leave null to keep the old value.ownerId
- The id of the user that owns this query. Use -1 to keep the old value.structure
- The structure of the query as string Base64, from an XML document<query version="" logicalconnector="" limit=""> <class name=""> <visibleattributes> <attribute name=""> </attribute> </visibleattributes> <filters> <filter attribute="" condition=""> </filter> </filters> </class> </query>
description
- The description of the query. Leave null to keep the old value.sessionId
- The session token id.- Returns:
- The summary of the changes.
-
deleteQuery
@RequestMapping(method=DELETE, value="deleteQuery/{id}/{sessionId}", produces="application/json") public void deleteQuery(@PathVariable("id") long id, @PathVariable("sessionId") String sessionId)
Deletes a Query.- Specified by:
deleteQuery
in interfaceQueriesRestOpenApi
- Parameters:
id
- The id of the query.sessionId
- The session token id.
-
getQueries
@RequestMapping(method=GET, value="getQueries/{showPublic}/{sessionId}", produces="application/json") public List<CompactQuery> getQueries(@PathVariable("showPublic") boolean showPublic, @PathVariable("sessionId") String sessionId)
Gets all queries.- Specified by:
getQueries
in interfaceQueriesRestOpenApi
- Parameters:
showPublic
- Include public queries or show only the private ones.sessionId
- The session token id.- Returns:
- The list of queries.
-
getQuery
@RequestMapping(method=GET, value="getQuery/{id}/{sessionId}", produces="application/json") public CompactQuery getQuery(@PathVariable("id") long id, @PathVariable("sessionId") String sessionId)
Gets a single query.- Specified by:
getQuery
in interfaceQueriesRestOpenApi
- Parameters:
id
- The id of the query.sessionId
- The session token id.- Returns:
- The query as an object.
-
executeQuery
@RequestMapping(method=PUT, value="executeQuery/{sessionId}", produces="application/json") public List<ResultRecord> executeQuery(@RequestBody ExtendedQuery query, @PathVariable("sessionId") String sessionId)
Used to perform complex queries. Please note that the first record is reserved for the column headers, so and empty result set will have at least one record.- Specified by:
executeQuery
in interfaceQueriesRestOpenApi
- Parameters:
query
- The code-friendly representation of the query made using the graphical query builder.sessionId
- The session token id.- Returns:
- A set of objects matching the specified criteria as ResultRecord array.
-
-