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
223edfcc
Commit
223edfcc
authored
Mar 25, 2022
by
Milan Mozolák
Browse files
Added Country entity + Country DAO
parent
22883c39
Pipeline
#122352
waiting for manual action with stage
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/dao/CountryDao.java
0 → 100644
View file @
223edfcc
package
cz.fi.muni.pa165.seminar4.group7.secretservice.dao
;
import
cz.fi.muni.pa165.seminar4.group7.secretservice.entity.Country
;
import
org.springframework.data.repository.CrudRepository
;
public
interface
CountryDao
extends
CrudRepository
<
Country
,
Long
>
{
}
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/entity/Country.java
0 → 100644
View file @
223edfcc
package
cz.fi.muni.pa165.seminar4.group7.secretservice.entity
;
import
com.sun.istack.NotNull
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.persistence.*
;
import
java.util.List
;
import
java.util.Objects
;
/**
* @author Milan Mozolak
*/
@Entity
public
class
Country
{
@Id
@Column
(
name
=
"id"
,
nullable
=
false
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Getter
@Setter
private
Long
id
;
@NotNull
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
code
;
@NotNull
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
name
;
@NotNull
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
demographics
;
@NotNull
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
geography
;
@NotNull
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
communications
;
@NotNull
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
government
;
@NotNull
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
economy
;
@NotNull
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
military
;
@Getter
@Setter
@OneToMany
(
mappedBy
=
"country"
)
private
List
<
Mission
>
missions
;
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Country
country
=
(
Country
)
o
;
return
id
.
equals
(
country
.
id
)
&&
code
.
equals
(
country
.
code
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
id
,
code
);
}
}
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/entity/Mission.java
View file @
223edfcc
...
...
@@ -41,9 +41,11 @@ public class Mission {
@OneToMany
(
mappedBy
=
"mission"
)
private
List
<
Resource
>
resources
;
// TODO
// @ManyToOne ?
// private Country country;
@ManyToOne
@JoinColumn
(
name
=
"country_id"
)
@Getter
@Setter
private
Country
country
;
@Override
public
boolean
equals
(
Object
o
)
{
...
...
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