ailton 8 years ago
parent
commit
f0ff30c159

+ 31 - 36
.classpath

@@ -1,36 +1,31 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<classpath>
3
-	<classpathentry kind="src" output="target/classes" path="src/main/java">
4
-		<attributes>
5
-			<attribute name="optional" value="true"/>
6
-			<attribute name="maven.pomderived" value="true"/>
7
-		</attributes>
8
-	</classpathentry>
9
-	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10
-		<attributes>
11
-			<attribute name="maven.pomderived" value="true"/>
12
-		</attributes>
13
-	</classpathentry>
14
-	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15
-		<attributes>
16
-			<attribute name="optional" value="true"/>
17
-			<attribute name="maven.pomderived" value="true"/>
18
-		</attributes>
19
-	</classpathentry>
20
-	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
21
-		<attributes>
22
-			<attribute name="maven.pomderived" value="true"/>
23
-		</attributes>
24
-	</classpathentry>
25
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
26
-		<attributes>
27
-			<attribute name="maven.pomderived" value="true"/>
28
-		</attributes>
29
-	</classpathentry>
30
-	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
31
-		<attributes>
32
-			<attribute name="maven.pomderived" value="true"/>
33
-		</attributes>
34
-	</classpathentry>
35
-	<classpathentry kind="output" path="target/classes"/>
36
-</classpath>
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<classpath>
3
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
4
+		<attributes>
5
+			<attribute name="optional" value="true"/>
6
+			<attribute name="maven.pomderived" value="true"/>
7
+		</attributes>
8
+	</classpathentry>
9
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10
+		<attributes>
11
+			<attribute name="maven.pomderived" value="true"/>
12
+		</attributes>
13
+	</classpathentry>
14
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15
+		<attributes>
16
+			<attribute name="optional" value="true"/>
17
+			<attribute name="maven.pomderived" value="true"/>
18
+		</attributes>
19
+	</classpathentry>
20
+	<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-8-oracle">
21
+		<attributes>
22
+			<attribute name="maven.pomderived" value="true"/>
23
+		</attributes>
24
+	</classpathentry>
25
+	<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
26
+		<attributes>
27
+			<attribute name="maven.pomderived" value="true"/>
28
+		</attributes>
29
+	</classpathentry>
30
+	<classpathentry kind="output" path="target/classes"/>
31
+</classpath>

+ 2 - 2
src/main/java/org/develop/officialjournal/controllers/JudgeController.java

@@ -6,8 +6,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
6 6
 import org.springframework.web.bind.annotation.RequestParam;
7 7
 import org.springframework.web.bind.annotation.RestController;
8 8
 
9
-import dao.DAOJudge;
10
-import entity.Judge;
9
+import dao.entity.Judge;
10
+import dao.lucene.tables.DAOJudge;
11 11
 
12 12
 @RestController
13 13
 public class JudgeController {

+ 2 - 2
src/main/java/org/develop/officialjournal/controllers/LawyerController.java

@@ -6,8 +6,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
6 6
 import org.springframework.web.bind.annotation.RequestParam;
7 7
 import org.springframework.web.bind.annotation.RestController;
8 8
 
9
-import dao.DAOLawyer;
10
-import entity.Lawyer;
9
+import dao.entity.Lawyer;
10
+import dao.lucene.tables.DAOLawyer;
11 11
 
12 12
 @RestController
13 13
 public class LawyerController {

+ 4 - 4
src/main/java/org/develop/officialjournal/controllers/ProcessController.java

@@ -9,10 +9,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
9 9
 import org.springframework.web.bind.annotation.RequestParam;
10 10
 import org.springframework.web.bind.annotation.RestController;
11 11
 
12
-import dao.DAOProcess;
13
-import dao.DAOSearch;
14
-import entity.DOProcess;
15
-import entity.Entity;
12
+
13
+import dao.entity.DOProcess;
14
+import dao.entity.Entity;
15
+import dao.lucene.tables.DAOProcess;
16 16
 
17 17
 @RestController
18 18
 public class ProcessController {

+ 8 - 8
src/main/java/org/develop/officialjournal/controllers/SearchController.java

@@ -7,14 +7,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
7 7
 import org.springframework.web.bind.annotation.RequestParam;
8 8
 import org.springframework.web.bind.annotation.RestController;
9 9
 
10
-import dao.DAOEntity;
11
-import dao.DAOJudge;
12
-import dao.DAOLawyer;
13
-import dao.DAOSearch;
14
-import entity.Entity;
15
-import entity.Info;
16
-import entity.Judge;
17
-import entity.Lawyer;
10
+
11
+import dao.entity.Entity;
12
+import dao.entity.Info;
13
+import dao.entity.Judge;
14
+import dao.entity.Lawyer;
15
+import dao.lucene.tables.DAOEntity;
16
+import dao.lucene.tables.DAOJudge;
17
+import dao.lucene.tables.DAOLawyer;
18 18
 
19 19
 @RestController
20 20
 public class SearchController {

+ 27 - 81
src/main/java/org/develop/officialjournal/services/Database.java

@@ -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
 }