|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.edustructures.sifworks.SIFDTD
public class SIFDTD
Metadata for the Schools Interoperability Framework (SIF)
SIFDTD defines global ElementDef constants that describe SIF Data Objects, elements, and attributes across all supported versions of the SIF Specification. The ADK uses this metadata internally to parse and render SIF Data Objects. In addition, many of the framework APIs require that the programmer pass an ElementDef constant from the SIFDTD class to identify an object, element, or attribute.
ElementDef constants are named [PARENT_]ENTITY, where
PARENT is the name of the parent element and
ENTITY is the name of the element or attribute
encapsulated by the ElementDef. Some examples of ElementDef constants defined
by this class include:
| ElementDef | Description |
SIFDTD.STUDENTPERSONAL |
Identifies the StudentPersonal data object |
Zone.setSubscriber
method is an ElementDef:
myZone.setSubscriber( SIFDTD.BUSINFO, this, ADKFlags.PROV_SUBSCRIBE );
ElementDef also identifies child elements and attributes as demonstrated by the
Query.addCondition method:
Query query = new Query( SIFDTD.STUDENTPERSONAL );
query.addCondition(
SIFDTD.STUDENTPERSONAL_REFID, Condition.EQ,
"4A37969803F0D00322AF0EB969038483" );
SDO Libraries
ElementDef metadata is grouped into "SDO Libraries", which are organized along
SIF Working Group boundaries. SDO Libraries are loaded into the SIFDTD
class when the ADK is initialized. All or part of the metadata is loaded into depending on the flags passed to the
ADK.initialize(SIFVersion, int) method,
metadata from one or more SDO Libraries may be loaded. For example, the following
call loads metadata for the Student Information Working Group Objects
and Transportation & Geographic Information Working Group Objects
(Common Elements and Infrastructure Working Group Objects metadata is
always loaded):
ADK.initialize( SIFVersion.LATEST, SDO.STUDENT | SDO.TRANS )
If an given SDO Library is not loaded, all of the SIFDTD constants that belong
to that library will be null and cannot be referenced. For example,
given the SDO Libraries loaded above, attempting to reference the
SIFDTD.LIBRARYPATRONSTATUS object from the Library Automation Working
Group would result in a NullPointerException:
SIFDTD.LIBRARYPATRONSTATUS.name();
| Field Summary | |
|---|---|
static java.lang.String |
assessment
The name of the Assessment package |
static java.lang.String |
common
The name of the Common package |
static java.lang.String |
datamodel
The name of the Data Model package |
static java.lang.String |
dw
The name of the Data Warehouse package |
static java.lang.String |
etranscripts
The name of the package |
static java.lang.String |
food
The name of the Food Services package |
static java.lang.String |
gradebook
The name of the Gradebook package |
static java.lang.String |
hrfin
The name of the Human Resources and Financials package |
static java.lang.String |
infra
The name of the Infrastructure package |
static java.lang.String |
instr
The name of the Instructional Services package |
static java.lang.String |
library
The name of the Library Automation package |
static byte |
MSGTYP_ACK
Identifies the SIF_Ack element |
static byte |
MSGTYP_EVENT
Identifies the SIF_Event element |
static byte |
MSGTYP_PROVIDE
Identifies the SIF_Provide element |
static byte |
MSGTYP_PROVISION
Identifies the SIF_Provision element |
static byte |
MSGTYP_REGISTER
Identifies the SIF_Register element |
static byte |
MSGTYP_REQUEST
Identifies the SIF_Request element |
static byte |
MSGTYP_RESPONSE
Identifies the SIF_Response element |
static byte |
MSGTYP_SUBSCRIBE
Identifies the SIF_Subscribe element |
static byte |
MSGTYP_SYSTEMCONTROL
Identifies the SIF_SystemControl element |
static byte |
MSGTYP_UNPROVIDE
Identifies the SIF_Unprovide element |
static byte |
MSGTYP_UNREGISTER
Identifies the SIF_Unregister element |
static byte |
MSGTYP_UNSUBSCRIBE
Identifies the SIF_Unsubscribe element |
static byte |
MSGTYP_ZONESTATUS
Identifies the SIF_ZoneStatus element |
static java.lang.String |
profdev
The name of the Professional Development package |
static java.lang.String |
programs
The name of the Special Programs package |
static java.lang.String |
reporting
The name of the Vertical Reporting package |
static int |
SDO_ALL
All SDO libraries |
static int |
SDO_ASSESSMENT
Identifies the Assessment package |
static int |
SDO_DATAMODEL
Identifies the Data Model package |
static int |
SDO_DW
Identifies the Data Warehouse package |
static int |
SDO_ETRANSCRIPTS
Identifies the package |
static int |
SDO_FOOD
Identifies the Food Services package |
static int |
SDO_GRADEBOOK
Identifies the Gradebook package |
static int |
SDO_HRFIN
Identifies the Human Resources and Financials package |
static int |
SDO_INSTR
Identifies the Instructional Services package |
static int |
SDO_LIBRARY
Identifies the Library Automation package |
static int |
SDO_NONE
No SDO libraries |
static int |
SDO_PROFDEV
Identifies the Professional Development package |
static int |
SDO_PROGRAMS
Identifies the Special Programs package |
static int |
SDO_REPORTING
Identifies the Vertical Reporting package |
static int |
SDO_STUDENT
Identifies the Student Information package |
static int |
SDO_TRANS
Identifies the Transportation and Geographic Information package |
static java.util.HashMap<java.lang.String,ElementDef> |
sElementDefs
|
static ElementDef |
SIF_MESSAGE
|
static ElementDef |
SIF_MESSAGE_VERSION
|
static java.lang.String |
student
The name of the Student Information package |
static java.lang.String |
trans
The name of the Transportation and Geographic Information package |
static java.lang.String |
XMLNS_BASE
The base xmlns for this edition of the ADK without the version |
| Constructor Summary | |
|---|---|
SIFDTD()
|
|
| Method Summary | |
|---|---|
Element |
createElementOrAttributeFromXPath(SIFElement relativeTo,
java.lang.String query,
ValueBuilder valueBuilder)
Create all elements and attributes referenced by the XPath-like query string. |
Element |
createElementOrAttributeFromXPath(SIFElement relativeTo,
java.lang.String query,
ValueBuilder valueBuilder,
SIFVersion version,
SIFFormatter textFormatter,
SIFFormatter pathFormatter)
Create all elements and attributes referenced by the XPath-like query string. |
SIFDataObject |
createSIFDataObject(ElementDef objType)
Creates an instance of a SIFDataObject given an ElementDef. |
java.lang.String[] |
getAvailableLibraries()
Gets the names of all SDO libraries offered with this version of the ADK |
java.lang.String |
getElementTag(byte type)
Gets the element tag corresponding to a type ID |
byte |
getElementType(java.lang.String name)
Gets the type ID corresponding to an element tag name |
SIFFormatter |
getFormatter(SIFVersion version)
|
java.util.List<java.lang.String> |
getLibraryNames(int libraries)
Gets the names of SDO libraries given an identifier derived from bitwise combinations of the SDO_ constants defined by SIFDTD. |
int |
getLoadedLibraries()
Gets an integer identifying all loaded libraries |
java.lang.String |
getNamespace(SIFVersion version)
Get the SIF namespace for a given version of the specification. |
boolean |
isLibraryLoaded(int library)
Determines if the specified SDO library is loaded |
void |
loadLibraries(int libraries)
Loads the SDO Libraries specified by using flags from the SDO_ constants defined by SIFDTD. |
Element |
lookupBySQP(SIFDataObject relativeTo,
java.lang.String query)
Find an SIFElement given a SIF Query Pattern string. |
Element |
lookupByXPath(SIFDataObject relativeTo,
java.lang.String query)
Find an SIFElement given an XPath-like query string. |
Element |
lookupByXPath(SIFDataObject relativeTo,
java.lang.String query,
ValueBuilder valueBuilder)
Find an SIFElement given an XPath-like query string. |
ElementDef |
lookupElementDef(ElementDef parent,
java.lang.String childTag)
Lookup an ElementDef object describing an element or attribute |
ElementDef |
lookupElementDef(java.lang.String key)
Lookup an ElementDef object describing an element or attribute |
ElementDef |
lookupElementDefBySQP(ElementDef relativeTo,
java.lang.String query)
Lookup an ElementDef given a SIF Query Pattern string. |
java.lang.String |
translateSQP(ElementDef objectType,
java.lang.String path,
SIFVersion version)
Attempts to convert the path to the specified version of SIF. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte MSGTYP_ACK
public static final byte MSGTYP_EVENT
public static final byte MSGTYP_PROVIDE
public static final byte MSGTYP_REGISTER
public static final byte MSGTYP_REQUEST
public static final byte MSGTYP_RESPONSE
public static final byte MSGTYP_SUBSCRIBE
public static final byte MSGTYP_SYSTEMCONTROL
public static final byte MSGTYP_UNPROVIDE
public static final byte MSGTYP_UNREGISTER
public static final byte MSGTYP_UNSUBSCRIBE
public static final byte MSGTYP_ZONESTATUS
public static final byte MSGTYP_PROVISION
public static ElementDef SIF_MESSAGE
public static ElementDef SIF_MESSAGE_VERSION
public static final java.lang.String dw
public static final java.lang.String hrfin
public static final java.lang.String assessment
public static final java.lang.String programs
public static final java.lang.String student
public static final java.lang.String infra
public static final java.lang.String food
public static final java.lang.String common
public static final java.lang.String etranscripts
public static final java.lang.String reporting
public static final java.lang.String library
public static final java.lang.String profdev
public static final java.lang.String instr
public static final java.lang.String datamodel
public static final java.lang.String gradebook
public static final java.lang.String trans
public static final int SDO_ALL
public static final int SDO_NONE
public static final int SDO_DW
public static final int SDO_HRFIN
public static final int SDO_ASSESSMENT
public static final int SDO_PROGRAMS
public static final int SDO_STUDENT
public static final int SDO_FOOD
public static final int SDO_ETRANSCRIPTS
public static final int SDO_REPORTING
public static final int SDO_LIBRARY
public static final int SDO_PROFDEV
public static final int SDO_INSTR
public static final int SDO_DATAMODEL
public static final int SDO_GRADEBOOK
public static final int SDO_TRANS
public static final java.lang.String XMLNS_BASE
public static java.util.HashMap<java.lang.String,ElementDef> sElementDefs
| Constructor Detail |
|---|
public SIFDTD()
| Method Detail |
|---|
public ElementDef lookupElementDef(java.lang.String key)
DTD
lookupElementDef in interface DTDkey - The name of the element in the form "parent_field", where
parent is the name of the parent element and field is
the name of the child element or attribute (e.g. "SIF_Ack_SIF_Header",
"StudentPersonal_Name", etc.)
public ElementDef lookupElementDef(ElementDef parent,
java.lang.String childTag)
DTD
lookupElementDef in interface DTDparent - The parent ElementDefchildTag - the name of the child element
public void loadLibraries(int libraries)
throws ADKException
libraries - An integer with zero or more library identifier bits set
(e.g. SIFDTD.SDO_FOOD )
ADKExceptionpublic boolean isLibraryLoaded(int library)
library - The library identifier (e.g. SDOLibrary.FOOD)public int getLoadedLibraries()
public java.util.List<java.lang.String> getLibraryNames(int libraries)
SDO_ constants defined by SIFDTD.
libraries - The library identifier (e.g. SIFDTD.SDO_FOOD)
public java.lang.String[] getAvailableLibraries()
public java.lang.String getNamespace(SIFVersion version)
getNamespace in interface DTDversion - The SIF Version
public java.lang.String getElementTag(byte type)
DTD
getElementTag in interface DTDtype - A type identifier defined by the class that implements this
interface (e.g. SIFDTD.MSGTYP_PROVIDE)
public byte getElementType(java.lang.String name)
DTD
getElementType in interface DTDname - The tag name of an element (e.g. "SIF_Provide")
SIFDTD.MSGTYP_PROVIDE)
public ElementDef lookupElementDefBySQP(ElementDef relativeTo,
java.lang.String query)
relativeTo - An ElementDef for a root SIF Data Object to which the
query is relative (e.g. SIFDTD.STUDENTPERSONAL)query - A SIF Query Pattern (e.g. "@RefId", "Name/FirstName", etc.)
public java.lang.String translateSQP(ElementDef objectType,
java.lang.String path,
SIFVersion version)
objectType - The metadata object representing the object typepath - The XPath query (such as "Demographics/Ethnicity")version - The SIF version to render the path in, such as SIFVersion.SIF20
public Element lookupBySQP(SIFDataObject relativeTo,
java.lang.String query)
throws ADKSchemaException
relativeTo - An ElementDef identifying a SIF Data Object to which
the query is relative to (e.g. STUDENTPERSONAL, BUSINFO, etc.)query - A SIF Query Pattern string as described by the SIF 1.0r1
Specification
null if no
match was found. If the query resolves to an attribute, a SimpleField
object is returned. If the query resolves to an element, a SIFElement
object is returned. In both cases the caller can obtain the text
value of the attribute or element by calling its getTextValue
method.
ADKSchemaException
public Element lookupByXPath(SIFDataObject relativeTo,
java.lang.String query)
throws ADKSchemaException
Query strings can only take one of these forms:
@AttrElementElement/@AttrElement/Element/.../@AttrElement[@Attr='value1']Element[@Attr1='value1',@Attr2='value2',...]/Element/...
relativeTo - A SIFDataObject to which the query is relative to.query - An XPath-like query string as described above
null if no
match was found. If the query resolves to an attribute, a SimpleField
object is returned. If the query resolves to an element, a SIFElement
object is returned. In both cases the caller can obtain the text
value of the attribute or element by calling its getTextValue
method.
ADKSchemaException
public Element lookupByXPath(SIFDataObject relativeTo,
java.lang.String query,
ValueBuilder valueBuilder)
throws ADKSchemaException
Query strings can only take one of these forms:
@AttrElementElement/@AttrElement/Element/.../@AttrElement[@Attr='value1']Element[@Attr1='value1',@Attr2='value2',...]/Element/...
When the create parameter is true, the method will ensure that
the elements and attributes specified in the query string are created in
the SIFDataObject. All values are evaluated by the ValueBuilder implementation
passed to this method. In addition, the query string may end with a value
expression in the form "Element[@Attribute='val']=expression",
where expression is evaluated by the ValueBuilder.
Refer to the DefaultValueBuilder class for a description of
how value expressions are evaluated by in XPath query strings by default.
Note that when create is true, this method will attempt to create
a new element when a set of attributes is specified and an element does
not already exist with those same attribute settings. This is not always
desirable, however. For example, if you call this method in succession
with the following XPath query strings, the result will be a single
OtherId[@Type='ZZ'] element with a value of "$(School)".
This is because each call will match the OtherId[@Type='ZZ']
element created by the first call, and will replace its value instead of
creating an new instance of the OtherId element:
OtherId[@Type='ZZ']=GRADE:$(Grade)
OtherId[@Type='ZZ']=HOMEROOM:$(HomeRoom)
OtherId[@Type='ZZ']=SCHOOL:$(School)
<OtherId Type='ZZ'>SCHOOL:$(School)<OtherId>
OtherId[@Type='ZZ'+]=GRADE:$(Grade)
OtherId[@Type='ZZ'+]=HOMEROOM:$(HomeRoom)
OtherId[@Type='ZZ'+]=SCHOOL:$(School)
<OtherId Type='ZZ'>GRADE:$(Grade)<OtherId>
<OtherId Type='ZZ'>HOMEROOM:$(HomeRoom)<OtherId>
<OtherId Type='ZZ'>SCHOOL:$(School)<OtherId>
relativeTo - A SIFDataObject to which the query is relative to.query - An XPath-like query string as described above.create - True to create the element or attribute referenced by the
query if it does not exist; false to return null.
If the query specifies an attribute value (e.g. "Element[@Attr='value']"),
that value is assigned to the attribute. When more than one attribute
value is provided the first one will be used.
null if no
match was found (unless the create parameter is true). If the
query resolves to an attribute, a SimpleField object is returned. If
it resolves to an element, a SIFElement object is returned. In both
cases the caller can obtain the text value of the attribute or
element by calling its getTextValue method.
ADKSchemaException
public Element createElementOrAttributeFromXPath(SIFElement relativeTo,
java.lang.String query,
ValueBuilder valueBuilder)
throws ADKSchemaException
relativeTo - The element that is the starting point of the pathquery - The xPath query to build outvalueBuilder - The class to use forformatter - The formatter to use for formatting values
ADKSchemaException
public Element createElementOrAttributeFromXPath(SIFElement relativeTo,
java.lang.String query,
ValueBuilder valueBuilder,
SIFVersion version,
SIFFormatter textFormatter,
SIFFormatter pathFormatter)
throws ADKSchemaException
relativeTo - The element that is the starting point of the pathquery - The xPath query to build outvalueBuilder - The class to use forversion - The version of SIF for which this mapping operation is being evaluatedtextFormatter - The SIFFormatter instance used to parse strings into strongly-typed data values.
For many uses of this API, this formatter is equivalent to ADK.getTextFormatter()pathFormatter - The SIFFormatter instance used for setting child SIFElements on their parents.
This formatter may be different than the text formatter. The text formatter is, for
compatibility's sake defaulted to SIF 1.x. However, the path formatter must be
correct for the mappings path being evaluated.
ADKSchemaException
public SIFDataObject createSIFDataObject(ElementDef objType)
throws ADKSchemaException,
java.lang.ClassNotFoundException,
java.lang.IllegalAccessException,
java.lang.InstantiationException
objType - An ElementDef constant from the SIFDTD class that identifies
a top-level SIF Data Object such as SIFDTD.STUDENTPERSONAL, SIFDTD.BUSINFO, etc.
ADKSchemaException - thrown if the objType parameter does
not identify a top-level SIF Data Object, or the ADK was not
initialized to load the SDO module in which the specified object
type is defined.
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationExceptionpublic SIFFormatter getFormatter(SIFVersion version)
getFormatter in interface DTD
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||