Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.boot.ApplicationArguments
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.core.annotation.AnnotatedElementUtils
import org.springframework.stereotype.Component

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.netgrif.application.engine.objects.workflow.domain.eventoutcomes.petr
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.core.io.ClassPathResource
import org.springframework.data.domain.Pageable
import org.springframework.stereotype.Component

import java.util.stream.Collectors
Expand All @@ -23,7 +24,7 @@ class ActionMigration {
@Autowired
private UserService userService;

void migrateActions(String petriNetPath) {
void migrateActions(String petriNetPath, Pageable pageable = Pageable.unpaged()) {
InputStream netStream = new ClassPathResource(petriNetPath).inputStream
ImportPetriNetEventOutcome newPetriNet = petriNetService.importPetriNet(netStream, VersionType.MAJOR, ActorTransformer.toLoggedUser(userService.getLoggedOrSystem()))
List<PetriNet> oldPetriNets
Expand All @@ -33,7 +34,7 @@ class ActionMigration {
log.error(message)
throw new IllegalArgumentException(message)
} else {
oldPetriNets = petriNetService.getByIdentifier(newPetriNet.getNet().importId)
oldPetriNets = petriNetService.getByIdentifier(newPetriNet.getNet().importId, pageable)
.stream().filter({ net -> (net.version != newPetriNet.getNet().version)})
.collect(Collectors.toList())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1024,8 +1024,8 @@ class ActionDelegate {
return actualUser
}

AbstractUser assignRole(String roleId, String netId, AbstractUser user = userService.loggedUser) {
List<PetriNet> nets = petriNetService.getByIdentifier(netId)
AbstractUser assignRole(String roleId, String netId, AbstractUser user = userService.loggedUser, Pageable pageable = Pageable.unpaged()) {
List<PetriNet> nets = petriNetService.getByIdentifier(netId, pageable).content
nets.forEach({ net -> user = assignRole(roleId, net, user) })
return user
}
Expand All @@ -1045,8 +1045,8 @@ class ActionDelegate {
return actualUser
}

AbstractUser removeRole(String roleId, String netId, AbstractUser user = userService.loggedUser) {
List<PetriNet> nets = petriNetService.getByIdentifier(netId)
AbstractUser removeRole(String roleId, String netId, AbstractUser user = userService.loggedUser, Pageable pageable = Pageable.unpaged()) {
List<PetriNet> nets = petriNetService.getByIdentifier(netId, pageable).content
nets.forEach({ net -> user = removeRole(roleId, net, user) })
return user
}
Expand Down Expand Up @@ -1321,7 +1321,12 @@ class ActionDelegate {
}

def changeUserByEmail(String email, String attribute, def cl) {
AbstractUser user = userService.findUserByUsername(email, null)
Optional<AbstractUser> userOptional = userService.findUserByUsername(email, null)
if (!userOptional.isPresent()) {
log.error("Cannot find user with email [" + email + "]")
return
}
AbstractUser user = userOptional.get()
changeUser(user, attribute, cl)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ImportHelper {
}

Optional<PetriNet> createNet(String fileName, String release, LoggedUser author = ActorTransformer.toLoggedUser(userService.getSystem())) {
return createNet(fileName, VersionType.valueOf(release.trim().toUpperCase()), author, uriNodeId)
return createNet(fileName, VersionType.valueOf(release.trim().toUpperCase()), author)
}

Optional<PetriNet> createNet(String fileName, VersionType release = VersionType.MAJOR, LoggedUser author = ActorTransformer.toLoggedUser(userService.getSystem())) {
Expand Down Expand Up @@ -167,7 +167,7 @@ class ImportHelper {
}

Map<String, ProcessRole> getProcessRoles(PetriNet net) {
List<ProcessRole> roles = processRoleService.findAll(net.stringId)
List<ProcessRole> roles = processRoleService.findAllByNetStringId(net.stringId)
Map<String, ProcessRole> map = [:]
net.roles.values().each { netRole ->
map[netRole.name.getDefaultValue()] = roles.find { it.stringId == netRole.stringId }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.netgrif.application.engine.workflow.service;

import com.netgrif.application.engine.adapter.spring.auth.domain.LoggedUserImpl;
import com.netgrif.application.engine.auth.service.UserService;
import com.netgrif.application.engine.objects.auth.domain.AbstractUser;
import com.netgrif.application.engine.objects.auth.domain.LoggedUser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotWritableException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class PetriNetTest {
def lastImport = petriNetService.importPetriNet(netResource4.inputStream, VersionType.PATCH, superCreator.loggedSuper)
assert lastImport.getNet().version.toString() == "3.1.1"

Page<PetriNetReference> nets = petriNetService.getByIdentifier(zeroImport.getNet().identifier, Pageable.unpaged())
Page<PetriNet> nets = petriNetService.getByIdentifier(zeroImport.getNet().identifier, Pageable.unpaged())
assert nets.getSize() == 5
}

Expand Down
Loading