public class TransformationUtilityLoop extends TransformationUtility<TransformationUtilityLoop> implements com.paypal.butterfly.extensions.api.TransformationUtilityParent
TransformationUtilityGroup
, multiple times in a loop.
The number of iterations is defined by one of these options:
TransformationContext
attribute (by its name) whose value is true or false. If that is not a boolean, or if non-existent, it will be treated as false. If that is false, the loop is interrupted.UtilityCondition
object whose result is true or false. The result of this TU condition object won't be saved to the TC, it will be executed exclusively to the scope of this loop execution. Any result other than a boolean true value, including failures, will be treated as false. If that is false, the loop is interrupted.UTILITY_NAME_SYNTAX
Constructor and Description |
---|
TransformationUtilityLoop()
Allows the execution of any transformation utility instance,
including a
TransformationUtilityGroup , multiple times in a loop. |
TransformationUtilityLoop(TransformationUtility template)
Allows the execution of any transformation utility instance,
including a
TransformationUtilityGroup , multiple times in a loop. |
Modifier and Type | Method and Description |
---|---|
protected ExecutionResult |
execution(java.io.File transformedAppFolder,
TransformationContext transformationContext)
Returns, as its value, the condition to keep iterating over this loop
|
java.lang.String |
getAttribute() |
java.util.List<TransformationUtility> |
getChildren() |
TransformationUtility |
getCondition() |
java.lang.String |
getDescription()
Returns a short one line, but SPECIFIC, description about the transformation
utility, including mentioning the files and/or folders
to be manipulated.
|
int |
getIterations() |
int |
getNextIteration() |
TransformationUtility |
getTemplate() |
TransformationUtility |
iterate()
Returns a clone of this transformation utility loop ready for the next iteration
|
TransformationUtility |
run()
Returns the TU instance to be run in the this iteration.
|
TransformationUtilityLoop |
setCondition(int iterations)
In this case the condition to execute the next iteration is based on
a pre-defined number of iterations to be executed.
|
TransformationUtilityLoop |
setCondition(java.lang.String attribute)
In this case the condition to execute the next iteration is based on
a
TransformationContext attribute (specified by its name) whose
value is true or false. |
TransformationUtilityLoop |
setCondition(UtilityCondition condition)
In this case the condition to execute the next iteration is based on
a
UtilityCondition object whose result is true or false. |
protected TransformationUtilityLoop |
setName(java.lang.String name)
Set this transformation utility instance name.
|
TransformationUtilityLoop |
setTemplate(TransformationUtility template)
Sets the transformation utility instance to be used as a template.
|
abortOnFailure, abortOnFailure, absolute, absolute, applyPropertiesFromContext, checkDependencies, checkForBlankString, checkForEmptyString, checkForNull, clone, copy, dependsOn, equals, executeIf, executeIf, executeUnless, getAbortionMessage, getAbsoluteFile, getContextAttributeName, getDependencies, getIfConditionAttributeName, getName, getOrder, getParent, getRelativePath, getRelativePath, getSimpleClassName, getTransformationTemplate, getUnlessConditionAttributeName, hasBeenPerformed, hashCode, hashCode, isAbortOnFailure, isFileSet, isSaveResult, normalizeRelativePathSeparator, perform, relative, set, setContextAttributeName, setParent, setSaveResult, toString, wasFileExplicitlySet
public TransformationUtilityLoop()
TransformationUtilityGroup
, multiple times in a loop.
The number of iterations is defined by one of these options:
TransformationContext
attribute (by its name) whose value is true or false. If that is not a boolean, or if non-existent, it will be treated as false. If that is false, the loop is interrupted.UtilityCondition
object whose result is true or false. The result of this TU condition object won't be saved to the TC, it will be executed exclusively to the scope of this loop execution. Any result other than a boolean true value, including failures, will be treated as false. If that is false, the loop is interrupted.public TransformationUtilityLoop(TransformationUtility template)
TransformationUtilityGroup
, multiple times in a loop.
The number of iterations is defined by one of these options:
TransformationContext
attribute (by its name) whose value is true or false. If that is not a boolean, or if non-existent, it will be treated as false. If that is false, the loop is interrupted.UtilityCondition
object whose result is true or false. The result of this TU condition object won't be saved to the TC, it will be executed exclusively to the scope of this loop execution. Any result other than a boolean true value, including failures, will be treated as false. If that is false, the loop is interrupted.template
- the transformation utility instance to be used a template.
A clone utility instance will be created out of the template
for each iteration. See TransformationUtility.clone()
for further information
about the clone object.public TransformationUtilityLoop setTemplate(TransformationUtility template)
TransformationUtility.clone()
for further information
about the clone object.template
- the transformation utility instance to be used as template.public TransformationUtilityLoop setCondition(int iterations)
iterations
- the total number of iterations to be executedpublic TransformationUtilityLoop setCondition(java.lang.String attribute)
TransformationContext
attribute (specified by its name) whose
value is true or false. If that is not a boolean, or if non-existent,
it will be treated as false. If that is false, the loop is interrupted.attribute
- the name of the transformation context attribute
holding the boolean to be used as the condition
to execute the next iteration. If that is false,
the loop is interrupted.public TransformationUtilityLoop setCondition(UtilityCondition condition)
UtilityCondition
object whose result is true or false.
The result of this TU condition object won't be saved to the TC,
it will be executed exclusively to the scope of this loop execution.
Any result other than a boolean true value, including failures, will be treated as false.
If that is false, the loop is interrupted.condition
- the UtilityCondition
object whose result
will be used as the condition to execute the next iteration.
If that is false, the loop is interrupted.protected TransformationUtilityLoop setName(java.lang.String name)
TransformationUtility
setName
in class TransformationUtility<TransformationUtilityLoop>
name
- transformation utility instance namepublic TransformationUtility getTemplate()
public int getIterations()
public java.lang.String getAttribute()
public TransformationUtility getCondition()
public int getNextIteration()
public java.lang.String getDescription()
TransformationUtility
getDescription
in class TransformationUtility<TransformationUtilityLoop>
public java.util.List<TransformationUtility> getChildren()
getChildren
in interface com.paypal.butterfly.extensions.api.TransformationUtilityParent
protected ExecutionResult execution(java.io.File transformedAppFolder, TransformationContext transformationContext)
execution
in class TransformationUtility<TransformationUtilityLoop>
transformedAppFolder
- the folder where the transformed application code istransformationContext
- the transformation context objectpublic TransformationUtility run()
public TransformationUtility iterate()