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
c6541069
Commit
c6541069
authored
Mar 27, 2022
by
tbilos
Browse files
Merge branch 'main' into fix/agent-equals
parents
232282fa
ad2b625d
Pipeline
#123033
waiting for manual action with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/cz/fi/muni/pa165/seminar4/group7/secretservice/entity/Country.java
View file @
c6541069
package
cz.fi.muni.pa165.seminar4.group7.secretservice.entity
;
package
cz.fi.muni.pa165.seminar4.group7.secretservice.entity
;
import
com.sun.istack.NotNull
;
import
com.sun.istack.NotNull
;
import
lombok.AccessLevel
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.util.
Lis
t
;
import
java.util.
HashSe
t
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Set
;
/**
/**
* @author Milan Mozolak
* @author Milan Mozolak
*/
*/
@Entity
@Entity
@Getter
@Setter
@Accessors
(
chain
=
true
)
public
class
Country
{
public
class
Country
{
@Id
@Id
@Column
(
name
=
"id"
,
nullable
=
false
)
@Column
(
name
=
"id"
,
nullable
=
false
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Getter
@Setter
private
Long
id
;
private
Long
id
;
@NotNull
@NotNull
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
code
;
private
String
code
;
@NotNull
@NotNull
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
name
;
private
String
name
;
@NotNull
@NotNull
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
demographics
;
private
String
demographics
;
@NotNull
@NotNull
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
geography
;
private
String
geography
;
@NotNull
@NotNull
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
communications
;
private
String
communications
;
@NotNull
@NotNull
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
government
;
private
String
government
;
@NotNull
@NotNull
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
economy
;
private
String
economy
;
@NotNull
@NotNull
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
@Getter
@Setter
private
String
military
;
private
String
military
;
@Getter
@Setter
(
AccessLevel
.
NONE
)
@Setter
@OneToMany
(
mappedBy
=
"country"
)
@OneToMany
(
mappedBy
=
"country"
)
private
List
<
Mission
>
missions
;
private
Set
<
Mission
>
missions
=
new
HashSet
<>();
public
void
addMission
(
Mission
mission
)
{
missions
.
add
(
mission
);
mission
.
setCountry
(
this
);
}
public
void
removeMission
(
Mission
mission
)
{
missions
.
remove
(
mission
);
mission
.
setCountry
(
null
);
}
@Override
@Override
public
boolean
equals
(
Object
o
)
{
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Country
country
=
(
Country
)
o
;
Country
country
=
(
Country
)
o
;
return
code
.
equals
(
country
.
code
);
return
id
.
equals
(
country
.
id
)
&&
code
.
equals
(
country
.
code
);
}
}
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
Objects
.
hash
(
id
,
code
);
return
Objects
.
hash
(
code
);
}
}
}
}
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