Adobe COLDFUSION 9 Manual page 478

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Accessing and Using Data
Code
<h2>Object Classes</h2>
<table border="1">
<tr>
<th>Name</th>
<th>Superior class</th>
<th>Must have</th>
<th>May have</th>
</tr>
<cfloop index = "thisElement" list =
#Entrylist2.objectclasses#>
<cfscript>
thiselement = Trim(thisElement);
nameloc = Find("NAME", thisElement);
descloc = Find("DESC", thisElement);
suploc = Find("SUP", thisElement);
mustloc = Find("MUST", thisElement);
mayloc = Find("MAY", thisElement);
endloc = Len(thisElement);
</cfscript>
<tr>
<td><cfoutput>#Mid(thisElement, nameloc+6, descloc-
nameloc-8)#
</cfoutput></td>
<cfif #suploc# NEQ 0>
<td><cfoutput>#Mid(thisElement, suploc+5, mustloc-
suploc-7)#
</cfoutput></td>
<cfelse>
<td>NONE</td>
</cfif>
<cfif #mayloc# NEQ 0>
<td><cfoutput>#Replace(Mid(thisElement, mustloc+6,
mayloc-mustloc-9), " $ ", ", ",
"all")#</cfoutput></td>
<td><cfoutput>#Replace(Mid(thisElement, mayloc+5,
endloc-mayloc-8),
" $ ", ", ", "all")#</cfoutput></td>
<cfelse>
<td><cfoutput>#Replace(Mid(thisElement, mustloc+6,
endloc-mustloc-9), " $ ", ", ",
"all")#</cfoutput></td>
<td>NONE</td>
</cfif>
</tr>
</cfloop>
</table>
Description
Displays the object class name, superior class, required attributes,
and optional attributes for each object class in a table.
The schema contains the definitions of all object classes in a comma
delimited list, so the code uses a list type cfloop tag.
The thisElement variable contains the object class definition. Trim off
any leading or trailing spaces, then use the class definition field
keywords in Find functions to get the starting locations of the
required fields, including the Object class ID. (The ID is not displayed.)
Gets the length of the
calculations.
Displays the field values. Uses the Mid function to extract individual
field values from the thisElement string.
The top object class does not have a superior class entry. Handles this
special case by testing the suploc location variable. If the value is not
0, handles normally, otherwise, output "NONE".
There might not be any optional attributes. Handles this case
similarly to the superior class. The calculation of the location of
required attributes uses the location of the optional attributes if the
field exists; otherwise, uses the end of the object class definition
string.
Last updated 8/5/2010
string for use in later
thisElement
473

Advertisement

Table of Contents
loading

Table of Contents