package org.alfresco.repo.content; import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; import org.springframework.extensions.surf.util.ParameterCheck; /** * Context information for node-related content. * * @author Derek Hulley */ public class NodeContentContext extends ContentContext { private static final long serialVersionUID = -1836714367516857907L; private NodeRef nodeRef; private QName propertyQName; /** * Construct the instance with the content URL. * * @param existingContentReader content with which to seed the new writer - may be null * @param contentUrl the content URL - may be null * @param nodeRef the node holding the content metadata - may not be null * @param propertyQName the property holding the content metadata - may not be null */ public NodeContentContext( ContentReader existingContentReader, String contentUrl, NodeRef nodeRef, QName propertyQName) { super(existingContentReader, contentUrl); ParameterCheck.mandatory("nodeRef", nodeRef); ParameterCheck.mandatory("propertyQName", propertyQName); this.nodeRef = nodeRef; this.propertyQName = propertyQName; } @Override public String toString() { StringBuilder sb = new StringBuilder(128); sb.append("NodeContentContext") .append("[ contentUrl=").append(getContentUrl()) .append(", existing=").append((getExistingContentReader() == null ? false : true)) .append(", nodeRef=").append(nodeRef) .append(", propertyQName=").append(propertyQName) .append("]"); return sb.toString(); } /** * @return Returns the node holding the content metadata */ public NodeRef getNodeRef() { return nodeRef; } /** * * @return Returns the property holding the content metadata */ public QName getPropertyQName() { return propertyQName; } }