Commit fffba4d10f8d71efd35b3358562a8e676de237bc

Authored by Cleverson Sacramento
1 parent a6fdf536
Exists in master

Tornando o TransactionInfo uma classe interna

impl/core/src/main/java/br/gov/frameworkdemoiselle/transaction/TransactionInfo.java
... ... @@ -1,44 +0,0 @@
1   -package br.gov.frameworkdemoiselle.transaction;
2   -
3   -import java.io.Serializable;
4   -
5   -import javax.enterprise.context.RequestScoped;
6   -
7   -@RequestScoped
8   -public class TransactionInfo implements Serializable {
9   -
10   - private static final long serialVersionUID = 1L;
11   -
12   - private int counter = 0;
13   -
14   - private boolean owner;
15   -
16   - public TransactionInfo() {
17   - clear();
18   - }
19   -
20   - public void clear() {
21   - this.owner = false;
22   - this.counter = 0;
23   - }
24   -
25   - public int getCounter() {
26   - return counter;
27   - }
28   -
29   - public void incrementCounter() {
30   - this.counter++;
31   - }
32   -
33   - public void decrementCounter() {
34   - this.counter--;
35   - }
36   -
37   - public void markAsOwner() {
38   - this.owner = true;
39   - }
40   -
41   - public boolean isOwner() {
42   - return owner;
43   - }
44   -}
impl/core/src/main/java/br/gov/frameworkdemoiselle/transaction/TransactionalInterceptor.java
... ... @@ -39,6 +39,7 @@ package br.gov.frameworkdemoiselle.transaction;
39 39 import java.io.Serializable;
40 40  
41 41 import javax.enterprise.context.ContextNotActiveException;
  42 +import javax.enterprise.context.RequestScoped;
42 43 import javax.enterprise.inject.Any;
43 44 import javax.interceptor.AroundInvoke;
44 45 import javax.interceptor.Interceptor;
... ... @@ -188,6 +189,45 @@ public class TransactionalInterceptor implements Serializable {
188 189 return logger;
189 190 }
190 191  
  192 + @RequestScoped
  193 + static class TransactionInfo implements Serializable {
  194 +
  195 + private static final long serialVersionUID = 1L;
  196 +
  197 + private int counter = 0;
  198 +
  199 + private boolean owner;
  200 +
  201 + public TransactionInfo() {
  202 + clear();
  203 + }
  204 +
  205 + public void clear() {
  206 + this.owner = false;
  207 + this.counter = 0;
  208 + }
  209 +
  210 + public int getCounter() {
  211 + return counter;
  212 + }
  213 +
  214 + public void incrementCounter() {
  215 + this.counter++;
  216 + }
  217 +
  218 + public void decrementCounter() {
  219 + this.counter--;
  220 + }
  221 +
  222 + public void markAsOwner() {
  223 + this.owner = true;
  224 + }
  225 +
  226 + public boolean isOwner() {
  227 + return owner;
  228 + }
  229 + }
  230 +
191 231 @Any
192 232 static class VoidTransactionInfo extends TransactionInfo {
193 233  
... ...