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>
caseTitledMap
protected org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
elasticsearchTemplate
protected java.util.Map<java.lang.String,java.lang.Float>
fullTextFieldMap
protected IPetriNetService
petriNetService
protected java.lang.String
taskIndex
protected ITaskService
taskService
protected org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
template
-
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 void
addRolesQueryConstraint(ElasticTaskSearchRequest request, LoggedUser user)
protected void
buildCaseQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Tasks of case with id "5cb07b6ff05be15f0b972c4d" { "case": { "id": "5cb07b6ff05be15f0b972c4d" } }protected void
buildFullTextQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Full text search on fields defined byfullTextFields()
.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" }protected void
buildProcessQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Tasks of process "document" { "process": "document" }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)
protected org.elasticsearch.index.query.BoolQueryBuilder
buildSingleQuery(ElasticTaskSearchRequest request, LoggedUser user, java.util.Locale locale)
protected void
buildStringQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query, LoggedUser user)
protected void
buildTitleQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Tasks with title (default value) "New task" { "title": "New task" }protected void
buildTransitionQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Tasks with transition id "document" { "transitionId": "document" }protected void
buildUserQuery(ElasticTaskSearchRequest request, org.elasticsearch.index.query.BoolQueryBuilder query)
Tasks assigned to user with id 1 { "user": 1 }protected org.elasticsearch.index.query.QueryBuilder
caseRequestQuery(TaskSearchCaseRequest caseRequest)
long
count(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)
void
index(ElasticTask task)
void
indexNow(ElasticTask task)
void
remove(java.lang.String taskId)
void
removeByPetriNetId(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)
void
setTaskService(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:
fullTextFields
in 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:
remove
in interfaceIElasticTaskService
-
removeByPetriNetId
public void removeByPetriNetId(java.lang.String petriNetId)
- Specified by:
removeByPetriNetId
in interfaceIElasticTaskService
-
scheduleTaskIndexing
public java.util.concurrent.Future<ElasticTask> scheduleTaskIndexing(ElasticTask task)
- Specified by:
scheduleTaskIndexing
in interfaceIElasticTaskService
-
index
@Async public void index(ElasticTask task)
- Specified by:
index
in interfaceIElasticTaskService
-
indexNow
public void indexNow(ElasticTask task)
- Specified by:
indexNow
in 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:
search
in interfaceIElasticTaskService
-
count
public long count(java.util.List<ElasticTaskSearchRequest> requests, LoggedUser user, java.util.Locale locale, java.lang.Boolean isIntersection)
- Specified by:
count
in 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", ] }
-
-