1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.store.legacy.store.internal; |
21 |
|
|
22 |
|
import com.xpn.xwiki.store.XWikiHibernateBaseStore; |
23 |
|
import com.xpn.xwiki.XWikiContext; |
24 |
|
import com.xpn.xwiki.XWikiException; |
25 |
|
import org.xwiki.store.RootTransactionRunnable; |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 58.8% |
Uncovered Elements: 7 (17) |
Complexity: 7 |
Complexity Density: 0.88 |
|
35 |
|
public class XWikiHibernateTransaction extends RootTransactionRunnable implements HibernateTransaction |
36 |
|
{ |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
private final XWikiHibernateBaseStore store; |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
private final XWikiContext context; |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
private boolean shouldCloseTransaction; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
@param |
58 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
59 |
5 |
public XWikiHibernateTransaction(final XWikiContext context)... |
60 |
|
{ |
61 |
5 |
this.store = context.getWiki().getHibernateStore(); |
62 |
5 |
this.context = context; |
63 |
|
} |
64 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
5 |
@Override... |
66 |
|
public void onPreRun() throws XWikiException |
67 |
|
{ |
68 |
5 |
this.store.checkHibernate(this.context); |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
@inheritDoc |
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
78 |
5 |
@Override... |
79 |
|
public void onRun() throws XWikiException |
80 |
|
{ |
81 |
5 |
this.shouldCloseTransaction = this.store.beginTransaction(this.context); |
82 |
|
} |
83 |
|
|
|
|
| 50% |
Uncovered Elements: 2 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
84 |
5 |
@Override... |
85 |
|
public void onCommit() |
86 |
|
{ |
87 |
5 |
if (this.shouldCloseTransaction) { |
88 |
0 |
this.store.endTransaction(this.context, true); |
89 |
|
} |
90 |
|
} |
91 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
92 |
0 |
@Override... |
93 |
|
public void onRollback() |
94 |
|
{ |
95 |
0 |
if (this.shouldCloseTransaction) { |
96 |
0 |
this.store.endTransaction(this.context, false); |
97 |
|
} |
98 |
|
} |
99 |
|
} |