/** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ public boolean evaluate(final Node node) { FacesContext facesContext = FacesContext.getCurrentInstance(); AVMService avmService = Repository.getServiceRegistry(facesContext).getAVMService(); Pair<Integer, String> p = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()); AVMNodeDescriptor nodeDesc = avmService.lookup(-1, p.getSecond()); // don't allow action if its a 'layeredfolder' and a primary indirection return !(nodeDesc.getType() == AVMNodeType.LAYERED_DIRECTORY && nodeDesc.isPrimary()); }
public List<Rendition> getRenditions(boolean includeDeleted) { final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService(); final PropertyValue pv = avmService.getNodeProperty(-1, this.getPath(), WCMAppModel.PROP_RENDITIONS); final Collection<Serializable> renditionPaths = (pv == null ? Collections.EMPTY_LIST : pv.getCollection(DataTypeDefinition.TEXT)); final String storeName = AVMUtil.getStoreName(this.getPath()); final List<Rendition> result = new ArrayList<Rendition>(renditionPaths.size()); for (Serializable path : renditionPaths) { String avmRenditionPath = AVMUtil.buildAVMPath(storeName, (String) path); if (avmService.lookup(-1, avmRenditionPath, includeDeleted) == null) { if (logger.isDebugEnabled()) { logger.debug("ignoring dangling rendition at: " + avmRenditionPath); } } else { final Rendition r = new RenditionImpl(-1, avmRenditionPath, this.getFormsService()); try { if (!this.equals(r.getPrimaryFormInstanceData(includeDeleted))) { if (logger.isDebugEnabled()) { logger.debug( "rendition " + r + " points at form instance data " + r.getPrimaryFormInstanceData(includeDeleted) + " instead of " + this + ". Not including in renditions list."); } continue; } } catch (FileNotFoundException fnfe) { continue; } if (r.getRenderingEngineTemplate() != null) { result.add(r); } } } return result; }