Search in sources :

Example 1 with NodeAspectsEntity

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);
}
Also used : NodeAspectsEntity(org.alfresco.repo.domain.node.NodeAspectsEntity)

Example 2 with NodeAspectsEntity

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;
}
Also used : NodeAspectsEntity(org.alfresco.repo.domain.node.NodeAspectsEntity) SortedSet(java.util.SortedSet) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) NodeVersionKey(org.alfresco.repo.domain.node.NodeVersionKey) HashSet(java.util.HashSet)

Aggregations

NodeAspectsEntity (org.alfresco.repo.domain.node.NodeAspectsEntity)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 SortedSet (java.util.SortedSet)1 NodeVersionKey (org.alfresco.repo.domain.node.NodeVersionKey)1 QName (org.alfresco.service.namespace.QName)1