com.edustructures.sifworks
Class Condition

java.lang.Object
  extended by com.edustructures.sifworks.Condition

public class Condition
extends java.lang.Object

A query condition.


Constructor Summary
Condition(ElementDef field, ComparisonOperators ops, java.lang.String value)
          Constructs a query condition
Condition(java.lang.String xPath, ComparisonOperators ops, java.lang.String value)
          Constructs a query condition using an xpath query string
 
Method Summary
 ElementDef getField()
          Gets the metadata for the field to evaluate.
 ComparisonOperators getOperator()
          Gets the comparision operator
 java.lang.String getValue()
          Gets the comparison value.
 java.lang.String getXPath()
          Gets the XPath representation of the Query condition.
 java.lang.String getXPath(Query q, SIFVersion version)
          Gets the XPath representation of this query for the specific version of SIF
static ComparisonOperators parseComparisionOperators(java.lang.String op)
          Parses a comparison operator represented as a string
static GroupOperators parseGroupOperator(java.lang.String op)
          Parses a grouping operator represented as a string
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Condition

public Condition(ElementDef field,
                 ComparisonOperators ops,
                 java.lang.String value)
Constructs a query condition

Parameters:
field - A static constant defined by the ADK to identify the field (i.e. element or attribute) to evaluate.
ops - The comparison operator from the ComparisonOperators enum
value - The value to evaluate

Condition

public Condition(java.lang.String xPath,
                 ComparisonOperators ops,
                 java.lang.String value)
Constructs a query condition using an xpath query string

Parameters:
xPath - The path to the field. e.g. "Name/FirstName"
ops - The comparison operator from the ComparisonOperators enum
value - The value to evaluate
Method Detail

getOperator

public ComparisonOperators getOperator()
Gets the comparision operator

Returns:
A combination of: EQ, LT, GT, and NOT

getField

public ElementDef getField()
Gets the metadata for the field to evaluate.

Returns:
The ElementDef representing the Query condition or null if the Query condition represents a deeply nested XPath.
See Also:
getXPath()

getXPath

public java.lang.String getXPath()
Gets the XPath representation of the Query condition. e.g. "Name/LastName" or "SIF_ExtendedElements/SIF_ExtendedElement[@Name='eyecolor']"

Returns:
The XPath representation of the query

getXPath

public java.lang.String getXPath(Query q,
                                 SIFVersion version)
Gets the XPath representation of this query for the specific version of SIF

Parameters:
q - The Query that this condition is associated with
version - The version of SIF to use when rendering element names in the path
Returns:
The XPath representation of this query path in the specified version of SIF

getValue

public java.lang.String getValue()
Gets the comparison value. The actual type of this value can be a string or a more strongly-typed value

Returns:
The

parseGroupOperator

public static GroupOperators parseGroupOperator(java.lang.String op)
                                         throws ADKUnknownOperatorException
Parses a grouping operator represented as a string

Parameters:
op - An operator value such as "And", "Or", "None"
Returns:
the parsed enum value
Throws:
ADKUnknownOperatorException - if the operator is not equal to "And", "Or", or "None"

parseComparisionOperators

public static ComparisonOperators parseComparisionOperators(java.lang.String op)
                                                     throws ADKUnknownOperatorException
Parses a comparison operator represented as a string

Parameters:
op - An operator value such as "EQ", "NEQ", "LT", "GT", "GE", "LE"
Returns:
the parsed enum value
Throws:
ADKUnknownOperatorException - If the comparision operator cannot be parsed


Copyright © 2001-2007 Edustructures LLC. All Rights Reserved. SIFWorks® and ADK® are registered trademarks of Edustructures LLC. SIF™ and Schools Interoperability Framework are trademarks of the Schools Interoperability Framework Association.