*/
public static void printSequence(DataObject letter) {
// Access the Sequence of the FormLetter
System.out.println("The type is for letter dataObject is mixed " + XSDHelper.INSTANCE.isMixed(letter.getType()));
Sequence letterSequence = letter.getSequence();
// Print out all the settings that contain unstructured text
System.out.println("Unstructured text:");
for (int i = 0; i < letterSequence.size(); i++) {
/*
* Please note that the following line is a correction to the 2.0 specification which incorrectly calls:
*
* String propertyName = ((Property) letterSequence.getProperty(i)).getName();
*
* According to the SDO API sequence.getProperty will return null if the content is mixed, in this case
* we want to print it out as unstructured text
*/
Property prop = letterSequence.getProperty(i);
if (prop == null) {
String text = (String) letterSequence.getValue(i);
System.out.println("\t(" + text + ")");
}
}
/*
* Please note that the following line is a correction to the 2.0 Specification which incorrectly uses letterDataObject variable rather than
* simply letter
*/
// Verify that the lastName property of the DataObject has the same
// value as the lastName property for the Sequence.
String dataObjectLastName = letter.getString("lastName");
for (int i = 0; i < letterSequence.size(); i++) {
/*
* The following line has been corrected from the 2.0 specification
* According to the SDO API sequence.getProperty will return null if the content is mixed.
* We want to check that the content is not mixed, and then check that it it is the property which
* we are looking for
*/
Property property = letterSequence.getProperty(i);
if ( (property != null) && ("lastName".equals(property.getName()))) {
String sequenceLastName = (String) letterSequence.getValue(i);
if (dataObjectLastName == sequenceLastName)
System.out.println("Last Name property matches");
break;
}
}