Advanced topics
501
<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>
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 thisElement string for
use in later calculations.
<tr>
<td><cfoutput>#Mid(thisElement,
6, descloc-nameloc-8)
#</cfoutput></td>
<cfif #suploc# NEQ 0>
<td><cfoutput>#Mid(thisElement,
5, mustloc-suploc-7)#
</cfoutput></td>
<cfelse>
<td>NONE</td>
</cfif>
<cfif #mayloc# NEQ 0>
<td><cfoutput>#Replace
(Mid(thisElement, 6,
mayloc-mustloc-9), " $ ", ", ",
"all")#</cfoutput></td>
<td><cfoutput>#Replace
(Mid(thisElement, 5,
endloc-mayloc-8), " $ ", ", ",
"all")#</cfoutput></td>
<cfelse>
<td><cfoutput>#Replace
(Mid(thisElement, 6,
endloc-mustloc-9), " $ ", ", ",
"all")#</cfoutput></td>
<td>NONE</td>
</cfif>
</tr>
</cfloop>
</table>
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.
Code
Description
Summary of Contents for COLDFUSION MX 61-DEVELOPING COLDFUSION MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......