use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method insertNodeAssoc.
@Override
protected Long insertNodeAssoc(Long sourceNodeId, Long targetNodeId, Long assocTypeQNameId, int assocIndex) {
NodeAssocEntity assoc = new NodeAssocEntity();
assoc.setVersion(1L);
assoc.setTypeQNameId(assocTypeQNameId);
// Source
NodeEntity sourceNode = new NodeEntity();
sourceNode.setId(sourceNodeId);
assoc.setSourceNode(sourceNode);
// Target
NodeEntity targetNode = new NodeEntity();
targetNode.setId(targetNodeId);
assoc.setTargetNode(targetNode);
// Index
assoc.setAssocIndex(assocIndex);
template.insert(INSERT_NODE_ASSOC, assoc);
return assoc.getId();
}
use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectNodeAssocMaxIndex.
@Override
protected int selectNodeAssocMaxIndex(Long sourceNodeId, Long assocTypeQNameId) {
NodeAssocEntity assoc = new NodeAssocEntity();
// Source
NodeEntity sourceNode = new NodeEntity();
sourceNode.setId(sourceNodeId);
assoc.setSourceNode(sourceNode);
// Assoc
assoc.setTypeQNameId(assocTypeQNameId);
Integer maxIndex = template.selectOne(SELECT_NODE_ASSOCS_MAX_INDEX, assoc);
return maxIndex == null ? 0 : maxIndex.intValue();
}
use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectPrimaryChildAcls.
@Override
public List<NodeIdAndAclId> selectPrimaryChildAcls(Long nodeId) {
ChildAssocEntity assoc = new ChildAssocEntity();
// Parent
NodeEntity parentNode = new NodeEntity();
parentNode.setId(nodeId);
assoc.setParentNode(parentNode);
// Primary
assoc.setPrimary(true);
return template.selectList(SELECT_NODE_PRIMARY_CHILD_ACLS, assoc);
}
use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectNodeAssocsBySourceAndPropertyValue.
@Override
protected List<NodeAssocEntity> selectNodeAssocsBySourceAndPropertyValue(Long sourceNodeId, Long typeQNameId, Long propertyQNameId, NodePropertyValue nodeValue) {
NodeAssocEntity assoc = new NodeAssocEntity();
// Source
NodeEntity sourceNode = new NodeEntity();
sourceNode.setId(sourceNodeId);
assoc.setSourceNode(sourceNode);
// Type
assoc.setTypeQNameId(typeQNameId);
// Property
assoc.setPropertyQNameId(propertyQNameId);
assoc.setPropertyValue(nodeValue);
return template.selectList(SELECT_NODE_ASSOCS_BY_SOURCE_AND_PROPERTY_VALUE, assoc);
}
use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectChildAssocs.
@Override
protected void selectChildAssocs(Long parentNodeId, Set<QName> assocTypeQNames, ChildAssocRefQueryCallback resultsCallback) {
ChildAssocEntity assoc = new ChildAssocEntity();
// Parent
NodeEntity parentNode = new NodeEntity();
parentNode.setId(parentNodeId);
assoc.setParentNode(parentNode);
// Type QNames
Set<Long> assocTypeQNameIds = qnameDAO.convertQNamesToIds(assocTypeQNames, false);
if (assocTypeQNameIds.size() == 0) {
resultsCallback.done();
// Shortcut as they don't exist
return;
}
assoc.setTypeQNameIds(new ArrayList<Long>(assocTypeQNameIds));
// Ordered
assoc.setOrdered(resultsCallback.orderResults());
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler);
resultsCallback.done();
}
Aggregations