From: Gautam J. <ga...@us...> - 2007-09-12 23:46:41
|
Update of /cvsroot/jaffa/JaffaComponentsUser/source/java/org/jaffa/applications/jaffa/modules/user/domain In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9943/source/java/org/jaffa/applications/jaffa/modules/user/domain Modified Files: UserRequest.java Log Message: Index: UserRequest.java =================================================================== RCS file: /cvsroot/jaffa/JaffaComponentsUser/source/java/org/jaffa/applications/jaffa/modules/user/domain/UserRequest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UserRequest.java 20 Mar 2007 22:09:17 -0000 1.2 --- UserRequest.java 12 Sep 2007 23:46:34 -0000 1.3 *************** *** 99,103 **** */ public static boolean exists(UOW uow, java.lang.Long requestId) throws FrameworkException { ! return findByPK(uow, requestId) != null ? true : false; } --- 99,121 ---- */ public static boolean exists(UOW uow, java.lang.Long requestId) throws FrameworkException { ! boolean localUow = false; ! try { ! if (uow == null || !uow.isActive()) { ! uow = new UOW(); ! localUow = true; ! } ! boolean exists = false; ! Criteria criteria = findByPKCriteria(requestId); ! criteria.addFunction(Criteria.FUNCTION_COUNT, null, Criteria.ID_FUNCTION_COUNT); ! Iterator itr = uow.query(criteria).iterator(); ! if (itr.hasNext()) { ! Number count = (Number) ((Map) itr.next()).get(Criteria.ID_FUNCTION_COUNT); ! exists = count != null && count.intValue() > 0; ! } ! return exists; ! } finally { ! if (localUow && uow != null) ! uow.rollback(); ! } } |