use of org.alfresco.repo.domain.node.NodeAspectsEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method deleteNodeAspects.
@Override
protected int deleteNodeAspects(Long nodeId, Set<Long> qnameIds) {
NodeAspectsEntity nodeAspects = new NodeAspectsEntity();
nodeAspects.setNodeId(nodeId);
if (qnameIds != null && !qnameIds.isEmpty()) {
// Null means all
nodeAspects.setAspectQNameIds(new ArrayList<Long>(qnameIds));
}
return template.delete(DELETE_NODE_ASPECTS, nodeAspects);
}
use of org.alfresco.repo.domain.node.NodeAspectsEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectNodeAspects.
@Override
protected Map<NodeVersionKey, Set<QName>> selectNodeAspects(Set<Long> nodeIds) {
if (nodeIds.size() == 0) {
return Collections.emptyMap();
}
NodeAspectsEntity aspects = new NodeAspectsEntity();
aspects.setNodeIds(new ArrayList<Long>(nodeIds));
List<NodeAspectsEntity> rows = template.selectList(SELECT_NODE_ASPECTS, aspects);
Map<NodeVersionKey, Set<QName>> results = new HashMap<NodeVersionKey, Set<QName>>(rows.size() * 2);
for (NodeAspectsEntity nodeAspectsEntity : rows) {
Long nodeId = nodeAspectsEntity.getNodeId();
Long nodeVersion = nodeAspectsEntity.getNodeVersion();
NodeVersionKey nodeVersionKey = new NodeVersionKey(nodeId, nodeVersion);
if (results.containsKey(nodeVersionKey)) {
throw new IllegalStateException("Found existing key while querying for node aspects: " + nodeIds);
}
Set<Long> aspectIds = new HashSet<Long>(nodeAspectsEntity.getAspectQNameIds());
Set<QName> aspectQNames = qnameDAO.convertIdsToQNames(aspectIds);
results.put(nodeVersionKey, aspectQNames);
}
return results;
}
Aggregations