Class ManagedFunctionBuilderImpl<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- java.lang.Object
-
- net.officefloor.frame.impl.construct.function.AbstractFunctionBuilder<F>
-
- net.officefloor.frame.impl.construct.managedfunction.ManagedFunctionBuilderImpl<O,F>
-
- All Implemented Interfaces:
FlowBuilder<F>
,FunctionBuilder<F>
,ManagedFunctionBuilder<O,F>
,FunctionConfiguration<F>
,ManagedFunctionConfiguration<O,F>
public class ManagedFunctionBuilderImpl<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>> extends AbstractFunctionBuilder<F> implements ManagedFunctionBuilder<O,F>, ManagedFunctionConfiguration<O,F>
Implementation of theManagedFunctionBuilder
.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ManagedFunctionBuilderImpl(java.lang.String functionName, ManagedFunctionFactory<O,F> functionFactory)
Initiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnnotation(java.lang.Object annotation)
Adds the annotation for thisManagedFunction
.void
addGovernance(java.lang.String governanceName)
AddsGovernance
to thisManagedFunction
.DependencyMappingBuilder
addManagedObject(java.lang.String functionManagedObjectName, java.lang.String officeManagedObjectName)
Adds aManagedObject
bound to thisManagedFunction
.java.lang.Object[]
getAnnotations()
Obtains the annotations for theManagedFunction
.long
getAsynchronousFlowTimeout()
Obtains the timeout for anyAsynchronousFlow
instigated.java.lang.String
getFunctionName()
Obtains the name of thisManagedFunction
.ManagedFunctionGovernanceConfiguration[]
getGovernanceConfiguration()
Obtains the configuration of theGovernance
instances for thisManagedFunction
.ManagedFunctionFactory<O,F>
getManagedFunctionFactory()
Obtains theManagedFunctionFactory
for theManagedFunction
.ManagedObjectConfiguration<?>[]
getManagedObjectConfiguration()
Obtains the configuration of theManagedFunction
boundManagedObject
instances.ManagedFunctionReference
getNextFunction()
Obtains the reference to the nextManagedFunction
.ManagedFunctionObjectConfiguration<O>[]
getObjectConfiguration()
Obtains the configuration of the dependentObject
instances for thisManagedFunction
.AdministrationConfiguration<?,?,?>[]
getPostAdministration()
Obtains the listing of theAdministration
to be done after theManagedFunction
is executed.AdministrationConfiguration<?,?,?>[]
getPreAdministration()
Obtains the listing of theAdministration
to be done before theManagedFunction
is executed.void
linkManagedObject(int index, java.lang.String scopeManagedObjectName, java.lang.Class<?> objectType)
Links in aManagedObject
to thisManagedFunction
.void
linkManagedObject(O key, java.lang.String scopeManagedObjectName, java.lang.Class<?> objectType)
Links in aManagedObject
to thisManagedFunction
.void
linkParameter(int index, java.lang.Class<?> parameterType)
Links in the parameter for thisManagedFunction
.void
linkParameter(O key, java.lang.Class<?> parameterType)
Links in the parameter for thisManagedFunction
.<E,f extends java.lang.Enum<f>,G extends java.lang.Enum<G>>
AdministrationBuilder<f,G>postAdminister(java.lang.String administrationName, java.lang.Class<E> extension, AdministrationFactory<E,f,G> administrationFactory)
AddsAdministration
to be undertaken after thisManagedFunction
.<E,f extends java.lang.Enum<f>,G extends java.lang.Enum<G>>
AdministrationBuilder<f,G>preAdminister(java.lang.String administrationName, java.lang.Class<E> extension, AdministrationFactory<E,f,G> administrationFactory)
AddsAdministration
to be undertaken before thisManagedFunction
.void
setAsynchronousFlowTimeout(long timeout)
Specifies the timeout to forAsynchronousFlow
instances for thisManagedFunction
.void
setNextFunction(java.lang.String functionName, java.lang.Class<?> argumentType)
Specifies the nextManagedFunction
to be executed.-
Methods inherited from class net.officefloor.frame.impl.construct.function.AbstractFunctionBuilder
addEscalation, getEscalations, getFlowConfiguration, getResponsibleTeamName, linkFlow, linkFlow, setResponsibleTeam
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.officefloor.frame.api.build.FunctionBuilder
addEscalation, linkFlow, linkFlow, setResponsibleTeam
-
Methods inherited from interface net.officefloor.frame.internal.configuration.FunctionConfiguration
getEscalations, getFlowConfiguration, getResponsibleTeamName
-
-
-
-
Constructor Detail
-
ManagedFunctionBuilderImpl
public ManagedFunctionBuilderImpl(java.lang.String functionName, ManagedFunctionFactory<O,F> functionFactory)
Initiate.- Parameters:
functionName
- Name of thisManagedFunction
.functionFactory
-ManagedFunctionFactory
.
-
-
Method Detail
-
addAnnotation
public void addAnnotation(java.lang.Object annotation)
Description copied from interface:ManagedFunctionBuilder
Adds the annotation for this
ManagedFunction
.This is exposed as is on the
FunctionManager
interface for thisManagedFunction
to allow reflective:- identification of this
ManagedFunction
(e.g. can check on type of this object) - means to trigger functionality on this
ManagedFunction
(e.g. can expose functionality to be invoked)
- Specified by:
addAnnotation
in interfaceManagedFunctionBuilder<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
annotation
- Annotation.
- identification of this
-
setNextFunction
public void setNextFunction(java.lang.String functionName, java.lang.Class<?> argumentType)
Description copied from interface:FlowBuilder
Specifies the nextManagedFunction
to be executed.- Specified by:
setNextFunction
in interfaceFlowBuilder<O extends java.lang.Enum<O>>
- Parameters:
functionName
- Name of the nextManagedFunction
.argumentType
- Type of argument passed to the nextManagedFunction
. May benull
to indicate no argument.
-
linkParameter
public void linkParameter(O key, java.lang.Class<?> parameterType)
Description copied from interface:ManagedFunctionBuilder
Links in the parameter for thisManagedFunction
.- Specified by:
linkParameter
in interfaceManagedFunctionBuilder<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
key
- Key identifying the parameter.parameterType
- Type of the parameter.
-
linkParameter
public void linkParameter(int index, java.lang.Class<?> parameterType)
Description copied from interface:ManagedFunctionBuilder
Links in the parameter for thisManagedFunction
.- Specified by:
linkParameter
in interfaceManagedFunctionBuilder<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
index
- Index identifying the parameter.parameterType
- Type of the parameter.
-
linkManagedObject
public void linkManagedObject(O key, java.lang.String scopeManagedObjectName, java.lang.Class<?> objectType)
Description copied from interface:ManagedFunctionBuilder
Links in aManagedObject
to thisManagedFunction
.- Specified by:
linkManagedObject
in interfaceManagedFunctionBuilder<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
key
- Key identifying theManagedObject
.scopeManagedObjectName
- Name of theManagedObject
within theManagedObjectScope
.objectType
- Type required by theManagedFunction
.
-
linkManagedObject
public void linkManagedObject(int index, java.lang.String scopeManagedObjectName, java.lang.Class<?> objectType)
Description copied from interface:ManagedFunctionBuilder
Links in aManagedObject
to thisManagedFunction
.- Specified by:
linkManagedObject
in interfaceManagedFunctionBuilder<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
index
- Index of theManagedObject
.scopeManagedObjectName
- Name of theManagedObject
within theManagedObjectScope
.objectType
- Type required by theManagedFunction
.
-
addManagedObject
public DependencyMappingBuilder addManagedObject(java.lang.String functionManagedObjectName, java.lang.String officeManagedObjectName)
Description copied from interface:ManagedFunctionBuilder
Adds a
ManagedObject
bound to thisManagedFunction
.Dependency scope:
- Other
ManagedObject
instances added via this method. ThreadState
boundManagedObject
instances.ProcessState
boundManagedObject
instances.
- Specified by:
addManagedObject
in interfaceManagedFunctionBuilder<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
functionManagedObjectName
- Name of theManagedObject
to be referenced locally by thisManagedFunction
.officeManagedObjectName
- Name of theManagedObject
referenced locally within theOffice
.- Returns:
DependencyMappingBuilder
.
- Other
-
preAdminister
public <E,f extends java.lang.Enum<f>,G extends java.lang.Enum<G>> AdministrationBuilder<f,G> preAdminister(java.lang.String administrationName, java.lang.Class<E> extension, AdministrationFactory<E,f,G> administrationFactory)
Description copied from interface:ManagedFunctionBuilder
AddsAdministration
to be undertaken before thisManagedFunction
.- Specified by:
preAdminister
in interfaceManagedFunctionBuilder<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Type Parameters:
E
- Extension type.f
-Flow
key type.G
-Governance
key type.- Parameters:
administrationName
- Name of theAdministration
.extension
- Extension type forAdministration
.administrationFactory
-AdministrationFactory
.- Returns:
AdministrationBuilder
to build theAdministration
.
-
postAdminister
public <E,f extends java.lang.Enum<f>,G extends java.lang.Enum<G>> AdministrationBuilder<f,G> postAdminister(java.lang.String administrationName, java.lang.Class<E> extension, AdministrationFactory<E,f,G> administrationFactory)
Description copied from interface:ManagedFunctionBuilder
AddsAdministration
to be undertaken after thisManagedFunction
.- Specified by:
postAdminister
in interfaceManagedFunctionBuilder<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Type Parameters:
E
- Extension type.f
-Flow
key type.G
-Governance
key type.- Parameters:
administrationName
- Name of theAdministration
.extension
- Extension type forAdministration
.administrationFactory
-AdministrationFactory
.- Returns:
AdministrationBuilder
to build theAdministration
.
-
addGovernance
public void addGovernance(java.lang.String governanceName)
Description copied from interface:ManagedFunctionBuilder
Adds
Governance
to thisManagedFunction
.In other words, to execute this
ManagedFunction
theGovernance
will be automatically activated before theManagedFunction
is executed (or stay active from previousManagedFunction
).The
Governance
will be:- enforced when either a
ManagedFunction
does not require theGovernance
or theThreadState
completes. - disregarded when an escalation occurs to a
ManagedFunction
not requiring theGovernance
. Note that this does allow theGovernance
to stay active should theEscalation
ManagedFunction
require theGovernance
. - Manually managed by an
Administration
- Specified by:
addGovernance
in interfaceManagedFunctionBuilder<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
governanceName
- Name of theGovernance
.
- enforced when either a
-
setAsynchronousFlowTimeout
public void setAsynchronousFlowTimeout(long timeout)
Description copied from interface:ManagedFunctionBuilder
Specifies the timeout to forAsynchronousFlow
instances for thisManagedFunction
.- Specified by:
setAsynchronousFlowTimeout
in interfaceManagedFunctionBuilder<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
timeout
- Timeout.
-
getFunctionName
public java.lang.String getFunctionName()
Description copied from interface:ManagedFunctionConfiguration
Obtains the name of thisManagedFunction
.- Specified by:
getFunctionName
in interfaceManagedFunctionConfiguration<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Returns:
- Name of this
ManagedFunction
.
-
getManagedFunctionFactory
public ManagedFunctionFactory<O,F> getManagedFunctionFactory()
Description copied from interface:ManagedFunctionConfiguration
Obtains theManagedFunctionFactory
for theManagedFunction
.- Specified by:
getManagedFunctionFactory
in interfaceManagedFunctionConfiguration<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Returns:
ManagedFunctionFactory
.
-
getAnnotations
public java.lang.Object[] getAnnotations()
Description copied from interface:ManagedFunctionConfiguration
Obtains the annotations for theManagedFunction
.- Specified by:
getAnnotations
in interfaceManagedFunctionConfiguration<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Returns:
- Annotations for the
ManagedFunction
.
-
getObjectConfiguration
public ManagedFunctionObjectConfiguration<O>[] getObjectConfiguration()
Description copied from interface:ManagedFunctionConfiguration
Obtains the configuration of the dependentObject
instances for thisManagedFunction
.- Specified by:
getObjectConfiguration
in interfaceManagedFunctionConfiguration<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Returns:
- Configuration of the dependent
Object
instances for thisManagedFunction
.
-
getGovernanceConfiguration
public ManagedFunctionGovernanceConfiguration[] getGovernanceConfiguration()
Description copied from interface:ManagedFunctionConfiguration
Obtains the configuration of theGovernance
instances for thisManagedFunction
.- Specified by:
getGovernanceConfiguration
in interfaceManagedFunctionConfiguration<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Returns:
- Configuration of the
Governance
for thisManagedFunction
.
-
getNextFunction
public ManagedFunctionReference getNextFunction()
Description copied from interface:ManagedFunctionConfiguration
Obtains the reference to the nextManagedFunction
.- Specified by:
getNextFunction
in interfaceManagedFunctionConfiguration<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Returns:
- Reference to the next
ManagedFunction
.
-
getPreAdministration
public AdministrationConfiguration<?,?,?>[] getPreAdministration()
Description copied from interface:ManagedFunctionConfiguration
Obtains the listing of theAdministration
to be done before theManagedFunction
is executed.- Specified by:
getPreAdministration
in interfaceManagedFunctionConfiguration<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Returns:
- Listing of the
Administration
to be done before theManagedFunction
is executed.
-
getPostAdministration
public AdministrationConfiguration<?,?,?>[] getPostAdministration()
Description copied from interface:ManagedFunctionConfiguration
Obtains the listing of theAdministration
to be done after theManagedFunction
is executed.- Specified by:
getPostAdministration
in interfaceManagedFunctionConfiguration<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Returns:
- Listing of the
Administration
to be done after theManagedFunction
is executed.
-
getManagedObjectConfiguration
public ManagedObjectConfiguration<?>[] getManagedObjectConfiguration()
Description copied from interface:ManagedFunctionConfiguration
Obtains the configuration of theManagedFunction
boundManagedObject
instances.- Specified by:
getManagedObjectConfiguration
in interfaceManagedFunctionConfiguration<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Returns:
- Listing of the
ManagedObject
configuration for thisManagedFunction
.
-
getAsynchronousFlowTimeout
public long getAsynchronousFlowTimeout()
Description copied from interface:ManagedFunctionConfiguration
Obtains the timeout for anyAsynchronousFlow
instigated.- Specified by:
getAsynchronousFlowTimeout
in interfaceManagedFunctionConfiguration<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Returns:
- Timeout for any
AsynchronousFlow
instigated.
-
-