mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
77259: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 76447: SOLR node metadata includes getNamePaths, which is a Collection<Collection<String>> - JSON serialization stubbed out; fix TODOs in NodesMetaDataGet to transfer serialize to specification - The name paths are the largest list of names of nodes that culminate in the target node. - The top parent is the last highest parent with a cm:name property - ALL paths are introspected but it does not mean that the node path count will always equal the name path count git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@78115 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -238,63 +238,68 @@ public class NodesMetaDataGet extends DeclarativeWebScript
|
|||||||
*/
|
*/
|
||||||
public static class FreemarkerNodeMetaData
|
public static class FreemarkerNodeMetaData
|
||||||
{
|
{
|
||||||
private Long nodeId;
|
private final Long nodeId;
|
||||||
private NodeRef nodeRef;
|
private final NodeRef nodeRef;
|
||||||
private QName nodeType;
|
private final QName nodeType;
|
||||||
private Long aclId;
|
private final Long aclId;
|
||||||
private Map<String, PropertyValue> properties;
|
private final Map<String, PropertyValue> properties;
|
||||||
private Set<QName> aspects;
|
private final Set<QName> aspects;
|
||||||
private List<String> paths;
|
private final List<String> paths;
|
||||||
private List<ChildAssociationRef> childAssocs;
|
private final List<String> namePaths;
|
||||||
private List<ChildAssociationRef> parentAssocs;
|
private final List<ChildAssociationRef> childAssocs;
|
||||||
private Long parentAssocsCrc;
|
private final List<ChildAssociationRef> parentAssocs;
|
||||||
private List<Long> childIds;
|
private final Long parentAssocsCrc;
|
||||||
private String owner;
|
private final List<Long> childIds;
|
||||||
private Long txnId;
|
private final String owner;
|
||||||
private Set<String> ancestors;
|
private final Long txnId;
|
||||||
private String tenantDomain;
|
private final Set<String> ancestors;
|
||||||
|
private final String tenantDomain;
|
||||||
|
|
||||||
public FreemarkerNodeMetaData(final SOLRSerializer solrSerializer, final NodeMetaData nodeMetaData)
|
public FreemarkerNodeMetaData(final SOLRSerializer solrSerializer, final NodeMetaData nodeMetaData)
|
||||||
throws IOException, JSONException
|
throws IOException, JSONException
|
||||||
{
|
{
|
||||||
setNodeId(nodeMetaData.getNodeId());
|
this.nodeId = nodeMetaData.getNodeId();
|
||||||
setTenantDomain(nodeMetaData.getTenantDomain());
|
this.tenantDomain = nodeMetaData.getTenantDomain();
|
||||||
setAclId(nodeMetaData.getAclId());
|
this.aclId = nodeMetaData.getAclId();
|
||||||
setNodeRef(nodeMetaData.getNodeRef());
|
this.nodeRef = nodeMetaData.getNodeRef();
|
||||||
setNodeType(nodeMetaData.getNodeType());
|
this.nodeType = nodeMetaData.getNodeType();
|
||||||
setTxnId(nodeMetaData.getTxnId());
|
this.txnId = nodeMetaData.getTxnId();
|
||||||
|
|
||||||
// convert Paths to Strings
|
// convert Paths to Strings
|
||||||
List<String> paths = new ArrayList<String>();
|
List<String> paths = new ArrayList<String>();
|
||||||
HashSet<String> ancestors = new HashSet<String>();
|
HashSet<String> ancestors = new HashSet<String>();
|
||||||
if(nodeMetaData.getPaths() != null)
|
if(nodeMetaData.getPaths() != null)
|
||||||
{
|
{
|
||||||
for(Pair<Path, QName> pair : nodeMetaData.getPaths())
|
for(Pair<Path, QName> pair : nodeMetaData.getPaths())
|
||||||
{
|
|
||||||
JSONObject o = new JSONObject();
|
|
||||||
o.put("path", solrSerializer.serializeValue(String.class, pair.getFirst()));
|
|
||||||
o.put("qname", solrSerializer.serializeValue(String.class, pair.getSecond()));
|
|
||||||
paths.add(o.toString(3));
|
|
||||||
|
|
||||||
for (NodeRef ancestor : getAncestors(pair.getFirst()))
|
|
||||||
{
|
{
|
||||||
ancestors.add(ancestor.toString());
|
JSONObject o = new JSONObject();
|
||||||
|
o.put("path", solrSerializer.serializeValue(String.class, pair.getFirst()));
|
||||||
|
o.put("qname", solrSerializer.serializeValue(String.class, pair.getSecond()));
|
||||||
|
paths.add(o.toString(3));
|
||||||
|
|
||||||
|
for (NodeRef ancestor : getAncestors(pair.getFirst()))
|
||||||
|
{
|
||||||
|
ancestors.add(ancestor.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
this.ancestors = ancestors;
|
||||||
setAncestors(ancestors);
|
this.paths = paths;
|
||||||
setPaths(paths);
|
// TODO: Convert name paths to required strings
|
||||||
|
this.namePaths = null; // TODO: use a JSON-friendly string
|
||||||
|
|
||||||
|
this.owner = nodeMetaData.getOwner();
|
||||||
|
this.childAssocs = nodeMetaData.getChildAssocs();
|
||||||
|
this.childIds = nodeMetaData.getChildIds();
|
||||||
|
this.parentAssocs = nodeMetaData.getParentAssocs();
|
||||||
|
this.parentAssocsCrc = nodeMetaData.getParentAssocsCrc();
|
||||||
|
this.aspects = nodeMetaData.getAspects();
|
||||||
|
|
||||||
setChildAssocs(nodeMetaData.getChildAssocs());
|
|
||||||
setChildIds(nodeMetaData.getChildIds());
|
|
||||||
setParentAssocs(nodeMetaData.getParentAssocs());
|
|
||||||
setParentAssocsCrc(nodeMetaData.getParentAssocsCrc());
|
|
||||||
setAspects(nodeMetaData.getAspects());
|
|
||||||
final Map<QName, Serializable> props = nodeMetaData.getProperties();
|
final Map<QName, Serializable> props = nodeMetaData.getProperties();
|
||||||
if(props != null)
|
if (props != null)
|
||||||
{
|
{
|
||||||
final Map<String, PropertyValue> properties = (props != null ? new HashMap<String, PropertyValue>(props.size()) : null);
|
final Map<String, PropertyValue> properties = new HashMap<String, PropertyValue>(props.size());
|
||||||
for(final QName propName : props.keySet())
|
for (final QName propName : props.keySet())
|
||||||
{
|
{
|
||||||
// need to run this in tenant context because types may be in a tenant-specific
|
// need to run this in tenant context because types may be in a tenant-specific
|
||||||
// dictionary registry
|
// dictionary registry
|
||||||
@@ -310,139 +315,74 @@ public class NodesMetaDataGet extends DeclarativeWebScript
|
|||||||
}
|
}
|
||||||
}, tenantDomain);
|
}, tenantDomain);
|
||||||
}
|
}
|
||||||
setProperties(properties);
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.properties = null;
|
||||||
}
|
}
|
||||||
setOwner(nodeMetaData.getOwner());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeRef getNodeRef()
|
public NodeRef getNodeRef()
|
||||||
{
|
{
|
||||||
return nodeRef;
|
return nodeRef;
|
||||||
}
|
}
|
||||||
public void setNodeRef(NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
this.nodeRef = nodeRef;
|
|
||||||
}
|
|
||||||
public List<String> getPaths()
|
public List<String> getPaths()
|
||||||
{
|
{
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
public void setPaths(List<String> paths)
|
|
||||||
{
|
|
||||||
this.paths = paths;
|
|
||||||
}
|
|
||||||
public QName getNodeType()
|
public QName getNodeType()
|
||||||
{
|
{
|
||||||
return nodeType;
|
return nodeType;
|
||||||
}
|
}
|
||||||
public void setNodeType(QName nodeType)
|
|
||||||
{
|
|
||||||
this.nodeType = nodeType;
|
|
||||||
}
|
|
||||||
public Long getNodeId()
|
public Long getNodeId()
|
||||||
{
|
{
|
||||||
return nodeId;
|
return nodeId;
|
||||||
}
|
}
|
||||||
public void setNodeId(Long nodeId)
|
|
||||||
{
|
|
||||||
this.nodeId = nodeId;
|
|
||||||
}
|
|
||||||
public Long getAclId()
|
public Long getAclId()
|
||||||
{
|
{
|
||||||
return aclId;
|
return aclId;
|
||||||
}
|
}
|
||||||
public void setAclId(Long aclId)
|
|
||||||
{
|
|
||||||
this.aclId = aclId;
|
|
||||||
}
|
|
||||||
public Map<String, PropertyValue> getProperties()
|
public Map<String, PropertyValue> getProperties()
|
||||||
{
|
{
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
public void setProperties(Map<String, PropertyValue> properties)
|
|
||||||
{
|
|
||||||
this.properties = properties;
|
|
||||||
}
|
|
||||||
public Set<QName> getAspects()
|
public Set<QName> getAspects()
|
||||||
{
|
{
|
||||||
return aspects;
|
return aspects;
|
||||||
}
|
}
|
||||||
public void setAspects(Set<QName> aspects)
|
|
||||||
{
|
|
||||||
this.aspects = aspects;
|
|
||||||
}
|
|
||||||
public List<ChildAssociationRef> getChildAssocs()
|
public List<ChildAssociationRef> getChildAssocs()
|
||||||
{
|
{
|
||||||
return childAssocs;
|
return childAssocs;
|
||||||
}
|
}
|
||||||
public void setChildAssocs(List<ChildAssociationRef> childAssocs)
|
|
||||||
{
|
|
||||||
this.childAssocs = childAssocs;
|
|
||||||
}
|
|
||||||
public List<ChildAssociationRef> getParentAssocs()
|
public List<ChildAssociationRef> getParentAssocs()
|
||||||
{
|
{
|
||||||
return parentAssocs;
|
return parentAssocs;
|
||||||
}
|
}
|
||||||
public void setParentAssocs(List<ChildAssociationRef> parentAssocs)
|
|
||||||
{
|
|
||||||
this.parentAssocs = parentAssocs;
|
|
||||||
}
|
|
||||||
public Long getParentAssocsCrc()
|
public Long getParentAssocsCrc()
|
||||||
{
|
{
|
||||||
return parentAssocsCrc;
|
return parentAssocsCrc;
|
||||||
}
|
}
|
||||||
public void setParentAssocsCrc(Long parentAssocsCrc)
|
|
||||||
{
|
|
||||||
this.parentAssocsCrc = parentAssocsCrc;
|
|
||||||
}
|
|
||||||
public void setAncestors(Set<String> ancestors)
|
|
||||||
{
|
|
||||||
this.ancestors = ancestors;
|
|
||||||
}
|
|
||||||
public Set<String> getAncestors()
|
public Set<String> getAncestors()
|
||||||
{
|
{
|
||||||
return ancestors;
|
return ancestors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Long> getChildIds()
|
public List<Long> getChildIds()
|
||||||
{
|
{
|
||||||
return childIds;
|
return childIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChildIds(List<Long> childIds)
|
|
||||||
{
|
|
||||||
this.childIds = childIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOwner()
|
public String getOwner()
|
||||||
{
|
{
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOwner(String owner)
|
|
||||||
{
|
|
||||||
this.owner = owner;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getTxnId()
|
public Long getTxnId()
|
||||||
{
|
{
|
||||||
return txnId;
|
return txnId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTxnId(Long txnId)
|
|
||||||
{
|
|
||||||
this.txnId = txnId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTenantDomain()
|
public String getTenantDomain()
|
||||||
{
|
{
|
||||||
return tenantDomain;
|
return tenantDomain;
|
||||||
}
|
}
|
||||||
public void setTenantDomain(String tenantDomain)
|
|
||||||
{
|
|
||||||
this.tenantDomain = tenantDomain;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<NodeRef> getAncestors(Path path)
|
private ArrayList<NodeRef> getAncestors(Path path)
|
||||||
{
|
{
|
||||||
ArrayList<NodeRef> ancestors = new ArrayList<NodeRef>(8);
|
ArrayList<NodeRef> ancestors = new ArrayList<NodeRef>(8);
|
||||||
|
Reference in New Issue
Block a user