Automation Platform Tasks

ComponentManager

2 minute read

This class provides methods to load FlowPDF Components. It supports 2 loading strategies.

  • Local

    Local component gets loaded to current ComponentManager object context. In this case, it is only possible to access it from current object.

  • Global

    In this strategy component gets loaded for whole execution context and can be accessed using the static instance ComponentManager object. This is the default.

ComponentManager(FlowPlugin plugin)

Constructor of the ComponentManager object.

Parameters

  • (Optional)(FlowPlugin) Instance of the plugin that will be passed to the EF components. Exception will be thrown when Component expects instance but it is not defined.

Returns

ComponentManager

Usage

Component componentManager = new ComponentManager()

loadComponentLocal(Class componentClass, Map<String, Object> componentInitValues, FlowPlugin plugin)

Loads, initializes the component and saves a Component object in context of current ComponentManager object.

Parameters

  • (Required)(Class<Component>) Class of the component to be loaded.

  • (Required)(Map<String, Object>) Configuration values for the component. Will be passed to the init() method of the Component.

  • (Optional)(FlowPlugin) Instance of the plugin. Exception will be thrown when Component expects instance but it is not defined.

Returns

Component object

Usage

ComponentManager cm = new ComponentManager()
YourComponent yc = (YourComponent) cm.loadComponentLocal(YourComponent.class, [one : 'two'])

Accepts a component name and initialization values as parameters.

loadComponent(Class<Component> componentClass, Map<String, Object> componentInitValues, FlowPlugin plugin)

Loads, initializes the component and returns a Component object in global context.

Parameters

  • (Required)(Class<Component>) Class of the component to be loaded.

  • (Required)(Map<String, Object>) Configuration values for the component. Will be passed to the init() method of the Component.

  • (Optional)(FlowPlugin) Instance of the plugin. Exception will be thrown when Component expects instance but it is not defined.

Returns

Component object

Usage

YourComponent yc = (YourComponent) ComponentManager.loadComponent(YourComponent.class, [one : 'two'], this);

Accepts as parameters component name and initialization values.

getComponent(Class<Component> componentClass)

Returns a Component object that was previously loaded globally. For local context see getComponentLocal.

Parameters

  • (Required)(Class<Component> componentClass) Class of the previously instantiated component.

Returns

Component object

Usage

ProxyComponent yc = (ProxyComponent) ComponentManager.getComponent(ProxyComponent.class)

getComponentLocal(Class<Component> componentClass)

Returns a Component object that was previously loaded in local context.

Parameters

  • (Required)(Class<Component> componentClass) Class of the previously instantiated component.

Returns

  • Component object

Usage

ProxyComponent yc = (ProxyComponent) ComponentManager.getComponentLocal(ProxyComponent.class)