Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Handle that POS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
samulu
Handle that POS
Merge requests
!41
Product.java perustestit ja virheilmoitukset
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Product.java perustestit ja virheilmoitukset
Lbranch
into
master
Overview
0
Commits
1
Pipelines
0
Changes
2
Merged
lassipii
requested to merge
Lbranch
into
master
3 years ago
Overview
0
Commits
1
Pipelines
0
Changes
2
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
6249db5a
1 commit,
3 years ago
2 files
+
46
−
19
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
src/main/java/model/classes/Product.java
+
33
−
19
Options
@@ -4,22 +4,22 @@ import javax.persistence.*;
@Entity
@Table
(
name
=
"Tuote"
)
public
class
Product
{
public
class
Product
{
@Id
@Column
(
name
=
"ID"
,
updatable
=
false
,
nullable
=
false
)
private
int
id
;
@Column
(
name
=
"Nimi"
)
private
String
name
;
@Column
(
name
=
"Kuvaus"
)
@Column
(
name
=
"Nimi"
)
private
String
name
;
@Column
(
name
=
"Kuvaus"
)
private
String
description
;
@Column
(
name
=
"Hinta"
)
@Column
(
name
=
"Hinta"
)
private
int
price
;
@Column
(
name
=
"Varastomäärä"
)
@Column
(
name
=
"Varastomäärä"
)
private
int
stock
;
public
Product
(){
public
Product
()
{
}
@@ -31,39 +31,49 @@ public class Product{
this
.
stock
=
stock
;
}
public
int
getId
()
{
return
id
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDescription
()
{
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
int
getPrice
()
{
public
int
getPrice
()
{
return
price
;
}
public
void
setPrice
(
int
price
)
{
public
void
setPrice
(
int
price
)
{
if
(
price
<
0
){
throw
new
RuntimeException
(
"Negative price for a product is not accepted"
);
}
this
.
price
=
price
;
}
public
int
getStock
()
{
public
int
getStock
()
{
return
stock
;
}
public
void
setStock
(
int
stock
)
{
public
void
setStock
(
int
stock
)
{
if
(
stock
<
0
){
throw
new
RuntimeException
(
"Negative stock for a product is not accepted"
);
}
this
.
stock
=
stock
;
}
@@ -74,8 +84,12 @@ public class Product{
@Override
public
boolean
equals
(
Object
o
)
{
if
(
o
==
null
)
{
return
false
;
}
if
(
o
.
getClass
()
!=
this
.
getClass
())
{
return
false
;
}
if
(
o
==
null
)
{
return
false
;
}
if
(
o
.
getClass
()
!=
this
.
getClass
())
{
return
false
;
}
final
Product
product
=
(
Product
)
o
;
Loading