本文整理汇总了Java中org.springframework.dao.support.DataAccessUtils.intResult方法的典型用法代码示例。如果您正苦于以下问题:Java DataAccessUtils.intResult方法的具体用法?Java DataAccessUtils.intResult怎么用?Java DataAccessUtils.intResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.dao.support.DataAccessUtils
的用法示例。
在下文中一共展示了DataAccessUtils.intResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: count
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
* Counts collections whose the given user is authorized.
* @param user the given user.
* @return number of authorized collection for user.
*/
public int count (User user)
{
String userString = "";
// Bypass for Data Right Managers. They can see all products and
// collections.
if ( !cfgManager.isDataPublic () && (user != null) &&
!user.getRoles ().contains (Role.DATA_MANAGER))
{
userString =
"WHERE ('" + user.getUUID () + "' in elements(authorizedUsers) OR '" +
userDao.getPublicData ().getUUID () +
"' in elements(authorizedUsers))";
}
return DataAccessUtils
.intResult (find ("select count(*) FROM Collection " + userString));
}
示例2: countOpenSessions
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@SuppressWarnings ("rawtypes")
private int countOpenSessions ()
{
return DataAccessUtils.intResult (getHibernateTemplate ().execute (
new HibernateCallback<List>()
{
@Override
public List doInHibernate(Session session)
throws HibernateException, SQLException
{
String sql =
"SELECT count (*) FROM INFORMATION_SCHEMA.SYSTEM_SESSIONS";
SQLQuery query = session.createSQLQuery (sql);
return query.list ();
}
}));
}
示例3: count
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
* Returns the number of Product records whose `processed` field is `true`.
* @param filter an optional additionnal `where` clause (without the "where" token).
* @param collection_uuid an optional parent collection ID.
* @return a number of rows in table `PRODUCTS`.
*/
public int count (String filter, final String collection_uuid)
{
StringBuilder sb = new StringBuilder("select count(*) ");
if (collection_uuid != null)
{
sb.append("from Collection c left outer join c.products p ");
sb.append("where c.uuid='").append(collection_uuid).append("' and ");
}
else
{
sb.append("from Product p where ");
}
sb.append("p.processed=true");
if (filter != null && !filter.isEmpty())
{
sb.append(" and ").append(filter);
}
return DataAccessUtils.intResult(find(sb.toString()));
}
示例4: countNotDeleted
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public int countNotDeleted (String filter)
{
return DataAccessUtils.intResult (find (
"select count(*) FROM " + entityClass.getName () +
" u WHERE u.deleted is false AND u.username LIKE '%" + filter +
"%' and " + "not u.username='" +
cfgManager.getAdministratorConfiguration ().getName () + "'" +
" and not u.username LIKE '"+getPublicData ().getUsername ()+"' "));
}
示例5: countForDataRight
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public int countForDataRight (String filter)
{
return DataAccessUtils.intResult (find (
"select count(*) FROM " + entityClass.getName () +
" u WHERE u.deleted is false AND u.username LIKE '%" + filter +
"%' and " + "not u.username='" +
cfgManager.getAdministratorConfiguration ().getName () + "' "));
}
示例6: countAll
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public int countAll (String filter)
{
return DataAccessUtils.intResult (find (
"select count(*) FROM " + entityClass.getName () +
" u WHERE u.username LIKE '%" + filter + "%'" +
" and not u.username LIKE '" + getPublicData ().getUsername () +
"' " ));
}
示例7: countNotDeletedByFilter
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public int countNotDeletedByFilter (String filter)
{
return DataAccessUtils.intResult (find (
"select count(*) FROM " + entityClass.getName () +
" u WHERE u.deleted is false AND (u.username LIKE '%" + filter +
"%' OR lower(u.firstname) LIKE '%"+filter.toLowerCase()+ "%' OR lower(u.lastname) LIKE '%"+filter.toLowerCase()+
"%' OR lower(u.email) LIKE '%"+filter.toLowerCase()+ "%') and not u.username='" +
cfgManager.getAdministratorConfiguration ().getName () + "'" +
" and not u.username LIKE '"+getPublicData ().getUsername ()+"' "));
}
示例8: handleCount
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected int handleCount(String filter) {
if (StringUtils.isNotBlank(filter)) {
Criteria criteria = getSession().createCriteria(Group.class);
criteria.add(Restrictions.ilike(GroupConstants.NAME, "%" + filter + "%"));
criteria.add(Restrictions.ilike(GroupConstants.ALIAS, "%" + filter + "%"));
criteria.setProjection(Projections.rowCount());
Object result = criteria.uniqueResult();
return Integer.parseInt(result.toString());
}
return DataAccessUtils.intResult(getHibernateTemplate().find(
"select count(*) from " + GroupConstants.CLASS_NAME));
}
示例9: handleCountMembers
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected int handleCountMembers(long groupId) {
Group group = load(groupId);
if (group != null) {
return DataAccessUtils.intResult(getHibernateTemplate().find(
"select count(*) " + MEMBERSHIP_QUERY, groupId));
}
return 0;
}
示例10: count
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@Override
public int count(String hql, Object... args) throws Exception {
Query query=this.getCurrentSession().createQuery(hql);
for (int position=0; args!=null && position<args.length; position++) {
this.setQueryParams(query, Integer.toString(position), args[position]);
}
return DataAccessUtils.intResult(query.list());
}
示例11: countByPK
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public int countByPK(PK pk) throws Exception {
return DataAccessUtils.intResult(
this.getCurrentSession().createQuery(
" select count(*) from "+this.getPersisentName() +
" where " + BaseEntityUtil.getPKOneName((BaseEntity<PK>)entityClass.newInstance()) + "=?0 ")
.setString("0", (String)pk).list());
}
示例12: countByEntityUK
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public int countByEntityUK(Map<String, Object> ukMap) throws Exception {
if (ukMap==null || ukMap.size()<1) {
return 0;
}
Query query=this.getQueryByKeyMap("select count(*)", ukMap);
return DataAccessUtils.intResult(query.list());
}
示例13: isRunning
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
* Determines whether there are any open (running or initialising) TaskRuns for the Task identified by the passed ID.
*
* @param taskId The task ID.
* @return True if there are running tasks, false otherwise.
*/
public boolean isRunning(long taskId) {
int count = DataAccessUtils.intResult(getHibernateTemplate().findByNamedParam(
"select count(*) from TaskRun where taskId = :taskId AND (status = 'RUNNING' OR status = 'INITIALISING')",
"taskId", taskId));
if (count > 0) {
return true;
}
return false;
}
示例14: handleCount
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
* @see com.communote.server.persistence.security.iprange.IpRangeDao#count()
* @return Number of elements.
*/
@Override
protected int handleCount() {
return DataAccessUtils.intResult(getHibernateTemplate().find(
"select count(*) from " + IpRangeFilterConstants.CLASS_NAME));
}
示例15: countForMixData
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@Override
public int countForMixData(Map<String, Object> paramMap) throws Exception {
Query query = this.getCurrentSession().createQuery(this.getDynamicHql("findKpiMixData-count", paramMap));
this.setQueryMixDataParameter(query, paramMap);
return DataAccessUtils.intResult( query.list() );
}