. Aspect API added to Version History nodes

- hasAspect() and aspects set

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4769 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-01-09 18:38:18 +00:00
parent 16261c92e5
commit 5354e26f34
2 changed files with 47 additions and 1 deletions

View File

@@ -69,7 +69,7 @@ public class TemplateNode implements Serializable
private static Log logger = LogFactory.getLog(TemplateNode.class);
private final static String NAMESPACE_BEGIN = "" + QName.NAMESPACE_BEGIN;
protected final static String NAMESPACE_BEGIN = "" + QName.NAMESPACE_BEGIN;
protected final static String CONTENT_DEFAULT_URL = "/download/direct/{0}/{1}/{2}/{3}";
private final static String CONTENT_PROP_URL = "/download/direct/{0}/{1}/{2}/{3}?property={4}";
private final static String FOLDER_BROWSE_URL = "/navigate/browse/{0}/{1}/{2}";

View File

@@ -22,6 +22,7 @@ import java.net.URLEncoder;
import java.text.MessageFormat;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.TemplateNode.TemplateContentData;
@@ -43,6 +44,7 @@ public class VersionHistoryNode implements Serializable
private boolean propsRetrieved = false;
private Version version;
private TemplateNode parent;
private Set<QName> aspects = null;
/**
* Constructor
@@ -184,6 +186,50 @@ public class VersionHistoryNode implements Serializable
return this.properties;
}
/**
* @return The list of aspects applied to this node
*/
public Set<QName> getAspects()
{
if (this.aspects == null)
{
this.aspects = parent.services.getNodeService().getAspects(this.version.getFrozenStateNodeRef());
}
return this.aspects;
}
/**
* @param aspect The aspect name to test for
*
* @return true if the node has the aspect false otherwise
*/
public boolean hasAspect(String aspect)
{
if (this.aspects == null)
{
getAspects();
}
if (aspect.startsWith(parent.NAMESPACE_BEGIN))
{
return aspects.contains((QName.createQName(aspect)));
}
else
{
boolean found = false;
for (QName qname : this.aspects)
{
if (qname.toPrefixString(parent.services.getNamespaceService()).equals(aspect))
{
found = true;
break;
}
}
return found;
}
}
// ------------------------------------------------------------------------------
// Content API