1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.index.tree.internal.nestedpages.query; |
21 |
|
|
22 |
|
import java.util.Collections; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import javax.inject.Inject; |
26 |
|
import javax.inject.Named; |
27 |
|
import javax.inject.Singleton; |
28 |
|
|
29 |
|
import org.xwiki.component.annotation.Component; |
30 |
|
import org.xwiki.observation.EventListener; |
31 |
|
import org.xwiki.observation.event.ApplicationStartedEvent; |
32 |
|
import org.xwiki.observation.event.Event; |
33 |
|
|
34 |
|
import com.xpn.xwiki.store.hibernate.HibernateSessionFactory; |
35 |
|
import com.xpn.xwiki.util.Util; |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
@version |
41 |
|
@since |
42 |
|
@since |
43 |
|
|
44 |
|
@Component |
45 |
|
@Named("queryRegistrationHandler/nestedPages") |
46 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 4 |
Complexity Density: 1 |
|
47 |
|
public class QueryRegistrationHandler implements EventListener |
48 |
|
{ |
49 |
|
@Inject |
50 |
|
private HibernateSessionFactory sessionFactory; |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
32 |
@Override... |
53 |
|
public List<Event> getEvents() |
54 |
|
{ |
55 |
32 |
return Collections.<Event>singletonList(new ApplicationStartedEvent()); |
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
58 |
64 |
@Override... |
59 |
|
public String getName() |
60 |
|
{ |
61 |
64 |
return "queryRegistrationHandler/nestedPages"; |
62 |
|
} |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
64 |
16 |
@Override... |
65 |
|
public void onEvent(Event event, Object source, Object data) |
66 |
|
{ |
67 |
16 |
loadMappingFile("org/xwiki/index/tree/internal/nestedpages/query/queries.hbm.xml"); |
68 |
|
} |
69 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
70 |
32 |
protected void loadMappingFile(String path)... |
71 |
|
{ |
72 |
|
|
73 |
32 |
this.sessionFactory.getConfiguration().addInputStream(Util.getResourceAsStream(path)); |
74 |
|
} |
75 |
|
} |