Search in sources :

Example 96 with DBQuery

use of org.olat.core.commons.persistence.DBQuery in project openolat by klemens.

the class CollaborationManagerImpl method lookupFolderAccess.

@Override
public Long lookupFolderAccess(OLATResourceable ores) {
    StringBuilder query = new StringBuilder();
    query.append("select prop.longValue from ").append(Property.class.getName()).append(" as prop where ").append(" prop.category='").append(PROP_CAT_BG_COLLABTOOLS).append("'").append(" and prop.resourceTypeName='").append(ores.getResourceableTypeName()).append("'").append(" and prop.resourceTypeId=").append(ores.getResourceableId()).append(" and prop.name='").append(KEY_FOLDER_ACCESS).append("'").append(" and prop.identity is null and prop.grp is null");
    DBQuery dbquery = DBFactory.getInstance().createQuery(query.toString());
    dbquery.setCacheable(true);
    @SuppressWarnings("unchecked") List<Long> props = dbquery.list();
    if (props.isEmpty()) {
        return null;
    } else {
        return props.get(0);
    }
}
Also used : DBQuery(org.olat.core.commons.persistence.DBQuery)

Example 97 with DBQuery

use of org.olat.core.commons.persistence.DBQuery in project openolat by klemens.

the class BaseSecurityManager method countIdentitiesOfSecurityGroup.

/**
 * @see org.olat.basesecurity.Manager#countIdentitiesOfSecurityGroup(org.olat.basesecurity.SecurityGroup)
 */
@Override
public int countIdentitiesOfSecurityGroup(SecurityGroup secGroup) {
    DB db = DBFactory.getInstance();
    String q = "select count(sgm) from org.olat.basesecurity.SecurityGroupMembershipImpl sgm where sgm.securityGroup = :group";
    DBQuery query = db.createQuery(q);
    query.setEntity("group", secGroup);
    query.setCacheable(true);
    int result = ((Long) query.list().get(0)).intValue();
    return result;
}
Also used : DBQuery(org.olat.core.commons.persistence.DBQuery) DB(org.olat.core.commons.persistence.DB)

Example 98 with DBQuery

use of org.olat.core.commons.persistence.DBQuery in project openolat by klemens.

the class BaseSecurityManager method getIdentitiesByPowerSearch.

@Override
public List<Identity> getIdentitiesByPowerSearch(SearchIdentityParams params, int firstResult, int maxResults) {
    DBQuery dbq = createIdentitiesByPowerQuery(params, false);
    if (firstResult >= 0) {
        dbq.setFirstResult(firstResult);
    }
    if (maxResults > 0) {
        dbq.setMaxResults(maxResults);
    }
    @SuppressWarnings("unchecked") List<Identity> identities = dbq.list();
    return identities;
}
Also used : DBQuery(org.olat.core.commons.persistence.DBQuery) Identity(org.olat.core.id.Identity)

Example 99 with DBQuery

use of org.olat.core.commons.persistence.DBQuery in project openolat by klemens.

the class BaseSecurityManager method countUniqueUserLoginsSince.

/**
 * @see org.olat.basesecurity.Manager#countUniqueUserLoginsSince(java.util.Date)
 */
@Override
public Long countUniqueUserLoginsSince(Date lastLoginLimit) {
    String queryStr = "Select count(ident) from org.olat.core.id.Identity as ident where " + "ident.lastLogin > :lastLoginLimit and ident.lastLogin != ident.creationDate";
    DBQuery dbq = DBFactory.getInstance().createQuery(queryStr);
    dbq.setDate("lastLoginLimit", lastLoginLimit);
    List res = dbq.list();
    Long cntL = (Long) res.get(0);
    return cntL;
}
Also used : DBQuery(org.olat.core.commons.persistence.DBQuery) List(java.util.List) ArrayList(java.util.ArrayList)

Example 100 with DBQuery

use of org.olat.core.commons.persistence.DBQuery in project openolat by klemens.

the class BaseSecurityManager method countIdentitiesByPowerSearch.

@Override
public int countIdentitiesByPowerSearch(SearchIdentityParams params) {
    DBQuery dbq = createIdentitiesByPowerQuery(params, true);
    Number count = (Number) dbq.uniqueResult();
    return count.intValue();
}
Also used : DBQuery(org.olat.core.commons.persistence.DBQuery)

Aggregations

DBQuery (org.olat.core.commons.persistence.DBQuery)108 EPStructureToArtefactLink (org.olat.portfolio.model.structel.EPStructureToArtefactLink)12 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)10 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)10 Calendar (java.util.Calendar)8 IdentityImpl (org.olat.basesecurity.IdentityImpl)6 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 HashMap (java.util.HashMap)4 DB (org.olat.core.commons.persistence.DB)4 Publisher (org.olat.core.commons.services.notifications.Publisher)4 Tag (org.olat.core.commons.services.tagging.model.Tag)4 Identity (org.olat.core.id.Identity)4 EPStructureToStructureLink (org.olat.portfolio.model.structel.EPStructureToStructureLink)4 EPStructuredMap (org.olat.portfolio.model.structel.EPStructuredMap)4 EPStructuredMapTemplate (org.olat.portfolio.model.structel.EPStructuredMapTemplate)4 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 StringTokenizer (java.util.StringTokenizer)2