Class RuleExecutionResult
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.buildlangModel.RuleExecutionResult
-
- All Implemented Interfaces:
IStringValueProvider,IVilType
public class RuleExecutionResult extends java.lang.Object implements IVilType, IStringValueProvider
Denotes the result of a rule execution.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRuleExecutionResult.StatusDenotes the execution status.-
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
IStringValueProvider.StringComparator
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<IArtifact>allResultsprivate java.lang.IntegerfailCodeprivate java.lang.StringfailReasonprivate booleanhasChangesprivate java.util.List<IArtifact>resultprivate RuleExecutionResult.Statusstatusstatic TypeDescriptor<?>TYPE
-
Constructor Summary
Constructors Constructor Description RuleExecutionResult(RuleExecutionResult.Status status, RuleExecutionContext context)Creates a new rule execution result.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<IArtifact>allResults()All results achieved so far.(package private) java.util.Collection<IArtifact>allResultsAsCollection()Returns all results collected so far as a Java collection.static Set<IArtifact>convert(RuleExecutionResult res)Conversion operation.voidfail()Changes the status toRuleExecutionResult.Status.FAIL.java.lang.IntegergetFailCode()The failure code.java.lang.StringgetFailReason()Returns the fail reason (if the execution failed).RuleExecutionResult.StatusgetStatus()Returns the execution status of the rule.java.lang.StringgetStringValue(IStringValueProvider.StringComparator comparator)Returns the string value of this object.booleanhasChanges()Returns whether the rule call represented by this instance changed the configuration and committed the changes.Set<IArtifact>result()The immediate result of the execution.(package private) java.util.Collection<IArtifact>resultAsCollection()Returns the results of the execution of the related rule as a Java collection.voidsetChanges(boolean hasChanges)Defines whether the rule call represented by this instance changed the configuration and committed the changes.private static java.util.List<IArtifact>transfer(java.util.Collection<IArtifact> in)Transfers the data inininto a new list to be stored in an instance of this class.
-
-
-
Field Detail
-
TYPE
public static final TypeDescriptor<?> TYPE
-
status
private RuleExecutionResult.Status status
-
result
private java.util.List<IArtifact> result
-
allResults
private java.util.List<IArtifact> allResults
-
failReason
private java.lang.String failReason
-
failCode
private java.lang.Integer failCode
-
hasChanges
private boolean hasChanges
-
-
Constructor Detail
-
RuleExecutionResult
public RuleExecutionResult(RuleExecutionResult.Status status, RuleExecutionContext context)
Creates a new rule execution result.- Parameters:
status- the execution statuscontext- the actual rule execution context to take the data from
-
-
Method Detail
-
transfer
private static java.util.List<IArtifact> transfer(java.util.Collection<IArtifact> in)
Transfers the data inininto a new list to be stored in an instance of this class.- Parameters:
in- the collection to be considered as input- Returns:
- the created list
-
result
public Set<IArtifact> result()
The immediate result of the execution.- Returns:
- the immediate result
-
allResultsAsCollection
java.util.Collection<IArtifact> allResultsAsCollection()
Returns all results collected so far as a Java collection.- Returns:
- all results
-
resultAsCollection
java.util.Collection<IArtifact> resultAsCollection()
Returns the results of the execution of the related rule as a Java collection.- Returns:
- the immediate results
-
getStatus
public RuleExecutionResult.Status getStatus()
Returns the execution status of the rule.- Returns:
- the execution status
-
fail
public void fail()
Changes the status toRuleExecutionResult.Status.FAIL.
-
getFailReason
public java.lang.String getFailReason()
Returns the fail reason (if the execution failed).- Returns:
- the reason or null if unknown, not set or not failing
-
getFailCode
public java.lang.Integer getFailCode()
The failure code.- Returns:
- the failure code (may be null if not set)
-
setChanges
public void setChanges(boolean hasChanges)
Defines whether the rule call represented by this instance changed the configuration and committed the changes.- Parameters:
hasChanges-truefor changes,falseelse
-
hasChanges
public boolean hasChanges()
Returns whether the rule call represented by this instance changed the configuration and committed the changes.- Returns:
truefor changes,falseelse
-
convert
public static Set<IArtifact> convert(RuleExecutionResult res)
Conversion operation.- Parameters:
res- the rule execution result to be converted/projected- Returns:
- the converted value
-
getStringValue
public java.lang.String getStringValue(IStringValueProvider.StringComparator comparator)
Description copied from interface:IStringValueProviderReturns the string value of this object.- Specified by:
getStringValuein interfaceIStringValueProvider- Parameters:
comparator- if the sequence of elements, e.g., in case of collections, shall be ordered according to the comparator, null if the original sequence shall be returned- Returns:
- the string value
-
-