Source:
<code>public NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCountRequest rqst) { Long result = 0L; boolean commited = false; Query query = null; try { openTransaction(); long fromEventId = rqst.getFromEventId(); String inputDbName = rqst.getDbName(); String catName = rqst.isSetCatName() ? rqst.getCatName() : getDefaultCatalog(conf); long toEventId; String paramSpecs; List<Object> paramVals = new ArrayList<Object>(); String queryStr = "select count(eventId) from " + MNotificationLog.class.getName(); queryStr = queryStr + " where eventId > fromEventId"; paramSpecs = "java.lang.Long fromEventId"; paramVals.add(new Long(fromEventId)); queryStr = queryStr + " && (dbName == inputDbName || dbName == null)"; paramSpecs = paramSpecs + ", java.lang.String inputDbName"; paramVals.add(inputDbName); queryStr = queryStr + " && (catalogName == catName || catalogName == null)"; paramSpecs = paramSpecs +", java.lang.String catName"; paramVals.add(catName); if (rqst.isSetToEventId()) { toEventId = rqst.getToEventId(); queryStr = queryStr + " && eventId <= toEventId"; paramSpecs = paramSpecs + ", java.lang.Long toEventId"; paramVals.add(new Long(toEventId)); } query = pm.newQuery(queryStr); query.declareParameters(paramSpecs); result = (Long) query.executeWithArray(paramVals.toArray()); commited = commitTransaction(); long eventCount = result.longValue(); <START> if (rqst.isSetLimit() && eventCount > rqst.getLimit()) <END> eventCount = rqst.getLimit(); return new NotificationEventsCountResponse(eventCount); } finally { rollbackAndCleanup(commited, query); } }</code><technical_language>Need for single line</technical_language>

Target:
public NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCountRequest rqst) { Long result = 0L; boolean commited = false; Query query = null; try { openTransaction(); long fromEventId = rqst.getFromEventId(); String inputDbName = rqst.getDbName(); String catName = rqst.isSetCatName() ? rqst.getCatName() : getDefaultCatalog(conf); long toEventId; String paramSpecs; List<Object> paramVals = new ArrayList<Object>(); assert catName.equals(catName.toLowerCase()); String queryStr = "select count(eventId) from " + MNotificationLog.class.getName(); queryStr = queryStr + " where eventId > fromEventId"; paramSpecs = "java.lang.Long fromEventId"; paramVals.add(Long.valueOf(fromEventId)); if (!inputDbName.equals("*")) { queryStr = queryStr + " && (dbName == inputDbName || dbName == null)"; paramSpecs = paramSpecs + ", java.lang.String inputDbName"; paramVals.add(inputDbName.toLowerCase()); } queryStr = queryStr + " && (catalogName == catName || catalogName == null)"; paramSpecs = paramSpecs +", java.lang.String catName"; paramVals.add(catName); if (rqst.isSetToEventId()) { toEventId = rqst.getToEventId(); queryStr = queryStr + " && eventId <= toEventId"; paramSpecs = paramSpecs + ", java.lang.Long toEventId"; paramVals.add(Long.valueOf(toEventId)); } query = pm.newQuery(queryStr); query.declareParameters(paramSpecs); result = (Long) query.executeWithArray(paramVals.toArray()); commited = commitTransaction(); long eventCount = result.longValue(); if (rqst.isSetLimit() && eventCount > rqst.getLimit()) { eventCount = rqst.getLimit(); } return new NotificationEventsCountResponse(eventCount); } finally { rollbackAndCleanup(commited, query); } }