Package org.uberfire.client.mvp
Class PluginActivityManagerImpl
- java.lang.Object
-
- org.uberfire.client.mvp.PluginActivityManagerImpl
-
- All Implemented Interfaces:
ActivityManager
@ApplicationScoped public class PluginActivityManagerImpl extends Object implements ActivityManager
ThisActivityManagerimplementation is active for plugins only, to satisfy compile-time dependencies (of other components on the plugin's classpath that require an activity manager). Plugins don't get access to the main application'sActivityManageras it would allow them to control all activities of the application, not just their own.
-
-
Constructor Summary
Constructors Constructor Description PluginActivityManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsActivity(org.uberfire.mvp.PlaceRequest placeRequest)Returns an active, accessible activity that can handle the given PlaceRequest.voiddestroyActivity(Activity activity)Destroys the given Activity bean instance, making it eligible for garbage collection.<T extends Activity>
Set<T>getActivities(Class<T> clazz)Obtains the set of activity instances which implement the given type, areactive, and that the current userhas permission to access.Set<Activity>getActivities(org.uberfire.mvp.PlaceRequest placeRequest)Calls toActivityManager.getActivities(PlaceRequest)with security checks enabled.Set<Activity>getActivities(org.uberfire.mvp.PlaceRequest placeRequest, boolean secure)Returns the set of activities that can handle the given PlaceRequest.<T extends Activity>
TgetActivity(Class<T> clazz, org.uberfire.mvp.PlaceRequest placeRequest)Calls to asActivityManager.getActivity(Class, PlaceRequest)with security checks enabled.<T extends Activity>
TgetActivity(Class<T> clazz, org.uberfire.mvp.PlaceRequest placeRequest, boolean secure)Works likeActivityManager.getActivities(PlaceRequest, boolean)but performs an unsafe cast to treat the return value as an instance of the given class.ActivitygetActivity(org.uberfire.mvp.PlaceRequest placeRequest)Calls to asActivityManager.getActivity(PlaceRequest)with security checks enabled.ActivitygetActivity(org.uberfire.mvp.PlaceRequest placeRequest, boolean secure)Finds an activity that can handle the given PlaceRequest, creating and starting a new one if necessary.SplashScreenActivitygetSplashScreenInterceptor(org.uberfire.mvp.PlaceRequest placeRequest)Returns the splash screen activity that should appear upon navigation to the given place, if such a splash screen exists.booleanisStarted(Activity activity)Returns true if the given Activity instance is currently in the started or open state and managed by this ActivityManager.
-
-
-
Method Detail
-
getActivities
public <T extends Activity> Set<T> getActivities(Class<T> clazz)
Description copied from interface:ActivityManagerObtains the set of activity instances which implement the given type, areactive, and that the current userhas permission to access.- Specified by:
getActivitiesin interfaceActivityManager- Parameters:
clazz- the type of activities to enumerate. Must not be null. Passing inActivity.classwill yield all possible activity types.- Returns:
- the set of available activities. Never null. Each object in the returned set must be freed by the caller
via a call to
ClientBeanManager.destroyBean(Object).
-
getSplashScreenInterceptor
public SplashScreenActivity getSplashScreenInterceptor(org.uberfire.mvp.PlaceRequest placeRequest)
Description copied from interface:ActivityManagerReturns the splash screen activity that should appear upon navigation to the given place, if such a splash screen exists. In case multiple splash screens would intercept the given place request, one of them is chosen at random. TODO (UF-93) : make this deterministic.- Specified by:
getSplashScreenInterceptorin interfaceActivityManager- Parameters:
placeRequest- the place request to look up a splash screen for.- Returns:
- a splash screen which should be displayed upon navigation to the given place, or null if no such activity exists.
-
getActivities
public Set<Activity> getActivities(org.uberfire.mvp.PlaceRequest placeRequest)
Description copied from interface:ActivityManagerCalls toActivityManager.getActivities(PlaceRequest)with security checks enabled.- Specified by:
getActivitiesin interfaceActivityManager
-
containsActivity
public boolean containsActivity(org.uberfire.mvp.PlaceRequest placeRequest)
Description copied from interface:ActivityManagerReturns an active, accessible activity that can handle the given PlaceRequest. In case there are multiple activities that can handle the given place request, one of them is chosen at random. TODO (UF-92) : make this deterministic.- Specified by:
containsActivityin interfaceActivityManager- Returns:
- an activity that handles the given PlaceRequest, or null if no available activity can handle. No
actual type checking is performed! If you guess the type wrong, you will have an instance of the
wrong type. The only truly "safe" type to guess is
Activity..
-
getActivity
public Activity getActivity(org.uberfire.mvp.PlaceRequest placeRequest)
Description copied from interface:ActivityManagerCalls to asActivityManager.getActivity(PlaceRequest)with security checks enabled.- Specified by:
getActivityin interfaceActivityManager
-
getActivity
public <T extends Activity> T getActivity(Class<T> clazz, org.uberfire.mvp.PlaceRequest placeRequest)
Description copied from interface:ActivityManagerCalls to asActivityManager.getActivity(Class, PlaceRequest)with security checks enabled.- Specified by:
getActivityin interfaceActivityManager
-
destroyActivity
public void destroyActivity(Activity activity)
Description copied from interface:ActivityManagerDestroys the given Activity bean instance, making it eligible for garbage collection.- Specified by:
destroyActivityin interfaceActivityManager- Parameters:
activity- the activity instance to destroy. Warning: do not use with instances of SplashScreenActivity. These are ApplicationScoped and cannot be destroyed.
-
isStarted
public boolean isStarted(Activity activity)
Description copied from interface:ActivityManagerReturns true if the given Activity instance is currently in the started or open state and managed by this ActivityManager.- Specified by:
isStartedin interfaceActivityManager- Parameters:
activity- the activity to check- Returns:
- true if the activity is started; false if it is uninitialized.
-
getActivities
public Set<Activity> getActivities(org.uberfire.mvp.PlaceRequest placeRequest, boolean secure)
Description copied from interface:ActivityManagerReturns the set of activities that can handle the given PlaceRequest. The activities will be in the started state (seeActivityfor details on the activity lifecycle). If the PlaceRequest is for a certain place ID, this method will return a set with at most one activity in it. If the PlaceRequest is for a certain path, the returned set can contain any number of activities.- Specified by:
getActivitiesin interfaceActivityManager- Parameters:
placeRequest- the PlaceRequest to resolve activities for. Although null is permitted for convenience, it always resolves to the empty set.secure- flag indicating if calls to theAuthorizationManagerservice are required in order to determine which activities are available.- Returns:
- an unmodifiable set of activities that can handle the given PlaceRequest. Never null, but can be empty.
To prevent memory leaks, pass Activity in the returned set to
ActivityManager.destroyActivity(Activity)when you are done with it.
-
getActivity
public Activity getActivity(org.uberfire.mvp.PlaceRequest placeRequest, boolean secure)
Description copied from interface:ActivityManagerFinds an activity that can handle the given PlaceRequest, creating and starting a new one if necessary.- Specified by:
getActivityin interfaceActivityManager- Parameters:
placeRequest- the place the resolved activity should handlesecure- flag indicating if calls to theAuthorizationManagerservice are required in order to determine if the resulting activity is available.- Returns:
- an activity that can handle the request, or null if no known activity can handle it. If the return value is non-null, it will be an activity in the started or open state.
-
getActivity
public <T extends Activity> T getActivity(Class<T> clazz, org.uberfire.mvp.PlaceRequest placeRequest, boolean secure)
Description copied from interface:ActivityManagerWorks likeActivityManager.getActivities(PlaceRequest, boolean)but performs an unsafe cast to treat the return value as an instance of the given class. Only use this method if you are absolutely sure which activity type matches the request. If you are wrong, there will not be a ClassCastException as a result of this call. The safer approach is to useActivityManager.getActivities(PlaceRequest, boolean)and cast its return value explicitly.- Specified by:
getActivityin interfaceActivityManager- Parameters:
clazz- the type of activity that you expect to find.placeRequest- the place the resolved activity should handlesecure- flag indicating if calls to theAuthorizationManagerservice are required in order to determine if the resulting activity is available.- Returns:
- an activity that can handle the request, or null if no known activity can handle it. If the return value is non-null, it will be an activity in the started or open state.
-
-