diff --git a/src/main/java/com/netgrif/application/engine/elastic/service/ElasticCaseService.java b/src/main/java/com/netgrif/application/engine/elastic/service/ElasticCaseService.java index 7375f1c60e..5c9e1cb960 100644 --- a/src/main/java/com/netgrif/application/engine/elastic/service/ElasticCaseService.java +++ b/src/main/java/com/netgrif/application/engine/elastic/service/ElasticCaseService.java @@ -8,6 +8,7 @@ import com.netgrif.application.engine.elastic.service.interfaces.IElasticCasePrioritySearch; import com.netgrif.application.engine.elastic.service.interfaces.IElasticCaseService; import com.netgrif.application.engine.elastic.web.requestbodies.CaseSearchRequest; +import com.netgrif.application.engine.petrinet.domain.PetriNetSearch; import com.netgrif.application.engine.petrinet.service.interfaces.IPetriNetService; import com.netgrif.application.engine.petrinet.web.responsebodies.PetriNetReference; import com.netgrif.application.engine.utils.FullPageRequest; @@ -465,8 +466,8 @@ private boolean buildGroupQuery(CaseSearchRequest request, LoggedUser user, Loca return false; } - Map processQuery = new HashMap<>(); - processQuery.put("group", request.group); + PetriNetSearch processQuery = new PetriNetSearch(); + processQuery.setGroup(request.group); List groupProcesses = this.petriNetService.search(processQuery, user, new FullPageRequest(), locale).getContent(); if (groupProcesses.size() == 0) return true; diff --git a/src/main/java/com/netgrif/application/engine/elastic/service/ElasticTaskService.java b/src/main/java/com/netgrif/application/engine/elastic/service/ElasticTaskService.java index 6de4d4f317..be620d2354 100644 --- a/src/main/java/com/netgrif/application/engine/elastic/service/ElasticTaskService.java +++ b/src/main/java/com/netgrif/application/engine/elastic/service/ElasticTaskService.java @@ -6,6 +6,7 @@ import com.netgrif.application.engine.elastic.service.interfaces.IElasticTaskService; import com.netgrif.application.engine.elastic.web.requestbodies.CaseSearchRequest; import com.netgrif.application.engine.elastic.web.requestbodies.ElasticTaskSearchRequest; +import com.netgrif.application.engine.petrinet.domain.PetriNetSearch; import com.netgrif.application.engine.petrinet.service.interfaces.IPetriNetService; import com.netgrif.application.engine.petrinet.web.responsebodies.PetriNetReference; import com.netgrif.application.engine.utils.FullPageRequest; @@ -423,8 +424,8 @@ public boolean buildGroupQuery(TaskSearchRequest request, LoggedUser user, Local if (request.group == null || request.group.isEmpty()) return false; - Map processQuery = new HashMap<>(); - processQuery.put("group", request.group); + PetriNetSearch processQuery = new PetriNetSearch(); + processQuery.setGroup(request.group); List groupProcesses = this.petriNetService.search(processQuery, user, new FullPageRequest(), locale).getContent(); if (groupProcesses.size() == 0) return true; diff --git a/src/main/java/com/netgrif/application/engine/petrinet/domain/PetriNetSearch.java b/src/main/java/com/netgrif/application/engine/petrinet/domain/PetriNetSearch.java new file mode 100644 index 0000000000..50faf1ce2a --- /dev/null +++ b/src/main/java/com/netgrif/application/engine/petrinet/domain/PetriNetSearch.java @@ -0,0 +1,33 @@ +package com.netgrif.application.engine.petrinet.domain; + +import com.netgrif.application.engine.auth.domain.Author; +import com.netgrif.application.engine.petrinet.domain.version.Version; +import lombok.Getter; +import lombok.Setter; +import java.util.List; +import java.util.Map; + +@Getter +@Setter +public class PetriNetSearch { + + private String importId; + + private String identifier; + + private String title; + + private String defaultCaseName; + + private String initials; + + private List group; + + private Version version; + + private Author author; + + private List negativeViewRoles; + + private Map tags; +} diff --git a/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java b/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java index 09192fe7a6..f67c70886d 100644 --- a/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java +++ b/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java @@ -36,6 +36,7 @@ import com.netgrif.application.engine.workflow.service.interfaces.IFieldActionsCacheService; import com.netgrif.application.engine.workflow.service.interfaces.IWorkflowService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringEscapeUtils; import org.apache.tomcat.util.http.fileupload.IOUtils; import org.bson.Document; import org.bson.types.ObjectId; @@ -457,35 +458,61 @@ public Optional findByImportId(String id) { } @Override - public Page search(Map criteria, LoggedUser user, Pageable pageable, Locale locale) { + public Page search(PetriNetSearch criteriaClass, LoggedUser user, Pageable pageable, Locale locale) { Query query = new Query(); - Query query_total = new Query(); + Query queryTotal = new Query(); if (!user.getSelfOrImpersonated().isAdmin()) query.addCriteria(getProcessRolesCriteria(user.getSelfOrImpersonated())); - criteria.forEach((key, value) -> { - Criteria valueCriteria; - if (key.equalsIgnoreCase("group")) { - if (value instanceof List) { - Collection authors = this.groupService.getGroupsOwnerEmails((List) value); - valueCriteria = Criteria.where("author.email").in(authors); - } else { - valueCriteria = Criteria.where("author.email").is(this.groupService.getGroupOwnerEmail((String) value)); - } - } else if (value instanceof List) - valueCriteria = Criteria.where(key).in(value); - else if (key.equalsIgnoreCase("title") || key.equalsIgnoreCase("initials") || key.equalsIgnoreCase("identifier")) - valueCriteria = Criteria.where(key).regex((String) value, "i"); - else - valueCriteria = Criteria.where(key).is(value); - query.addCriteria(valueCriteria); - query_total.addCriteria(valueCriteria); - }); + if (criteriaClass.getIdentifier() != null) { + this.addValueCriteria(query, queryTotal, Criteria.where("identifier").regex(criteriaClass.getIdentifier(), "i")); + } + if (criteriaClass.getTitle() != null) { + this.addValueCriteria(query, queryTotal, Criteria.where("title.defaultValue").regex(criteriaClass.getTitle(), "i")); + } + if (criteriaClass.getInitials() != null) { + this.addValueCriteria(query, queryTotal, Criteria.where("initials").regex(criteriaClass.getInitials(), "i")); + } + if (criteriaClass.getDefaultCaseName() != null) { + this.addValueCriteria(query, queryTotal, Criteria.where("defaultCaseName.defaultValue").regex(criteriaClass.getDefaultCaseName(), "i")); + } + if (criteriaClass.getGroup() != null) { + if (criteriaClass.getGroup().size() == 1) { + this.addValueCriteria(query, queryTotal, Criteria.where("author.email").is(this.groupService.getGroupOwnerEmail(criteriaClass.getGroup().get(0)))); + } else { + this.addValueCriteria(query, queryTotal,Criteria.where("author.email").in(this.groupService.getGroupsOwnerEmails(criteriaClass.getGroup()))); + } + } + if (criteriaClass.getVersion() != null) { + this.addValueCriteria(query, queryTotal, Criteria.where("version").is(criteriaClass.getVersion())); + } + if (criteriaClass.getAuthor() != null) { + if (criteriaClass.getAuthor().getEmail() != null) { + this.addValueCriteria(query, queryTotal, Criteria.where("author.email").is(criteriaClass.getAuthor().getEmail())); + } + if (criteriaClass.getAuthor().getId() != null) { + this.addValueCriteria(query, queryTotal, Criteria.where("author.id").is(criteriaClass.getAuthor().getId())); + } + if (criteriaClass.getAuthor().getFullName() != null) { + this.addValueCriteria(query, queryTotal, Criteria.where("author.fullName").is(criteriaClass.getAuthor().getFullName())); + } + } + if (criteriaClass.getNegativeViewRoles() != null) { + this.addValueCriteria(query, queryTotal, Criteria.where("negativeViewRoles").in(criteriaClass.getNegativeViewRoles())); + } + if (criteriaClass.getTags() != null) { + criteriaClass.getTags().entrySet().forEach(stringStringEntry -> this.addValueCriteria(query, queryTotal, Criteria.where("tags." + stringStringEntry.getKey()).is(stringStringEntry.getValue()))); + } query.with(pageable); List nets = mongoTemplate.find(query, PetriNet.class); - return new PageImpl<>(nets.stream().map(net -> new PetriNetReference(net, locale)).collect(Collectors.toList()), pageable, mongoTemplate.count(query_total, PetriNet.class)); + return new PageImpl<>(nets.stream().map(net -> new PetriNetReference(net, locale)).collect(Collectors.toList()), pageable, mongoTemplate.count(queryTotal, PetriNet.class)); + } + + private void addValueCriteria(Query query, Query queryTotal, Criteria criteria) { + query.addCriteria(criteria); + queryTotal.addCriteria(criteria); } @Override diff --git a/src/main/java/com/netgrif/application/engine/petrinet/service/interfaces/IPetriNetService.java b/src/main/java/com/netgrif/application/engine/petrinet/service/interfaces/IPetriNetService.java index a81623c075..33d1b8bb3c 100644 --- a/src/main/java/com/netgrif/application/engine/petrinet/service/interfaces/IPetriNetService.java +++ b/src/main/java/com/netgrif/application/engine/petrinet/service/interfaces/IPetriNetService.java @@ -3,6 +3,7 @@ import com.netgrif.application.engine.auth.domain.LoggedUser; import com.netgrif.application.engine.importer.service.throwable.MissingIconKeyException; import com.netgrif.application.engine.petrinet.domain.PetriNet; +import com.netgrif.application.engine.petrinet.domain.PetriNetSearch; import com.netgrif.application.engine.petrinet.domain.Transition; import com.netgrif.application.engine.petrinet.domain.VersionType; import com.netgrif.application.engine.petrinet.domain.dataset.Field; @@ -69,7 +70,7 @@ public interface IPetriNetService { List getDataFieldReferences(List transitions, Locale locale); - Page search(Map criteria, LoggedUser user, Pageable pageable, Locale locale); + Page search(PetriNetSearch criteria, LoggedUser user, Pageable pageable, Locale locale); Optional findByImportId(String id); diff --git a/src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java b/src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java index f1b2916c85..1f3099104d 100644 --- a/src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java +++ b/src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java @@ -6,6 +6,7 @@ import com.netgrif.application.engine.importer.service.Importer; import com.netgrif.application.engine.importer.service.throwable.MissingIconKeyException; import com.netgrif.application.engine.petrinet.domain.PetriNet; +import com.netgrif.application.engine.petrinet.domain.PetriNetSearch; import com.netgrif.application.engine.petrinet.domain.VersionType; import com.netgrif.application.engine.petrinet.domain.throwable.MissingPetriNetMetaDataException; import com.netgrif.application.engine.petrinet.domain.version.StringToVersionConverter; @@ -171,7 +172,7 @@ public FileSystemResource getNetFile(@PathVariable("netId") String netId, @Reque @Operation(summary = "Search processes", security = {@SecurityRequirement(name = "BasicAuth")}) @PostMapping(value = "/search", produces = MediaTypes.HAL_JSON_VALUE) public @ResponseBody - PagedModel searchPetriNets(@RequestBody Map criteria, Authentication auth, Pageable pageable, PagedResourcesAssembler assembler, Locale locale) { + PagedModel searchPetriNets(@RequestBody PetriNetSearch criteria, Authentication auth, Pageable pageable, PagedResourcesAssembler assembler, Locale locale) { LoggedUser user = (LoggedUser) auth.getPrincipal(); Page nets = service.search(criteria, user, pageable, locale); Link selfLink = WebMvcLinkBuilder.linkTo(WebMvcLinkBuilder.methodOn(PetriNetController.class) diff --git a/src/main/java/com/netgrif/application/engine/petrinet/web/PublicPetriNetController.java b/src/main/java/com/netgrif/application/engine/petrinet/web/PublicPetriNetController.java index 614c464ad2..4075a55230 100644 --- a/src/main/java/com/netgrif/application/engine/petrinet/web/PublicPetriNetController.java +++ b/src/main/java/com/netgrif/application/engine/petrinet/web/PublicPetriNetController.java @@ -2,6 +2,7 @@ import com.netgrif.application.engine.auth.service.interfaces.IUserService; import com.netgrif.application.engine.petrinet.domain.PetriNet; +import com.netgrif.application.engine.petrinet.domain.PetriNetSearch; import com.netgrif.application.engine.petrinet.domain.version.StringToVersionConverter; import com.netgrif.application.engine.petrinet.service.interfaces.IPetriNetService; import com.netgrif.application.engine.petrinet.service.interfaces.IProcessRoleService; @@ -69,7 +70,7 @@ public PetriNetReferenceResource getOne(@PathVariable("identifier") String ident @Operation(summary = "Search processes") @PostMapping(value = "/search", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaTypes.HAL_JSON_VALUE) - public PagedModel searchPetriNets(@RequestBody Map criteria, Pageable pageable, PagedResourcesAssembler assembler, Locale locale) { + public PagedModel searchPetriNets(@RequestBody PetriNetSearch criteria, Pageable pageable, PagedResourcesAssembler assembler, Locale locale) { Page nets = petriNetService.search(criteria, userService.getAnonymousLogged(), pageable, locale); Link selfLink = WebMvcLinkBuilder.linkTo(WebMvcLinkBuilder.methodOn(PublicPetriNetController.class) .searchPetriNets(criteria, pageable, assembler, locale)).withRel("search"); diff --git a/src/main/java/com/netgrif/application/engine/workflow/service/CaseSearchService.java b/src/main/java/com/netgrif/application/engine/workflow/service/CaseSearchService.java index e50ed5eb7f..0ba4cfc56d 100644 --- a/src/main/java/com/netgrif/application/engine/workflow/service/CaseSearchService.java +++ b/src/main/java/com/netgrif/application/engine/workflow/service/CaseSearchService.java @@ -4,6 +4,7 @@ import com.netgrif.application.engine.importer.service.FieldFactory; import com.netgrif.application.engine.petrinet.domain.I18nString; import com.netgrif.application.engine.petrinet.domain.PetriNet; +import com.netgrif.application.engine.petrinet.domain.PetriNetSearch; import com.netgrif.application.engine.petrinet.domain.dataset.FieldType; import com.netgrif.application.engine.petrinet.domain.dataset.UserFieldValue; import com.netgrif.application.engine.petrinet.service.interfaces.IPetriNetService; @@ -347,8 +348,12 @@ private static BooleanExpression caseIdString(String caseId) { } public Predicate group(Object query, LoggedUser user, Locale locale) { - Map processQuery = new HashMap<>(); - processQuery.put(GROUP, query); + PetriNetSearch processQuery = new PetriNetSearch(); + if (query instanceof List) { + processQuery.setGroup((List) query); + } else if (query instanceof String) { + processQuery.setGroup(new ArrayList( Arrays.asList((String) query)) ); + } List groupProcesses = this.petriNetService.search(processQuery, user, new FullPageRequest(), locale).getContent(); if (groupProcesses.size() == 0) return null; diff --git a/src/main/java/com/netgrif/application/engine/workflow/service/ConfigurableMenuService.java b/src/main/java/com/netgrif/application/engine/workflow/service/ConfigurableMenuService.java index cc531cb835..a8bafae797 100644 --- a/src/main/java/com/netgrif/application/engine/workflow/service/ConfigurableMenuService.java +++ b/src/main/java/com/netgrif/application/engine/workflow/service/ConfigurableMenuService.java @@ -1,9 +1,11 @@ package com.netgrif.application.engine.workflow.service; +import com.netgrif.application.engine.auth.domain.Author; import com.netgrif.application.engine.auth.domain.LoggedUser; import com.netgrif.application.engine.auth.domain.User; import com.netgrif.application.engine.petrinet.domain.I18nString; import com.netgrif.application.engine.petrinet.domain.PetriNet; +import com.netgrif.application.engine.petrinet.domain.PetriNetSearch; import com.netgrif.application.engine.petrinet.domain.dataset.EnumerationMapField; import com.netgrif.application.engine.petrinet.domain.dataset.MultichoiceMapField; import com.netgrif.application.engine.petrinet.domain.version.StringToVersionConverter; @@ -43,8 +45,10 @@ public class ConfigurableMenuService implements IConfigurableMenuService { @Override public Map getNetsByAuthorAsMapOptions(User author, Locale locale){ LoggedUser loggedAuthor = author.transformToLoggedUser(); - Map requestQuery = new HashMap<>(); - requestQuery.put("author.email", author.getEmail()); + PetriNetSearch requestQuery = new PetriNetSearch(); + Author authorQuery = new Author(); + authorQuery.setEmail(author.getEmail()); + requestQuery.setAuthor(authorQuery); List nets = this.petriNetService.search(requestQuery, loggedAuthor, new FullPageRequest(), locale).getContent(); Map options = new HashMap<>(); diff --git a/src/main/java/com/netgrif/application/engine/workflow/service/TaskSearchService.java b/src/main/java/com/netgrif/application/engine/workflow/service/TaskSearchService.java index 743ad4f05f..aace6fb034 100644 --- a/src/main/java/com/netgrif/application/engine/workflow/service/TaskSearchService.java +++ b/src/main/java/com/netgrif/application/engine/workflow/service/TaskSearchService.java @@ -1,6 +1,7 @@ package com.netgrif.application.engine.workflow.service; import com.netgrif.application.engine.auth.domain.LoggedUser; +import com.netgrif.application.engine.petrinet.domain.PetriNetSearch; import com.netgrif.application.engine.petrinet.service.interfaces.IPetriNetService; import com.netgrif.application.engine.petrinet.web.responsebodies.PetriNetReference; import com.netgrif.application.engine.utils.FullPageRequest; @@ -271,8 +272,8 @@ public boolean buildGroupQuery(TaskSearchRequest request, LoggedUser user, Local if (request.group == null || request.group.isEmpty()) return false; - Map processQuery = new HashMap<>(); - processQuery.put("group", request.group); + PetriNetSearch processQuery = new PetriNetSearch(); + processQuery.setGroup(request.group); List groupProcesses = this.petriNetService.search(processQuery, user, new FullPageRequest(), locale).getContent(); if (groupProcesses.size() == 0) return true; diff --git a/src/test/groovy/com/netgrif/application/engine/petrinet/service/PetriNetServiceTest.groovy b/src/test/groovy/com/netgrif/application/engine/petrinet/service/PetriNetServiceTest.groovy index 353717829c..3667da365b 100644 --- a/src/test/groovy/com/netgrif/application/engine/petrinet/service/PetriNetServiceTest.groovy +++ b/src/test/groovy/com/netgrif/application/engine/petrinet/service/PetriNetServiceTest.groovy @@ -1,6 +1,7 @@ package com.netgrif.application.engine.petrinet.service import com.netgrif.application.engine.TestHelper +import com.netgrif.application.engine.auth.domain.Author import com.netgrif.application.engine.auth.domain.Authority import com.netgrif.application.engine.auth.domain.User import com.netgrif.application.engine.auth.domain.UserState @@ -8,18 +9,20 @@ import com.netgrif.application.engine.auth.service.interfaces.IUserService import com.netgrif.application.engine.elastic.domain.ElasticPetriNet import com.netgrif.application.engine.elastic.domain.ElasticPetriNetRepository import com.netgrif.application.engine.ipc.TaskApiTest +import com.netgrif.application.engine.petrinet.domain.I18nString import com.netgrif.application.engine.petrinet.domain.PetriNet +import com.netgrif.application.engine.petrinet.domain.PetriNetSearch import com.netgrif.application.engine.petrinet.domain.UriContentType import com.netgrif.application.engine.petrinet.domain.UriNode import com.netgrif.application.engine.petrinet.domain.VersionType import com.netgrif.application.engine.petrinet.domain.repositories.PetriNetRepository import com.netgrif.application.engine.petrinet.domain.roles.ProcessRole import com.netgrif.application.engine.petrinet.domain.roles.ProcessRoleRepository +import com.netgrif.application.engine.petrinet.domain.version.Version import com.netgrif.application.engine.petrinet.service.interfaces.IPetriNetService import com.netgrif.application.engine.petrinet.service.interfaces.IProcessRoleService import com.netgrif.application.engine.startup.ImportHelper import com.netgrif.application.engine.startup.SuperCreator -import com.netgrif.application.engine.utils.FullPageRequest import com.netgrif.application.engine.workflow.domain.eventoutcomes.petrinetoutcomes.ImportPetriNetEventOutcome import com.netgrif.application.engine.workflow.domain.repositories.CaseRepository import com.netgrif.application.engine.workflow.domain.repositories.TaskRepository @@ -31,9 +34,13 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest +import org.springframework.context.i18n.LocaleContextHolder +import org.springframework.data.domain.PageRequest import org.springframework.test.context.ActiveProfiles import org.springframework.test.context.junit.jupiter.SpringExtension +import java.time.LocalDateTime + @Disabled @ExtendWith(SpringExtension.class) @ActiveProfiles(["test"]) @@ -41,6 +48,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension class PetriNetServiceTest { public static final String NET_FILE = "process_delete_test.xml" + public static final String NET_SEARCH_FILE = "process_search_test.xml" public static final String CUSTOMER_USER_MAIL = "customer@netgrif.com" @Autowired @@ -160,4 +168,65 @@ class PetriNetServiceTest { List petriNets = petriNetService.findAllByUriNodeId(myNode.id) assert petriNets.size() == 2 } + + @Test + void processSearch() { + long processCount = petriNetRepository.count() + + + def user = userService.findByEmail(CUSTOMER_USER_MAIL, false) + assert user != null + petriNetService.importPetriNet(stream(NET_FILE), VersionType.MAJOR, superCreator.getLoggedSuper()) + petriNetService.importPetriNet(stream(NET_SEARCH_FILE), VersionType.MAJOR, user.transformToLoggedUser()) + + assert petriNetRepository.count() == processCount + 2 + + PetriNetSearch search = new PetriNetSearch(); + assert petriNetService.search(search, superCreator.getLoggedSuper(), PageRequest.of(0, 50), LocaleContextHolder.locale).getNumberOfElements() == processCount + 2; + + PetriNetSearch search1 = new PetriNetSearch(); + search1.setIdentifier("processSearchTest"); + assert petriNetService.search(search1, superCreator.getLoggedSuper(), PageRequest.of(0, 50), LocaleContextHolder.locale).getNumberOfElements() == 1; + + PetriNetSearch search2 = new PetriNetSearch(); + search2.setTitle("Process Search Test"); + assert petriNetService.search(search2, superCreator.getLoggedSuper(), PageRequest.of(0, 50), LocaleContextHolder.locale).getNumberOfElements() == 1; + + PetriNetSearch search3 = new PetriNetSearch(); + search3.setDefaultCaseName("Process Search Case Name"); + assert petriNetService.search(search3, superCreator.getLoggedSuper(), PageRequest.of(0, 50), LocaleContextHolder.locale).getNumberOfElements() == 1; + + PetriNetSearch search4 = new PetriNetSearch(); + search4.setInitials("PST"); + assert petriNetService.search(search4, superCreator.getLoggedSuper(), PageRequest.of(0, 50), LocaleContextHolder.locale).getNumberOfElements() == 1; + + + PetriNetSearch search5 = new PetriNetSearch(); + Author author = new Author(); + author.setEmail(user.getEmail()); + search5.setAuthor(author); + assert petriNetService.search(search5, superCreator.getLoggedSuper(), PageRequest.of(0, 50), LocaleContextHolder.locale).getNumberOfElements() == 1; + + + PetriNetSearch search6 = new PetriNetSearch(); + search6.setVersion(new Version(1,0,0)); + assert petriNetService.search(search6, superCreator.getLoggedSuper(), PageRequest.of(0, 50), LocaleContextHolder.locale).getNumberOfElements() == processCount + 2; + + PetriNetSearch search7 = new PetriNetSearch(); + HashMap map = new HashMap(); + map.put("test", "test"); + search7.setTags(map); + assert petriNetService.search(search7, superCreator.getLoggedSuper(), PageRequest.of(0, 50), LocaleContextHolder.locale).getNumberOfElements() == 1; + + PetriNetSearch search8 = new PetriNetSearch(); + HashMap mapTags = new HashMap(); + mapTags.put("test", "test"); + search8.setTags(mapTags); + search8.setIdentifier("processSearchTest"); + search8.setTitle("Process Search Test"); + search8.setDefaultCaseName("Process Search Case Name"); + search8.setInitials("PST"); + search8.setAuthor(author); + assert petriNetService.search(search8, superCreator.getLoggedSuper(), PageRequest.of(0, 50), LocaleContextHolder.locale).getNumberOfElements() == 1; + } } diff --git a/src/test/resources/process_search_test.xml b/src/test/resources/process_search_test.xml new file mode 100644 index 0000000000..f92fedb067 --- /dev/null +++ b/src/test/resources/process_search_test.xml @@ -0,0 +1,39 @@ + + + processSearchTest + PST + Process Search Test + Process Search Case Name + false + + test + + + + + role1 + Role 1 + + + role2 + Role 2 + + + + + + 1 + 553 + 304 + + + + 2 + 653 + 304 + + + + +