@Override public CriteriaQuery<T> q() { q.where(expr.toString()).params(params); return q; }
/** * Returns a {@link CriteriaWhere} object for building where condition. */ @Instrument public static <T extends Model> CriteriaWhere<T> where() { return (CriteriaWhere<T>)query().where(); }
@Override public void cleanupAuthorizationCodes() { int result; if(null != cleanupAuthorizationCodesCommand) { result = dao.executeUpdate(cleanupAuthorizationCodesCommand, New.hashMap("now", new Date())); }else{ result = dao.createCriteriaQuery(AuthzCodeEntity.class).where("expiration <= :now", new Date()).delete(); } log.info("Cleanup {} expired authorization codes", result); }
/** * Delete all the records with the given where expression. */ @Instrument public static int deleteAll(String whereExpression,Object... args) { return query().where(whereExpression, args).delete(); }
@Override public void cleanupAuthorizationCodes() { int result; if(null != cleanupAuthorizationCodesCommand) { result = dao.executeUpdate(cleanupAuthorizationCodesCommand, New.hashMap("now", new Date())); }else{ result = dao.createCriteriaQuery(AuthzCodeEntity.class).where("expiration <= :now", new Date()).delete(); } log.info("Cleanup {} expired authorization codes", result); }
/** * Delete all the records with the given where expression. */ @Instrument public static int deleteAll(String whereExpression) { return query().where(whereExpression).delete(); }
@Instrument public static int deleteBy(String field,Object value) { return query().where(field + "=?",value).delete(); }
@Instrument public static <T extends Model> T findBy(String field,Object value) throws TooManyRecordsException { return (T)query().where(field + "=?",value).singleOrNull(); }
/** * Updates all the records matched the where expression with all the fields. */ public final int updateAll(String whereExpression,Object... args) { return thisQuery().where(whereExpression,args).update(getUpdateFields()); }
/** * Delete all the records with the given where expression. */ @Instrument @SuppressWarnings("rawtypes") public static int deleteAll(String whereExpression,Map<String, Object> params) { return ((CriteriaQuery)query().where(whereExpression).params(params)).delete(); }
/** * Updates all the records matched the where expression with all the fields. */ public final int updateAll(String whereExpression) { _init(); return thisQuery().where(whereExpression).update(getUpdateFields()); }
/** * Updates all the records matched the where expression with all the fields. */ @SuppressWarnings("rawtypes") public final int updateAll(String whereExpression,Map<String, Object> params) { CriteriaQuery q = ((CriteriaQuery)thisQuery()); q.where(whereExpression).params(params); return q.update(getUpdateFields()); }
protected void cleanupSessions(Date now) { int result; if(null != cleanupSessionsCommand) { result = dao.executeUpdate(cleanupSessionsCommand, New.hashMap("now",now)); }else{ result = dao.createCriteriaQuery(AuthzSSOSessionEntity.class).where("expiration <= :now",now).delete(); } log.info("Cleanup {} expired sso sessions", result); }
protected void cleanupRefreshTokens(Date now) { int result; if(null != cleanupRefreshTokensCommand) { result = dao.executeUpdate(cleanupRefreshTokensCommand, New.hashMap("now",now)); }else{ result = dao.createCriteriaQuery(AuthzRefreshTokenEntity.class).where("expiration <= :now",now).delete(); } log.info("Cleanup {} expired refresh tokens", result); }
protected void cleanupSessions(Date now) { int result; if(null != cleanupSessionsCommand) { result = dao.executeUpdate(cleanupSessionsCommand, New.hashMap("now",now)); }else{ result = dao.createCriteriaQuery(AuthzSSOSessionEntity.class).where("expiration <= :now",now).delete(); } log.info("Cleanup {} expired sso sessions", result); }
protected void cleanupLogins(Date now) { int result; if(null != cleanupLoginsCommand) { result = dao.executeUpdate(cleanupLoginsCommand, New.hashMap("now",now)); }else{ result = dao.createCriteriaQuery(AuthzSSOLoginEntity.class).where("expiration <= :now",now).delete(); } log.info("Cleanup {} expired sso logins", result); }
protected void cleanupRefreshTokens(Date now) { int result; if(null != cleanupRefreshTokensCommand) { result = dao.executeUpdate(cleanupRefreshTokensCommand, New.hashMap("now",now)); }else{ result = dao.createCriteriaQuery(AuthzRefreshTokenEntity.class).where("expiration <= :now",now).delete(); } log.info("Cleanup {} expired refresh tokens", result); }
protected void cleanupAccessTokens(Date now) { int result; if(null != cleanupAccessTokensCommand) { result = dao.executeUpdate(cleanupAccessTokensCommand, New.hashMap("now",now)); }else{ result = dao.createCriteriaQuery(AuthzAccessTokenEntity.class).where("expiration <= :now",now).delete(); } log.info("Cleanup {} expired access tokens", result); }
protected void cleanupLogins(Date now) { int result; if(null != cleanupLoginsCommand) { result = dao.executeUpdate(cleanupLoginsCommand, New.hashMap("now",now)); }else{ result = dao.createCriteriaQuery(AuthzSSOLoginEntity.class).where("expiration <= :now",now).delete(); } log.info("Cleanup {} expired sso logins", result); }
protected void cleanupAccessTokens(Date now) { int result; if(null != cleanupAccessTokensCommand) { result = dao.executeUpdate(cleanupAccessTokensCommand, New.hashMap("now",now)); }else{ result = dao.createCriteriaQuery(AuthzAccessTokenEntity.class).where("expiration <= :now",now).delete(); } log.info("Cleanup {} expired access tokens", result); }