if (TAG_INSERTINSTANCE.equals(name)) {
if (session != null) {
String id = attributes.getValue(TAG_INSERTINSTANCE_ATTR_ID);
getLogger().debug("inserting instance [id=" + String.valueOf(id) + "]");
Instance instance = (Instance) session.getAttribute(id);
if (instance != null) {
instance.toSAX(this, true);
}
else {
getLogger().debug("could not find instance [id=" + String.valueOf(id) + "]");
}
}
else {
getLogger().debug("no session - no instance");
}
}
else if (TAG_INSERTVIOLATIONS.equals(name)) {
Collection violations = (Collection) request.getAttribute(AbstractPreceptorAction.PRECEPTORVIOLATIONS);
if (violations != null) {
for (Iterator it = violations.iterator(); it.hasNext();) {
Constraint constraint = (Constraint) it.next();
super.startElement(uri, "constraint", prefix + ":" + "constraint", NOATTR);
String v = String.valueOf(constraint);
super.characters(v.toCharArray(), 0, v.length());
super.endElement(uri, "constraint", prefix + ":" + "constraint");
}
}
}
else if (TAG_INSTANCE.equals(name)) {
if (session != null) {
String id = attributes.getValue(TAG_INSTANCE_ATTR_ID);
defaultInstance = (Instance) session.getAttribute(id);
if (defaultInstance != null) {
getLogger().debug("using default instance [id=" + String.valueOf(id) + "]");
}
else {
getLogger().error("could not find instance [id=" + String.valueOf(id) + "]");
}
}
}
else if (TAG_OUTPUT.equals(name) || TAG_TEXTBOX.equals(name) ||
TAG_PASSWORD.equals(name) || TAG_SELECTBOOLEAN.equals(name) ||
TAG_SELECTONE.equals(name)) {
String ref = attributes.getValue(TAG_COMMON_ATTR_REF);
String id = attributes.getValue(TAG_COMMON_ATTR_INSTANCE);
getLogger().debug("[" + String.valueOf(name) + "] getting value from [" + String.valueOf(ref) + "]");
if (ref != null) {
Instance instance = defaultInstance;
if (id != null) {
if (session != null) {
instance = (Instance) session.getAttribute(id);
if (instance != null) {
getLogger().debug("using instance [id=" + String.valueOf(id) + "]");
}
else {
getLogger().error("could not find instance [id=" + String.valueOf(id) + "]");
}
}
}
super.startElement(uri, name, raw, attributes);
try {
value = instance.getValue(ref);
getLogger().debug("[" + String.valueOf(ref) + "] = " + String.valueOf(value));
super.startElement(uri, "value", prefix + ":" + "value", NOATTR);
if (value != null) {
String v = String.valueOf(value);
super.characters(v.toCharArray(), 0, v.length());
}
super.endElement(uri, "value", prefix + ":" + "value");
if (instance.getPreceptor() != null) {
Collection constraints = instance.getPreceptor().getConstraintsFor(ref);
if (constraints != null) {
for (Iterator it = constraints.iterator(); it.hasNext();) {
Constraint constraint = (Constraint) it.next();
constraint.toSAX(this);
}