use of org.alfresco.repo.domain.node.ChildAssocEntity 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.ChildAssocEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectChildAssoc.
@Override
protected ChildAssocEntity selectChildAssoc(Long assocId) {
ChildAssocEntity assoc = new ChildAssocEntity();
assoc.setId(assocId);
return template.selectOne(SELECT_CHILD_ASSOC_BY_ID, assoc);
}
use of org.alfresco.repo.domain.node.ChildAssocEntity 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();
}
use of org.alfresco.repo.domain.node.ChildAssocEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectChildAssocs.
@SuppressWarnings("unchecked")
@Override
public void selectChildAssocs(Long parentNodeId, QName assocTypeQName, QName assocQName, final int maxResults, ChildAssocRefQueryCallback resultsCallback) {
ChildAssocEntity assoc = new ChildAssocEntity();
// Parent
NodeEntity parentNode = new NodeEntity();
parentNode.setId(parentNodeId);
assoc.setParentNode(parentNode);
// Type QName
if (assocTypeQName != null) {
if (!assoc.setTypeQNameAll(qnameDAO, assocTypeQName, false)) {
resultsCallback.done();
// Shortcut
return;
}
}
// QName
if (assocQName != null) {
if (!assoc.setQNameAll(qnameDAO, assocQName, false)) {
resultsCallback.done();
// Shortcut
return;
}
}
// Order
assoc.setOrdered(resultsCallback.orderResults());
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
RowBounds rowBounds = new RowBounds(0, maxResults);
List<?> entities = template.selectList(SELECT_CHILD_ASSOCS_OF_PARENT_LIMITED, assoc, rowBounds);
@SuppressWarnings("rawtypes") final DefaultResultContext resultContext = new DefaultResultContext();
for (Object entity : entities) {
resultContext.nextResultObject(entity);
resultHandler.handleResult(resultContext);
}
resultsCallback.done();
}
use of org.alfresco.repo.domain.node.ChildAssocEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method selectChildAssocs.
@Override
protected void selectChildAssocs(Long parentNodeId, Long childNodeId, QName assocTypeQName, QName assocQName, Boolean isPrimary, Boolean sameStore, ChildAssocRefQueryCallback resultsCallback) {
ChildAssocEntity assoc = new ChildAssocEntity();
// Parent
NodeEntity parentNode = new NodeEntity();
parentNode.setId(parentNodeId);
assoc.setParentNode(parentNode);
// Child
if (childNodeId != null) {
NodeEntity childNode = new NodeEntity();
childNode.setId(childNodeId);
assoc.setChildNode(childNode);
}
// Type QName
if (assocTypeQName != null) {
if (!assoc.setTypeQNameAll(qnameDAO, assocTypeQName, false)) {
resultsCallback.done();
// Shortcut
return;
}
}
// QName
if (assocQName != null) {
if (!assoc.setQNameAll(qnameDAO, assocQName, false)) {
resultsCallback.done();
// Shortcut
return;
}
}
// Primary
if (isPrimary != null) {
assoc.setPrimary(isPrimary);
}
// Same store
if (sameStore != null) {
assoc.setSameStore(sameStore);
}
// Ordered
assoc.setOrdered(resultsCallback.orderResults());
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler);
resultsCallback.done();
}
Aggregations