createDebugNode(parentDebugNode);
status.iterationDebugNode = debugNode.addElement("starttag");
}
// First get tml context to allow script execution (maybe already needed in id-calculation)
TMLContext parentContext = this.getParentTagContext();
TMLContext baseContext = null;
// We have no parent tag, so we are absolute root: Construct main context
if (parentContext == null) {
baseContext = new TMLContext((WGContent) this.pageContext.getRequest().getAttribute(WGACore.ATTRIB_MAINCONTEXT), this);
TMLContext.clearThreadMainContext();
baseContext.makeThreadMainContext();
}
else {
baseContext = new TMLContext(parentContext, status);
}
this.setTMLContext(baseContext);
// Register status with id
String id = this.getId();
if (id != null) {
status.id = id;
Map tagIds = status.getTagIds();
tagIds.put(id, status);
}
TMLContext tmlContext = null;
// Set tag contexts
status.childTMLContext = baseContext;
if (this.getContext() != null) {
tmlContext = baseContext.context(this.getContext(), false);
if (tmlContext != null) {
this.setTMLContext(tmlContext);
this.setChildTagContext(tmlContext);
}
else {
status.subContextError = true;
// Tag should not be canceled if the context validity
// is checked via iscontextvalid
boolean cancelTag = true;
if (this instanceof ConditionBase) {
ConditionBase conditionTag = (ConditionBase) this;
if (conditionTag.getIscontextvalid() != null) {
cancelTag = false;
}
}
if (cancelTag == true) {
String msg = "Failed context change: " + getContext();
if (baseContext.getlasterror() != null) {
msg += ". Reason: " + baseContext.getlasterror();
}
this.addWarning(msg, true);
setCancelTag(true);
return Tag.SKIP_BODY;
}
}
}
if (this.getPrivatecontext() != null) {
tmlContext = baseContext.context(this.getPrivatecontext());
if (baseContext.getlasterror() == null) {
this.setTMLContext(tmlContext);
}
else {
this.addWarning(tmlContext.getlasterror(), false);
}
}
// Set boolean flags
this.setEvalBody(true);