use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectChildAssocsByChildTypes.
@Override
protected void selectChildAssocsByChildTypes(Long parentNodeId, Set<QName> childNodeTypeQNames, ChildAssocRefQueryCallback resultsCallback) {
ChildAssocEntity assoc = new ChildAssocEntity();
// Parent
NodeEntity parentNode = new NodeEntity();
parentNode.setId(parentNodeId);
assoc.setParentNode(parentNode);
// Child Node Type QNames
Set<Long> childNodeTypeQNameIds = qnameDAO.convertQNamesToIds(childNodeTypeQNames, false);
if (childNodeTypeQNameIds.size() == 0) {
resultsCallback.done();
// Shortcut as they don't exist
return;
}
assoc.setChildNodeTypeQNameIds(new ArrayList<Long>(childNodeTypeQNameIds));
// Ordered
assoc.setOrdered(resultsCallback.orderResults());
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler);
resultsCallback.done();
}
use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectNodesWithAspects.
@Override
protected void selectNodesWithAspects(List<Long> qnameIds, Long minNodeId, Long maxNodeId, final NodeRefQueryCallback resultsCallback) {
@SuppressWarnings("rawtypes") ResultHandler resultHandler = new ResultHandler() {
public void handleResult(ResultContext context) {
NodeEntity entity = (NodeEntity) context.getResultObject();
Pair<Long, NodeRef> nodePair = new Pair<Long, NodeRef>(entity.getId(), entity.getNodeRef());
resultsCallback.handle(nodePair);
}
};
IdsEntity parameters = new IdsEntity();
parameters.setIdOne(minNodeId);
parameters.setIdTwo(maxNodeId);
parameters.setIds(qnameIds);
template.select(SELECT_NODES_WITH_ASPECT_IDS, parameters, resultHandler);
}
use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectNodeByNodeRef.
@Override
protected NodeEntity selectNodeByNodeRef(NodeRef nodeRef) {
StoreEntity store = new StoreEntity();
StoreRef storeRef = nodeRef.getStoreRef();
store.setProtocol(storeRef.getProtocol());
store.setIdentifier(storeRef.getIdentifier());
NodeEntity node = new NodeEntity();
// Store
node.setStore(store);
// UUID
String uuid = nodeRef.getId();
if (uuid.length() > 36) {
// Avoid query failure if someone passes in a made-up UUID.
return null;
// Originally for DB2 which has been EOLed, but might now be used by other databases.
}
node.setUuid(uuid);
return template.selectOne(SELECT_NODE_BY_NODEREF, node);
}
use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectPrimaryParentAssocs.
@Override
protected List<ChildAssocEntity> selectPrimaryParentAssocs(Long childNodeId) {
ChildAssocEntity assoc = new ChildAssocEntity();
// Child
NodeEntity childNode = new NodeEntity();
childNode.setId(childNodeId);
assoc.setChildNode(childNode);
// Primary
assoc.setPrimary(Boolean.TRUE);
return template.selectList(SELECT_PARENT_ASSOCS_OF_CHILD, assoc);
}
use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method deleteNodeById.
@Override
protected int deleteNodeById(Long nodeId) {
NodeEntity node = new NodeEntity();
node.setId(nodeId);
return template.delete(DELETE_NODE_BY_ID, node);
}
Aggregations