Class NodeDependencyProvider
- java.lang.Object
-
- de.aristaflow.adept2.core.changeoperations.NodeDependencyProvider
-
- All Implemented Interfaces:
DependencyProvider
- Direct Known Subclasses:
VolatileNodeDependencyProvider
public class NodeDependencyProvider extends Object implements DependencyProvider
A default implementation ofDependencyProviderthat should be sufficient for most cases.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Dependency>injectedDependenciesinjected parameters and their dependenciesprotected Nodenodenode determining the context for the dependency providerprotected Templatetemplatetemplate determining the context for the dependency provider
-
Constructor Summary
Constructors Constructor Description NodeDependencyProvider(Template template, int nodeID)Constructs a newNodeDependencyProviderfor the specified process template and node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Pair<ProcessConstants.AdeptDataType,String>getCompleteDataTypeOf(String parameterName)Returns the data type (including the UDT name if appropriate) of the parameter with the specified name ornullif the parameter does not exist.DependencygetDependencyOf(String parameterName)Returns dependency-related information about the parameter with the specified name ornullif the parameter has currently no dependency bound to it or the parameter does not exist.Map<Dependency,String>getDependencyTypeArguments(Object dependencyType, ProcessConstants.AdeptDataType dataType, String udtName)The same asDependencyProvider.getDependencyTypeArguments(Object, de.aristaflow.adept2.model.globals.ProcessConstants.AdeptDataType, UUID)but restricting based on the designated UDT name instead of the identifier ID.Map<Dependency,String>getDependencyTypeArguments(Object dependencyType, ProcessConstants.AdeptDataType dataType, UUID identifierID)Returns all available dependencies for the specified dependency type in a map.Map<Object,String>getDependencyTypes(ProcessConstants.AdeptDataType dataType, UUID identifierID)Returns all available dependency types in a map.StringgetLabelForArgument(Dependency dependency)Returns a label text for argument of the designated dependency.StringgetLabelForType(Object dependencyType)Returns a label text for the given dependency type.StringgetLabelForTypeAndArgument(Dependency dependency)Returns a label text for the designated dependency.Map<String,Dependency>getParameterBindings()Returns the parameter bindings, i.e.ParameterRef[]getParameters()Returns all already existing parameters.ParameterRefgetPreferredParameter(Dependency dependency)Returns the preferred parameter name and type for the specified dependency.voidinjectDependency(String parameterName, Dependency dependency)Injects an additional parameter into this dependency provider.booleanparameterExists(String parameterName)Returns whether a parameter with the specified name already exists.voidremoveInjectedDependency(String parameterName)Removes an injected parameter with the specified name from this dependency provider.
-
-
-
Field Detail
-
template
protected Template template
template determining the context for the dependency provider
-
node
protected final Node node
node determining the context for the dependency provider
-
injectedDependencies
protected final Map<String,Dependency> injectedDependencies
injected parameters and their dependencies
-
-
Constructor Detail
-
NodeDependencyProvider
public NodeDependencyProvider(Template template, int nodeID)
Constructs a newNodeDependencyProviderfor the specified process template and node.- Parameters:
template- template determining the context for the dependency providernodeID- node determining the context for the dependency provider
-
-
Method Detail
-
getParameters
public ParameterRef[] getParameters()
Description copied from interface:DependencyProviderReturns all already existing parameters. UseDependencyProvider.getDependencyOf(String)to retrieve dependency information about each parameter.- Specified by:
getParametersin interfaceDependencyProvider- Returns:
- all already existing parameters
-
getParameterBindings
public Map<String,Dependency> getParameterBindings()
Returns the parameter bindings, i.e. the dependency of each parameter in a map. This is equivalent to callinggetDependencyOf(String)for each parameter returned bygetParameters().- Returns:
- the parameter bindings, i.e. the dependency of each parameter in a map
-
parameterExists
public boolean parameterExists(String parameterName)
Description copied from interface:DependencyProviderReturns whether a parameter with the specified name already exists.- Specified by:
parameterExistsin interfaceDependencyProvider- Parameters:
parameterName- name of the parameter to be looked for- Returns:
- whether a parameter with the specified name already exists
-
getDependencyOf
public Dependency getDependencyOf(String parameterName)
Description copied from interface:DependencyProviderReturns dependency-related information about the parameter with the specified name ornullif the parameter has currently no dependency bound to it or the parameter does not exist.- Specified by:
getDependencyOfin interfaceDependencyProvider- Parameters:
parameterName- the name of the parameter for which to return dependency-related information- Returns:
- dependency-related information for the specified parameter
-
getCompleteDataTypeOf
public Pair<ProcessConstants.AdeptDataType,String> getCompleteDataTypeOf(String parameterName)
Description copied from interface:DependencyProviderReturns the data type (including the UDT name if appropriate) of the parameter with the specified name ornullif the parameter does not exist.- Specified by:
getCompleteDataTypeOfin interfaceDependencyProvider- Parameters:
parameterName- the name of the parameter for which to return dependency-related information- Returns:
- The data type including the UDT name of the specified parameter. If
the designated parameter does not exist,
nullwill be returned. If the designated parameter is notProcessConstants.AdeptDataType.USERDEFINED, the second element of the pair will benull.
-
getDependencyTypes
public Map<Object,String> getDependencyTypes(ProcessConstants.AdeptDataType dataType, UUID identifierID)
Description copied from interface:DependencyProviderReturns all available dependency types in a map. This number of dependency types can optionally be limited by specifying adata typeand (also optionally} an identifier ID.The dependency types are represented by objects and used as keys in the maps. The value is a label text created by
DependencyProvider.getLabelForType(Object).The map should have a specific, consistent order (-> e.g.
LinkedHashMap).- Specified by:
getDependencyTypesin interfaceDependencyProvider- Parameters:
dataType- data type to limit the number of returned dependency types; may benullfor no restrictionidentifierID- identifier ID to further limit the number of returned dependency types; may benullfor no restriction- Returns:
- all available dependency types in a map (matching the optionally specified data type and identifier ID)
-
getDependencyTypeArguments
public Map<Dependency,String> getDependencyTypeArguments(Object dependencyType, ProcessConstants.AdeptDataType dataType, UUID identifierID)
Description copied from interface:DependencyProviderReturns all available dependencies for the specified dependency type in a map. The arguments are the dependencies while the value is a label text created byDependencyProvider.getLabelForType(Object).If the dependency type does not need any arguments a singleton map with
nullas key is returned. If the returned map is empty this means that there are no valid arguments which basically renders the dependency type unusable in the current context.The map should have a specific, consistent order (-> e.g.
LinkedHashMap).- Specified by:
getDependencyTypeArgumentsin interfaceDependencyProvider- Parameters:
dependencyType- the dependency type for which to return available argumentsdataType- data type to limit the number of returned dependency type argumentsidentifierID- identifier ID to further limit the number of returned dependency type arguments; may benullfor no restriction- Returns:
- all arguments for the specified dependency type in a map (matching the optionally specified data type and identifier ID)
-
getDependencyTypeArguments
public Map<Dependency,String> getDependencyTypeArguments(Object dependencyType, ProcessConstants.AdeptDataType dataType, String udtName)
Description copied from interface:DependencyProviderThe same asDependencyProvider.getDependencyTypeArguments(Object, de.aristaflow.adept2.model.globals.ProcessConstants.AdeptDataType, UUID)but restricting based on the designated UDT name instead of the identifier ID.- Specified by:
getDependencyTypeArgumentsin interfaceDependencyProvider- Parameters:
dependencyType- The dependency type for which to return available arguments.dataType- The data type to limit the number of returned dependency type arguments.udtName- The name of the UDT (in case of a UDT) to limit the number of returned dependency type arguments. This may benull.- Returns:
- All arguments for the specified dependency type in a map (matching the data type and UDT name).
-
getLabelForType
public String getLabelForType(Object dependencyType)
Description copied from interface:DependencyProviderReturns a label text for the given dependency type.- Specified by:
getLabelForTypein interfaceDependencyProvider- Parameters:
dependencyType- dependency type for which to return a label- Returns:
- a label text for the given dependency type
-
getLabelForArgument
public String getLabelForArgument(Dependency dependency)
Description copied from interface:DependencyProviderReturns a label text for argument of the designated dependency.- Specified by:
getLabelForArgumentin interfaceDependencyProvider- Parameters:
dependency- The dependency of which to receive a label of the argument.- Returns:
- A label text for the argument of the designated dependency.
-
getLabelForTypeAndArgument
public String getLabelForTypeAndArgument(Dependency dependency)
Description copied from interface:DependencyProviderReturns a label text for the designated dependency.- Specified by:
getLabelForTypeAndArgumentin interfaceDependencyProvider- Parameters:
dependency- the dependency for which to return a label- Returns:
- a label text for the given dependency
-
getPreferredParameter
public ParameterRef getPreferredParameter(Dependency dependency)
Description copied from interface:DependencyProviderReturns the preferred parameter name and type for the specified dependency. Each combination of dependency type and argument should have its own unique name. If a parameter for the dependency already exists, that parameter's name is returned instead, even if it doesn't have the preferred name. If the preferred name is already occupied by a parameter which is associated to a different dependency, a different parameter name is generated in a deterministic way.- Specified by:
getPreferredParameterin interfaceDependencyProvider- Parameters:
dependency- the dependency for which to return the preferred parameter name- Returns:
- the preferred parameter name for the specified dependency
-
injectDependency
public void injectDependency(String parameterName, Dependency dependency)
Injects an additional parameter into this dependency provider. Usually existing parameters are queried from the template. Temporary parameters (like in the PnP/Node Wizard) that don't exist yet in the template can be added with this method.- Parameters:
parameterName- the name of the injected parameterdependency- the dependency of the injected parameter
-
removeInjectedDependency
public void removeInjectedDependency(String parameterName)
Removes an injected parameter with the specified name from this dependency provider.- Parameters:
parameterName- the name of the injected parameter
-
-