Skip to content

[NAE-2055] Rework enum registry to service registry #291

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 42 commits into
base: release/6.5.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d02feea
[NAE-2034] Otvorenie prvého viewu
Retoocs Jan 28, 2025
458b89e
[NAE-2033] Úvodný dashboard
camperko Feb 5, 2025
c61be81
Merge remote-tracking branch 'origin/NAE-2034' into NAE-2033
camperko Feb 5, 2025
8bf002e
[NAE-2033] Úvodný dashboard
camperko Feb 7, 2025
c7cb0d2
[NAE-2033] Úvodný dashboard
camperko Feb 7, 2025
16a3cd6
[NAE-2051] Implementovat moznost volby komponentu zobrazenia v menu i…
Retoocs Feb 10, 2025
12c6379
[NAE-2051] Implementovat moznost volby komponentu zobrazenia v menu i…
Retoocs Feb 10, 2025
860b0d0
[NAE-2051] Implementovat moznost volby komponentu zobrazenia v menu i…
Retoocs Feb 10, 2025
255340f
[NAE-2051] Implement configurable view in menu items
Retoocs Feb 11, 2025
2bde47c
[NAE-2051] Implement configurable view in menu items
Retoocs Feb 11, 2025
570a7ad
[NAE-2051] Implement configurable view in menu items
Retoocs Feb 12, 2025
6c71bdb
[NAE-2051] Implement configurable view in menu items
Retoocs Feb 12, 2025
06d484d
[NAE-2033] Úvodný dashboard
camperko Feb 13, 2025
a5e0350
[NAE-2052] Integrate ticket view with menu items
Retoocs Feb 13, 2025
1097ea3
[NAE-2033] Úvodný dashboard
camperko Feb 13, 2025
9dc653e
[NAE-2033] Úvodný dashboard
camperko Feb 13, 2025
dd06c6e
[NAE-2052] Integrate ticket view with menu items
Retoocs Feb 14, 2025
7971f6d
[NAE-2052] Integrate ticket view with menu items
Retoocs Feb 14, 2025
817cb99
[NAE-2033] Úvodný dashboard
camperko Feb 14, 2025
be3da23
[NAE-2039] Search in workflow view
Kovy95 Feb 14, 2025
e3f80ab
[NAE-2039] Search in workflow view
Kovy95 Feb 14, 2025
145e3e0
[NAE-2052] Integrate ticket view with menu items
Retoocs Feb 14, 2025
1c16250
[NAE-2033] Úvodný dashboard
camperko Feb 14, 2025
7211660
[NAE-2039] Search in workflow view
Kovy95 Feb 14, 2025
fa81b02
[NAE-2052] Integrate ticket view with menu items
Retoocs Feb 14, 2025
4940da2
Merge remote-tracking branch 'origin/NAE-2051' into NAE-2054
Kovy95 Feb 17, 2025
c550d27
[NAE-2054] Release 6.5.0 CE
Kovy95 Feb 17, 2025
9cebf5f
Merge remote-tracking branch 'origin/NAE-2039' into NAE-2054
Kovy95 Feb 17, 2025
c47db8d
Merge remote-tracking branch 'origin/NAE-2052' into NAE-2054
Kovy95 Feb 17, 2025
32c8a4b
[NAE-2055] Rework enum registry to service registry
Retoocs Feb 17, 2025
56d016a
Revert "[NAE-2055] Rework enum registry to service registry"
Retoocs Feb 17, 2025
afe468f
[NAE-2051] Implement configurable view in menu items
Retoocs Feb 17, 2025
438bb1d
Merge remote-tracking branch 'origin/NAE-2051' into NAE-2052
Retoocs Feb 17, 2025
0881cf9
[NAE-2055] Rework enum registry to service registry
Retoocs Feb 17, 2025
32f4c1a
[NAE-2054] Release 6.5.0 CE
Kovy95 Feb 17, 2025
9606298
Merge remote-tracking branch 'origin/NAE-2052' into NAE-2054
Kovy95 Feb 17, 2025
1fa70e9
[NAE-2054] Release 6.5.0 CE
Retoocs Feb 17, 2025
97fb697
[NAE-2055] Rework enum registry to service registry
Retoocs Feb 17, 2025
5eca9de
[NAE-2051] Implement configurable view in menu items
Retoocs Feb 17, 2025
810507d
[NAE-2055] Rework enum registry to service registry
Retoocs Feb 17, 2025
bc3e5b1
Merge remote-tracking branch 'origin/NAE-2054' into NAE-2055
Retoocs Feb 17, 2025
68464fc
[NAE-2055] Rework enum registry to service registry
Retoocs Feb 18, 2025
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.netgrif.application.engine.startup

import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.stereotype.Component

