use of org.alfresco.ibatis.IdsEntity in project alfresco-repository by Alfresco.
the class RepoUsageComponentImpl method updateUsers.
/**
* Update number of users with appropriate locking
*/
private boolean updateUsers(boolean reset) {
Long userCount = 0L;
if (!reset) {
// Count users
IdsEntity idsParam = new IdsEntity();
idsParam.setIdOne(qnameDAO.getOrCreateQName(ContentModel.ASPECT_PERSON_DISABLED).getFirst());
idsParam.setIdTwo(qnameDAO.getOrCreateQName(ContentModel.TYPE_PERSON).getFirst());
userCount = cannedQueryDAO.executeCountQuery(QUERY_NS, QUERY_SELECT_COUNT_PERSONS_NOT_DISABLED, idsParam);
// We subtract one to cater for 'guest', which is implicit
userCount = userCount > 0L ? userCount - 1L : 0L;
}
attributeService.setAttribute(new Long(System.currentTimeMillis()), KEY_USAGE_ROOT, KEY_USAGE_CURRENT, KEY_USAGE_LAST_UPDATE_USERS);
attributeService.setAttribute(userCount, KEY_USAGE_ROOT, KEY_USAGE_CURRENT, KEY_USAGE_USERS);
// Success
return true;
}
use of org.alfresco.ibatis.IdsEntity in project alfresco-repository by Alfresco.
the class AuthorityDAOImpl method getGroupCount.
@Override
public long getGroupCount() {
/* Unboxing accepted. See CannedQueryDAO javadoc and implementation. */
Pair<Long, QName> qnamePair = qnameDAO.getQName(ContentModel.TYPE_AUTHORITY_CONTAINER);
if (qnamePair == null) {
// No results
return 0L;
}
IdsEntity ids = new IdsEntity();
ids.setIdOne(qnamePair.getFirst());
Long groupCount = cannedQueryDAO.executeCountQuery("alfresco.query.authorities", "select_AuthorityCount_Groups", ids);
if (logger.isDebugEnabled()) {
logger.debug("Counted authorities (groups):" + groupCount);
}
return groupCount;
}
use of org.alfresco.ibatis.IdsEntity in project alfresco-repository by Alfresco.
the class ContentDataDAOImpl method deleteContentDataForNode.
@Override
public void deleteContentDataForNode(Long nodeId, Set<Long> qnameIds) {
if (qnameIds.size() == 0) {
// There will be no results
return;
}
IdsEntity idsEntity = new IdsEntity();
idsEntity.setIdOne(nodeId);
idsEntity.setIds(new ArrayList<Long>(qnameIds));
List<Long> ids = template.selectList(SELECT_CONTENT_DATA_BY_NODE_AND_QNAME, idsEntity);
// Delete each one
for (Long id : ids) {
try {
// Delete the ContentData entity
deleteContentData(id);
} catch (ConcurrencyFailureException e) {
// The DB may return results even though the row has just been
// deleted. Since we are deleting the row, it doesn't matter
// if it is deleted here or not.
}
}
}
use of org.alfresco.ibatis.IdsEntity in project alfresco-repository by Alfresco.
the class NodeDAOImpl method updateNodesInStore.
@Override
protected int updateNodesInStore(Long txnId, Long storeId) {
IdsEntity ids = new IdsEntity();
ids.setIdOne(txnId);
ids.setIdTwo(storeId);
return template.update(UPDATE_NODES_IN_STORE, ids);
}
use of org.alfresco.ibatis.IdsEntity 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);
}
Aggregations