protected String getParentFormName() { final AVMService avmService = this.getServiceRegistry().getAVMService(); return avmService .getNodeProperty( AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), WCMAppModel.PROP_PARENT_FORM_NAME) .getStringValue(); }
/** the name of this rendition */ public String getName() { // final AVMService avmService = this.getServiceRegistry().getAVMService(); // return // avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), // // AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), // ContentModel.PROP_NAME).getStringValue(); return AVMNodeConverter.SplitBase(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond())[ 1]; }
/* package */ FormInstanceDataImpl(final NodeRef nodeRef, final FormsService formsService) { if (nodeRef == null) { throw new NullPointerException(); } if (formsService == null) { throw new NullPointerException(); } final AVMService avmService = this.getServiceRegistry().getAVMService(); if (!avmService.hasAspect( AVMNodeConverter.ToAVMVersionPath(nodeRef).getFirst(), AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(), WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) { throw new IllegalArgumentException( "node " + nodeRef + " does not have aspect " + WCMAppModel.ASPECT_FORM_INSTANCE_DATA); } this.nodeRef = nodeRef; this.formsService = formsService; }
/** * @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()); }
@Override protected List<StoreRef> getAllStores() { List<AVMStoreDescriptor> stores = avmService.getStores(); List<StoreRef> storeRefs = new ArrayList<StoreRef>(stores.size()); for (AVMStoreDescriptor storeDesc : stores) { StoreRef storeRef = AVMNodeConverter.ToStoreRef(storeDesc.getName()); if (avmSnapShotTriggeredIndexingMethodInterceptor.getIndexMode(storeRef.getIdentifier()) == IndexMode.UNINDEXED) { // ALF-5722 fix continue; } storeRefs.add(storeRef); } return storeRefs; }
/* package */ FormInstanceDataImpl( final int version, final String avmPath, final FormsService formsService) { this(AVMNodeConverter.ToNodeRef(version, avmPath), formsService); }
public List<FormInstanceData.RegenerateResult> regenerateRenditions() throws FormNotFoundException { if (logger.isDebugEnabled()) { logger.debug("regenerating renditions of " + this); } AVMLockingService avmLockService = this.getServiceRegistry().getAVMLockingService(); final AVMService avmService = this.getServiceRegistry().getAVMService(); PropertyValue pv = avmService.getNodeProperty( AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), WCMAppModel.PROP_ORIGINAL_PARENT_PATH); String originalParentAvmPath = (pv == null) ? AVMNodeConverter.SplitBase(this.getPath())[0] : pv.getStringValue(); final HashSet<RenderingEngineTemplate> allRets = new HashSet<RenderingEngineTemplate>(this.getForm().getRenderingEngineTemplates()); final List<RegenerateResult> result = new LinkedList<RegenerateResult>(); // regenerate existing renditions boolean renditionLockedBefore = false; String path = null; for (final Rendition r : this.getRenditions()) { // Try to skip renditions without rendering engine template. if (r instanceof RenditionImpl) { RenditionImpl rImpl = (RenditionImpl) r; RenderingEngineTemplate ret = rImpl.getRenderingEngineTemplate(); if ((ret != null) && (ret instanceof RenderingEngineTemplateImpl)) { RenderingEngineTemplateImpl retImpl = (RenderingEngineTemplateImpl) ret; if (!retImpl.isExists()) { continue; } } } final RenderingEngineTemplate ret = r.getRenderingEngineTemplate(); if (ret == null || !allRets.contains(ret)) { continue; } try { if (logger.isDebugEnabled()) { logger.debug("regenerating rendition " + r + " using template " + ret); } renditionLockedBefore = false; path = r.getPath(); AVMLock lock = avmLockService.getLock(AVMUtil.getStoreId(path), AVMUtil.getStoreRelativePath(path)); if (lock != null) { renditionLockedBefore = true; if (logger.isDebugEnabled()) { logger.debug("Lock already exists for " + path); } } ret.render(this, r); allRets.remove(ret); result.add(new RegenerateResult(ret, path, r)); } catch (Exception e) { result.add(new RegenerateResult(ret, path, e)); // remove lock if there wasn't one before if (renditionLockedBefore == false) { avmLockService.removeLock(AVMUtil.getStoreId(path), AVMUtil.getStoreRelativePath(path)); if (logger.isDebugEnabled()) { logger.debug("Removed lock for " + path + " as it failed to generate"); } } } } // render all renditions for newly added templates for (final RenderingEngineTemplate ret : allRets) { try { renditionLockedBefore = false; path = ret.getOutputPathForRendition(this, originalParentAvmPath, getName()); if (logger.isDebugEnabled()) { logger.debug( "regenerating rendition of " + this.getPath() + " at " + path + " using template " + ret); } AVMLock lock = avmLockService.getLock(AVMUtil.getStoreId(path), AVMUtil.getStoreRelativePath(path)); if (lock != null) { renditionLockedBefore = true; if (logger.isDebugEnabled()) { logger.debug("Lock already exists for " + path); } } result.add(new RegenerateResult(ret, path, ret.render(this, path))); } catch (Exception e) { result.add(new RegenerateResult(ret, path, e)); // remove lock if there wasn't one before if (renditionLockedBefore == false) { avmLockService.removeLock(AVMUtil.getStoreId(path), AVMUtil.getStoreRelativePath(path)); if (logger.isDebugEnabled()) { logger.debug("Removed lock for " + path + " as it failed to generate"); } } } } return result; }
public Document getDocument() throws IOException, SAXException { return XMLUtil.parse( AVMNodeConverter.ToAVMVersionPath(nodeRef).getFirst(), AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(), this.getServiceRegistry().getAVMService()); }
public String getPath() { return AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(); }