Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
daaexample
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Miguel Reboiro Jato
daaexample
Commits
fa5608c2
Commit
fa5608c2
authored
Feb 08, 2017
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactorizes the backend
Some backend classes have been refactorized and simplified.
parent
940c14a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
8 deletions
+7
-8
DAAExampleApplication.java
src/main/java/es/uvigo/esei/daa/DAAExampleApplication.java
+4
-2
DAO.java
src/main/java/es/uvigo/esei/daa/dao/DAO.java
+1
-5
UsersDAO.java
src/main/java/es/uvigo/esei/daa/dao/UsersDAO.java
+1
-0
Person.java
src/main/java/es/uvigo/esei/daa/entities/Person.java
+1
-1
No files found.
src/main/java/es/uvigo/esei/daa/DAAExampleApplication.java
View file @
fa5608c2
...
...
@@ -24,8 +24,10 @@ import es.uvigo.esei.daa.rest.UsersResource;
public
class
DAAExampleApplication
extends
Application
{
@Override
public
Set
<
Class
<?>>
getClasses
()
{
return
Stream
.
of
(
PeopleResource
.
class
,
UsersResource
.
class
)
.
collect
(
toSet
());
return
Stream
.
of
(
PeopleResource
.
class
,
UsersResource
.
class
).
collect
(
toSet
());
}
@Override
...
...
src/main/java/es/uvigo/esei/daa/dao/DAO.java
View file @
fa5608c2
...
...
@@ -5,7 +5,6 @@ import java.sql.SQLException;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.naming.Context
;
import
javax.naming.InitialContext
;
import
javax.naming.NamingException
;
import
javax.sql.DataSource
;
...
...
@@ -27,11 +26,8 @@ public abstract class DAO {
* Constructs a new instance of {@link DAO}.
*/
public
DAO
()
{
Context
initContext
;
try
{
initContext
=
new
InitialContext
();
this
.
dataSource
=
(
DataSource
)
initContext
.
lookup
(
JNDI_NAME
);
this
.
dataSource
=
(
DataSource
)
new
InitialContext
().
lookup
(
JNDI_NAME
);
}
catch
(
NamingException
e
)
{
LOG
.
log
(
Level
.
SEVERE
,
"Error initializing DAO"
,
e
);
throw
new
RuntimeException
(
e
);
...
...
src/main/java/es/uvigo/esei/daa/dao/UsersDAO.java
View file @
fa5608c2
...
...
@@ -19,6 +19,7 @@ import es.uvigo.esei.daa.entities.User;
public
class
UsersDAO
extends
DAO
{
private
final
static
Logger
LOG
=
Logger
.
getLogger
(
UsersDAO
.
class
.
getName
());
// Yes, SALT should come from external configuration (for example, a property in Tomcat's context).
private
final
static
String
SALT
=
"daaexample-"
;
/**
...
...
src/main/java/es/uvigo/esei/daa/entities/Person.java
View file @
fa5608c2
...
...
@@ -89,7 +89,7 @@ public class Person {
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
getClass
()
!=
obj
.
getClass
(
))
if
(
!(
obj
instanceof
Person
))
return
false
;
Person
other
=
(
Person
)
obj
;
if
(
id
!=
other
.
id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment