001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: *
005: * Licensed under the Educational Community License, Version 1.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.opensource.org/licenses/ecl1.php
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package edu.iu.uis.eden.routetemplate.dao;
018:
019: import java.sql.PreparedStatement;
020: import java.sql.ResultSet;
021: import java.sql.Timestamp;
022: import java.util.ArrayList;
023: import java.util.Collection;
024: import java.util.Date;
025: import java.util.Iterator;
026: import java.util.List;
027: import java.util.Map;
028:
029: import org.apache.ojb.broker.PersistenceBroker;
030: import org.apache.ojb.broker.query.Criteria;
031: import org.apache.ojb.broker.query.QueryByCriteria;
032: import org.apache.ojb.broker.query.QueryFactory;
033: import org.apache.ojb.broker.query.ReportQueryByCriteria;
034: import org.springmodules.orm.ojb.PersistenceBrokerCallback;
035: import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
036:
037: import edu.iu.uis.eden.EdenConstants;
038: import edu.iu.uis.eden.exception.WorkflowRuntimeException;
039: import edu.iu.uis.eden.routetemplate.RuleBaseValues;
040: import edu.iu.uis.eden.routetemplate.RuleExtension;
041: import edu.iu.uis.eden.routetemplate.RuleResponsibility;
042: import edu.iu.uis.eden.util.Utilities;
043:
044: public class RuleDAOOjbImpl extends PersistenceBrokerDaoSupport
045: implements RuleDAO {
046:
047: private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
048: .getLogger(RuleDAOOjbImpl.class);
049:
050: private static final String OLD_DELEGATIONS_SQL = "select oldDel.dlgn_rule_base_val_id "
051: + "from en_rule_rsp_t oldRsp, en_dlgn_rsp_t oldDel "
052: + "where oldRsp.rule_base_val_id=? and "
053: + "oldRsp.rule_rsp_id=oldDel.rule_rsp_id and "
054: + "oldDel.dlgn_rule_base_val_id not in "
055: + "(select newDel.dlgn_rule_base_val_id from en_rule_rsp_t newRsp, en_dlgn_rsp_t newDel "
056: + "where newRsp.rule_base_val_id=? and "
057: + "newRsp.rule_rsp_id=newDel.rule_rsp_id)";
058:
059: public void save(RuleBaseValues ruleBaseValues) {
060: this .getPersistenceBrokerTemplate().store(ruleBaseValues);
061: }
062:
063: public void saveDeactivationDate(final RuleBaseValues ruleBaseValues) {
064:
065: final String sql = "update en_rule_base_val_t set RULE_BASE_VAL_ACTVN_DT = ?, RULE_BASE_VAL_DACTVN_DT = ? where rule_base_val_id = ?";
066: this .getPersistenceBrokerTemplate().execute(
067: new PersistenceBrokerCallback() {
068: public Object doInPersistenceBroker(
069: PersistenceBroker pb) {
070: PreparedStatement ps = null;
071: try {
072: ps = pb.serviceConnectionManager()
073: .getConnection().prepareStatement(
074: sql);
075: ps.setTimestamp(1, ruleBaseValues
076: .getActivationDate());
077: ps.setTimestamp(2, ruleBaseValues
078: .getDeactivationDate());
079: ps.setLong(3, ruleBaseValues
080: .getRuleBaseValuesId().longValue());
081: ps.executeUpdate();
082: } catch (Exception e) {
083: throw new WorkflowRuntimeException(
084: "error saving deactivation date", e);
085: } finally {
086: if (ps != null) {
087: try {
088: ps.close();
089: } catch (Exception e) {
090: LOG
091: .error(
092: "error closing preparedstatement",
093: e);
094: }
095: }
096: }
097: return null;
098: }
099: });
100:
101: }
102:
103: public List fetchAllCurrentRulesForTemplateDocCombination(
104: Long ruleTemplateId, List documentTypes) {
105: Criteria crit = new Criteria();
106: crit.addIn("docTypeName", documentTypes);
107: crit.addEqualTo("ruleTemplateId", ruleTemplateId);
108: crit.addEqualTo("currentInd", new Boolean(true));
109: crit.addEqualTo("activeInd", new Boolean(true));
110: crit.addEqualTo("delegateRule", new Boolean(false));
111: crit.addEqualTo("templateRuleInd", new Boolean(false));
112:
113: crit.addLessOrEqualThan("fromDate", new Timestamp(new Date()
114: .getTime()));
115: crit.addGreaterOrEqualThan("toDate", new Timestamp(new Date()
116: .getTime()));
117: return (List) this
118: .getPersistenceBrokerTemplate()
119: .getCollectionByQuery(
120: new QueryByCriteria(RuleBaseValues.class, crit));
121: }
122:
123: public List fetchAllCurrentRulesForTemplateDocCombination(
124: Long ruleTemplateId, List documentTypes,
125: Timestamp effectiveDate) {
126: Criteria crit = new Criteria();
127: crit.addIn("docTypeName", documentTypes);
128: crit.addEqualTo("ruleTemplateId", ruleTemplateId);
129: crit.addEqualTo("activeInd", new Boolean(true));
130: crit.addEqualTo("delegateRule", new Boolean(false));
131: crit.addEqualTo("templateRuleInd", new Boolean(false));
132: if (effectiveDate != null) {
133: crit.addLessOrEqualThan("activationDate", effectiveDate);
134: crit.addGreaterThan("deactivationDate", effectiveDate);
135: }
136:
137: crit.addLessOrEqualThan("fromDate", new Timestamp(new Date()
138: .getTime()));
139: crit.addGreaterOrEqualThan("toDate", new Timestamp(new Date()
140: .getTime()));
141: return (List) this
142: .getPersistenceBrokerTemplate()
143: .getCollectionByQuery(
144: new QueryByCriteria(RuleBaseValues.class, crit));
145: }
146:
147: public List fetchAllRules(boolean currentRules) {
148: Criteria crit = new Criteria();
149: crit.addEqualTo("currentInd", new Boolean(currentRules));
150: crit.addEqualTo("templateRuleInd", new Boolean(false));
151: // crit.addEqualTo("delegateRule", new Boolean(false));
152:
153: QueryByCriteria query = new QueryByCriteria(
154: RuleBaseValues.class, crit);
155: query.addOrderByDescending("activationDate");
156:
157: return (List) this .getPersistenceBrokerTemplate()
158: .getCollectionByQuery(query);
159: }
160:
161: public List findResponsibilitiesByDelegationRuleId(
162: Long delegationRuleId) {
163: Criteria crit = new Criteria();
164: crit.addEqualTo("currentInd", new Boolean(true));
165: crit.addEqualTo("templateRuleInd", new Boolean(false));
166:
167: Criteria criteriaDelegationId = new Criteria();
168: criteriaDelegationId.addEqualTo(
169: "responsibilities.delegateRuleId", delegationRuleId);
170: crit.addAndCriteria(criteriaDelegationId);
171: return (List) this
172: .getPersistenceBrokerTemplate()
173: .getCollectionByQuery(
174: new QueryByCriteria(RuleBaseValues.class, crit));
175: }
176:
177: public void delete(Long ruleBaseValuesId) {
178: this .getPersistenceBrokerTemplate().delete(
179: findRuleBaseValuesById(ruleBaseValuesId));
180: }
181:
182: public List findByRouteHeaderId(Long routeHeaderId) {
183: Criteria crit = new Criteria();
184: crit.addEqualTo("routeHeaderId", routeHeaderId);
185: return (List) this
186: .getPersistenceBrokerTemplate()
187: .getCollectionByQuery(
188: new QueryByCriteria(RuleBaseValues.class, crit));
189: }
190:
191: public RuleBaseValues findRuleBaseValuesById(Long ruleBaseValuesId) {
192: Criteria crit = new Criteria();
193: crit.addEqualTo("ruleBaseValuesId", ruleBaseValuesId);
194: // crit.addEqualTo("currentInd", new Boolean(true));
195: return (RuleBaseValues) this
196: .getPersistenceBrokerTemplate()
197: .getObjectByQuery(
198: new QueryByCriteria(RuleBaseValues.class, crit));
199: }
200:
201: public List findRuleBaseValuesByResponsibilityReviewer(
202: String reviewerName, String type) {
203: Criteria crit = new Criteria();
204: crit.addEqualTo("ruleResponsibilityName", reviewerName);
205: crit.addEqualTo("ruleResponsibilityType", type);
206:
207: List responsibilities = (List) this
208: .getPersistenceBrokerTemplate().getCollectionByQuery(
209: new QueryByCriteria(RuleResponsibility.class,
210: crit));
211: List rules = new ArrayList();
212:
213: for (Iterator iter = responsibilities.iterator(); iter
214: .hasNext();) {
215: RuleResponsibility responsibility = (RuleResponsibility) iter
216: .next();
217: RuleBaseValues rule = responsibility.getRuleBaseValues();
218: if (rule != null && rule.getCurrentInd() != null
219: && rule.getCurrentInd().booleanValue()) {
220: rules.add(rule);
221: }
222: }
223: return rules;
224: }
225:
226: public List findRuleBaseValuesByObjectGraph(
227: RuleBaseValues ruleBaseValues) {
228: ruleBaseValues.setCurrentInd(new Boolean(true));
229: ruleBaseValues.setTemplateRuleInd(Boolean.FALSE);
230: return (List) this .getPersistenceBrokerTemplate()
231: .getCollectionByQuery(
232: new QueryByCriteria(ruleBaseValues));
233: }
234:
235: public RuleResponsibility findRuleResponsibility(
236: Long responsibilityId) {
237: Criteria crit = new Criteria();
238: crit.addEqualTo("responsibilityId", responsibilityId);
239: Collection responsibilities = this
240: .getPersistenceBrokerTemplate().getCollectionByQuery(
241: new QueryByCriteria(RuleResponsibility.class,
242: crit));
243: for (Iterator iterator = responsibilities.iterator(); iterator
244: .hasNext();) {
245: RuleResponsibility responsibility = (RuleResponsibility) iterator
246: .next();
247: if (responsibility.getRuleBaseValues().getCurrentInd()
248: .booleanValue()) {
249: return responsibility;
250: }
251: }
252: return null;
253: }
254:
255: public List search(String docTypeName, Long ruleId,
256: Long ruleTemplateId, String ruleDescription,
257: Long workgroupId, String workflowId, String roleName,
258: Boolean delegateRule, Boolean activeInd, Map extensionValues) {
259: Criteria crit = getSearchCriteria(docTypeName, ruleTemplateId,
260: ruleDescription, delegateRule, activeInd,
261: extensionValues);
262: if (ruleId != null) {
263: crit.addEqualTo("ruleBaseValuesId", ruleId);
264: }
265: if (workgroupId != null) {
266: crit.addIn("responsibilities.ruleBaseValuesId",
267: getResponsibilitySubQuery(workgroupId.toString()));
268: }
269: if (!Utilities.isEmpty(workflowId)) {
270: crit.addIn("responsibilities.ruleBaseValuesId",
271: getResponsibilitySubQuery(workflowId));
272: }
273: if (!Utilities.isEmpty(roleName)) {
274: crit.addIn("responsibilities.ruleBaseValuesId",
275: getResponsibilitySubQuery(roleName));
276: }
277:
278: return (List) this .getPersistenceBrokerTemplate()
279: .getCollectionByQuery(
280: new QueryByCriteria(RuleBaseValues.class, crit,
281: true));
282: }
283:
284: public List search(String docTypeName, Long ruleTemplateId,
285: String ruleDescription, Collection<String> workgroupIds,
286: String workflowId, String roleName, Boolean delegateRule,
287: Boolean activeInd, Map extensionValues,
288: Collection actionRequestCodes) {
289: Criteria crit = getSearchCriteria(docTypeName, ruleTemplateId,
290: ruleDescription, delegateRule, activeInd,
291: extensionValues);
292: // if (!Utilities.isEmpty(roleName)) {
293: // crit.addIn("responsibilities.ruleBaseValuesId", getResponsibilitySubQuery(roleName));
294: // }
295: // if ( (actionRequestCodes != null) && (!actionRequestCodes.isEmpty()) ) {
296: // crit.addIn("responsibilities.actionRequestedCd", actionRequestCodes);
297: // }
298: // // user id -- no workgroups
299: // // user id -- workgroups
300: // // no user id -- workgroups
301: // Criteria userResponsibilityCrit = null;
302: // if ( (!Utilities.isEmpty(workflowId)) &&
303: // ( (workgroupIds != null) && (!workgroupIds.isEmpty()) ) ) {
304: // // have user id and at least one workgroup id
305: // userResponsibilityCrit = new Criteria();
306: // userResponsibilityCrit.addIn("responsibilities.ruleBaseValuesId", getResponsibilitySubQuery(workflowId));
307: // Criteria workgroupCrit = this.getWorkgroupOrCriteria(workgroupIds);
308: // userResponsibilityCrit.addOrCriteria(workgroupCrit);
309: // } else if ( (!Utilities.isEmpty(workflowId)) &&
310: // ( (workgroupIds == null) || (workgroupIds.isEmpty()) ) ) {
311: // // have user id and no workgroup ids
312: // userResponsibilityCrit = new Criteria();
313: // userResponsibilityCrit.addIn("responsibilities.ruleBaseValuesId", getResponsibilitySubQuery(workflowId));
314: // } else if ( (Utilities.isEmpty(workflowId)) &&
315: // ( (workgroupIds != null) && (!workgroupIds.isEmpty()) ) ) {
316: // // have no user id and at least one workgroup id
317: // userResponsibilityCrit = this.getWorkgroupOrCriteria(workgroupIds);
318: // }
319: // if (userResponsibilityCrit != null) {
320: // crit.addAndCriteria(userResponsibilityCrit);
321: // }
322: crit.addIn("responsibilities.ruleBaseValuesId",
323: getResponsibilitySubQuery(workgroupIds, workflowId,
324: roleName, actionRequestCodes));
325:
326: return (List) this .getPersistenceBrokerTemplate()
327: .getCollectionByQuery(
328: new QueryByCriteria(RuleBaseValues.class, crit,
329: true));
330: }
331:
332: private ReportQueryByCriteria getResponsibilitySubQuery(
333: Collection<String> workgroupIds, String workflowId,
334: String roleName, Collection actionRequestCodes) {
335: Criteria responsibilityCrit = new Criteria();
336: if ((actionRequestCodes != null)
337: && (!actionRequestCodes.isEmpty())) {
338: responsibilityCrit.addIn("actionRequestedCd",
339: actionRequestCodes);
340: }
341:
342: Criteria ruleResponsibilityNameCrit = null;
343: if (!Utilities.isEmpty(roleName)) {
344: // role name exists... nothing else matters
345: ruleResponsibilityNameCrit = new Criteria();
346: ruleResponsibilityNameCrit.addLike(
347: "ruleResponsibilityName", workflowId);
348: ruleResponsibilityNameCrit.addEqualTo(
349: "ruleResponsibilityType",
350: EdenConstants.RULE_RESPONSIBILITY_ROLE_ID);
351: } else {
352: if (!Utilities.isEmpty(workflowId)) {
353: // workflow user id exists
354: ruleResponsibilityNameCrit = new Criteria();
355: ruleResponsibilityNameCrit.addLike(
356: "ruleResponsibilityName", workflowId);
357: ruleResponsibilityNameCrit.addEqualTo(
358: "ruleResponsibilityType",
359: EdenConstants.RULE_RESPONSIBILITY_WORKFLOW_ID);
360: if ((workgroupIds != null) && (!workgroupIds.isEmpty())) {
361: // at least one workgroup id exists
362: Criteria workgroupCrit = new Criteria();
363: workgroupCrit.addIn("ruleResponsibilityName",
364: workgroupIds);
365: workgroupCrit
366: .addEqualTo(
367: "ruleResponsibilityType",
368: EdenConstants.RULE_RESPONSIBILITY_WORKGROUP_ID);
369: ruleResponsibilityNameCrit
370: .addOrCriteria(workgroupCrit);
371: }
372: } else if ((workgroupIds != null)
373: && (workgroupIds.size() == 1)) {
374: // no user and one workgroup id
375: ruleResponsibilityNameCrit = new Criteria();
376: ruleResponsibilityNameCrit.addLike(
377: "ruleResponsibilityName", workgroupIds
378: .iterator().next());
379: ruleResponsibilityNameCrit.addEqualTo(
380: "ruleResponsibilityType",
381: EdenConstants.RULE_RESPONSIBILITY_WORKGROUP_ID);
382: } else if ((workgroupIds != null)
383: && (workgroupIds.size() > 1)) {
384: // no user and more than one workgroup id
385: ruleResponsibilityNameCrit = new Criteria();
386: ruleResponsibilityNameCrit.addIn(
387: "ruleResponsibilityName", workgroupIds);
388: ruleResponsibilityNameCrit.addEqualTo(
389: "ruleResponsibilityType",
390: EdenConstants.RULE_RESPONSIBILITY_WORKGROUP_ID);
391: }
392: }
393: if (ruleResponsibilityNameCrit != null) {
394: responsibilityCrit
395: .addAndCriteria(ruleResponsibilityNameCrit);
396: }
397:
398: ReportQueryByCriteria query = QueryFactory.newReportQuery(
399: RuleResponsibility.class, responsibilityCrit);
400: query.setAttributes(new String[] { "ruleBaseValuesId" });
401: return query;
402: }
403:
404: private Criteria getSearchCriteria(String docTypeName,
405: Long ruleTemplateId, String ruleDescription,
406: Boolean delegateRule, Boolean activeInd, Map extensionValues) {
407: Criteria crit = new Criteria();
408: crit.addEqualTo("currentInd", new Boolean(true));
409: crit.addEqualTo("templateRuleInd", new Boolean(false));
410: if (activeInd != null) {
411: crit.addEqualTo("activeInd", activeInd);
412: }
413: if (docTypeName != null) {
414: crit.addLike("UPPER(docTypeName)", docTypeName
415: .toUpperCase());
416: }
417: if (ruleDescription != null
418: && !ruleDescription.trim().equals("")) {
419: crit.addLike("UPPER(description)", ruleDescription
420: .toUpperCase());
421: }
422: if (ruleTemplateId != null) {
423: crit.addEqualTo("ruleTemplateId", ruleTemplateId);
424: }
425: if (delegateRule != null) {
426: crit.addEqualTo("delegateRule", delegateRule);
427: }
428: if (extensionValues != null && !extensionValues.isEmpty()) {
429: for (Iterator iter2 = extensionValues.entrySet().iterator(); iter2
430: .hasNext();) {
431: Map.Entry entry = (Map.Entry) iter2.next();
432: if (!Utilities.isEmpty((String) entry.getValue())) {
433: // Criteria extensionCrit = new Criteria();
434: // extensionCrit.addEqualTo("extensionValues.key",
435: // entry.getKey());
436: // extensionCrit.addLike("extensionValues.value",
437: // "%"+(String) entry.getValue()+"%");
438:
439: Criteria extensionCrit2 = new Criteria();
440: extensionCrit2.addEqualTo("extensionValues.key",
441: entry.getKey());
442: extensionCrit2.addLike(
443: "UPPER(extensionValues.value)", ("%"
444: + (String) entry.getValue() + "%")
445: .toUpperCase());
446:
447: // Criteria extensionCrit3 = new Criteria();
448: // extensionCrit3.addEqualTo("extensionValues.key",
449: // entry.getKey());
450: // extensionCrit3.addLike("extensionValues.value",
451: // ("%"+(String) entry.getValue()+"%").toLowerCase());
452:
453: // extensionCrit.addOrCriteria(extensionCrit2);
454: // extensionCrit.addOrCriteria(extensionCrit3);
455: ReportQueryByCriteria query = QueryFactory
456: .newReportQuery(RuleExtension.class,
457: extensionCrit2);
458: query
459: .setAttributes(new String[] { "ruleBaseValuesId" });
460: crit
461: .addIn("ruleExtensions.ruleBaseValuesId",
462: query);
463: }
464: }
465: }
466: return crit;
467: }
468:
469: private Criteria getWorkgroupOrCriteria(Collection workgroupIds) {
470: Criteria responsibilityCrit = new Criteria();
471: for (Iterator iter = workgroupIds.iterator(); iter.hasNext();) {
472: String workgroupIdFromList = (String) iter.next();
473: Criteria orCriteria = new Criteria();
474: orCriteria.addLike("ruleResponsibilityName",
475: workgroupIdFromList);
476: responsibilityCrit.addOrCriteria(orCriteria);
477: }
478: ReportQueryByCriteria query = QueryFactory.newReportQuery(
479: RuleResponsibility.class, responsibilityCrit);
480: query.setAttributes(new String[] { "ruleBaseValuesId" });
481: Criteria crit = new Criteria();
482: crit.addIn("responsibilities.ruleBaseValuesId", query);
483: return crit;
484: }
485:
486: private ReportQueryByCriteria getResponsibilitySubQuery(
487: String ruleResponsibilityName) {
488: Criteria responsibilityCrit = new Criteria();
489: responsibilityCrit.addLike("ruleResponsibilityName",
490: ruleResponsibilityName);
491: ReportQueryByCriteria query = QueryFactory.newReportQuery(
492: RuleResponsibility.class, responsibilityCrit);
493: query.setAttributes(new String[] { "ruleBaseValuesId" });
494: return query;
495: }
496:
497: public List findByPreviousVersionId(Long previousVersionId) {
498: Criteria crit = new Criteria();
499: crit.addEqualTo("previousVersionId", previousVersionId);
500: return (List) this
501: .getPersistenceBrokerTemplate()
502: .getCollectionByQuery(
503: new QueryByCriteria(RuleBaseValues.class, crit));
504: }
505:
506: public RuleBaseValues findDefaultRuleByRuleTemplateId(
507: Long ruleTemplateId) {
508: Criteria crit = new Criteria();
509: crit.addEqualTo("ruleTemplateId", ruleTemplateId);
510: crit.addEqualTo("templateRuleInd", new Boolean(true));
511: List rules = (List) this
512: .getPersistenceBrokerTemplate()
513: .getCollectionByQuery(
514: new QueryByCriteria(RuleBaseValues.class, crit));
515: if (rules != null && !rules.isEmpty()) {
516: return (RuleBaseValues) rules.get(0);
517: }
518: return null;
519: }
520:
521: public void clearCache() {
522: this .getPersistenceBroker(false).clearCache();
523: }
524:
525: public void retrieveAllReferences(RuleBaseValues rule) {
526: // getPersistenceBroker().retrieveAllReferences(rule);
527: }
528:
529: public RuleBaseValues getParentRule(Long ruleBaseValuesId) {
530: Criteria criteria = new Criteria();
531: criteria.addEqualTo("currentInd", Boolean.TRUE);
532: criteria.addEqualTo(
533: "responsibilities.delegationRules.delegateRuleId",
534: ruleBaseValuesId);
535: Collection rules = this .getPersistenceBrokerTemplate()
536: .getCollectionByQuery(
537: new QueryByCriteria(RuleBaseValues.class,
538: criteria));
539: RuleBaseValues rule = null;
540: for (Iterator iterator = rules.iterator(); iterator.hasNext();) {
541: RuleBaseValues currentRule = (RuleBaseValues) iterator
542: .next();
543: if (rule == null
544: || currentRule.getVersionNbr().intValue() > rule
545: .getVersionNbr().intValue()) {
546: rule = currentRule;
547: }
548: }
549: return rule;
550: }
551:
552: public List findOldDelegations(final RuleBaseValues oldRule,
553: final RuleBaseValues newRule) {
554: return (List) this .getPersistenceBrokerTemplate().execute(
555: new PersistenceBrokerCallback() {
556: public Object doInPersistenceBroker(
557: PersistenceBroker pb) {
558: List oldDelegations = new ArrayList();
559: PreparedStatement ps = null;
560: ResultSet rs = null;
561: try {
562: ps = pb.serviceConnectionManager()
563: .getConnection().prepareStatement(
564: OLD_DELEGATIONS_SQL);
565: ps.setLong(1, oldRule.getRuleBaseValuesId()
566: .longValue());
567: ps.setLong(2, newRule.getRuleBaseValuesId()
568: .longValue());
569: rs = ps.executeQuery();
570: while (rs.next()) {
571: oldDelegations
572: .add(findRuleBaseValuesById(new Long(
573: rs.getLong(1))));
574: }
575: } catch (Exception e) {
576: throw new WorkflowRuntimeException(
577: "error saving deactivation date", e);
578: } finally {
579: if (rs != null) {
580: try {
581: rs.close();
582: } catch (Exception e) {
583: LOG.error(
584: "error closing result set",
585: e);
586: }
587: }
588: if (ps != null) {
589: try {
590: ps.close();
591: } catch (Exception e) {
592: LOG
593: .error(
594: "error closing preparedstatement",
595: e);
596: }
597: }
598: }
599: return oldDelegations;
600: }
601: });
602: }
603:
604: }
|