}
// special keyword "link", works on deeper levels, too
if ("link".equals(part) && _data instanceof AbstractNode) {
ResourceLink rel = ((AbstractNode) _data).getOutgoingRelationship(ResourceLink.class);
if (rel != null) {
_data = rel.getTargetNode();
break;
}
continue;
}
if (value == null) {
// check for default value
if (defaultValue != null && StringUtils.contains(refKey, "!")) {
return numberOrString(defaultValue);
}
// Need to return null here to avoid _data sticking to the (wrong) parent object
return null;
}
}
// data objects from parent elements
if (this.hasDataForKey(part)) {
_data = this.getDataNode(part);
if (parts.length == 1) {
return _data;
}
continue;
}
// special keyword "request"
if ("request".equals(part)) {
final HttpServletRequest request = this.getRequest(); //securityContext.getRequest();
if (request != null) {
if (StringUtils.contains(refKey, "!")) {
return numberOrString(StringUtils.defaultIfBlank(request.getParameter(referenceKey), defaultValue));
} else {
return numberOrString(StringUtils.defaultString(request.getParameter(referenceKey)));
}
}
}
// special keyword "now":
if ("now".equals(part)) {
return new Date();
}
// special keyword "me"
if ("me".equals(part)) {
Principal me = (Principal) securityContext.getUser(false);
if (me != null) {
_data = me;
if (parts.length == 1) {
return _data;
}
continue;
}
}
// special boolean keywords
if ("true".equals(part)) {
return true;
}
if ("false".equals(part)) {
return false;
}
// the following keywords work only on root level
// so that they can be used as property keys for data objects
if (_data == null) {
// details data object id
if ("id".equals(part)) {
GraphObject detailsObject = this.getDetailsDataObject();
if (detailsObject != null) {
return detailsObject.getUuid();
}
}
// details data object
if ("current".equals(part)) {
GraphObject detailsObject = this.getDetailsDataObject();
if (detailsObject != null) {
_data = detailsObject;
if (parts.length == 1) {
return _data;
}
continue;
}
}
// special keyword "this"
if ("this".equals(part)) {
_data = this.getDataObject();
if (parts.length == 1) {
return _data;
}
continue;
}
// special keyword "element"
if ("element".equals(part)) {
_data = entity;
if (parts.length == 1) {
return _data;
}
continue;
}
// special keyword "template", references the closest Template node in the current page
if ("template".equals(part)) {
_data = ((DOMNode) entity).getClosestTemplate(_page);
if (parts.length == 1) {
return _data;
}
continue;
}
// special keyword "ownerDocument", works only on root level
if ("page".equals(part)) {
_data = _page;
if (parts.length == 1) {
return _data;
}
continue;
}
// special keyword "link"
if (entity instanceof NodeInterface && "link".equals(part)) {
ResourceLink rel = ((NodeInterface) entity).getOutgoingRelationship(ResourceLink.class);
if (rel != null) {
_data = rel.getTargetNode();
if (parts.length == 1) {
return _data;
}
continue;
}
}
// special keyword "parent"
if ("parent".equals(part)) {
_data = (DOMNode) ((DOMNode) entity).getParentNode();
if (parts.length == 1) {
return _data;
}
continue;
}
// special keyword "children", references the children of the closest Template node in the current page
if ("children".equals(part)) {
if (parts.length == 1) {
final Template template = ((DOMNode) entity).getClosestTemplate(_page);
if (template != null) {
return template.getChildNodes();
}
}
continue;
}
// special keyword "owner"
if (entity instanceof NodeInterface && "owner".equals(part)) {
Ownership rel = ((NodeInterface) entity).getIncomingRelationship(PrincipalOwnsNode.class);
if (rel != null) {
_data = rel.getSourceNode();
if (parts.length == 1) {
return _data;
}
}