Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PA165 - Airport - project
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ján Macháček
PA165 - Airport - project
Commits
9c2b58c8
There was an error fetching the commit references. Please try again later.
Verified
Commit
9c2b58c8
authored
1 year ago
by
Adam Krídl
Browse files
Options
Downloads
Patches
Plain Diff
Add entity Airport
parent
a10b8b59
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/java/cz/muni/fi/pa165/core/data/domain/Airport.java
+67
-0
67 additions, 0 deletions
.../main/java/cz/muni/fi/pa165/core/data/domain/Airport.java
with
67 additions
and
0 deletions
core/src/main/java/cz/muni/fi/pa165/core/data/domain/Airport.java
0 → 100644
+
67
−
0
View file @
9c2b58c8
package
cz.muni.fi.pa165.core.data.domain
;
import
cz.muni.fi.pa165.core.data.domain.common.DomainEntity
;
import
jakarta.persistence.Column
;
import
jakarta.persistence.Entity
;
import
jakarta.persistence.FetchType
;
import
jakarta.persistence.JoinColumn
;
import
jakarta.persistence.ManyToOne
;
import
jakarta.persistence.Table
;
import
jakarta.persistence.Transient
;
import
jakarta.validation.constraints.Size
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NonNull
;
import
java.util.Objects
;
@Entity
@Table
(
name
=
"airports"
)
@Data
@NoArgsConstructor
public
class
Airport
extends
DomainEntity
{
@Column
(
nullable
=
false
,
unique
=
true
)
private
@NonNull
String
name
;
@Column
(
nullable
=
false
,
unique
=
true
)
@Size
(
min
=
3
,
max
=
3
)
private
@NonNull
String
code
;
@ManyToOne
(
fetch
=
FetchType
.
LAZY
)
@JoinColumn
(
name
=
"city_id"
)
private
City
city
;
private
@Transient
GpsLocation
gpsLocation
;
// TODO: arrivingFlights -- Flight - Airport relationship, add to toString()
// TODO: departingFlights -- Flight - Airport relationship, add to toString()
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(!(
o
instanceof
Airport
airport
))
{
return
false
;
}
return
getName
().
equals
(
airport
.
getName
())
&&
getCode
().
equals
(
airport
.
getCode
());
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
getName
(),
getCode
());
}
@Override
public
String
toString
()
{
return
"Airport{"
+
"name='"
+
name
+
'\''
+
", code='"
+
code
+
'\''
+
", city="
+
city
.
getName
()
+
", gpsLocation="
+
gpsLocation
+
'}'
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment