public class ThreadLocalApplication extends Application
Warning: This class is only for rare cases where you really need several applications in one JVM. Normally there is exactly one Application configured at startup and no further change is made. This class is not for production!
For tests or demo deployments it may be needed that the application can be replaced. This is forbidden by the Application class itself. This extension can switch the current Application and the repository.
Also note that this trick only works if Frontend and Backend are deployed in the same JVM!
Modifier and Type | Class and Description |
---|---|
class |
ThreadLocalApplication.ThreadLocalBackend |
Constructor and Description |
---|
ThreadLocalApplication() |
Modifier and Type | Method and Description |
---|---|
Page |
createDefaultPage() |
Page |
createSearchPage(String query)
If more than one class of entities should be searched have a look at
SearchPage.handle(SearchPage...)
|
Application |
getCurrentApplication() |
Class<?>[] |
getEntityClasses()
Defines the (root) entities.
|
String |
getName() |
List<Action> |
getNavigation()
If the list of actions depend on the currently logged in user you can
check if the user has the needed roles by
Subject.hasRole(String...) |
void |
setCurrentApplication(Application application) |
createPage, getIcon, getInstance, getResourceBundle, hasSearchPages, initApplication, isLoginRequired, main, setInstance, setThreadInstance
public void setCurrentApplication(Application application)
public Application getCurrentApplication()
public Class<?>[] getEntityClasses()
Model
getEntityClasses
in interface Model
getEntityClasses
in class Application
public String getName()
getName
in class Application
public Page createSearchPage(String query)
Application
createSearchPage
in class Application
query
- the string the user entered in the search fieldpublic Page createDefaultPage()
createDefaultPage
in class Application
public List<Action> getNavigation()
Application
Subject.hasRole(String...)
getNavigation
in class Application
Copyright © 2019. All rights reserved.