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 b197f1a6
authored
Oct 04, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Random stuff.
1 parent
0cbebcb7
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
203 additions
and
89 deletions
code/LanBortalAuthModuleClient/.project
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/BillBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/CheckoutFiBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceGroupBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ProductBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ProductPBean.java
code/LanBortalBeansClient/.project
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/ProductBeanLocal.java
code/LanBortalDatabase/.project
code/LanBortalDatabase/src/META-INF/MANIFEST.MF
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EntityEquals.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/GroupMembership.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/SitePage.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/SitePage_.java
code/LanBortalUtilities/.project
code/LanBortalWeb/WebContent/place/edit.xhtml
code/LanBortalWeb/WebContent/resources/cditools/products/shop.xhtml
code/LanBortalWeb/WebContent/resources/cditools/role/edit.xhtml
code/LanBortalWeb/WebContent/resources/style/insomnia2/css/tyyli.css
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/map/PlaceView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/map/TokenView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ProductShopView.java
code/lib-AuthModule-depends/.project
code/LanBortalAuthModuleClient/.project
View file @
b197f1a
...
...
@@ -16,6 +16,11 @@
</arguments>
</buildCommand>
<buildCommand>
<name>
org.jboss.tools.jst.web.kb.kbbuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.wst.validation.validationbuilder
</name>
<arguments>
</arguments>
...
...
@@ -26,5 +31,6 @@
<nature>
org.eclipse.wst.common.modulecore.ModuleCoreNature
</nature>
<nature>
org.eclipse.wst.common.project.facet.core.nature
</nature>
<nature>
org.eclipse.jdt.core.javanature
</nature>
<nature>
org.jboss.tools.jst.web.kb.kbnature
</nature>
</natures>
</projectDescription>
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/BillBean.java
View file @
b197f1a
...
...
@@ -72,6 +72,8 @@ public class BillBean implements BillBeanLocal {
private
LoggingBeanLocal
loggingBean
;
@EJB
private
EventUserFacade
eventUserFacade
;
@EJB
private
ProductPBean
productPBean
;
/**
* Default constructor.
...
...
@@ -238,7 +240,7 @@ public class BillBean implements BillBeanLocal {
placebean
.
lockPlaceProduct
(
bill
.
getUser
(),
prod
,
bl
.
getQuantity
());
}
AccountEvent
ac2
=
productBean
.
createAccountEvent
(
prod
,
bl
.
getQuantity
(),
user
,
bill
.
getSentDate
());
AccountEvent
ac2
=
product
P
Bean
.
createAccountEvent
(
prod
,
bl
.
getQuantity
(),
user
,
bill
.
getSentDate
());
logger
.
info
(
"Created ac from product. {}, userproducts {}"
,
ac2
,
user
.
getAccountEvents
().
size
());
ac2
.
setSeller
(
permbean
.
getCurrentUser
());
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/CheckoutFiBean.java
View file @
b197f1a
...
...
@@ -86,9 +86,9 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
@Override
public
boolean
isPaymentEnabled
()
{
LanEventPrivateProperty
expire
=
eventbean
.
getPrivateProperty
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_KEY_EXPIRE
);
String
merchantid
=
eventbean
.
getPrivatePropertyString
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_MERCHANT_ID
);
String
merchantPassword
=
eventbean
.
getPrivatePropertyString
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_MERCHANT_PASSWORD
);
final
LanEventPrivateProperty
expire
=
eventbean
.
getPrivateProperty
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_KEY_EXPIRE
);
final
String
merchantid
=
eventbean
.
getPrivatePropertyString
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_MERCHANT_ID
);
final
String
merchantPassword
=
eventbean
.
getPrivatePropertyString
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_MERCHANT_PASSWORD
);
return
!((
expire
!=
null
&&
new
Date
().
after
(
expire
.
getDateValue
()))
||
merchantid
==
null
||
merchantid
.
isEmpty
()
||
merchantPassword
==
null
||
merchantPassword
.
isEmpty
());
...
...
@@ -107,24 +107,25 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
@RolesAllowed
(
BillPermission
.
S_CREATE_VERKKOMAKSU
)
public
List
<
CheckoutBank
>
getToken
(
Bill
bill
)
{
LanEventPrivateProperty
expire
=
eventbean
.
getPrivateProperty
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_KEY_EXPIRE
);
String
merchantid
=
eventbean
.
getPrivatePropertyString
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_MERCHANT_ID
);
String
merchantPassword
=
eventbean
.
getPrivatePropertyString
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_MERCHANT_PASSWORD
);
final
LanEventPrivateProperty
expire
=
eventbean
.
getPrivateProperty
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_KEY_EXPIRE
);
final
String
merchantid
=
eventbean
.
getPrivatePropertyString
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_MERCHANT_ID
);
final
String
merchantPassword
=
eventbean
.
getPrivatePropertyString
(
LanEventPrivatePropertyKey
.
CHECKOUT_FI_MERCHANT_PASSWORD
);
if
((
expire
!=
null
&&
new
Date
().
after
(
expire
.
getDateValue
()))
||
merchantid
==
null
||
merchantid
.
isEmpty
()
||
merchantPassword
==
null
||
merchantPassword
.
isEmpty
())
{
return
null
;
}
String
priceInCents
=
Integer
.
valueOf
(
bill
.
totalPrice
().
multiply
(
TO_CENTS
).
intValue
()).
toString
();
Map
<
CheckoutFiParam
,
String
>
postParams
=
new
HashMap
<
CheckoutFiParam
,
String
>();
final
String
priceInCents
=
Integer
.
valueOf
(
bill
.
totalPrice
().
multiply
(
TO_CENTS
).
intValue
()).
toString
();
final
Map
<
CheckoutFiParam
,
String
>
postParams
=
new
HashMap
<
CheckoutFiParam
,
String
>();
String
returnUrl
=
new
StringBuilder
(
BortalLocalContextHolder
.
isSsl
()
?
"https://"
:
"http://"
)
final
String
returnUrl
=
new
StringBuilder
(
BortalLocalContextHolder
.
isSsl
()
?
"https://"
:
"http://"
)
.
append
(
BortalLocalContextHolder
.
getHostname
())
.
append
(
"/LanBortalWeb/checkout/"
)
.
toString
();
StringBuilder
stamp
=
new
StringBuilder
();
final
StringBuilder
stamp
=
new
StringBuilder
();
stamp
.
append
(
bill
.
getId
());
stamp
.
append
(
STAMP_SPLITCHAR
);
stamp
.
append
(
bill
.
getSentDate
().
getTimeInMillis
()
/
1000
);
...
...
@@ -167,14 +168,16 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
nameValuePairs
.
add
(
new
BasicNameValuePair
(
"MAC"
,
calculatedHash
));
HttpPost
postRequest
=
new
HttpPost
(
REMOTE_URL
);
final
HttpPost
postRequest
=
new
HttpPost
(
REMOTE_URL
);
postRequest
.
setEntity
(
new
UrlEncodedFormEntity
(
nameValuePairs
));
DefaultHttpClient
client
=
new
DefaultHttpClient
();
final
DefaultHttpClient
client
=
new
DefaultHttpClient
();
HttpResponse
response
=
client
.
execute
(
postRequest
);
StringWriter
writer
=
new
StringWriter
();
final
StringWriter
writer
=
new
StringWriter
();
IOUtils
.
copy
(
response
.
getEntity
().
getContent
(),
writer
,
"UTF8"
);
String
xmlReturn
=
writer
.
toString
();
final
String
xmlReturn
=
writer
.
toString
();
// logger.info("Got response from checkout.fi msg {}, {} ",
// response.getStatusLine().getStatusCode(), xmlReturn);
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceBean.java
View file @
b197f1a
...
...
@@ -5,6 +5,7 @@
package
fi
.
insomnia
.
bortal
.
beans
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Collection
;
import
java.util.Date
;
...
...
@@ -53,9 +54,11 @@ import fi.insomnia.bortal.model.ProductFlag;
*/
@Stateless
@LocalBean
@DeclareRoles
({
MapPermission
.
S_BUY_PLACES
,
@DeclareRoles
({
MapPermission
.
S_BUY_PLACES
,
MapPermission
.
S_MANAGE_MAPS
,
MapPermission
.
S_VIEW
,
MapPermission
.
S_MANAGE_OTHERS
,
})
public
class
PlaceBean
implements
PlaceBeanLocal
{
private
static
final
String
PLACE_RESERVE_TIMEOUTER
=
"Map reserve timeouter"
;
...
...
@@ -93,6 +96,8 @@ public class PlaceBean implements PlaceBeanLocal {
private
AccountEventBeanLocal
acbean
;
@EJB
private
PlaceGroupFacade
pgfacade
;
@EJB
private
ProductPBean
productPBean
;
@Override
@RolesAllowed
(
MapPermission
.
S_MANAGE_MAPS
)
...
...
@@ -231,12 +236,12 @@ public class PlaceBean implements PlaceBeanLocal {
// }
@Override
@RolesAllowed
(
MapPermission
.
S_BUY_PLACES
)
@RolesAllowed
(
{
MapPermission
.
S_BUY_PLACES
,
MapPermission
.
S_MANAGE_OTHERS
}
)
public
PlaceGroup
buySelectedPlaces
(
EventUser
user
)
throws
BortalCatchableException
{
if
(
user
==
null
)
{
user
=
permbean
.
getCurrentUser
();
}
else
{
if
(!
user
.
equals
(
permbean
.
getCurrentUser
()))
{
if
(!
user
.
equals
(
permbean
.
getCurrentUser
())
&&
!
permbean
.
hasPermission
(
MapPermission
.
MANAGE_OTHERS
)
)
{
loggerbean
.
logMessage
(
SecurityLogType
.
permissionDenied
,
permbean
.
getCurrentUser
(),
"Can not buy places for user "
+
user
);
throw
new
EJBAccessException
(
"Not enough permissions to buy place"
);
}
...
...
@@ -253,13 +258,13 @@ public class PlaceBean implements PlaceBeanLocal {
BigDecimal
totalprice
=
addAndCalcPrice
(
user
,
null
);
BigDecimal
balance
=
user
.
getAccountBalance
();
if
(
balance
.
compareTo
(
totalprice
)
<
0
)
{
if
(
balance
.
compareTo
(
totalprice
)
<
0
&&
!
permbean
.
hasPermission
(
MapPermission
.
MANAGE_OTHERS
)
)
{
logger
.
info
(
"User {} Could not buy things because account balance {} is too low for purchase {}"
,
new
Object
[]
{
user
,
balance
,
totalprice
});
return
null
;
}
for
(
Entry
<
Product
,
Integer
>
line
:
getPlaceProductcount
(
places
).
entrySet
())
{
product
Bean
.
createAccountEvent
(
line
.
getKey
(),
new
BigDecimal
(
line
.
getValue
()),
user
);
product
PBean
.
createAccountEvent
(
line
.
getKey
(),
new
BigDecimal
(
line
.
getValue
()),
user
,
Calendar
.
getInstance
()
);
}
PlaceGroup
pg
=
new
PlaceGroup
(
event
,
Calendar
.
getInstance
(),
Calendar
.
getInstance
(),
true
);
...
...
@@ -357,6 +362,13 @@ public class PlaceBean implements PlaceBeanLocal {
GroupMembership
membership
=
new
GroupMembership
(
pg
,
p
,
gmemfacade
.
createInviteToken
());
pg
.
getMembers
().
add
(
membership
);
p
.
setPlaceReserver
(
membership
);
if
(
pg
.
getPlaces
()
==
null
)
{
pg
.
setPlaces
(
new
ArrayList
<
Place
>());
}
if
(!
pg
.
getPlaces
().
contains
(
p
))
{
pg
.
getPlaces
().
add
(
p
);
}
return
membership
;
}
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceGroupBean.java
View file @
b197f1a
...
...
@@ -23,6 +23,7 @@ import com.pdfjet.TextLine;
import
fi.insomnia.bortal.enums.apps.MapPermission
;
import
fi.insomnia.bortal.enums.apps.SpecialPermission
;
import
fi.insomnia.bortal.facade.EventUserFacade
;
import
fi.insomnia.bortal.facade.GroupMembershipFacade
;
import
fi.insomnia.bortal.facade.PlaceGroupFacade
;
import
fi.insomnia.bortal.model.EventUser
;
...
...
@@ -53,6 +54,8 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal {
private
LoggingBeanLocal
loggerbean
;
@EJB
private
PlaceGroupFacade
pgfacade
;
@EJB
private
EventUserFacade
eventuserfacade
;
/**
* Default constructor.
...
...
@@ -102,17 +105,18 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal {
@Override
@RolesAllowed
(
MapPermission
.
S_BUY_PLACES
)
public
boolean
associateToToken
(
EventUser
user
,
String
token
)
{
user
=
eventuserfacade
.
reload
(
user
);
if
(!
permbean
.
isCurrentUser
(
user
)
&&
!
permbean
.
hasPermission
(
MapPermission
.
MANAGE_OTHERS
))
{
throw
new
EJBAccessException
();
}
token
=
token
.
trim
();
GroupMembership
mem
=
gmemfacade
.
findByToken
(
token
);
boolean
ret
=
false
;
if
(
mem
!=
null
&&
mem
.
getUser
()
==
null
)
{
mem
.
setUser
(
user
);
gmemfacade
.
merge
(
mem
);
//
gmemfacade.merge(mem);
ret
=
true
;
}
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ProductBean.java
View file @
b197f1a
...
...
@@ -2,7 +2,6 @@ package fi.insomnia.bortal.beans;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -28,7 +27,6 @@ import fi.insomnia.bortal.facade.ProductFacade;
import
fi.insomnia.bortal.facade.UserFacade
;
import
fi.insomnia.bortal.model.AccountEvent
;
import
fi.insomnia.bortal.model.Discount
;
import
fi.insomnia.bortal.model.DiscountInstance
;
import
fi.insomnia.bortal.model.EventUser
;
import
fi.insomnia.bortal.model.LanEvent
;
import
fi.insomnia.bortal.model.Product
;
...
...
@@ -78,6 +76,8 @@ public class ProductBean implements ProductBeanLocal {
private
EventBeanLocal
eventbean
;
@EJB
private
BillLineFacade
billLineFacade
;
@EJB
private
ProductPBean
productPBean
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ProductBean
.
class
);
...
...
@@ -290,36 +290,6 @@ public class ProductBean implements ProductBeanLocal {
// return ret;
// }
public
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
quantity
,
EventUser
user
,
Calendar
date
)
{
BigDecimal
unitPrice
=
product
.
getPrice
().
negate
();
List
<
Discount
>
discounts
=
product
.
getActiveDiscounts
(
quantity
,
date
);
for
(
Discount
d
:
discounts
)
{
unitPrice
=
unitPrice
.
multiply
(
d
.
getPercentage
());
}
AccountEvent
ret
=
new
AccountEvent
(
user
,
product
,
unitPrice
,
quantity
,
Calendar
.
getInstance
());
ret
.
setDelivered
(
Calendar
.
getInstance
());
ret
.
setSeller
(
permbean
.
getCurrentUser
());
List
<
DiscountInstance
>
accEventdiscounts
=
ret
.
getDiscountInstances
();
for
(
Discount
d
:
discounts
)
{
// discountsArray.add(discInst);
// discountinstancefacade.create(discInst);
accEventdiscounts
.
add
(
new
DiscountInstance
(
ret
,
d
));
}
if
(
user
.
getAccountEvents
()
==
null
)
{
user
.
setAccountEvents
(
new
ArrayList
<
AccountEvent
>());
}
user
.
getAccountEvents
().
add
(
ret
);
accounteventfacade
.
create
(
ret
);
// flush changes to db.
// userFacade.flush();
return
ret
;
}
@Override
public
Product
findById
(
int
id
)
{
Product
ret
=
productFacade
.
find
(
id
);
...
...
@@ -354,14 +324,15 @@ public class ProductBean implements ProductBeanLocal {
@Override
public
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
quantity
,
EventUser
user
)
{
return
createAccountEvent
(
product
,
quantity
,
user
,
Calendar
.
getInstance
());
user
=
eventUserFacade
.
reload
(
user
);
AccountEvent
ret
=
productPBean
.
createAccountEvent
(
product
,
quantity
,
user
,
Calendar
.
getInstance
());
return
ret
;
}
@Override
//@RolesAllowed(ShopPermission.S_LIST_ALL_PRODUCTS)
//
@RolesAllowed(ShopPermission.S_LIST_ALL_PRODUCTS)
public
Product
findByBarcode
(
String
barcode
)
{
return
productFacade
.
findProductByBarcode
(
barcode
);
}
}
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ProductPBean.java
0 → 100644
View file @
b197f1a
package
fi
.
insomnia
.
bortal
.
beans
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
fi.insomnia.bortal.facade.AccountEventFacade
;
import
fi.insomnia.bortal.model.AccountEvent
;
import
fi.insomnia.bortal.model.Discount
;
import
fi.insomnia.bortal.model.DiscountInstance
;
import
fi.insomnia.bortal.model.EventUser
;
import
fi.insomnia.bortal.model.Product
;
/**
* Session Bean implementation class ProductPBean
*/
@Stateless
@LocalBean
public
class
ProductPBean
{
@EJB
private
PermissionBean
permbean
;
private
AccountEventFacade
accounteventfacade
;
/**
* Default constructor.
*/
public
ProductPBean
()
{
// TODO Auto-generated constructor stub
}
/**
* Creates new AccountEvent from provided product to provided user <br>
* <strong>Notice</strong>, that this function expects the user parameter to
* be attached entity!
*
* @param product
* Product to create the account event from
* @param quantity
* How many products have been bought
* @param user
* user to whom the product should be created. MUST BE ATTACHED
* ENTITY!
* @param date
* AccountEvent creation time
* @return The created AccountEvent entity
*/
public
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
quantity
,
EventUser
user
,
Calendar
date
)
{
BigDecimal
unitPrice
=
product
.
getPrice
().
negate
();
List
<
Discount
>
discounts
=
product
.
getActiveDiscounts
(
quantity
,
date
);
for
(
Discount
d
:
discounts
)
{
unitPrice
=
unitPrice
.
multiply
(
d
.
getPercentage
());
}
AccountEvent
ret
=
new
AccountEvent
(
user
,
product
,
unitPrice
,
quantity
,
Calendar
.
getInstance
());
ret
.
setDelivered
(
Calendar
.
getInstance
());
ret
.
setSeller
(
permbean
.
getCurrentUser
());
List
<
DiscountInstance
>
accEventdiscounts
=
ret
.
getDiscountInstances
();
for
(
Discount
d
:
discounts
)
{
// discountsArray.add(discInst);
// discountinstancefacade.create(discInst);
accEventdiscounts
.
add
(
new
DiscountInstance
(
ret
,
d
));
}
if
(
user
.
getAccountEvents
()
==
null
)
{
user
.
setAccountEvents
(
new
ArrayList
<
AccountEvent
>());
}
user
.
getAccountEvents
().
add
(
ret
);
accounteventfacade
.
create
(
ret
);
// flush changes to db.
// userFacade.flush();
return
ret
;
}
}
code/LanBortalBeansClient/.project
View file @
b197f1a
...
...
@@ -16,6 +16,11 @@
</arguments>
</buildCommand>
<buildCommand>
<name>
org.jboss.tools.jst.web.kb.kbbuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.wst.validation.validationbuilder
</name>
<arguments>
</arguments>
...
...
@@ -26,5 +31,6 @@
<nature>
org.eclipse.wst.common.modulecore.ModuleCoreNature
</nature>
<nature>
org.eclipse.wst.common.project.facet.core.nature
</nature>
<nature>
org.eclipse.jdt.core.javanature
</nature>
<nature>
org.jboss.tools.jst.web.kb.kbnature
</nature>
</natures>
</projectDescription>
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/ProductBeanLocal.java
View file @
b197f1a
code/LanBortalDatabase/.project
View file @
b197f1a
...
...
@@ -17,7 +17,7 @@
</arguments>
</buildCommand>
<buildCommand>
<name>
org.
eclipse.wst.validation.validation
builder
</name>
<name>
org.
jboss.tools.jst.web.kb.kb
builder
</name>
<arguments>
</arguments>
</buildCommand>
...
...
@@ -36,6 +36,11 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.wst.validation.validationbuilder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.jem.workbench.JavaEMFNature
</nature>
...
...
@@ -43,5 +48,6 @@
<nature>
org.eclipse.wst.common.project.facet.core.nature
</nature>
<nature>
org.eclipse.jdt.core.javanature
</nature>
<nature>
org.axdt.as3.imp.nature
</nature>
<nature>
org.jboss.tools.jst.web.kb.kbnature
</nature>
</natures>
</projectDescription>
code/LanBortalDatabase/src/META-INF/MANIFEST.MF
View file @
b197f1a
Manifest-Version: 1.0
Class-Path: lib/LanBortalUtilities.jar
bcprov-jdk16-146.jar
Class-Path: bcprov-jdk16-146.jar
bcmail-jdk16-146.jar
LanBortalUtilities.jar
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EntityEquals.java
View file @
b197f1a
...
...
@@ -26,7 +26,9 @@ public abstract class EntityEquals {
@Override
public
boolean
equals
(
Object
o
)
{
boolean
ret
=
false
;
if
(
o
!=
null
&&
o
instanceof
EntityEquals
&&
this
.
getClass
().
getCanonicalName
().
equals
(
o
.
getClass
().
getCanonicalName
()))
{
if
(
this
==
o
)
{
ret
=
true
;
}
else
if
(
o
!=
null
&&
o
instanceof
EntityEquals
&&
this
.
getClass
().
getCanonicalName
().
equals
(
o
.
getClass
().
getCanonicalName
()))
{
EntityEquals
oobj
=
(
EntityEquals
)
o
;
if
(
getId
()
==
null
)
{
ret
=
(
getRndid
().
equals
(
oobj
.
rndid
));
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/GroupMembership.java
View file @
b197f1a
...
...
@@ -16,7 +16,6 @@ import javax.persistence.OneToOne;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
javax.persistence.UniqueConstraint
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
...
...
@@ -25,7 +24,9 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
*
*/
@Entity
@Table
(
name
=
"group_memberships"
,
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
GroupMembership
.
EVENTUSER_ID
,
GroupMembership
.
GROUP_ID
})
})
@Table
(
name
=
"group_memberships"
)
// , uniqueConstraints = { @UniqueConstraint(columnNames = {
// GroupMembership.EVENTUSER_ID, GroupMembership.GROUP_ID }) })
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
GroupMembership
extends
GenericEntity
{
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/SitePage.java
View file @
b197f1a
...
...
@@ -17,7 +17,7 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
import
org.eclipse.persistence.annotations.PrivateOwned
;
@Entity
@Table
(
name
=
"site_pages"
,
uniqueConstraints
=
@UniqueConstraint
(
columnNames
=
{
"event_id"
,
"name"
}))
@Table
(
name
=
"site_pages"
,
uniqueConstraints
=
@UniqueConstraint
(
columnNames
=
{
SitePage
.
EVENT_ID_COLUMN
,
"name"
}))
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
SitePage
extends
GenericEntity
{
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/SitePage_.java
View file @
b197f1a
...
...
@@ -5,7 +5,7 @@ import javax.persistence.metamodel.ListAttribute;
import
javax.persistence.metamodel.SingularAttribute
;
import
javax.persistence.metamodel.StaticMetamodel
;
@Generated
(
value
=
"Dali"
,
date
=
"2012-
05-12T14:43:39.125
+0300"
)
@Generated
(
value
=
"Dali"
,
date
=
"2012-
10-04T21:02:39.749
+0300"
)
@StaticMetamodel
(
SitePage
.
class
)
public
class
SitePage_
extends
GenericEntity_
{
public
static
volatile
SingularAttribute
<
SitePage
,
LanEvent
>
event
;
...
...
code/LanBortalUtilities/.project
View file @
b197f1a
...
...
@@ -16,7 +16,7 @@
</arguments>
</buildCommand>
<buildCommand>
<name>
org.
eclipse.wst.validation.validation
builder
</name>
<name>
org.
jboss.tools.jst.web.kb.kb
builder
</name>
<arguments>
</arguments>
</buildCommand>
...
...
@@ -25,6 +25,11 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.wst.validation.validationbuilder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.jem.workbench.JavaEMFNature
</nature>
...
...
@@ -32,5 +37,6 @@
<nature>
org.eclipse.wst.common.project.facet.core.nature
</nature>
<nature>
org.eclipse.jdt.core.javanature
</nature>
<nature>
org.axdt.as3.imp.nature
</nature>
<nature>
org.jboss.tools.jst.web.kb.kbnature
</nature>
</natures>
</projectDescription>
code/LanBortalWeb/WebContent/place/edit.xhtml
View file @
b197f1a
...
...
@@ -126,7 +126,7 @@
<h:inputTextarea
value=
"#{placeView.place.group.details}"
/>
<h:outputLabel
value=
"#{i18n['placegroup.creator']}"
/>
<h:link
outcome=
"/user/edit"
value=
"#{placeView.place.group.creator.wholeName}"
>
<h:link
outcome=
"/user
admin
/edit"
value=
"#{placeView.place.group.creator.wholeName}"
>
<f:param
name=
"userid"
value=
"#{placeView.place.group.creator.id}"
/>
</h:link>
</h:panelGrid>
...
...
@@ -147,7 +147,7 @@
<h:column>
<h:outputText
rendered=
"#{empty place.placeReserver.user}"
value=
"#{i18n['place.noReserver']}"
/>
<h:link
rendered=
"#{!empty place.placeReserver.user}"
outcome=
"/user/edit"
>
<h:link
rendered=
"#{!empty place.placeReserver.user}"
outcome=
"/user
admin
/edit"
>
<h:outputText
value=
"#{place.placeReserver.user.wholeName}"
/>
(
<h:outputText
value=
"#{place.placeReserver.user.nick}"
/>
)
<f:param
name=
"userid"
value=
"#{place.placeReserver.user.user.id}"
/>
...
...
code/LanBortalWeb/WebContent/resources/cditools/products/shop.xhtml
View file @
b197f1a
...
...
@@ -18,7 +18,8 @@
<div
style=
"margin-top: 5px;"
>
<h:commandButton
action=
"#{cc.attrs.commitaction}"
id=
"commitbutton-top"
value=
"#{cc.attrs.commitValue}"
/>
</div>
<h:dataTable
columnClasses=
",numalign,numalign,,numalign"
styleClass=
"bordertable"
id=
"billcart"
value=
"#{cc.attrs.items}"
var=
"cart"
>
<h:dataTable
columnClasses=
"nowrap,numalign,numalign,nowrap,numalign"
styleClass=
"bordertable"
id=
"billcart"
value=
"#{cc.attrs.items}"
var=
"cart"
>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
id=
"name"
value=
"${i18n['product.name']}"
/>
...
...
code/LanBortalWeb/WebContent/resources/cditools/role/edit.xhtml
View file @
b197f1a
...
...
@@ -24,7 +24,7 @@
<h2>
#{i18n['role.permissionheader']}
</h2>
<p>
<h:form
id=
"permissionform"
>
<h:commandButton
id=
"save"
value=
"#{i18n['role.savePermissions']}"
action=
"#{roleView.savePermissions}"
/>
<h:commandButton
id=
"save
1
"
value=
"#{i18n['role.savePermissions']}"
action=
"#{roleView.savePermissions}"
/>
<h:dataTable
border=
"1"
id=
"bortalApps"
value=
"#{roleView.rolePermissions}"
var=
"bapp"
>
<h:column>
<f:facet
name=
"header"
>
...
...
@@ -54,7 +54,7 @@
<!-- </ui:repeat> -->
<!-- </h:column> -->
</h:dataTable>
<h:commandButton
id=
"save"
value=
"#{i18n['role.savePermissions']}"
action=
"#{roleView.savePermissions}"
/>
<h:commandButton
id=
"save
2
"
value=
"#{i18n['role.savePermissions']}"
action=
"#{roleView.savePermissions}"
/>
</h:form>
</p>
...
...
code/LanBortalWeb/WebContent/resources/style/insomnia2/css/tyyli.css
View file @
b197f1a
...
...
@@ -231,7 +231,7 @@ td ul {
#right
ul
{
color
:
#7dac0c
;
list-style-type
:
square
;
list-style-position
:
inside
;
list-style-position
:
inside
;
}
#right
ul
li
{
...
...
@@ -241,7 +241,6 @@ td ul {
#right
ul
li
a
{
color
:
#0073bc
;
text-decoration
:
none
;
}
#right
ul
li
a
:hover
{
...
...
@@ -256,3 +255,7 @@ table {
table
.border
td
,
table
.border
th
{
padding
:
1px
4px
;
}
.nowrap
{
white-space
:
nowrap
;
}
\ No newline at end of file
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
View file @
b197f1a
...
...
@@ -25,11 +25,8 @@
</ui:define>
<ui:define
name=
"content"
>
<h:form
id=
"shoppingcartform"
>
<h:panelGrid
columns=
"2"
>
<h:panelGrid
columns=
"2"
>
<h:outputLabel
value=
"#{i18n['shop.accountBalance']}"
/>
...
...
@@ -47,7 +44,6 @@
<f:ajax
render=
"@form"
event=
"valueChange"
/>
<f:convertNumber
/>
</h:inputText>
</h:panelGrid>
<h:panelGroup>
<h:outputLabel
value=
"#{i18n['shop.readBarcode']}"
/>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/map/PlaceView.java
View file @
b197f1a
...
...
@@ -22,6 +22,7 @@ import fi.insomnia.bortal.exceptions.BortalCatchableException;
import
fi.insomnia.bortal.model.EventMap
;
import
fi.insomnia.bortal.model.EventUser
;
import
fi.insomnia.bortal.model.Place
;
import
fi.insomnia.bortal.model.PlaceGroup
;
import
fi.insomnia.bortal.model.User
;
import
fi.insomnia.bortal.utilities.SearchQuery
;
import
fi.insomnia.bortal.web.annotations.SelectedUser
;
...
...
@@ -105,20 +106,18 @@ public class PlaceView extends GenericCDIView {
price
=
placebean
.
getTotalReservationPrice
(
place
);
}
else
{
price
=
placebean
.
getTotalReservationPrice
(
user
,
place
);
}
logger
.
debug
(
"Balance {}, price {}"
,
balance
,
price
);
if
(
price
.
compareTo
(
balance
)
<=
0
)
{
logger
.
debug
(
"Place was free. Marking for user."
);
if
(!
placebean
.
reservePlace
(
place
,
user
))
{
this
.
addFaceMessage
(
"mapView.errorWhenReservingPlace"
);
}
}
else
{
if
(
balance
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
addFaceMessage
(
"mapView.notEnoughCreditsToReserve"
);
}
logger
.
debug
(
"Did not have enought
money
to reserve place! required {} , got {}"
,
price
,
balance
);
logger
.
debug
(
"Did not have enought
credits
to reserve place! required {} , got {}"
,
price
,
balance
);
}
}
}
...
...
@@ -140,7 +139,12 @@ public class PlaceView extends GenericCDIView {
try
{
EventUser
user
=
userbean
.
getEventUser
(
userlist
.
getRowData
());
if
(
placebean
.
reservePlace
(
place
,
user
))
{
placebean
.
buySelectedPlaces
(
user
);
PlaceGroup
newgroup
=
placebean
.
buySelectedPlaces
(
user
);
for
(
Place
p
:
newgroup
.
getPlaces
())
{
if
(
p
.
equals
(
place
))
{
place
=
p
;
}
}
}
}
catch
(
BortalCatchableException
e
)
{
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/map/TokenView.java
View file @
b197f1a
...
...
@@ -33,13 +33,12 @@ public class TokenView extends GenericCDIView {
return
null
;
}
String
ret
=
"myGroups"
;
//
String ret = "myGroups";
if
(!
placegroupbean
.
associateToToken
(
user
,
getToken
()))
{
this
.
addFaceMessage
(
"placetoken.tokenNotFound"
);
ret
=
null
;
}
return
ret
;
return
null
;
}
public
void
setToken
(
String
token
)
{
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ProductShopView.java
View file @
b197f1a
...
...
@@ -176,15 +176,13 @@ public class ProductShopView extends GenericCDIView {
EventUser
retuser
=
null
;
for
(
ProductShopItem
shopitem
:
shoppingcart
)
{
if
(
shopitem
.
getCount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
retuser
=
productBean
.
createAccountEvent
(
shopitem
.
getProduct
(),
shopitem
.
getCount
(),
user
).
getUser
();
retuser
=
productBean
.
createAccountEvent
(
shopitem
.
getProduct
(),
shopitem
.
getCount
(),
user
).
getUser
();
}
}
if
(
cash
!=
null
&&
cash
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
Product
credProd
=
productBean
.
findCreditProduct
();
retuser
=
productBean
.
createAccountEvent
(
credProd
,
cash
,
user
)
.
getUser
();
retuser
=
productBean
.
createAccountEvent
(
credProd
,
cash
,
user
).
getUser
();
}
if
(
user
!=
null
)
{
user
=
retuser
;
...
...
code/lib-AuthModule-depends/.project
View file @
b197f1a
...
...
@@ -10,8 +10,19 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.jboss.tools.jst.web.kb.kbbuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.wst.validation.validationbuilder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.jdt.core.javanature
</nature>
<nature>
org.jboss.tools.jst.web.kb.kbnature
</nature>
</natures>
</projectDescription>
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