Class TransformMeta
- java.lang.Object
-
- org.apache.hop.pipeline.transform.TransformMeta
-
- All Implemented Interfaces:
Cloneable,Comparable<TransformMeta>,IBaseMeta,IGuiPosition,IAttributes,ICheckResultSource,IResourceExport,IResourceHolder
public class TransformMeta extends Object implements Cloneable, Comparable<TransformMeta>, IGuiPosition, ICheckResultSource, IResourceExport, IResourceHolder, IAttributes, IBaseMeta
This class contains everything that is needed to define a transform.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Map<String,String>>attributesMapstatic StringSTRING_ID_ETL_META_INJECTstatic StringSTRING_ID_MAPPINGstatic StringSTRING_ID_MAPPING_INPUTstatic StringSTRING_ID_MAPPING_OUTPUTstatic StringSTRING_ID_SINGLE_THREADERstatic StringSTRING_ID_WORKFLOW_EXECUTORstatic StringXML_TAG
-
Constructor Summary
Constructors Constructor Description TransformMeta()TransformMeta(String transformId, String transformName, ITransformMeta transform)TransformMeta(String transformName, ITransformMeta transform)TransformMeta(Node transformNode, IHopMetadataProvider metadataProvider)Read the transform data from XML
-
Method Summary
-
-
-
Field Detail
-
XML_TAG
public static final String XML_TAG
- See Also:
- Constant Field Values
-
STRING_ID_MAPPING
public static final String STRING_ID_MAPPING
- See Also:
- Constant Field Values
-
STRING_ID_SINGLE_THREADER
public static final String STRING_ID_SINGLE_THREADER
- See Also:
- Constant Field Values
-
STRING_ID_ETL_META_INJECT
public static final String STRING_ID_ETL_META_INJECT
- See Also:
- Constant Field Values
-
STRING_ID_WORKFLOW_EXECUTOR
public static final String STRING_ID_WORKFLOW_EXECUTOR
- See Also:
- Constant Field Values
-
STRING_ID_MAPPING_INPUT
public static final String STRING_ID_MAPPING_INPUT
- See Also:
- Constant Field Values
-
STRING_ID_MAPPING_OUTPUT
public static final String STRING_ID_MAPPING_OUTPUT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TransformMeta
public TransformMeta(String transformId, String transformName, ITransformMeta transform)
- Parameters:
transformId- The plugin ID of the transformtransformName- The name of the new transformtransform- The transform metadata interface to use (TextFileInputMeta, etc)
-
TransformMeta
public TransformMeta(String transformName, ITransformMeta transform)
- Parameters:
transformName- The name of the new transformtransform- The transform metadata interface to use (TextFileInputMeta, etc)
-
TransformMeta
public TransformMeta()
-
TransformMeta
public TransformMeta(Node transformNode, IHopMetadataProvider metadataProvider) throws HopXmlException, HopPluginLoaderException
Read the transform data from XML- Parameters:
transformNode- The XML transform node.metadataProvider- where to get the metadata.- Throws:
HopXmlExceptionHopPluginLoaderException
-
-
Method Detail
-
getXml
public String getXml() throws HopException
- Throws:
HopException
-
fromXml
public static TransformMeta fromXml(String metaXml)
-
setCopies
public void setCopies(int c)
Sets the number of parallel copies that this transform will be launched with.- Parameters:
c- The number of copies.
-
getCopies
public int getCopies(IVariables variables)
Get the number of copies to start of a transform. This takes into account the partitioning logic.- Returns:
- the number of transform copies to start.
-
equals
public boolean equals(Object obj)
Two transforms are equal if their names are equal.
-
compareTo
public int compareTo(TransformMeta o)
- Specified by:
compareToin interfaceComparable<TransformMeta>
-
hasChanged
public boolean hasChanged()
-
setChanged
public void setChanged(boolean ch)
-
setChanged
public void setChanged()
-
chosesTargetTransforms
public boolean chosesTargetTransforms()
-
replaceMeta
public void replaceMeta(TransformMeta transformMeta)
-
getTransform
public ITransformMeta getTransform()
-
setTransform
public void setTransform(ITransformMeta transform)
-
getTransformPluginId
public String getTransformPluginId()
-
getName
public String getName()
- Specified by:
getNamein interfaceICheckResultSource- Specified by:
getNamein interfaceIResourceHolder- Returns:
- The name of the holder of the resource
-
setName
public void setName(String sname)
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfaceICheckResultSource- Specified by:
getDescriptionin interfaceIResourceHolder- Returns:
- The description of the holder of the resource
-
setDescription
public void setDescription(String description)
-
setSelected
public void setSelected(boolean sel)
- Specified by:
setSelectedin interfaceIGuiPosition
-
flipSelected
public void flipSelected()
-
isSelected
public boolean isSelected()
- Specified by:
isSelectedin interfaceIGuiPosition
-
setTerminator
public void setTerminator()
-
setTerminator
public void setTerminator(boolean t)
-
hasTerminator
public boolean hasTerminator()
-
setLocation
public void setLocation(int x, int y)- Specified by:
setLocationin interfaceIGuiPosition
-
setLocation
public void setLocation(Point loc)
- Specified by:
setLocationin interfaceIGuiPosition
-
getLocation
public Point getLocation()
- Specified by:
getLocationin interfaceIBaseMeta- Specified by:
getLocationin interfaceIGuiPosition
-
check
public void check(List<ICheckResult> remarks, PipelineMeta pipelineMeta, IRowMeta prev, String[] input, String[] output, IRowMeta info, IVariables variables, IHopMetadataProvider metadataProvider)
-
isPartitioned
public boolean isPartitioned()
- Returns:
- true is the transform is partitioned
-
isTargetPartitioned
public boolean isTargetPartitioned()
- Returns:
- true is the transform is partitioned
-
getTransformPartitioningMeta
public TransformPartitioningMeta getTransformPartitioningMeta()
- Returns:
- the transformPartitioningMeta
-
setTransformPartitioningMeta
public void setTransformPartitioningMeta(TransformPartitioningMeta transformPartitioningMeta)
- Parameters:
transformPartitioningMeta- the transformPartitioningMeta to set
-
isDistributes
public boolean isDistributes()
- Returns:
- the distributes
-
setDistributes
public void setDistributes(boolean distributes)
- Parameters:
distributes- the distributes to set
-
getTransformErrorMeta
public TransformErrorMeta getTransformErrorMeta()
- Returns:
- the TransformErrorMeta error handling metadata for this transform
-
setTransformErrorMeta
public void setTransformErrorMeta(TransformErrorMeta transformErrorMeta)
- Parameters:
transformErrorMeta- the error handling metadata for this transform
-
findTransform
public static final TransformMeta findTransform(List<TransformMeta> transforms, String transformName)
Find a transform with its name in a given ArrayList of transforms- Parameters:
transforms- The List of transforms to searchtransformName- The name of the transform- Returns:
- The transform if it was found, null if nothing was found
-
supportsErrorHandling
public boolean supportsErrorHandling()
-
isDoingErrorHandling
public boolean isDoingErrorHandling()
- Returns:
- if error handling is supported for this transform, if error handling is defined and a target transform is set
-
isSendingErrorRowsToTransform
public boolean isSendingErrorRowsToTransform(TransformMeta targetTransform)
-
getTypeId
public String getTypeId()
Support for ICheckResultSource- Specified by:
getTypeIdin interfaceIResourceHolder- Returns:
- JOBENTRY, TRANSFORM, etc.
-
getPluginId
public String getPluginId()
- Specified by:
getPluginIdin interfaceIResourceHolder- Returns:
- The Type ID of the resource holder. The Type ID is the system-defined type identifier (like PIPELINE or SORT).
-
isMapping
public boolean isMapping()
-
isSingleThreader
public boolean isSingleThreader()
-
isEtlMetaInject
public boolean isEtlMetaInject()
-
isWorkflowExecutor
public boolean isWorkflowExecutor()
-
isMappingInput
public boolean isMappingInput()
-
isMappingOutput
public boolean isMappingOutput()
-
getResourceDependencies
public List<ResourceReference> getResourceDependencies(IVariables variables)
Get a list of all the resource dependencies that the transform is depending on.- Returns:
- a list of all the resource dependencies that the transform is depending on
-
exportResources
public String exportResources(IVariables variables, Map<String,ResourceDefinition> definitions, IResourceNaming iResourceNaming, IHopMetadataProvider metadataProvider) throws HopException
Description copied from interface:IResourceExportExports the object to a flat-file system, adding content with filename keys to a set of definitions. The supplied resource naming interface allows the object to name appropriately without worrying about those parts of the implementation specific details.- Specified by:
exportResourcesin interfaceIResourceExport- Parameters:
variables- The variable variables to resolve (environment) variables with.definitions- The map containing the filenames and contentiResourceNaming- The resource naming interface allows the object to name appropriatelymetadataProvider- the central metadata to load non-hop specific metadata from- Returns:
- The filename for this object. (also contained in the definitions map)
- Throws:
HopException- in case something goes wrong during the export
-
getTargetTransformPartitioningMeta
public TransformPartitioningMeta getTargetTransformPartitioningMeta()
- Returns:
- the targetTransformPartitioningMeta
-
setTargetTransformPartitioningMeta
public void setTargetTransformPartitioningMeta(TransformPartitioningMeta targetTransformPartitioningMeta)
- Parameters:
targetTransformPartitioningMeta- the targetTransformPartitioningMeta to set
-
isRepartitioning
public boolean isRepartitioning()
-
setTransformPluginId
public void setTransformPluginId(String transformPluginId)
Set the plugin transform id (code)- Parameters:
transformPluginId-
-
setParentPipelineMeta
public void setParentPipelineMeta(PipelineMeta parentPipelineMeta)
-
getParentPipelineMeta
public PipelineMeta getParentPipelineMeta()
-
getRowDistribution
public IRowDistribution getRowDistribution()
-
setRowDistribution
public void setRowDistribution(IRowDistribution rowDistribution)
-
getCopiesString
public String getCopiesString()
- Returns:
- the copiesString
-
setCopiesString
public void setCopiesString(String copiesString)
- Parameters:
copiesString- the copiesString to set
-
setAttributesMap
public void setAttributesMap(Map<String,Map<String,String>> attributesMap)
- Specified by:
setAttributesMapin interfaceIAttributes
-
getAttributesMap
public Map<String,Map<String,String>> getAttributesMap()
- Specified by:
getAttributesMapin interfaceIAttributes
-
setAttribute
public void setAttribute(String groupName, String key, String value)
- Specified by:
setAttributein interfaceIAttributes
-
setAttributes
public void setAttributes(String groupName, Map<String,String> attributes)
- Specified by:
setAttributesin interfaceIAttributes
-
getAttributes
public Map<String,String> getAttributes(String groupName)
- Specified by:
getAttributesin interfaceIAttributes
-
getAttribute
public String getAttribute(String groupName, String key)
- Specified by:
getAttributein interfaceIAttributes
-
isMissing
public boolean isMissing()
-
isDeprecated
public boolean isDeprecated()
-
getSuggestion
public String getSuggestion()
-
-