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);
}
}
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;
}
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;
}
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;
}
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();
}
Aggregations