try {
PageEnvelope envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
Publication publication = envelope.getPublication();
if (name.equals(AUTHORING_NODE)) {
SiteTree authoringTree = publication.getTree(Publication.AUTHORING_AREA);
value = authoringTree.getNode(envelope.getDocument().getId());
}
if (name.equals(LIVE_NODE)) {
SiteTree liveTree = publication.getTree(Publication.LIVE_AREA);
value = liveTree.getNode(envelope.getDocument().getId());
}
if (name.equals(TRASH_NODE)) {
SiteTree trashTree = publication.getTree(Publication.TRASH_AREA);
value = trashTree.getNode(envelope.getDocument().getId());
}
if (name.equals(ARCHIVE_NODE)) {
SiteTree archiveTree = publication.getTree(Publication.ARCHIVE_AREA);
value = archiveTree.getNode(envelope.getDocument().getId());
}
if (name.equals(FIRST_CHILD_ID)) {
SiteTree siteTree = publication.getTree(envelope.getDocument().getArea());
SiteTreeNode node = siteTree.getNode(envelope.getDocument().getId());
SiteTreeNode[] children = node.getChildren(envelope.getDocument().getLanguage());
if (children.length > 0){
value = children[0].getId();
} else {
value = null;
}
}
if (name.equals(LABEL_HREF)) {
Document document = envelope.getDocument();
SiteTree siteTree = publication.getTree(document.getArea());
value = siteTree.getNode(document.getId()).getLabel(document.getLanguage()).getHref();
if (value == null) value = "";
}
} catch (Exception e) {
throw new ConfigurationException("Obtaining value for [" + name + "] failed: ", e);