@Slf4j
@Component
@ConditionalOnProperty(value = "nae.dashboard-management.enabled", matchIfMissing = true)
class DashboardManagementRunner extends AbstractOrderedCommandLineRunner {

@Autowired
private ImportHelper helper

public static final String DASHBOARD_MANAGEMENT_NET_IDENTIFIER = "dashboard_management"
private static final String DASHBOARD_MANAGEMENT_FILE_NAME = "engine-processes/dashboard_management.xml"

public static final String DASHBOARD_ITEM_NET_IDENTIFIER = "dashboard_item"
private static final String DASHBOARD_ITEM_FILE_NAME = "engine-processes/dashboard_item.xml"

@Override
void run(String... args) throws Exception {
helper.importProcess("Petri net for filters", DASHBOARD_MANAGEMENT_NET_IDENTIFIER, DASHBOARD_MANAGEMENT_FILE_NAME)
helper.importProcess("Petri net for filter preferences", DASHBOARD_ITEM_NET_IDENTIFIER, DASHBOARD_ITEM_FILE_NAME)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.netgrif.application.engine.startup

import com.netgrif.application.engine.petrinet.domain.PetriNet
import com.netgrif.application.engine.petrinet.domain.VersionType
import com.netgrif.application.engine.petrinet.service.interfaces.IPetriNetService
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
Expand All @@ -13,15 +10,9 @@ import org.springframework.stereotype.Component
@ConditionalOnProperty(value = "nae.dashboard.enabled", matchIfMissing = false)
class DashboardRunner extends AbstractOrderedCommandLineRunner {

@Autowired
private IPetriNetService petriNetService

@Autowired
private ImportHelper helper

@Autowired
private SystemUserRunner systemCreator

public static final String DASHBOARD_NET_IDENTIFIER = "dashboard"
private static final String DASHBOARD_FILE_NAME = "engine-processes/dashboard.xml"

Expand All @@ -30,32 +21,7 @@ class DashboardRunner extends AbstractOrderedCommandLineRunner {

@Override
void run(String... args) throws Exception {
createDashboardNet()
createDashboardTileNet()
}

Optional<PetriNet> createDashboardNet() {
importProcess("Petri net for filters", DASHBOARD_NET_IDENTIFIER, DASHBOARD_FILE_NAME)
}

Optional<PetriNet> createDashboardTileNet() {
importProcess("Petri net for filter preferences", DASHBOARD_TILE_NET_IDENTIFIER, DASHBOARD_TILE_FILE_NAME)
}


Optional<PetriNet> importProcess(String message, String netIdentifier, String netFileName) {
PetriNet filter = petriNetService.getNewestVersionByIdentifier(netIdentifier)
if (filter != null) {
log.info("${message} has already been imported.")
return Optional.of(filter)
}

Optional<PetriNet> filterNet = helper.createNet(netFileName, VersionType.MAJOR, systemCreator.loggedSystem)

if (!filterNet.isPresent()) {
log.error("Import of ${message} failed!")
}

return filterNet
helper.importProcess("Petri net for filters", DASHBOARD_NET_IDENTIFIER, DASHBOARD_FILE_NAME)
helper.importProcess("Petri net for filter preferences", DASHBOARD_TILE_NET_IDENTIFIER, DASHBOARD_TILE_FILE_NAME)
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.netgrif.application.engine.startup

import com.netgrif.application.engine.menu.registry.interfaces.IMenuItemViewRegistry
import com.netgrif.application.engine.petrinet.domain.PetriNet
import com.netgrif.application.engine.petrinet.domain.VersionType
import com.netgrif.application.engine.petrinet.service.interfaces.IPetriNetService
import com.netgrif.application.engine.workflow.domain.eventoutcomes.petrinetoutcomes.ImportPetriNetEventOutcome
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
Expand All @@ -13,19 +12,22 @@ import org.springframework.stereotype.Component
class FilterRunner extends AbstractOrderedCommandLineRunner {

@Autowired
private IPetriNetService petriNetService
private ImportHelper helper

@Autowired
private ImportHelper helper
private IPetriNetService petriNetService

@Autowired
private SystemUserRunner systemCreator

@Autowired
private IMenuItemViewRegistry viewRegistry

private static final String FILTER_FILE_NAME = "engine-processes/filter.xml"
public static final String FILTER_PETRI_NET_IDENTIFIER = "filter"

private static final String PREFERRED_ITEM_FILE_NAME = "engine-processes/preference_item.xml"
public static final String PREFERRED_ITEM_NET_IDENTIFIER = "preference_item"
private static final String MENU_ITEM_FILE_NAME = "engine-processes/menu/menu_item.xml"
public static final String MENU_NET_IDENTIFIER = "menu_item"

private static final String EXPORT_FILTER_FILE_NAME = "engine-processes/export_filters.xml"
private static final String EXPORT_NET_IDENTIFIER = "export_filters"
Expand All @@ -35,41 +37,18 @@ class FilterRunner extends AbstractOrderedCommandLineRunner {

@Override
void run(String... args) throws Exception {
createFilterNet()
createPreferenceItemNet()
createImportFiltersNet()
createExportFiltersNet()
}

Optional<PetriNet> createFilterNet() {
importProcess("Petri net for filters", FILTER_PETRI_NET_IDENTIFIER, FILTER_FILE_NAME)
helper.importProcess("Petri net for filters", FILTER_PETRI_NET_IDENTIFIER, FILTER_FILE_NAME)
createConfigurationNets()
helper.importProcess("Petri net for filter preferences", MENU_NET_IDENTIFIER, MENU_ITEM_FILE_NAME)
helper.importProcess("Petri net for importing filters", IMPORT_NET_IDENTIFIER, IMPORT_FILTER_FILE_NAME)
helper.importProcess("Petri net for exporting filters", EXPORT_NET_IDENTIFIER, EXPORT_FILTER_FILE_NAME)
}

Optional<PetriNet> createPreferenceItemNet() {
importProcess("Petri net for filter preferences", PREFERRED_ITEM_NET_IDENTIFIER, PREFERRED_ITEM_FILE_NAME)
}

Optional<PetriNet> createImportFiltersNet() {
importProcess("Petri net for importing filters", IMPORT_NET_IDENTIFIER, IMPORT_FILTER_FILE_NAME)
}

Optional<PetriNet> createExportFiltersNet() {
importProcess("Petri net for exporting filters", EXPORT_NET_IDENTIFIER, EXPORT_FILTER_FILE_NAME)
}

Optional<PetriNet> importProcess(String message, String netIdentifier, String netFileName) {
PetriNet filter = petriNetService.getNewestVersionByIdentifier(netIdentifier)
if (filter != null) {
log.info("${message} has already been imported.")
return Optional.of(filter)
}

Optional<PetriNet> filterNet = helper.createNet(netFileName, VersionType.MAJOR, systemCreator.loggedSystem)

if (!filterNet.isPresent()) {
log.error("Import of ${message} failed!")
}

return filterNet
private List<PetriNet> createConfigurationNets() {
return viewRegistry.getAllViews().each { viewEntry ->
String processIdentifier = viewEntry.getKey() + "_configuration"
String filePath = String.format("engine-processes/menu/%s.xml", processIdentifier)
helper.importProcess(String.format("Petri net for %s", processIdentifier), processIdentifier, filePath)
}.collect()
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.netgrif.application.engine.startup

import com.netgrif.application.engine.petrinet.domain.PetriNet
import com.netgrif.application.engine.petrinet.domain.VersionType
import com.netgrif.application.engine.petrinet.service.interfaces.IPetriNetService
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
Expand All @@ -11,14 +8,9 @@ import org.springframework.stereotype.Component
@Component
class ImpersonationRunner extends AbstractOrderedCommandLineRunner {

@Autowired
protected IPetriNetService petriNetService

@Autowired
protected ImportHelper helper

@Autowired
protected SystemUserRunner systemCreator

protected static final String IMPERSONATION_CONFIG_FILE_NAME = "engine-processes/impersonation_config.xml"
public static final String IMPERSONATION_CONFIG_PETRI_NET_IDENTIFIER = "impersonation_config"
Expand All @@ -28,26 +20,7 @@ class ImpersonationRunner extends AbstractOrderedCommandLineRunner {

@Override
void run(String... args) throws Exception {
createConfigNets()
}

void createConfigNets() {
importProcess("Petri net for impersonation config", IMPERSONATION_CONFIG_PETRI_NET_IDENTIFIER, IMPERSONATION_CONFIG_FILE_NAME)
importProcess("Petri net for impersonation user select", IMPERSONATION_CONFIG_USER_SELECT_PETRI_NET_IDENTIFIER, IMPERSONATION_CONFIG_USER_SELECT_FILE_NAME)
}

Optional<PetriNet> importProcess(String message, String netIdentifier, String netFileName) {
PetriNet foundNet = petriNetService.getNewestVersionByIdentifier(netIdentifier)
if (foundNet != null) {
log.info("${message} has already been imported.")
return Optional.of(foundNet)
}

Optional<PetriNet> net = helper.createNet(netFileName, VersionType.MAJOR, systemCreator.loggedSystem)
if (!net.isPresent()) {
log.error("Import of ${message} failed!")
}

return net
helper.importProcess("Petri net for impersonation config", IMPERSONATION_CONFIG_PETRI_NET_IDENTIFIER, IMPERSONATION_CONFIG_FILE_NAME)
helper.importProcess("Petri net for impersonation user select", IMPERSONATION_CONFIG_USER_SELECT_PETRI_NET_IDENTIFIER, IMPERSONATION_CONFIG_USER_SELECT_FILE_NAME)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ class ImportHelper {
@Autowired
private IUriService uriService

@Autowired
private SystemUserRunner systemCreator

private final ClassLoader loader = ImportHelper.getClassLoader()


Expand Down Expand Up @@ -239,6 +242,22 @@ class ImportHelper {
superCreator.setAllToSuperUser();
}

Optional<PetriNet> importProcess(String message, String netIdentifier, String netFileName) {
PetriNet filter = petriNetService.getNewestVersionByIdentifier(netIdentifier)
if (filter != null) {
log.info("${message} has already been imported.")
return Optional.of(filter)
}

Optional<PetriNet> filterNet = this.createNet(netFileName, VersionType.MAJOR, systemCreator.loggedSystem)

if (!filterNet.isPresent()) {
log.error("Import of ${message} failed!")
}

return filterNet
}

static ObjectNode populateDataset(Map<String, Map<String, String>> data) {
ObjectMapper mapper = new ObjectMapper()
String json = mapper.writeValueAsString(data)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.netgrif.application.engine.startup

import com.netgrif.application.engine.menu.domain.MenuItemView
import com.netgrif.application.engine.menu.registry.interfaces.IMenuItemViewRegistry
import com.netgrif.application.engine.petrinet.domain.I18nString
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component

@Slf4j
@Component
class MenuItemViewRegistryRunner extends AbstractOrderedCommandLineRunner {

@Autowired
private IMenuItemViewRegistry registry

public static final String TABBED_CASE_VIEW_ID = "tabbed_case_view"
public static final String TABBED_TASK_VIEW_ID = "tabbed_task_view"
public static final String TABBED_TICKET_VIEW_ID = "tabbed_ticket_view"
public static final String TABBED_SINGLE_TASK_VIEW_ID = "tabbed_single_task_view"

@Override
void run(String... args) throws Exception {
registry.unregisterAllViews()

log.info("Registering menu item views...")
registerTabbedCaseView()
registerTabbedTaskView()
registerTabbedTicketView()
registerTabbedSingleTaskView()

int viewCount = registry.getAllViews().size()
log.info("Registered {} views.", viewCount)
}

private void registerTabbedCaseView() {
MenuItemView view = MenuItemView.with()
.name(new I18nString("Tabbed case view", Map.of("sk", "Zobrazenie prípadov v taboch",
"de", "Fallansicht mit Registerkarten")))
.identifier(TABBED_CASE_VIEW_ID)
.allowedAssociatedViews(List.of(TABBED_TASK_VIEW_ID))
.isTabbed(true)
.isPrimary(true)
.build()
registry.registerView(view)
}

private void registerTabbedTaskView() {
MenuItemView view = MenuItemView.with()
.name(new I18nString("Tabbed task view", Map.of("sk", "Zobrazenie úloh v taboch",
"de", "Aufgabenansicht mit Registerkarten")))
.identifier(TABBED_TASK_VIEW_ID)
.allowedAssociatedViews(List.of())
.isTabbed(true)
.isPrimary(true)
.build()
registry.registerView(view)
}

private void registerTabbedTicketView() {
MenuItemView view = MenuItemView.with()
.name(new I18nString("Tabbed ticket view", Map.of("sk", "Tiketové zobrazenie v taboch",
"de", "Ticketansicht mit Registerkarten")))
.identifier(TABBED_TICKET_VIEW_ID)
.allowedAssociatedViews(List.of(TABBED_SINGLE_TASK_VIEW_ID))
.isTabbed(true)
.isPrimary(true)
.build()
registry.registerView(view)
}

private void registerTabbedSingleTaskView() {
MenuItemView view = MenuItemView.with()
.name(new I18nString("Tabbed single task view", Map.of("sk", "Zobrazenie jednej úlohy v taboch",
"de", "Einzelaufgabenansicht mit Registerkarten")))
.identifier(TABBED_SINGLE_TASK_VIEW_ID)
.allowedAssociatedViews(List.of())
.isTabbed(true)
.isPrimary(false)
.build()
registry.registerView(view)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ class RunnerController {
UriRunner,
FunctionsCacheRunner,
FilterRunner,
MenuItemViewRegistryRunner,
GroupRunner,
DefaultFiltersRunner,
ImpersonationRunner,
DashboardRunner,
DashboardManagementRunner,
SuperCreator,
FlushSessionsRunner,
MailRunner,
Expand Down
Loading