You can get the compound node first to get and set properties, using JCR API [1]:
if (node.hasNode("hbook:primaryTaxonomy")) {
def compoundNode = node.getNode("hbook:primaryTaxonomy")
if (compoundNode.hasProperty("hbook:firstLevel")) {
def value = compoundNode.getProperty("hbook:firstLevel").getString()
//...
}
//...
compoundNode.setProperty("hbook:firstLevel", "ourstory")
}
You can also use the utility, org.hippoecm.repository.util.JcrUtils, to avoid exceptional cases such as non-existing node or illegal access, etc. For example,