@Component @Named(value="activeinstalls") @Singleton public class ActiveInstallsScriptService extends Object implements org.xwiki.script.service.ScriptService
Modifier and Type | Field and Description |
---|---|
static String |
ACTIVEINSTALLS_ERROR_KEY
The key under which the last encountered error is stored in the current execution context.
|
Constructor and Description |
---|
ActiveInstallsScriptService() |
Modifier and Type | Method and Description |
---|---|
com.google.gson.JsonObject |
countInstalls(String indexType,
String fullQuery) |
com.google.gson.JsonObject |
countInstalls(String indexType,
String fullQuery,
Map<String,Object> parameters)
Executes a Count query for Active Installs.
|
Exception |
getLastError()
Get the error generated while performing the previously called action.
|
com.google.gson.JsonObject |
searchInstalls(String indexType,
String fullQuery) |
com.google.gson.JsonObject |
searchInstalls(String indexType,
String fullQuery,
Map<String,Object> parameters)
Executes a Search query for Active Installs.
|
public static final String ACTIVEINSTALLS_ERROR_KEY
public com.google.gson.JsonObject countInstalls(String indexType, String fullQuery, Map<String,Object> parameters)
indexType
- the Elastic Search index type (e.g. "installs" or "installs2". Some XWiki instances may have
sent pings stored under a given index type while other instances may have used another index type (and
thus another data format). We use the index type to match a given data model. The Active Installs Client
module should be checked to understand the data model used.fullQuery
- the full Elastic Search query used to search for installs.parameters
- the ElasticSearch count parameters to use (see for example
Count API)getLastError()
.public com.google.gson.JsonObject searchInstalls(String indexType, String fullQuery, Map<String,Object> parameters)
indexType
- the Elastic Search index type (e.g. "installs" or "installs2". Some XWiki instances may have
sent pings stored under a given index type while other instances may have used another index type (and
thus another data format). We use the index type to match a given data model. The Active Installs Client
module should be checked to understand the data model used.fullQuery
- the full Elastic Search query used to search for installs. For example:
{
"query" : {
"term": { "distributionVersion" : "5.2" }
}
}
parameters
- the ElasticSearch search parameters to use (see for example
Search URI parameters)getLastError()
. For example:
{
"took": 97,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": "installs",
"_type": "install",
"_id": "id1",
"_score": 1,
"_source": {
"distributionVersion": "5.2",
...
}
},
{
"_index": "installs",
"_type": "install",
"_id": "id2",
"_score": 0.625,
"_source": {
"distributionVersion": "5.2-SNAPSHOT",
...
}
}
]
}
}
public Exception getLastError()
null
if no exception was thrownCopyright © 2004–2022 XWiki. All rights reserved.