1 17 package org.alfresco.repo.rule; 18 19 import org.alfresco.repo.transaction.TransactionListener; 20 import org.alfresco.util.GUID; 21 22 27 public class RuleTransactionListener implements TransactionListener 28 { 29 32 private String id = GUID.generate(); 33 34 37 private RuntimeRuleService ruleService; 38 39 44 public RuleTransactionListener(RuntimeRuleService ruleService) 45 { 46 this.ruleService = ruleService; 47 } 48 49 52 public void flush() 53 { 54 } 55 56 59 public void beforeCommit(boolean readOnly) 60 { 61 this.ruleService.executePendingRules(); 62 } 63 64 67 public void beforeCompletion() 68 { 69 } 70 71 74 public void afterCommit() 75 { 76 } 77 78 81 public void afterRollback() 82 { 83 } 84 85 88 @Override 89 public int hashCode() 90 { 91 return this.id.hashCode(); 92 } 93 94 97 @Override 98 public boolean equals(Object obj) 99 { 100 if (this == obj) 101 { 102 return true; 103 } 104 if (obj instanceof RuleTransactionListener) 105 { 106 RuleTransactionListener that = (RuleTransactionListener) obj; 107 return (this.id.equals(that.id)); 108 } 109 else 110 { 111 return false; 112 } 113 } 114 115 } 116 | Popular Tags |