Class ElasticTaskService
- java.lang.Object
-
- com.netgrif.application.engine.elastic.service.ElasticViewPermissionService
-
- com.netgrif.application.engine.elastic.service.ElasticTaskService
-
- All Implemented Interfaces:
IElasticTaskService
@Service public class ElasticTaskService extends ElasticViewPermissionService implements IElasticTaskService
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.Float>caseTitledMapprotected org.springframework.data.elasticsearch.core.ElasticsearchRestTemplateelasticsearchTemplateprotected java.util.Map<java.lang.String,java.lang.Float>fullTextFieldMapprotected IPetriNetServicepetriNetServiceprotected java.lang.StringtaskIndexprotected ITaskServicetaskServiceprotected org.springframework.data.elasticsearch.core.ElasticsearchRestTemplatetemplate
-
Constructor Summary
Constructors Constructor Description ElasticTaskService(org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate template)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddRolesQueryConstraint(ElasticTaskSearchRequest request, LoggedUser user)protected voidbuildCaseQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)Tasks of case with id "5cb07b6ff05be15f0b972c4d" { "case": { "id": "5cb07b6ff05be15f0b972c4d" } }protected voidbuildFullTextQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)Full text search on fields defined byfullTextFields().booleanbuildGroupQuery(TaskSearchRequest request, LoggedUser user, java.util.Locale locale, org.elasticsearch.index.query.BoolQueryBuilder query)Tasks of cases of group with id "5cb07b6ff05be15f0b972c4d" { "group": "5cb07b6ff05be15f0b972c4d" }protected voidbuildProcessQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)Tasks of process "document" { "process": "document" }protected org.springframework.data.elasticsearch.core.query.NativeSearchQuerybuildQuery(java.util.List<ElasticTaskSearchRequest> requests, LoggedUser user, org.springframework.data.domain.Pageable pageable, java.util.Locale locale, java.lang.Boolean isIntersection)protected org.elasticsearch.index.query.BoolQueryBuilderbuildSingleQuery(ElasticTaskSearchRequest request, LoggedUser user, java.util.Locale locale)protected voidbuildStringQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query, LoggedUser user)protected voidbuildTitleQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)Tasks with title (default value) "New task" { "title": "New task" }protected voidbuildTransitionQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)Tasks with transition id "document" { "transitionId": "document" }protected voidbuildUserQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)Tasks assigned to user with id 1 { "user": 1 }protected org.elasticsearch.index.query.QueryBuildercaseRequestQuery(TaskSearchCaseRequest caseRequest)longcount(java.util.List<ElasticTaskSearchRequest> requests, LoggedUser user, java.util.Locale locale, java.lang.Boolean isIntersection)java.util.Map<java.lang.String,java.lang.Float>fullTextFields()SeeQueryStringQueryBuilder.fields(Map)voidindex(ElasticTask task)voidindexNow(ElasticTask task)voidremove(java.lang.String taskId)voidremoveByPetriNetId(java.lang.String petriNetId)java.util.concurrent.Future<ElasticTask>scheduleTaskIndexing(ElasticTask task)org.springframework.data.domain.Page<Task>search(java.util.List<ElasticTaskSearchRequest> requests, LoggedUser user, org.springframework.data.domain.Pageable pageable, java.util.Locale locale, java.lang.Boolean isIntersection)voidsetTaskService(ITaskService taskService)-
Methods inherited from class com.netgrif.application.engine.elastic.service.ElasticViewPermissionService
buildViewPermissionQuery
-
-
-
-
Field Detail
-
taskService
protected ITaskService taskService
-
template
protected org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate template
-
taskIndex
@Value("${spring.data.elasticsearch.index.task}") protected java.lang.String taskIndex
-
elasticsearchTemplate
@Autowired protected org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate elasticsearchTemplate
-
petriNetService
@Autowired protected IPetriNetService petriNetService
-
fullTextFieldMap
protected java.util.Map<java.lang.String,java.lang.Float> fullTextFieldMap
-
caseTitledMap
protected java.util.Map<java.lang.String,java.lang.Float> caseTitledMap
-
-
Method Detail
-
setTaskService
@Autowired @Lazy public void setTaskService(ITaskService taskService)
-
fullTextFields
public java.util.Map<java.lang.String,java.lang.Float> fullTextFields()
SeeQueryStringQueryBuilder.fields(Map)- Specified by:
fullTextFieldsin interfaceIElasticTaskService- Returns:
- map where keys are ElasticCase field names and values are boosts of these fields
-
remove
public void remove(java.lang.String taskId)
- Specified by:
removein interfaceIElasticTaskService
-
removeByPetriNetId
public void removeByPetriNetId(java.lang.String petriNetId)
- Specified by:
removeByPetriNetIdin interfaceIElasticTaskService
-
scheduleTaskIndexing
public java.util.concurrent.Future<ElasticTask> scheduleTaskIndexing(ElasticTask task)
- Specified by:
scheduleTaskIndexingin interfaceIElasticTaskService
-
index
@Async public void index(ElasticTask task)
- Specified by:
indexin interfaceIElasticTaskService
-
indexNow
public void indexNow(ElasticTask task)
- Specified by:
indexNowin interfaceIElasticTaskService
-
search
public org.springframework.data.domain.Page<Task> search(java.util.List<ElasticTaskSearchRequest> requests, LoggedUser user, org.springframework.data.domain.Pageable pageable, java.util.Locale locale, java.lang.Boolean isIntersection)
- Specified by:
searchin interfaceIElasticTaskService
-
count
public long count(java.util.List<ElasticTaskSearchRequest> requests, LoggedUser user, java.util.Locale locale, java.lang.Boolean isIntersection)
- Specified by:
countin interfaceIElasticTaskService
-
buildQuery
protected org.springframework.data.elasticsearch.core.query.NativeSearchQuery buildQuery(java.util.List<ElasticTaskSearchRequest> requests, LoggedUser user, org.springframework.data.domain.Pageable pageable, java.util.Locale locale, java.lang.Boolean isIntersection)
-
buildSingleQuery
protected org.elasticsearch.index.query.BoolQueryBuilder buildSingleQuery(ElasticTaskSearchRequest request, LoggedUser user, java.util.Locale locale)
-
addRolesQueryConstraint
protected void addRolesQueryConstraint(ElasticTaskSearchRequest request, LoggedUser user)
-
buildCaseQuery
protected void buildCaseQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Tasks of case with id "5cb07b6ff05be15f0b972c4d" { "case": { "id": "5cb07b6ff05be15f0b972c4d" } }Tasks of cases with id "5cb07b6ff05be15f0b972c4d" OR "5cb07b6ff05be15f0b972c4e" { "case": [{ "id": "5cb07b6ff05be15f0b972c4d" }, { "id": "5cb07b6ff05be15f0b972c4e" }] }
Tasks of case with case title containing "foo" { "case": { "title": "foo" } }
Tasks of case with case title containing "foo" OR "bar" { "case": [{ "title": "foo" }, { "title: "bar" }] }
-
caseRequestQuery
protected org.elasticsearch.index.query.QueryBuilder caseRequestQuery(TaskSearchCaseRequest caseRequest)
- Returns:
- query for ID if only ID is present. Query for title if only title is present. If both are present an ID query is returned. If neither are present null is returned.
-
buildTitleQuery
protected void buildTitleQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Tasks with title (default value) "New task" { "title": "New task" }Tasks with title (default value) "New task" OR "Status" { "title": [ "New task", "Status" ] }
-
buildUserQuery
protected void buildUserQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Tasks assigned to user with id 1 { "user": 1 }Tasks assigned to user with id 1 OR 2
-
buildProcessQuery
protected void buildProcessQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Tasks of process "document" { "process": "document" }Tasks of process "document" OR "folder" { "process": [ "document", "folder", ] }
-
buildFullTextQuery
protected void buildFullTextQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Full text search on fields defined byfullTextFields().
-
buildTransitionQuery
protected void buildTransitionQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Tasks with transition id "document" { "transitionId": "document" }Tasks with transition id "document" OR "folder" { "transitionId": [ "document", "folder", ] }
-
buildStringQuery
protected void buildStringQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query, LoggedUser user)
-
buildGroupQuery
public boolean buildGroupQuery(TaskSearchRequest request, LoggedUser user, java.util.Locale locale, org.elasticsearch.index.query.BoolQueryBuilder query)
Tasks of cases of group with id "5cb07b6ff05be15f0b972c4d" { "group": "5cb07b6ff05be15f0b972c4d" }Tasks of cases of group with id "5cb07b6ff05be15f0b972c4d" OR "5cb07b6ff05be15f0b972c4e" { "transitionId": [ "5cb07b6ff05be15f0b972c4d", "5cb07b6ff05be15f0b972c4e", ] }
-
-