Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jan Smejkal
Pa165 Secret Archive
Commits
109866ad
Commit
109866ad
authored
Mar 26, 2022
by
tbilos
Browse files
Merge branch 'main' into feat/agent
parents
426c45df
17a2a8a8
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/dao/ReportDao.java
0 → 100644
View file @
109866ad
package
cz.fi.muni.pa165.seminar4.group7.secretservice.dao
;
import
cz.fi.muni.pa165.seminar4.group7.secretservice.entity.Report
;
import
java.util.List
;
/**
* @author Jan Smejkal
*/
public
interface
ReportDao
{
void
create
(
Report
report
);
List
<
Report
>
findAll
();
Report
findById
(
long
id
);
void
remove
(
Report
report
);
}
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/dao/ReportDaoImpl.java
0 → 100644
View file @
109866ad
package
cz.fi.muni.pa165.seminar4.group7.secretservice.dao
;
import
cz.fi.muni.pa165.seminar4.group7.secretservice.entity.Report
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
/**
* @author Jan Smejkal
*/
@Repository
public
class
ReportDaoImpl
implements
ReportDao
{
@PersistenceContext
private
EntityManager
em
;
public
ReportDaoImpl
(
EntityManager
em
)
{
this
.
em
=
em
;
}
@Override
public
void
create
(
Report
report
)
{
em
.
persist
(
report
);
}
@Override
public
List
<
Report
>
findAll
()
{
return
em
.
createQuery
(
"select r from Report r"
,
Report
.
class
).
getResultList
();
}
@Override
public
Report
findById
(
long
id
)
{
return
em
.
find
(
Report
.
class
,
id
);
}
@Override
public
void
remove
(
Report
report
)
{
em
.
remove
(
report
);
}
}
\ No newline at end of file
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/entity/AgentAssignment.java
0 → 100644
View file @
109866ad
package
cz.fi.muni.pa165.seminar4.group7.secretservice.entity
;
public
class
AgentAssignment
{
}
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/entity/PerformanceEvaluation.java
0 → 100644
View file @
109866ad
package
cz.fi.muni.pa165.seminar4.group7.secretservice.entity
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.persistence.*
;
/**
* @author Jan Smejkal
*/
@Entity
public
class
PerformanceEvaluation
{
@Id
@Column
(
name
=
"id"
,
nullable
=
false
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Getter
@Setter
private
Long
id
;
@ManyToOne
@Getter
@Setter
private
Report
report
;
@Getter
@Setter
private
String
evaluation
;
//on a scale of 0 upto 100
@Getter
@Setter
private
int
rating
;
public
PerformanceEvaluation
()
{
}
public
PerformanceEvaluation
(
String
evaluation
){
this
.
evaluation
=
evaluation
;
}
}
\ No newline at end of file
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/entity/Report.java
0 → 100644
View file @
109866ad
package
cz.fi.muni.pa165.seminar4.group7.secretservice.entity
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.persistence.*
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author Jan Smejkal
*/
@Entity
public
class
Report
{
@Id
@Column
(
name
=
"id"
,
nullable
=
false
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Getter
@Setter
private
Long
id
;
@Getter
@Setter
private
String
report
;
@OneToMany
@Getter
private
List
<
PerformanceEvaluation
>
performanceEvaluations
=
new
ArrayList
();
// @ManyToOne
// @Getter
// private AgentAssignment agentAssignment;
public
Report
()
{
}
public
void
addPerformanceEvaluation
(
PerformanceEvaluation
performanceEvaluation
)
{
performanceEvaluations
.
add
(
performanceEvaluation
);
}
public
Report
(
String
report
){
this
.
report
=
report
;
}
@Override
public
int
hashCode
()
{
final
int
PRIME
=
31
;
int
result
=
1
;
result
=
PRIME
*
result
+
((
report
==
null
)
?
0
:
report
.
hashCode
());
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(
obj
==
null
)
return
false
;
if
(!(
obj
instanceof
Report
))
return
false
;
Report
other
=
(
Report
)
obj
;
if
(
id
==
null
)
{
if
(
other
.
getReport
()
!=
null
)
return
false
;
}
else
if
(!
report
.
equals
(
other
.
getReport
()))
return
false
;
return
true
;
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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