@Override protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) { // Fetching request params Map<String, String> templateArgs = req.getServiceMatch().getTemplateVars(); String storeId = templateArgs.get("storeId"); String storeProtocol = templateArgs.get("storeProtocol"); String uuid = templateArgs.get("uuid"); // Getting the Store ID on which the changes are requested Pair<Long, StoreRef> store = nodeDao.getStore(new StoreRef(storeProtocol, storeId)); if (store == null) { throw new IllegalArgumentException( "Invalid store reference: " + storeProtocol + "://" + storeId); } Set<NodeEntity> nodes = new HashSet<NodeEntity>(); NodeEntity node = indexingService.getNodeByUuid(store, uuid); if (node != null) { nodes.add(node); } // Render them out Map<String, Object> model = new HashMap<String, Object>(1, 1.0f); model.put("qnameDao", qnameDao); model.put("nsResolver", namespaceService); model.put("nodes", nodes); model.put("storeId", storeId); model.put("storeProtocol", storeProtocol); model.put("propertiesUrlTemplate", propertiesUrlTemplate); // This allows to call the static method QName.createQName from the FTL template try { BeansWrapper wrapper = BeansWrapper.getDefaultInstance(); TemplateHashModel staticModels = wrapper.getStaticModels(); TemplateHashModel qnameStatics = (TemplateHashModel) staticModels.get("org.alfresco.service.namespace.QName"); model.put("QName", qnameStatics); } catch (Exception e) { throw new AlfrescoRuntimeException( "Cannot add BeansWrapper for static QName.createQName method to be used from a Freemarker template", e); } logger.debug(String.format("Attaching %s nodes to the WebScript template", nodes.size())); return model; }