Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 73158b8a
authored
Oct 25, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Product descr + foodwavestuff
1 parent
788b6bdd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
28 deletions
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWave.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWaveTemplate.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Product.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWave.java
View file @
73158b8
...
...
@@ -41,6 +41,9 @@ public class FoodWave extends GenericEntity {
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
time
;
@Column
(
name
=
"max_foods"
)
private
Integer
maximumFoods
;
@Column
(
name
=
"wave_closed"
,
nullable
=
false
,
columnDefinition
=
"boolean default false"
)
private
boolean
closed
=
false
;
...
...
@@ -92,7 +95,7 @@ public class FoodWave extends GenericEntity {
public
boolean
isClosed
()
{
return
closed
;
}
public
void
setClosed
(
boolean
waveClosed
)
{
this
.
closed
=
waveClosed
;
}
...
...
@@ -112,7 +115,7 @@ public class FoodWave extends GenericEntity {
public
FoodWaveTemplate
getTemplate
()
{
return
template
;
}
public
boolean
isFull
()
{
return
false
;
}
...
...
@@ -121,30 +124,32 @@ public class FoodWave extends GenericEntity {
* Check if foodwave is orderable
*
* That means that it's not closed, full and it's in future
*
* @return
*/
public
boolean
isOrderable
()
{
if
(
isClosed
())
{
if
(
isClosed
())
{
return
false
;
}
if
(
getTime
().
before
(
Calendar
.
getInstance
()))
{
if
(
getTime
().
before
(
Calendar
.
getInstance
()))
{
return
false
;
}
if
(
isFull
())
{
if
(
isFull
())
{
return
false
;
}
return
true
;
}
}
public
Integer
getMaximumFoods
()
{
return
maximumFoods
;
}
public
void
setMaximumFoods
(
Integer
maximumFoods
)
{
this
.
maximumFoods
=
maximumFoods
;
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWaveTemplate.java
View file @
73158b8
...
...
@@ -49,6 +49,9 @@ public class FoodWaveTemplate extends GenericEntity {
@OrderBy
(
value
=
"time"
)
private
List
<
FoodWave
>
foodwaves
;
@Column
(
name
=
"max_foods"
)
private
Integer
maximumFoods
;
public
FoodWaveTemplate
()
{
}
...
...
@@ -103,26 +106,17 @@ public class FoodWaveTemplate extends GenericEntity {
public
void
setEvent
(
LanEvent
event
)
{
this
.
event
=
event
;
}
public
List
<
FoodWave
>
getOrderableFoodwaves
()
{
List
<
FoodWave
>
returnList
=
new
ArrayList
<
FoodWave
>();
for
(
FoodWave
wave
:
getFoodwaves
())
{
if
(
wave
.
isOrderable
())
{
for
(
FoodWave
wave
:
getFoodwaves
())
{
if
(
wave
.
isOrderable
())
{
returnList
.
add
(
wave
);
}
}
return
returnList
;
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Product.java
View file @
73158b8
...
...
@@ -20,6 +20,7 @@ import javax.persistence.EnumType;
import
javax.persistence.Enumerated
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinTable
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToMany
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.OneToMany
;
...
...
@@ -53,6 +54,9 @@ public class Product extends GenericEntity {
@Column
(
name
=
"product_name"
)
private
String
name
;
@Column
(
name
=
"description"
)
@Lob
private
String
description
;
@Column
(
name
=
"price"
,
nullable
=
false
,
precision
=
24
,
scale
=
4
)
private
BigDecimal
price
=
BigDecimal
.
ZERO
;
...
...
@@ -281,4 +285,12 @@ public class Product extends GenericEntity {
this
.
productLimits
=
productLimits
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment