Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
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 ea0d6513
authored
Oct 25, 2012
by
Antti Tönkyrä
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of codecrew.fi:bortal
2 parents
be6a6052
45ef301c
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 @
ea0d651
...
@@ -41,6 +41,9 @@ public class FoodWave extends GenericEntity {
...
@@ -41,6 +41,9 @@ public class FoodWave extends GenericEntity {
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
time
;
private
Calendar
time
;
@Column
(
name
=
"max_foods"
)
private
Integer
maximumFoods
;
@Column
(
name
=
"wave_closed"
,
nullable
=
false
,
columnDefinition
=
"boolean default false"
)
@Column
(
name
=
"wave_closed"
,
nullable
=
false
,
columnDefinition
=
"boolean default false"
)
private
boolean
closed
=
false
;
private
boolean
closed
=
false
;
...
@@ -92,7 +95,7 @@ public class FoodWave extends GenericEntity {
...
@@ -92,7 +95,7 @@ public class FoodWave extends GenericEntity {
public
boolean
isClosed
()
{
public
boolean
isClosed
()
{
return
closed
;
return
closed
;
}
}
public
void
setClosed
(
boolean
waveClosed
)
{
public
void
setClosed
(
boolean
waveClosed
)
{
this
.
closed
=
waveClosed
;
this
.
closed
=
waveClosed
;
}
}
...
@@ -112,7 +115,7 @@ public class FoodWave extends GenericEntity {
...
@@ -112,7 +115,7 @@ public class FoodWave extends GenericEntity {
public
FoodWaveTemplate
getTemplate
()
{
public
FoodWaveTemplate
getTemplate
()
{
return
template
;
return
template
;
}
}
public
boolean
isFull
()
{
public
boolean
isFull
()
{
return
false
;
return
false
;
}
}
...
@@ -121,30 +124,32 @@ public class FoodWave extends GenericEntity {
...
@@ -121,30 +124,32 @@ public class FoodWave extends GenericEntity {
* Check if foodwave is orderable
* Check if foodwave is orderable
*
*
* That means that it's not closed, full and it's in future
* That means that it's not closed, full and it's in future
*
* @return
* @return
*/
*/
public
boolean
isOrderable
()
{
public
boolean
isOrderable
()
{
if
(
isClosed
())
{
if
(
isClosed
())
{
return
false
;
return
false
;
}
}
if
(
getTime
().
before
(
Calendar
.
getInstance
()))
{
if
(
getTime
().
before
(
Calendar
.
getInstance
()))
{
return
false
;
return
false
;
}
}
if
(
isFull
())
{
if
(
isFull
())
{
return
false
;
return
false
;
}
}
return
true
;
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 @
ea0d651
...
@@ -49,6 +49,9 @@ public class FoodWaveTemplate extends GenericEntity {
...
@@ -49,6 +49,9 @@ public class FoodWaveTemplate extends GenericEntity {
@OrderBy
(
value
=
"time"
)
@OrderBy
(
value
=
"time"
)
private
List
<
FoodWave
>
foodwaves
;
private
List
<
FoodWave
>
foodwaves
;
@Column
(
name
=
"max_foods"
)
private
Integer
maximumFoods
;
public
FoodWaveTemplate
()
{
public
FoodWaveTemplate
()
{
}
}
...
@@ -103,26 +106,17 @@ public class FoodWaveTemplate extends GenericEntity {
...
@@ -103,26 +106,17 @@ public class FoodWaveTemplate extends GenericEntity {
public
void
setEvent
(
LanEvent
event
)
{
public
void
setEvent
(
LanEvent
event
)
{
this
.
event
=
event
;
this
.
event
=
event
;
}
}
public
List
<
FoodWave
>
getOrderableFoodwaves
()
{
public
List
<
FoodWave
>
getOrderableFoodwaves
()
{
List
<
FoodWave
>
returnList
=
new
ArrayList
<
FoodWave
>();
List
<
FoodWave
>
returnList
=
new
ArrayList
<
FoodWave
>();
for
(
FoodWave
wave
:
getFoodwaves
())
{
for
(
FoodWave
wave
:
getFoodwaves
())
{
if
(
wave
.
isOrderable
())
{
if
(
wave
.
isOrderable
())
{
returnList
.
add
(
wave
);
returnList
.
add
(
wave
);
}
}
}
}
return
returnList
;
return
returnList
;
}
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Product.java
View file @
ea0d651
...
@@ -20,6 +20,7 @@ import javax.persistence.EnumType;
...
@@ -20,6 +20,7 @@ import javax.persistence.EnumType;
import
javax.persistence.Enumerated
;
import
javax.persistence.Enumerated
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinTable
;
import
javax.persistence.JoinTable
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToMany
;
import
javax.persistence.ManyToMany
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.OneToMany
;
import
javax.persistence.OneToMany
;
...
@@ -53,6 +54,9 @@ public class Product extends GenericEntity {
...
@@ -53,6 +54,9 @@ public class Product extends GenericEntity {
@Column
(
name
=
"product_name"
)
@Column
(
name
=
"product_name"
)
private
String
name
;
private
String
name
;
@Column
(
name
=
"description"
)
@Lob
private
String
description
;
@Column
(
name
=
"price"
,
nullable
=
false
,
precision
=
24
,
scale
=
4
)
@Column
(
name
=
"price"
,
nullable
=
false
,
precision
=
24
,
scale
=
4
)
private
BigDecimal
price
=
BigDecimal
.
ZERO
;
private
BigDecimal
price
=
BigDecimal
.
ZERO
;
...
@@ -281,4 +285,12 @@ public class Product extends GenericEntity {
...
@@ -281,4 +285,12 @@ public class Product extends GenericEntity {
this
.
productLimits
=
productLimits
;
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