Search in sources :

Example 16 with IdsEntity

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;
}
Also used : IdsEntity(org.alfresco.ibatis.IdsEntity) QName(org.alfresco.service.namespace.QName) HashSet(java.util.HashSet)

Example 17 with IdsEntity

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;
}
Also used : IdsEntity(org.alfresco.ibatis.IdsEntity) QName(org.alfresco.service.namespace.QName)

Aggregations

IdsEntity (org.alfresco.ibatis.IdsEntity)17 QName (org.alfresco.service.namespace.QName)4 DefaultResultContext (org.apache.ibatis.executor.result.DefaultResultContext)3 ResultContext (org.apache.ibatis.session.ResultContext)3 ResultHandler (org.apache.ibatis.session.ResultHandler)3 ArrayList (java.util.ArrayList)2 NodePropertyEntity (org.alfresco.repo.domain.node.NodePropertyEntity)2 HashSet (java.util.HashSet)1 NodeEntity (org.alfresco.repo.domain.node.NodeEntity)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 Pair (org.alfresco.util.Pair)1 ConcurrencyFailureException (org.springframework.dao.ConcurrencyFailureException)1