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
17e53464
Commit
17e53464
authored
Mar 26, 2022
by
tbilos
Browse files
create AgentAssignment entity
parent
c40ca594
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/entity/Agent.java
View file @
17e53464
...
...
@@ -30,6 +30,14 @@ public class Agent {
@Getter
private
List
<
CodeName
>
codeNames
;
@OneToMany
(
mappedBy
=
"agent"
)
@Getter
private
List
<
AgentAssignment
>
agentAssignments
=
new
ArrayList
<>();
public
void
addAgentAssignment
(
AgentAssignment
agentAssignment
)
{
agentAssignments
.
add
(
agentAssignment
);
}
public
void
addCodeName
(
CodeName
codeName
)
{
codeNames
.
add
(
codeName
);
}
...
...
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/entity/AgentAssignment.java
View file @
17e53464
package
cz.fi.muni.pa165.seminar4.group7.secretservice.entity
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.persistence.*
;
import
java.sql.Date
;
/**
* @author Tomáš Biloš
*/
@Entity
public
class
AgentAssignment
{
@Id
@Column
(
name
=
"id"
,
nullable
=
false
)
@Getter
@Setter
private
Long
id
;
@Getter
@Setter
private
Date
start
;
@Getter
@Setter
private
int
durationInDays
;
@OneToOne
@JoinColumn
(
name
=
"report_id"
)
@Getter
@Setter
private
Report
report
;
@ManyToOne
@JoinColumn
(
name
=
"mission_id"
,
referencedColumnName
=
"id"
)
@Getter
@Setter
private
Mission
mission
;
@ManyToOne
@Getter
@Setter
private
Agent
agent
;
public
AgentAssignment
()
{}
}
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/entity/Mission.java
View file @
17e53464
...
...
@@ -47,6 +47,10 @@ public class Mission {
@Setter
private
Country
country
;
@OneToMany
(
mappedBy
=
"mission"
)
private
List
<
AgentAssignment
>
agentAssignments
;
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
...
...
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/entity/Report.java
View file @
17e53464
...
...
@@ -4,8 +4,6 @@ import lombok.Getter;
import
lombok.Setter
;
import
javax.persistence.*
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author Jan Smejkal
...
...
@@ -23,20 +21,17 @@ public class Report {
@Setter
private
String
report
;
@OneToMany
@OneToOne
@Setter
@Getter
private
List
<
PerformanceEvaluation
>
performanceEvaluations
=
new
ArrayList
();
// @ManyToOne
// @Getter
// private AgentAssignment agentAssignment;
private
PerformanceEvaluation
performanceEvaluation
;
public
Report
()
{
}
@OneToOne
(
mappedBy
=
"report"
)
@Getter
@Setter
private
AgentAssignment
agentAssignment
;
public
void
addPerformanceEvaluation
(
PerformanceEvaluation
performanceEvaluation
)
{
performanceEvaluations
.
add
(
performanceEvaluation
);
}
public
Report
()
{}
public
Report
(
String
report
){
this
.
report
=
report
;
...
...
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