Class BackgroundProcessManager
java.lang.Object
com.jalios.jcms.ChannelListener
com.jalios.jcms.backgroundprocess.BackgroundProcessManager
- All Implemented Interfaces:
PluginComponent,JPropertiesListener,Comparable
- Since:
- jcms-10.0.8 / JCMS-9179
-
Field Summary
FieldsFields inherited from class com.jalios.jcms.ChannelListener
order -
Method Summary
Modifier and TypeMethodDescriptionbooleancanBeNotified(Member loggedMember, Member processAuthor) Only for author for now (see BackgroundProcessInfo.notify monovaluated boolean)protected ControllerStatuscanStart(Member author, BackgroundProcess process, BackgroundProcess.Scope scope, boolean unique) Returns wether process can be run or not as a controller status.
Prevents unique process to be run simultaneously, depending on author, domain and scope.
Prevents null-author process to be run, unless it is explicitely allowed usingBackgroundProcess.allowNullAuthor();protected voidcreateInfo(BackgroundProcess process) Create a new BackgroundProcessInfo for the specified BackgroundProcess, and update BackgroundProcess to reference it.voiddeleteInfo(String infoId) Delete the BackgroundProcessInfo specified by its id.Return the BackgroundProcess of the current thread if any.static BackgroundProcessManagerbooleanlonggetPendingProcessCount(BackgroundProcess.Scope scope, String domain, Member author) Return count of process that are not completed.longgetPendingProcessCount(BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) Return count of process matching that are not completed.getPendingProcessList(BackgroundProcess.Scope scope, String domain, Member author) Deprecated.getPendingProcessList(BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) Deprecated.getPendingProcessList(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author) Lists pending process matching.getPendingProcessList(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) Lists pending process matching.longgetProcessCount(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author) Return count of all process matching.longgetProcessCount(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) Return count of all process matching.getProcessList(BackgroundProcess.Scope scope, String domain, Member author) Deprecated.getProcessList(BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) Deprecated.getProcessList(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author) getProcessList(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) booleanhasBackgroundProcess(Member member) Check if there is any BackgroundProcess started by specified membervoidinit()voidpropertiesChange(JProperties properties) Handle properties change.voidsaveNotifyPreference(BackgroundProcessInfo info, boolean isNotify) protected CompletableFuture<Void> start(Member author, BackgroundProcess process) Methods inherited from class com.jalios.jcms.ChannelListener
compareTo, equals, getOrder, handleFinalize, init, initAfterStartup, initAfterStoreLoad, initBeforeHibernateFactoryBuild, initBeforeStoreLoad
-
Field Details
-
PROCESS_REQ_ATTR
-
OPERATION_ACL
- See Also:
-
-
Method Details
-
getInstance
-
init
public void init() -
propertiesChange
Handle properties change.- Specified by:
propertiesChangein interfaceJPropertiesListener- Parameters:
properties- the properties which have been submitted to change
-
getCurrentBackgroundProcess
Return the BackgroundProcess of the current thread if any.- Returns:
- a BackgroundProcess instance, or null if none
- Since:
- jcms-10.0.8
-
start
- Parameters:
author- the member performing the operationprocess- the process to be started- Returns:
- a future result
- Since:
- jcms-10.0.8
-
saveNotifyPreference
- Parameters:
info- process infoisNotify- weither process author must be notified on process completed- Since:
- jcms-10.0.8
-
getNotifyPreference
- Parameters:
info- process info- Returns:
- weither process author must be notified on process completed
- Since:
- jcms-10.0.8
-
canBeNotified
Only for author for now (see BackgroundProcessInfo.notify monovaluated boolean)- Parameters:
loggedMember- the memberprocessAuthor- process author- Returns:
- true if member is info author
- Since:
- jcms-10.0.8
-
hasBackgroundProcess
Check if there is any BackgroundProcess started by specified member- Parameters:
member- a member (return false if null)- Returns:
- true if there is at least one background process, false otherwise
- Since:
- jcms-10.0.8
-
getProcessList
@Deprecated public List<BackgroundProcessInfo> getProcessList(BackgroundProcess.Scope scope, String domain, Member author) Deprecated.Lists all process (pending and completed) matching.- Parameters:
scope- the scope filterdomain- the domain filterauthor- the author filter- Returns:
- list of matching process
- Since:
- jcms-10.0.8
-
getProcessList
@Deprecated public List<BackgroundProcessInfo> getProcessList(BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) Deprecated.Lists all process (pending and completed) matching.- Parameters:
scope- the scope filterdomain- the domain filterauthor- the author filterqueryBuildHook- a hook to customize the queryBuilder- Returns:
- list of matching process
- Since:
- jcms-10.0.8
-
getProcessList
public List<BackgroundProcessInfo> getProcessList(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author) -
getProcessList
public List<BackgroundProcessInfo> getProcessList(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) -
getPendingProcessList
@Deprecated public List<BackgroundProcessInfo> getPendingProcessList(BackgroundProcess.Scope scope, String domain, Member author) Deprecated.Lists pending process matching.- Parameters:
scope- the scope filterdomain- the domain filterauthor- the author filter- Returns:
- list of matching process
- Since:
- jcms-10.0.8
-
getPendingProcessList
public List<BackgroundProcessInfo> getPendingProcessList(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author) Lists pending process matching.- Parameters:
loggedMember- member to use for read rightsscope- the scope filterdomain- the domain filterauthor- the author filter- Returns:
- list of matching process
- Since:
- jcms-10.0.8
-
getPendingProcessList
@Deprecated public List<BackgroundProcessInfo> getPendingProcessList(BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) Deprecated.Lists pending process matching.- Parameters:
scope- the scope filterdomain- the domain filterauthor- the author filterqueryBuildHook- a hook to customize the queryBuilder- Returns:
- list of matching process
- Since:
- jcms-10.0.8
-
getPendingProcessList
public List<BackgroundProcessInfo> getPendingProcessList(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) Lists pending process matching.- Parameters:
loggedMember- member to use for read rightsscope- the scope filterdomain- the domain filterauthor- the author filterqueryBuildHook- a hook to customize the queryBuilder- Returns:
- list of matching process
- Since:
- jcms-10.0.8
-
getPendingProcessCount
Return count of process that are not completed.- Parameters:
scope- the scope filterdomain- the domain filterauthor- the author filter- Returns:
- count of matching process
- Since:
- jcms-10.0.8
-
getPendingProcessCount
public long getPendingProcessCount(BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) Return count of process matching that are not completed.- Parameters:
scope- the scope filterdomain- the domain filterauthor- the author filterqueryBuildHook- a hook to customize the queryBuilder- Returns:
- count of matching process
- Since:
- jcms-10.0.8
-
getProcessCount
public long getProcessCount(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author) Return count of all process matching.- Parameters:
loggedMember- member to use for read rightsscope- the scope filterdomain- the domain filterauthor- the author filter- Returns:
- count of matching process
- Since:
- jcms-10.0.8
-
getProcessCount
public long getProcessCount(Member loggedMember, BackgroundProcess.Scope scope, String domain, Member author, Consumer<BackgroundProcessQueryBuilder> queryBuildHook) Return count of all process matching.- Parameters:
loggedMember- member to use for read rightsscope- the scope filterdomain- the domain filterauthor- the author filterqueryBuildHook- a hook to customize the queryBuilder- Returns:
- count of matching process
- Since:
- jcms-10.0.8
-
canStart
protected ControllerStatus canStart(Member author, BackgroundProcess process, BackgroundProcess.Scope scope, boolean unique) Returns wether process can be run or not as a controller status.
Prevents unique process to be run simultaneously, depending on author, domain and scope.
Prevents null-author process to be run, unless it is explicitely allowed usingBackgroundProcess.allowNullAuthor();- Parameters:
author- author of process to runprocess- the process to check if it can be runscope- scope of the process to run,BackgroundProcess.Scope.WEBAPPused by defaultunique- true if no new same process can be run if another one is already running- Returns:
- a ControllerStatus
- Since:
- jcms-10.0.8
-
createInfo
Create a new BackgroundProcessInfo for the specified BackgroundProcess, and update BackgroundProcess to reference it.The BackgroundProcessInfo create is performed in another hibernate session/transcation leaving your current transaction untouched.
- Parameters:
process- the BackgroundProcess for which info must be created- Since:
- jcms-10.0.8
-
deleteInfo
Delete the BackgroundProcessInfo specified by its id.The BackgroundProcessInfo is deleted in a dedicated thread, in another hibernate session/transaction leaving your current transaction untouched.
- Parameters:
infoId- the id of BackgroundProcessInfo- Since:
- jcms-10.0.8
-
getPendingProcessList(Member, Scope, String, Member)