use of org.alfresco.ibatis.IdsEntity in project alfresco-repository by Alfresco.
the class RepoUsageComponentImpl method updateDocuments.
/**
* Update number of documents with appropriate locking
*/
private boolean updateDocuments(boolean reset) {
Long documentCount = 0L;
if (!reset) {
// Count documents
Set<QName> searchTypeQNames = new HashSet<QName>(11);
Collection<QName> qnames = dictionaryService.getSubTypes(ContentModel.TYPE_CONTENT, true);
searchTypeQNames.addAll(qnames);
searchTypeQNames.add(ContentModel.TYPE_CONTENT);
qnames = dictionaryService.getSubTypes(ContentModel.TYPE_LINK, true);
searchTypeQNames.addAll(qnames);
searchTypeQNames.add(ContentModel.TYPE_LINK);
Set<Long> searchTypeQNameIds = qnameDAO.convertQNamesToIds(searchTypeQNames, false);
IdsEntity idsParam = new IdsEntity();
idsParam.setIds(new ArrayList<Long>(searchTypeQNameIds));
documentCount = cannedQueryDAO.executeCountQuery(QUERY_NS, QUERY_SELECT_COUNT_DOCUMENTS, idsParam);
}
attributeService.setAttribute(new Long(System.currentTimeMillis()), KEY_USAGE_ROOT, KEY_USAGE_CURRENT, KEY_USAGE_LAST_UPDATE_DOCUMENTS);
attributeService.setAttribute(documentCount, KEY_USAGE_ROOT, KEY_USAGE_CURRENT, KEY_USAGE_DOCUMENTS);
// Success
return true;
}
use of org.alfresco.ibatis.IdsEntity in project alfresco-repository by Alfresco.
the class AuthorityDAOImpl method getPersonCount.
@Override
public long getPersonCount() {
/* Unboxing accepted. See CannedQueryDAO javadoc and implementation. */
Pair<Long, QName> qnamePair = qnameDAO.getQName(ContentModel.TYPE_PERSON);
if (qnamePair == null) {
// No results
return 0L;
}
IdsEntity ids = new IdsEntity();
ids.setIdOne(qnamePair.getFirst());
Long personCount = cannedQueryDAO.executeCountQuery("alfresco.query.authorities", "select_AuthorityCount_People", ids);
if (logger.isDebugEnabled()) {
logger.debug("Counted authorities (people): " + personCount);
}
return personCount;
}
Aggregations