Skip to content

[NAE-1895] Setter Injection #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: release/6.4.0
Choose a base branch
from
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
12 changes: 10 additions & 2 deletions src/main/groovy/com/netgrif/application/engine/DevConsole.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,20 @@ class DevConsole {

private static final Logger log = LoggerFactory.getLogger(DevConsole)

@Autowired
private CaseRepository caseRepository

@Autowired
private PetriNetRepository netRepository

@Autowired
void setCaseRepository(CaseRepository caseRepository) {
this.caseRepository = caseRepository
}

@Autowired
void setNetRepository(PetriNetRepository netRepository) {
this.netRepository = netRepository
}

@GetMapping(value = "/dataset/{title}", produces = APPLICATION_JSON_VALUE)
String dataset(@PathVariable String title) {
def useCase = caseRepository.findAll().find { it.title == title }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ import java.util.stream.Collectors
@Slf4j
class ActionMigration {

@Autowired
private IPetriNetService petriNetService

@Autowired
private IUserService userService;

@Autowired
void setPetriNetService(IPetriNetService petriNetService) {
this.petriNetService = petriNetService
}

@Autowired
void setUserService(IUserService userService) {
this.userService = userService
}

void migrateActions(String petriNetPath) {
InputStream netStream = new ClassPathResource(petriNetPath).inputStream
ImportPetriNetEventOutcome newPetriNet = petriNetService.importPetriNet(netStream, VersionType.MAJOR, userService.loggedOrSystem.transformToLoggedUser())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@ abstract class MigrationOrderedCommandLineRunner extends AbstractOrderedCommandL

private String title = this.class.simpleName

@Autowired
private MigrationRepository repository

@Autowired
private IPetriNetService service

@Autowired
void setRepository(MigrationRepository repository) {
this.repository = repository
}

@Autowired
void setService(IPetriNetService service) {
this.service = service
}

@Override
void run(String... strings) throws Exception {
if (repository.existsByTitle(title)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,104 +98,192 @@ class ActionDelegate {
@Value('${nae.create.default.filters:false}')
private Boolean createDefaultFilters

@Autowired
FieldFactory fieldFactory

@Autowired
TaskService taskService
IDataService dataService
IWorkflowService workflowService
IUserService userService
IPetriNetService petriNetService
AsyncRunner async
IPdfGenerator pdfGenerator
IMailService mailService
INextGroupService nextGroupService
IRegistrationService registrationService
IMailAttemptService mailAttemptService
UserDetailsServiceImpl userDetailsService
IDataValidationExpressionEvaluator dataValidationExpressionEvaluator
IInitValueExpressionEvaluator initValueExpressionEvaluator
RuleRepository ruleRepository
Scheduler scheduler
IUserFilterSearchService filterSearchService
IConfigurableMenuService configurableMenuService
IMenuImportExportService menuImportExportService
IFilterImportExportService filterImportExportService
IExportService exportService
IElasticCaseService elasticCaseService
IElasticTaskService elasticTaskService
ExportConfiguration exportConfiguration
IUriService uriService
IImpersonationService impersonationService
IHistoryService historyService
PublicViewProperties publicViewProperties

FrontendActionOutcome Frontend

/**
* Reference of case and task in which current action is taking place.
*/
Case useCase
Optional<Task> task
def map = [:]
Action action
FieldActionsRunner actionsRunner
List<EventOutcome> outcomes

@Autowired
IDataService dataService
void setFieldFactory(FieldFactory fieldFactory) {
this.fieldFactory = fieldFactory
}

@Autowired
IWorkflowService workflowService
void setTaskService(TaskService taskService) {
this.taskService = taskService
}

@Autowired
IUserService userService
void setDataService(IDataService dataService) {
this.dataService = dataService
}

@Autowired
IPetriNetService petriNetService
void setWorkflowService(IWorkflowService workflowService) {
this.workflowService = workflowService
}

@Autowired
AsyncRunner async
void setUserService(IUserService userService) {
this.userService = userService
}

@Autowired
IPdfGenerator pdfGenerator
void setPetriNetService(IPetriNetService petriNetService) {
this.petriNetService = petriNetService
}

@Autowired
IMailService mailService
void setAsync(AsyncRunner async) {
this.async = async
}

@Autowired
INextGroupService nextGroupService
void setPdfGenerator(IPdfGenerator pdfGenerator) {
this.pdfGenerator = pdfGenerator
}

@Autowired
IRegistrationService registrationService
void setMailService(IMailService mailService) {
this.mailService = mailService
}

@Autowired
IMailAttemptService mailAttemptService
void setNextGroupService(INextGroupService nextGroupService) {
this.nextGroupService = nextGroupService
}

@Autowired
UserDetailsServiceImpl userDetailsService
void setRegistrationService(IRegistrationService registrationService) {
this.registrationService = registrationService
}

@Autowired
IDataValidationExpressionEvaluator dataValidationExpressionEvaluator
void setMailAttemptService(IMailAttemptService mailAttemptService) {
this.mailAttemptService = mailAttemptService
}

@Autowired
IInitValueExpressionEvaluator initValueExpressionEvaluator
void setUserDetailsService(UserDetailsServiceImpl userDetailsService) {
this.userDetailsService = userDetailsService
}

@Autowired
RuleRepository ruleRepository
void setDataValidationExpressionEvaluator(IDataValidationExpressionEvaluator dataValidationExpressionEvaluator) {
this.dataValidationExpressionEvaluator = dataValidationExpressionEvaluator
}

@Autowired
Scheduler scheduler
void setInitValueExpressionEvaluator(IInitValueExpressionEvaluator initValueExpressionEvaluator) {
this.initValueExpressionEvaluator = initValueExpressionEvaluator
}

@Autowired
IUserFilterSearchService filterSearchService
void setRuleRepository(RuleRepository ruleRepository) {
this.ruleRepository = ruleRepository
}

@Autowired
IConfigurableMenuService configurableMenuService
void setScheduler(Scheduler scheduler) {
this.scheduler = scheduler
}

@Autowired
IMenuImportExportService menuImportExportService
void setFilterSearchService(IUserFilterSearchService filterSearchService) {
this.filterSearchService = filterSearchService
}

@Autowired
IFilterImportExportService filterImportExportService
void setConfigurableMenuService(IConfigurableMenuService configurableMenuService) {
this.configurableMenuService = configurableMenuService
}

@Autowired
IExportService exportService
void setMenuImportExportService(IMenuImportExportService menuImportExportService) {
this.menuImportExportService = menuImportExportService
}

@Autowired
IElasticCaseService elasticCaseService
void setFilterImportExportService(IFilterImportExportService filterImportExportService) {
this.filterImportExportService = filterImportExportService
}

@Autowired
IElasticTaskService elasticTaskService
void setExportService(IExportService exportService) {
this.exportService = exportService
}

@Autowired
ExportConfiguration exportConfiguration
void setElasticCaseService(IElasticCaseService elasticCaseService) {
this.elasticCaseService = elasticCaseService
}

@Autowired
IUriService uriService
void setElasticTaskService(IElasticTaskService elasticTaskService) {
this.elasticTaskService = elasticTaskService
}

@Autowired
IImpersonationService impersonationService
void setExportConfiguration(ExportConfiguration exportConfiguration) {
this.exportConfiguration = exportConfiguration
}

@Autowired
IHistoryService historyService
void setUriService(IUriService uriService) {
this.uriService = uriService
}

@Autowired
PublicViewProperties publicViewProperties
void setImpersonationService(IImpersonationService impersonationService) {
this.impersonationService = impersonationService
}

FrontendActionOutcome Frontend
@Autowired
void setHistoryService(IHistoryService historyService) {
this.historyService = historyService
}

/**
* Reference of case and task in which current action is taking place.
*/
Case useCase
Optional<Task> task
def map = [:]
Action action
FieldActionsRunner actionsRunner
List<EventOutcome> outcomes
@Autowired
void setPublicViewProperties(PublicViewProperties publicViewProperties) {
this.publicViewProperties = publicViewProperties
}

def init(Action action, Case useCase, Optional<Task> task, FieldActionsRunner actionsRunner) {
this.action = action
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,36 @@ abstract class FieldActionsRunner {
@Lookup("actionDelegate")
abstract ActionDelegate getActionDeleget()

@Autowired
private IOrsrService orsrService

@Autowired
private IPostalCodeService postalCodeService

@Autowired
private FieldFactory fieldFactory

@Autowired
private IFieldActionsCacheService actionsCacheService

private Map<String, Object> actionsCache = new HashMap<>()

@Autowired
void setOrsrService(IOrsrService orsrService) {
this.orsrService = orsrService
}

@Autowired
void setPostalCodeService(IPostalCodeService postalCodeService) {
this.postalCodeService = postalCodeService
}

@Autowired
void setFieldFactory(FieldFactory fieldFactory) {
this.fieldFactory = fieldFactory
}

@Autowired
void setActionsCacheService(IFieldActionsCacheService actionsCacheService) {
this.actionsCacheService = actionsCacheService
}

List<EventOutcome> run(Action action, Case useCase, List<Function> functions = []) {
return run(action, useCase, Optional.empty(), functions)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,32 @@ import org.springframework.stereotype.Component
@SuppressWarnings(["GrMethodMayBeStatic", "GroovyUnusedDeclaration"])
class RoleActionDelegate extends AbstractActionDelegate<RoleContext> {

@Autowired
IUserService userService

@Autowired
IPetriNetService petriNetService

@Autowired
IProcessRoleService processRoleService

Action action
ProcessRole processRole
PetriNet petriNet
def affectedUser

@Autowired
void setUserService(IUserService userService) {
this.userService = userService
}

@Autowired
void setPetriNetService(IPetriNetService petriNetService) {
this.petriNetService = petriNetService
}

@Autowired
void setProcessRoleService(IProcessRoleService processRoleService) {
this.processRoleService = processRoleService
}

def init(Action action, RoleContext roleContext) {
this.action = action
this.actionContext = actionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ abstract class CaseFieldsExpressionRunner {
@Lookup("actionDelegate")
abstract ActionDelegate getActionDelegate()

@Autowired
private IGroovyShellFactory shellFactory

private int cacheSize

private Map<String, Closure> cache = new MaxSizeHashMap<>(cacheSize)

@Autowired
void setShellFactory(IGroovyShellFactory shellFactory) {
this.shellFactory = shellFactory
}

@Autowired
CaseFieldsExpressionRunner(@Value('${nae.expressions.runner.cache-size}') int cacheSize) {
this.cacheSize = cacheSize
Expand Down
Loading