mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
GetAspects() method now working correctly for AVM nodes in templating API
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5854 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -28,8 +28,10 @@ import java.io.Serializable;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.WCMModel;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
@@ -109,7 +111,7 @@ public class AVMTemplateNode extends BasePermissionsNode
|
||||
Pair<Integer, String> pair = AVMNodeConverter.ToAVMVersionPath(nodeRef);
|
||||
this.services = services;
|
||||
this.imageResolver = resolver;
|
||||
init(pair.getFirst(), pair.getSecond());
|
||||
init(pair.getFirst(), pair.getSecond(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,19 +137,49 @@ public class AVMTemplateNode extends BasePermissionsNode
|
||||
this.nodeRef = AVMNodeConverter.ToNodeRef(version, path);
|
||||
this.services = services;
|
||||
this.imageResolver = resolver;
|
||||
init(version, path);
|
||||
init(version, path, null);
|
||||
}
|
||||
|
||||
private void init(int version, String path)
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param descriptor AVMNodeDescriptior
|
||||
* @param services
|
||||
* @param resolver
|
||||
*/
|
||||
public AVMTemplateNode(AVMNodeDescriptor descriptor, ServiceRegistry services, TemplateImageResolver resolver)
|
||||
{
|
||||
if (descriptor == null)
|
||||
{
|
||||
throw new IllegalArgumentException("AVMNodeDescriptor must be supplied.");
|
||||
}
|
||||
|
||||
if (services == null)
|
||||
{
|
||||
throw new IllegalArgumentException("The ServiceRegistry must be supplied.");
|
||||
}
|
||||
|
||||
this.version = -1;
|
||||
this.path = descriptor.getPath();
|
||||
this.nodeRef = AVMNodeConverter.ToNodeRef(this.version, this.path);
|
||||
this.services = services;
|
||||
this.imageResolver = resolver;
|
||||
init(this.version, this.path, descriptor);
|
||||
}
|
||||
|
||||
private void init(int version, String path, AVMNodeDescriptor descriptor)
|
||||
{
|
||||
this.version = version;
|
||||
this.path = path;
|
||||
this.properties = new QNameMap<String, Serializable>(this.services.getNamespaceService());
|
||||
AVMNodeDescriptor descriptor = this.services.getAVMService().lookup(version, path, true);
|
||||
if (descriptor == null)
|
||||
{
|
||||
descriptor = this.services.getAVMService().lookup(version, path, true);
|
||||
if (descriptor == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Invalid node specified: " + nodeRef.toString());
|
||||
}
|
||||
}
|
||||
this.avmRef = descriptor;
|
||||
this.deleted = descriptor.isDeleted();
|
||||
}
|
||||
@@ -341,6 +373,21 @@ public class AVMTemplateNode extends BasePermissionsNode
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The list of aspects applied to this node
|
||||
*/
|
||||
@Override
|
||||
public Set<QName> getAspects()
|
||||
{
|
||||
if (this.aspects == null)
|
||||
{
|
||||
this.aspects = new HashSet<QName>();
|
||||
this.aspects.addAll(this.services.getAVMService().getAspects(this.version, this.path));
|
||||
}
|
||||
|
||||
return this.aspects;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Audit API
|
||||
|
@@ -66,7 +66,7 @@ public abstract class BaseContentNode implements TemplateContent
|
||||
|
||||
protected ServiceRegistry services = null;
|
||||
protected TemplateImageResolver imageResolver = null;
|
||||
private Set<QName> aspects = null;
|
||||
protected Set<QName> aspects = null;
|
||||
private String displayPath = null;
|
||||
|
||||
private Boolean isDocument = null;
|
||||
@@ -285,7 +285,7 @@ public abstract class BaseContentNode implements TemplateContent
|
||||
{
|
||||
if (this.aspects == null)
|
||||
{
|
||||
this.aspects = this.services.getNodeService().getAspects(getNodeRef());
|
||||
getAspects();
|
||||
}
|
||||
|
||||
if (aspect.startsWith(NAMESPACE_BEGIN))
|
||||
|
Reference in New Issue
Block a user