Class AbstractFunctionSectionSource
- java.lang.Object
-
- net.officefloor.compile.spi.section.source.impl.AbstractSectionSource
-
- net.officefloor.plugin.section.clazz.AbstractFunctionSectionSource
-
- All Implemented Interfaces:
SectionSource
- Direct Known Subclasses:
ClassSectionSource
public abstract class AbstractFunctionSectionSource extends AbstractSectionSource
Abstract functionSectionSource
.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractFunctionSectionSource.ObjectForMethod
Object
forMethod
.-
Nested classes/interfaces inherited from class net.officefloor.compile.spi.section.source.impl.AbstractSectionSource
AbstractSectionSource.SpecificationContext
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLASS_OBJECT_NAME
Name of theSectionManagedObject
for the section class.
-
Constructor Summary
Constructors Constructor Description AbstractFunctionSectionSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SectionFunctionNamespace
adddSectionFunctionNamespace(java.lang.String namespace, java.lang.Class<?> sectionClass)
Adds theSectionFunctionNamespace
.protected SectionManagedObject
createClassManagedObject(java.lang.String objectName, java.lang.Class<?> sectionClass)
Creates theSectionManagedObject
for providing the section object.protected void
enrichFunction(SectionFunction function, ManagedFunctionType<?,?> functionType, java.lang.Class<?> parameterType)
Enriches theManagedFunction
.protected DependencyMetaData[]
extractClassManagedObjectDependencies(java.lang.String objectName, java.lang.Class<?> sectionClass)
Extracts theDependencyMetaData
instances for the section object.protected SectionSourceContext
getContext()
Obtains theSectionSourceContext
.protected SectionDesigner
getDesigner()
Obtains theSectionDesigner
.SectionFunction
getFunctionByName(java.lang.String functionName)
Obtains theSectionFunction
by its name.SectionFunction
getFunctionByTypeName(java.lang.String functionTypeName)
Obtains theSectionFunction
by itsManagedFunctionType
name.protected java.lang.String
getFunctionName(ManagedFunctionType<?,?> functionType)
Obtains theManagedFunction
name from theManagedFunctionType
.ManagedFunctionType<?,?>
getFunctionTypeByName(java.lang.String functionName)
Obtains theManagedFunctionType
for theSectionFunction
by its name.SectionManagedObject
getManagedObject(java.lang.String typeName)
Obtains theSectionManagedObject
for the type.SectionInput
getOrCreateInput(java.lang.String name, java.lang.String argumentType)
Obtains theSectionInput
.SectionObject
getOrCreateObject(java.lang.String qualifier, java.lang.String typeName)
Obtains theSectionObject
.SectionOutput
getOrCreateOutput(java.lang.String name, java.lang.String argumentType, boolean isEscalationOnly)
Obtains theSectionOutput
.SubSection
getOrCreateSubSection(SectionInterfaceAnnotation sectionInterfaceAnnotation)
Obtains theSubSection
.protected java.lang.Class<?>
getSectionClass(java.lang.String sectionClassName)
Obtains the section class.protected java.lang.String
getSectionClassName()
Obtains the name of the class for the section.protected boolean
isIncludeManagedFunctionType(ManagedFunctionType<?,?> functionType)
Indicates if includeManagedFunctionType
.protected void
linkFunctionEscalation(SectionFunction function, ManagedFunctionType<?,?> functionType, ManagedFunctionEscalationType escalationType, SectionFunction escalationHandler)
Links theManagedFunction
escalation.protected void
linkFunctionFlow(FunctionFlow functionFlow, ManagedFunctionType<?,?> functionType, FlowAnnotation flowAnnotation)
Links theFunctionFlow
.protected void
linkFunctionFlow(FunctionFlow functionFlow, ManagedFunctionType<?,?> functionType, SectionInterfaceAnnotation sectionInterfaceAnnotation)
Links theFunctionFlow
.protected void
linkFunctionObject(SectionFunction function, ManagedFunctionType<?,?> functionType, ManagedFunctionObjectType<?> objectType)
Links theFunctionObject
.protected void
linkNextFunction(SectionFunction function, ManagedFunctionType<?,?> functionType, NextAnnotation nextFunctionAnnotation)
Links the nextManagedFunction
.protected FunctionNamespaceType
loadFunctionNamespaceType(java.lang.String namespace, java.lang.Class<?> sectionClass)
Loads theFunctionNamespaceType
.protected AbstractFunctionSectionSource.ObjectForMethod
loadObjectForMethod(java.lang.Class<?> sectionClass)
protected void
loadSpecification(AbstractSectionSource.SpecificationContext context)
Loads theSectionSourceSpecification
.void
registerFunctionByTypeName(java.lang.String functionTypeName, SectionFunction function)
Allows being made aware of furtherSectionFunction
instances within the section to be considered for linking flows.void
sourceSection(SectionDesigner designer, SectionSourceContext context)
Sources theOfficeSection
by constructing it via the inputSectionDesigner
.-
Methods inherited from class net.officefloor.compile.spi.section.source.impl.AbstractSectionSource
getSpecification
-
-
-
-
Field Detail
-
CLASS_OBJECT_NAME
public static final java.lang.String CLASS_OBJECT_NAME
Name of theSectionManagedObject
for the section class.- See Also:
- Constant Field Values
-
-
Method Detail
-
getDesigner
protected SectionDesigner getDesigner()
Obtains theSectionDesigner
.- Returns:
SectionDesigner
;
-
getContext
protected SectionSourceContext getContext()
Obtains theSectionSourceContext
.- Returns:
SectionSourceContext
.
-
getFunctionByName
public SectionFunction getFunctionByName(java.lang.String functionName)
Obtains theSectionFunction
by its name.- Parameters:
functionName
- Name of theSectionFunction
.- Returns:
SectionFunction
ornull
if noSectionFunction
by the name.
-
getFunctionTypeByName
public ManagedFunctionType<?,?> getFunctionTypeByName(java.lang.String functionName)
Obtains theManagedFunctionType
for theSectionFunction
by its name.- Parameters:
functionName
- Name of theSectionFunction
.- Returns:
ManagedFunctionType
ornull
if noSectionFunction
by the name.
-
getFunctionByTypeName
public SectionFunction getFunctionByTypeName(java.lang.String functionTypeName)
Obtains theSectionFunction
by itsManagedFunctionType
name.- Parameters:
functionTypeName
-ManagedFunctionType
name.- Returns:
SectionFunction
ornull
if noSectionFunction
by theManagedFunctionType
name.
-
registerFunctionByTypeName
public void registerFunctionByTypeName(java.lang.String functionTypeName, SectionFunction function)
Allows being made aware of further
SectionFunction
instances within the section to be considered for linking flows.This allows
ClassSectionSource
to be used in conjunction with other functionality - such as template rendering for dynamic HTTP web pages.- Parameters:
functionTypeName
- Name to register theSectionFunction
.function
-SectionFunction
.
-
getOrCreateObject
public SectionObject getOrCreateObject(java.lang.String qualifier, java.lang.String typeName)
Obtains the
SectionObject
.Should the
SectionObject
not yet be added, it is added.- Parameters:
qualifier
-Qualifier
for theSectionObject
. If notQualifier
should be the same as the type name.typeName
- Fully qualified type name of theSectionObject
.- Returns:
SectionObject
.
-
getManagedObject
public SectionManagedObject getManagedObject(java.lang.String typeName)
Obtains theSectionManagedObject
for the type.- Parameters:
typeName
- Fully qualified type name of the object for theSectionManagedObject
.- Returns:
SectionManagedObject
ornull
if noSectionManagedObject
for the type.
-
getOrCreateInput
public SectionInput getOrCreateInput(java.lang.String name, java.lang.String argumentType)
Obtains the
SectionInput
.Should the
SectionInput
not yet be added, it is added.- Parameters:
name
- Name of theSectionInput
.argumentType
- Type of the argument. May benull
if no argument.- Returns:
SectionInput
.
-
getOrCreateOutput
public SectionOutput getOrCreateOutput(java.lang.String name, java.lang.String argumentType, boolean isEscalationOnly)
Obtains the
SectionOutput
.Should the
SectionOutput
not yet be added, it is added.- Parameters:
name
- Name of theSectionOutput
.argumentType
- Type of the argument. May benull
if no argument.isEscalationOnly
-true
if escalation only.- Returns:
SectionObject
.
-
getOrCreateSubSection
public SubSection getOrCreateSubSection(SectionInterfaceAnnotation sectionInterfaceAnnotation)
Obtains the
SubSection
.Should the
SubSection
not already be created, it is created.- Parameters:
sectionInterfaceAnnotation
-SectionInterfaceAnnotation
.- Returns:
SubSection
.
-
getSectionClassName
protected java.lang.String getSectionClassName()
Obtains the name of the class for the section.- Returns:
- Class name for the backing class of the section.
-
getSectionClass
protected java.lang.Class<?> getSectionClass(java.lang.String sectionClassName) throws java.lang.Exception
Obtains the section class.- Parameters:
sectionClassName
- Name of the section class.- Returns:
- Section class.
- Throws:
java.lang.Exception
- If fails to obtain the section class.
-
createClassManagedObject
protected SectionManagedObject createClassManagedObject(java.lang.String objectName, java.lang.Class<?> sectionClass)
Creates theSectionManagedObject
for providing the section object.- Parameters:
objectName
- Name of the object within the section.sectionClass
- Section object class.- Returns:
SectionManagedObject
.
-
extractClassManagedObjectDependencies
protected DependencyMetaData[] extractClassManagedObjectDependencies(java.lang.String objectName, java.lang.Class<?> sectionClass) throws java.lang.Exception
Extracts theDependencyMetaData
instances for the section object.- Parameters:
objectName
- Name of the object within the section.sectionClass
- Section object class.- Returns:
- Extracted
DependencyMetaData
instances for the section object. - Throws:
java.lang.Exception
- If fails to extract theDependencyMetaData
instances.
-
getFunctionName
protected java.lang.String getFunctionName(ManagedFunctionType<?,?> functionType)
Obtains theManagedFunction
name from theManagedFunctionType
.- Parameters:
functionType
-ManagedFunctionType
.- Returns:
ManagedFunction
name.
-
enrichFunction
protected void enrichFunction(SectionFunction function, ManagedFunctionType<?,?> functionType, java.lang.Class<?> parameterType)
Enriches theManagedFunction
.- Parameters:
function
-SectionFunction
.functionType
-ManagedFunctionType
for theSectionFunction
.parameterType
- Parameter type for theSectionFunction
. May benull
if no parameter.
-
linkNextFunction
protected void linkNextFunction(SectionFunction function, ManagedFunctionType<?,?> functionType, NextAnnotation nextFunctionAnnotation)
Links the nextManagedFunction
.- Parameters:
function
-SectionFunction
.functionType
-ManagedFunctionType
.nextFunctionAnnotation
-NextAnnotation
.
-
linkFunctionFlow
protected void linkFunctionFlow(FunctionFlow functionFlow, ManagedFunctionType<?,?> functionType, FlowAnnotation flowAnnotation)
Links theFunctionFlow
.- Parameters:
functionFlow
-FunctionFlow
.functionType
-ManagedFunctionType
.flowAnnotation
-FlowAnnotation
.
-
linkFunctionFlow
protected void linkFunctionFlow(FunctionFlow functionFlow, ManagedFunctionType<?,?> functionType, SectionInterfaceAnnotation sectionInterfaceAnnotation)
Links theFunctionFlow
.- Parameters:
functionFlow
-FunctionFlow
.functionType
-ManagedFunctionType
.sectionInterfaceAnnotation
-SectionInterfaceAnnotation
.
-
linkFunctionEscalation
protected void linkFunctionEscalation(SectionFunction function, ManagedFunctionType<?,?> functionType, ManagedFunctionEscalationType escalationType, SectionFunction escalationHandler)
Links theManagedFunction
escalation.- Parameters:
function
-SectionFunction
.functionType
-ManagedFunctionType
.escalationType
-ManagedFunctionEscalationType
.escalationHandler
- PotentialSectionFunction
that can handle escalation based on its parameter. May benull
if noSectionFunction
can handle the escalation.
-
linkFunctionObject
protected void linkFunctionObject(SectionFunction function, ManagedFunctionType<?,?> functionType, ManagedFunctionObjectType<?> objectType)
Links theFunctionObject
.- Parameters:
function
-SectionFunction
.functionType
-ManagedFunctionType
.objectType
-ManagedFunctionObjectType
.
-
loadObjectForMethod
protected AbstractFunctionSectionSource.ObjectForMethod loadObjectForMethod(java.lang.Class<?> sectionClass) throws java.lang.Exception
- Parameters:
sectionClass
-Class
of theObject
.- Returns:
AbstractFunctionSectionSource.ObjectForMethod
. May benull
for noObject
forMethod
.- Throws:
java.lang.Exception
- If fails to loadObject
for theMethod
.
-
loadFunctionNamespaceType
protected FunctionNamespaceType loadFunctionNamespaceType(java.lang.String namespace, java.lang.Class<?> sectionClass)
Loads theFunctionNamespaceType
.- Parameters:
namespace
- Namespace.sectionClass
- SectionClass
.- Returns:
FunctionNamespaceType
.
-
adddSectionFunctionNamespace
protected SectionFunctionNamespace adddSectionFunctionNamespace(java.lang.String namespace, java.lang.Class<?> sectionClass)
Adds theSectionFunctionNamespace
.- Parameters:
namespace
- Namespace.sectionClass
- SectionClass
.- Returns:
SectionFunctionNamespace
.
-
isIncludeManagedFunctionType
protected boolean isIncludeManagedFunctionType(ManagedFunctionType<?,?> functionType)
Indicates if includeManagedFunctionType
.- Parameters:
functionType
-ManagedFunctionType
.- Returns:
true
include theManagedFunctionType
.
-
loadSpecification
protected void loadSpecification(AbstractSectionSource.SpecificationContext context)
Description copied from class:AbstractSectionSource
Loads theSectionSourceSpecification
.- Specified by:
loadSpecification
in classAbstractSectionSource
- Parameters:
context
-AbstractSectionSource.SpecificationContext
.
-
sourceSection
public void sourceSection(SectionDesigner designer, SectionSourceContext context) throws java.lang.Exception
Description copied from interface:SectionSource
Sources theOfficeSection
by constructing it via the inputSectionDesigner
.- Parameters:
designer
-SectionDesigner
to construct the structure of theOfficeSection
.context
-SectionSourceContext
to source details to construct theOfficeSection
.- Throws:
java.lang.Exception
- If fails to construct theOfficeSection
.
-
-