|
@@ -2,122 +2,68 @@ package org.develop.officialjournal.services;
|
2
|
2
|
|
3
|
3
|
import java.sql.Connection;
|
4
|
4
|
|
5
|
|
-import connector.Connector;
|
6
|
|
-import dao.DAOEntity;
|
7
|
|
-import dao.DAOJudge;
|
8
|
|
-import dao.DAOLawyer;
|
9
|
|
-import dao.DAOProcess;
|
10
|
|
-import dao.DAOSearch;
|
|
5
|
+import dao.connection.Connector;
|
|
6
|
+import dao.lucene.tables.DAOEntity;
|
|
7
|
+import dao.lucene.tables.DAOJudge;
|
|
8
|
+import dao.lucene.tables.DAOLawyer;
|
|
9
|
+import dao.lucene.tables.DAOProcess;
|
|
10
|
+
|
11
|
11
|
|
12
|
12
|
public class Database {
|
13
|
13
|
|
14
|
|
- private Connector connector;
|
15
|
14
|
private DAOSearch daoSearch;
|
16
|
15
|
private DAOLawyer daoLawyer;
|
17
|
16
|
private DAOEntity daoEntity;
|
18
|
17
|
private DAOJudge daoJudge;
|
19
|
18
|
private DAOProcess daoProcess;
|
|
19
|
+ private static Database database;
|
20
|
20
|
|
21
|
21
|
public Database() {
|
22
|
22
|
|
23
|
|
- this.connector = new Connector();
|
24
|
|
- Connection connection = connector.getConnection();
|
25
|
|
- this.setDaoJudge(new DAOJudge(connection));
|
26
|
|
- this.setDaoLawyer(new DAOLawyer(connection));
|
27
|
|
- this.setDaoJudge(new DAOJudge(connection));
|
28
|
|
- this.setDaoSearch(new DAOSearch(connection));
|
29
|
|
- this.setDaoEntity(new DAOEntity(connection));
|
30
|
|
-
|
31
|
|
- }
|
32
|
|
-
|
33
|
|
- private static Database database;
|
34
|
23
|
|
35
|
|
- public static Database get()
|
36
|
|
- {
|
37
|
|
- if(database == null)
|
38
|
|
- database = new Database();
|
|
24
|
+ daoEntity = DAOEntity.getInstance();
|
|
25
|
+ daoJudge = DAOJudge.getInstance();
|
|
26
|
+ daoLawyer = DAOLawyer.getInstance();
|
|
27
|
+ daoProcess = DAOProcess.getInstance();
|
|
28
|
+ daoSearch = DAOSearch.getInstance();
|
39
|
29
|
|
40
|
|
- return database;
|
41
|
30
|
|
42
|
31
|
}
|
43
|
32
|
|
44
|
|
-
|
45
|
|
-
|
46
|
|
- /**
|
47
|
|
- * @return the daoSearch
|
48
|
|
- */
|
49
|
33
|
public DAOSearch getDaoSearch() {
|
50
|
34
|
return daoSearch;
|
51
|
35
|
}
|
52
|
36
|
|
53
|
|
- /**
|
54
|
|
- * @param daoSearch the daoSearch to set
|
55
|
|
- */
|
56
|
|
- public void setDaoSearch(DAOSearch daoSearch) {
|
57
|
|
- this.daoSearch = daoSearch;
|
58
|
|
- }
|
59
|
|
-
|
60
|
|
- /**
|
61
|
|
- * @return the daoLawyer
|
62
|
|
- */
|
63
|
37
|
public DAOLawyer getDaoLawyer() {
|
64
|
38
|
return daoLawyer;
|
65
|
39
|
}
|
66
|
40
|
|
67
|
|
- /**
|
68
|
|
- * @param daoLawyer the daoLawyer to set
|
69
|
|
- */
|
70
|
|
- public void setDaoLawyer(DAOLawyer daoLawyer) {
|
71
|
|
- this.daoLawyer = daoLawyer;
|
|
41
|
+ public DAOEntity getDaoEntity() {
|
|
42
|
+ return daoEntity;
|
72
|
43
|
}
|
73
|
44
|
|
74
|
|
- /**
|
75
|
|
- * @return the daoJudge
|
76
|
|
- */
|
77
|
45
|
public DAOJudge getDaoJudge() {
|
78
|
46
|
return daoJudge;
|
79
|
47
|
}
|
80
|
48
|
|
81
|
|
- /**
|
82
|
|
- * @param daoJudge the daoJudge to set
|
83
|
|
- */
|
84
|
|
- public void setDaoJudge(DAOJudge daoJudge) {
|
85
|
|
- this.daoJudge = daoJudge;
|
86
|
|
- }
|
87
|
|
-
|
88
|
|
- /**
|
89
|
|
- * @return the daoProcess
|
90
|
|
- */
|
91
|
49
|
public DAOProcess getDaoProcess() {
|
92
|
|
- if(this.daoProcess == null)
|
93
|
|
- {
|
94
|
|
- this.daoProcess = new DAOProcess(connector.getConnection());
|
95
|
|
- }
|
96
|
50
|
return daoProcess;
|
97
|
51
|
}
|
98
|
52
|
|
99
|
|
- /**
|
100
|
|
- * @param daoProcess the daoProcess to set
|
101
|
|
- */
|
102
|
|
- public void setDaoProcess(DAOProcess daoProcess) {
|
103
|
|
- this.daoProcess = daoProcess;
|
104
|
|
- }
|
105
|
|
-
|
106
|
|
-
|
107
|
|
- /**
|
108
|
|
- * @return the daoEntity
|
109
|
|
- */
|
110
|
|
- public DAOEntity getDaoEntity() {
|
111
|
|
- return daoEntity;
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+ public static Database get()
|
|
57
|
+ {
|
|
58
|
+ if(database == null)
|
|
59
|
+ database = new Database();
|
|
60
|
+
|
|
61
|
+ return database;
|
|
62
|
+
|
112
|
63
|
}
|
|
64
|
+
|
|
65
|
+
|
113
|
66
|
|
114
|
|
-
|
115
|
|
-
|
116
|
|
- /**
|
117
|
|
- * @param daoEntity the daoEntity to set
|
118
|
|
- */
|
119
|
|
- public void setDaoEntity(DAOEntity daoEntity) {
|
120
|
|
- this.daoEntity = daoEntity;
|
121
|
|
- }
|
|
67
|
+
|
122
|
68
|
|
123
|
69
|
}
|