org.oddjob.jobs
Class CheckJob
java.lang.Object
org.oddjob.jobs.CheckJob
- All Implemented Interfaces:
- Serializable, Runnable, ArooaSessionAware
public class CheckJob
- extends Object
- implements Runnable, Serializable, ArooaSessionAware
Description
Checks a value for certain criteria. This
job is analogous to the Unix 'test' command.
This Job will COMPLETE if all checks pass. It will be INCOMPLETE
if any fail.
The conditional values are converted into the type of the
value before the checks are made. Thus in the example below
if the row count property is an integer, the 1000 is converted
into an integer for the comparison.
If the value property is not provided the job will be INCOMPLETE unless
the null property is set to true.
Example
Example text comparisons. All these checks COMPLETE.
<oddjob>
<job>
<sequential>
<jobs>
<check value="apple" eq="apple"/>
<check value="apple" ne="orange"/>
<check value="apple" lt="orange"/>
<check value="apple" le="apple"/>
<check value="orange" gt="apple"/>
<check value="orange" ge="orange"/>
<check value="anything" null="false"/>
<check value="${missing}" null="true"/>
<check value="pear" z="false"/>
<check value="" z="true"/>
</jobs>
</sequential>
</job>
</oddjob>
Checks that are INCOMPLETE.
<oddjob>
<job>
<!-- needed to force predictable state transitions for the unit test,
so Oddjob goes to INCOMPLETE not ACTIVE first. -->
<state:join xmlns:state="http://rgordon.co.uk/oddjob/state">
<job>
<parallel id="all-checks">
<jobs>
<check value="apple" eq="orange"/>
<check value="apple" ne="apple"/>
<check value="orange" lt="apple"/>
<check value="orange" le="apple"/>
<check value="apple" gt="orange"/>
<check value="apple" ge="orange"/>
<check value="anything" null="true"/>
<check value="${missing}" null="false"/>
</jobs>
</parallel>
</job>
</state:join>
</job>
</oddjob>
Example
Numeric checks. Note that the value must be the numeric value. The
operand attributes values are converted to the type of the value before
the comparison. If the value was "999" and the lt was "${sequence.current}"
this check would not be COMPLETE because the text "999" is greater than
"1000".
<oddjob>
<job>
<sequential>
<jobs>
<sequence id="sequence" from="1000"/>
<check value="${sequence.current}" eq="1000"/>
<check value="${sequence.current}" ne="999"/>
<check value="${sequence.current}" lt="1001"/>
<check value="${sequence.current}" le="1000"/>
<check value="${sequence.current}" gt="999"/>
<check value="${sequence.current}" ge="1000"/>
</jobs>
</sequential>
</job>
</oddjob>
Example
Check a Property Exists. The second check will be INCOMPLETE because the
property doesn't exist.
<oddjob>
<job>
<sequential>
<jobs>
<properties>
<values>
<value key="property.that.exists" value="some-value"/>
</values>
</properties>
<check name="Check Something that Exists" value="${property.that.exists}" id="should-complete"/>
<check name="Check Something that doesn't Exist" value="${property.doesnt.exist}" id="should-incomplete"/>
</jobs>
</sequential>
</job>
</oddjob>
- See Also:
- Serialized Form
- Author:
- rob
CheckJob
public CheckJob()
run
public void run()
- Specified by:
run
in interface Runnable
setArooaSession
public void setArooaSession(ArooaSession session)
- Specified by:
setArooaSession
in interface ArooaSessionAware
getName
public String getName()
setName
public void setName(String name)
getNull
public boolean getNull()
setNull
public void setNull(boolean value)
getZ
public Boolean getZ()
setZ
public void setZ(Boolean z)
getValue
public Object getValue()
setValue
public void setValue(Object value)
getEq
public ArooaValue getEq()
setEq
public void setEq(ArooaValue eq)
getNe
public ArooaValue getNe()
setNe
public void setNe(ArooaValue ne)
getLt
public ArooaValue getLt()
setLt
public void setLt(ArooaValue lt)
getGt
public ArooaValue getGt()
setGt
public void setGt(ArooaValue gt)
getLe
public ArooaValue getLe()
setLe
public void setLe(ArooaValue le)
getGe
public ArooaValue getGe()
setGe
public void setGe(ArooaValue ge)
getResult
public int getResult()
toString
public String toString()
- Overrides:
toString
in class Object