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 63fbadf0
authored
Aug 24, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Laskujen kuittaaminen näkyy välittömästi käyttäjän tilitapahtumissa ( bugi JPA:ssa? )
Menupuu..
1 parent
1730f446
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
156 additions
and
102 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/BillBean.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/facade/GenericFacade.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/GroupMembershipFacade.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventUser.java
code/LanBortalWeb/WebContent/menu/list.xhtml
code/LanBortalWeb/WebContent/resources/primefaces-bortal/theme.css
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/menu/MenuListView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/BillBean.java
View file @
63fbadf
...
...
@@ -22,6 +22,7 @@ import fi.insomnia.bortal.enums.apps.BillPermission;
import
fi.insomnia.bortal.enums.apps.SpecialPermission
;
import
fi.insomnia.bortal.facade.BillFacade
;
import
fi.insomnia.bortal.facade.BillLineFacade
;
import
fi.insomnia.bortal.facade.EventUserFacade
;
import
fi.insomnia.bortal.model.AccountEvent
;
import
fi.insomnia.bortal.model.Bill
;
import
fi.insomnia.bortal.model.BillLine
;
...
...
@@ -70,6 +71,8 @@ public class BillBean implements BillBeanLocal {
@EJB
private
LoggingBeanLocal
loggingBean
;
@EJB
private
EventUserFacade
eventUserFacade
;
/**
* Default constructor.
...
...
@@ -206,10 +209,14 @@ public class BillBean implements BillBeanLocal {
{
throw
new
EJBException
(
"Bill already marked paid!"
);
}
bill
=
billFacade
.
reload
(
bill
);
Product
creditproduct
=
productBean
.
findCreditProduct
();
AccountEvent
ac
=
productBean
.
createAccountEvent
(
creditproduct
,
bill
.
totalPrice
(),
bill
.
getUser
());
EventUser
user
=
bill
.
getUser
();
AccountEvent
ac
=
productBean
.
createAccountEvent
(
creditproduct
,
bill
.
totalPrice
(),
user
);
logger
.
info
(
"Created creditentry. {}, userproducts {}"
,
ac
,
user
.
getAccountEvents
().
size
());
ac
.
setDelivered
(
when
);
ac
.
setEventTime
(
when
);
ac
.
setBill
(
bill
);
...
...
@@ -218,30 +225,34 @@ public class BillBean implements BillBeanLocal {
bill
.
setAccountEvent
(
ac
);
bill
.
setPaidDate
(
when
.
getTime
());
bill
=
billFacade
.
merge
(
bill
);
//
bill = billFacade.merge(bill);
for
(
BillLine
bl
:
bill
.
getBillLines
())
{
Product
prod
=
bl
.
getLineProduct
();
if
(
prod
!=
null
)
{
if
(
prod
.
getProductFlags
().
contains
(
ProductFlag
.
PREPAID_INSTANT_CREATE
))
{
logger
.
debug
(
"Creating Bill prepaidInstant product {}, {}"
,
prod
.
getName
(),
bl
.
getQuantity
());
if
(
prod
.
getProductFlags
().
contains
(
ProductFlag
.
RESERVE_PLACE_WHEN_BOUGHT
)
||
prod
.
getProductFlags
().
contains
(
ProductFlag
.
CREATE_NEW_PLACE_WHEN_BOUGHT
)
)
{
placebean
.
lockPlaceProduct
(
bill
.
getUser
(),
prod
,
bl
.
getQuantity
());
}
if
(
prod
!=
null
&&
prod
.
getProductFlags
().
contains
(
ProductFlag
.
PREPAID_INSTANT_CREATE
))
{
logger
.
debug
(
"Creating Bill prepaidInstant product {}, {}"
,
prod
.
getName
(),
bl
.
getQuantity
());
if
(
prod
.
getProductFlags
().
contains
(
ProductFlag
.
RESERVE_PLACE_WHEN_BOUGHT
)
||
prod
.
getProductFlags
().
contains
(
ProductFlag
.
CREATE_NEW_PLACE_WHEN_BOUGHT
))
{
placebean
.
lockPlaceProduct
(
bill
.
getUser
(),
prod
,
bl
.
getQuantity
());
}
productBean
.
createAccountEvent
(
prod
,
bl
.
getQuantity
(),
bill
.
getUser
(),
bill
.
getSentDate
());
AccountEvent
ac2
=
productBean
.
createAccountEvent
(
prod
,
bl
.
getQuantity
(),
user
,
bill
.
getSentDate
());
logger
.
info
(
"Created ac from product. {}, userproducts {}"
,
ac2
,
user
.
getAccountEvents
().
size
());
ac2
.
setSeller
(
permbean
.
getCurrentUser
());
}
}
}
MailMessage
msg
=
new
MailMessage
();
msg
.
setSubject
(
I18n
.
get
(
"bill.billMarkedPaidMail.subject"
));
msg
.
setMessage
(
I18n
.
get
(
"bill.billMarkedPaidMail.message"
,
(
bill
.
getBillNumber
()
==
null
)
?
"----"
:
bill
.
getBillNumber
().
toString
()));
msg
.
setTo
(
bill
.
getUser
());
utilbean
.
sendMail
(
msg
);
eventUserFacade
.
flush
();
eventUserFacade
.
evict
(
bill
.
getUser
());
}
@Override
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceBean.java
View file @
63fbadf
...
...
@@ -241,12 +241,12 @@ public class PlaceBean implements PlaceBeanLocal {
loggerbean
.
logMessage
(
SecurityLogType
.
permissionDenied
,
permbean
.
getCurrentUser
(),
"Can not buy places for user "
+
user
);
throw
new
EJBAccessException
(
"Not enough permissions to buy place"
);
}
user
=
eventUserFacade
.
find
(
user
.
getId
()
);
user
=
eventUserFacade
.
reload
(
user
);
}
LanEvent
event
=
eventBean
.
getCurrentEvent
();
List
<
Place
>
places
=
placeFacade
.
findUsersReservations
(
event
,
user
);
if
(
places
.
size
()
<=
0
)
{
if
(
places
.
isEmpty
()
)
{
return
null
;
}
...
...
@@ -269,12 +269,21 @@ public class PlaceBean implements PlaceBeanLocal {
// user.getPlaceGroups().add(pg);
userfacade
.
flush
();
boolean
associatedToPlace
=
isUserMember
(
user
,
places
.
get
(
0
).
getProduct
());
for
(
Place
p
:
places
)
{
if
(!
p
.
isReservedFor
(
user
))
{
throw
new
BortalCatchableException
(
"Trying to buy place not reserved for that user"
);
}
logger
.
info
(
"Buying place {} for user {}"
,
p
.
getName
(),
user
.
getLogin
());
buy
(
p
,
pg
,
user
);
GroupMembership
gm
=
buy
(
p
,
pg
,
user
);
if
(!
associatedToPlace
)
{
logger
.
info
(
"Associating buyer {} to place {}"
,
user
,
gm
);
associatedToPlace
=
true
;
gm
.
setUser
(
user
);
}
}
// adding account event does funny stuff. evicting helps...
...
...
@@ -291,15 +300,9 @@ public class PlaceBean implements PlaceBeanLocal {
PlaceGroup
pg
=
new
PlaceGroup
(
event
,
Calendar
.
getInstance
(),
Calendar
.
getInstance
(),
true
);
pg
.
setCreator
(
user
);
pgfacade
.
create
(
pg
);
boolean
associatedToPlace
=
false
;
boolean
associatedToPlace
=
isUserMember
(
user
,
prod
)
;
// If user is not yet associated to this type of product, find it out...
for
(
GroupMembership
gm
:
user
.
getGroupMemberships
())
{
if
(
prod
.
equals
(
gm
.
getPlaceReservation
().
getProduct
()))
{
associatedToPlace
=
true
;
break
;
}
}
for
(
int
i
=
0
;
i
<
quantity
.
intValue
();
++
i
)
{
...
...
@@ -319,7 +322,6 @@ public class PlaceBean implements PlaceBeanLocal {
break
;
}
}
}
if
(
freePlace
==
null
)
{
throw
new
EJBException
(
"Could find a place to be reserved...."
);
...
...
@@ -327,6 +329,7 @@ public class PlaceBean implements PlaceBeanLocal {
GroupMembership
gm
=
buy
(
freePlace
,
pg
,
user
);
if
(!
associatedToPlace
)
{
logger
.
info
(
"Associating buyer {} to place {}"
,
user
,
gm
);
associatedToPlace
=
true
;
gm
.
setUser
(
user
);
}
...
...
@@ -335,6 +338,17 @@ public class PlaceBean implements PlaceBeanLocal {
// user.getPlaceGroups().add(pg);
}
private
static
boolean
isUserMember
(
EventUser
user
,
Product
prod
)
{
boolean
ret
=
false
;
for
(
GroupMembership
gm
:
user
.
getGroupMemberships
())
{
if
(
prod
.
equals
(
gm
.
getPlaceReservation
().
getProduct
()))
{
ret
=
true
;
break
;
}
}
return
ret
;
}
private
GroupMembership
buy
(
Place
p
,
PlaceGroup
pg
,
IUser
user
)
{
p
.
setGroup
(
pg
);
p
.
setReleaseTime
(
null
);
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceGroupBean.java
View file @
63fbadf
...
...
@@ -148,7 +148,15 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal {
image
.
setPosition
(
50
,
y
);
image
.
drawOn
(
page
);
TextLine
name
=
new
TextLine
(
bigfont
,
membership
.
getPlaceReservation
().
getName
());
StringBuilder
sb
=
new
StringBuilder
();
if
(
membership
.
getPlaceReservation
().
getName
()
!=
null
)
{
sb
.
append
(
membership
.
getPlaceReservation
().
getName
());
sb
.
append
(
" - "
);
}
sb
.
append
(
membership
.
getPlaceReservation
().
getProduct
().
getName
());
TextLine
name
=
new
TextLine
(
bigfont
,
sb
.
toString
());
name
.
setPosition
(
300
,
y
+
10
);
name
.
drawOn
(
page
);
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ProductBean.java
View file @
63fbadf
...
...
@@ -145,8 +145,6 @@ public class ProductBean implements ProductBeanLocal {
unitPrice
=
unitPrice
.
multiply
(
d
.
getPercentage
());
}
user
=
eventUserFacade
.
find
(
user
.
getId
());
AccountEvent
ret
=
new
AccountEvent
(
user
,
product
,
unitPrice
,
quantity
,
Calendar
.
getInstance
());
ret
.
setDelivered
(
Calendar
.
getInstance
());
...
...
@@ -164,7 +162,7 @@ public class ProductBean implements ProductBeanLocal {
user
.
getAccountEvents
().
add
(
ret
);
accounteventfacade
.
create
(
ret
);
// flush changes to db.
userFacade
.
flush
();
//
userFacade.flush();
return
ret
;
}
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/GenericFacade.java
View file @
63fbadf
...
...
@@ -17,7 +17,6 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.facade.callbacks.FacadeCallback
;
import
fi.insomnia.bortal.model.LanEvent
;
import
fi.insomnia.bortal.utilities.SearchResult
;
import
fi.insomnia.bortal.utilities.jpa.ModelInterface
;
...
...
@@ -268,7 +267,7 @@ public abstract class GenericFacade<C extends ModelInterface> {
getEm
().
flush
();
}
public
void
evict
(
C
clz
)
{
getEm
().
getEntityManagerFactory
().
getCache
().
evict
(
getEntityClass
(),
clz
.
getId
());
public
void
evict
(
C
entity
)
{
getEm
().
getEntityManagerFactory
().
getCache
().
evict
(
getEntityClass
(),
entity
.
getId
());
}
}
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/GroupMembershipFacade.java
View file @
63fbadf
...
...
@@ -78,7 +78,8 @@ public class GroupMembershipFacade extends IntegerPkGenericFacade<GroupMembershi
),
cb
.
equal
(
pg
.
get
(
PlaceGroup_
.
event
),
eventbean
.
getCurrentEvent
())
);
cq
.
orderBy
(
cb
.
asc
(
root
.
get
(
GroupMembership_
.
placeReservation
).
get
(
Place_
.
name
)));
cq
.
orderBy
(
cb
.
asc
(
root
.
get
(
GroupMembership_
.
placeReservation
).
get
(
Place_
.
name
)),
cb
.
asc
(
root
.
get
(
GroupMembership_
.
id
)));
// TypedQuery<GroupMembership> p =
// em.createQuery("select gm from GroupMembership gm where gm.id.eventId = :eventid and (gm.placeGroup.creator = :user or gm.user = :user) order by gm.placeReservation.name",
// GroupMembership.class);
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventUser.java
View file @
63fbadf
...
...
@@ -57,31 +57,32 @@ public class EventUser extends GenericEntity implements IUser {
private
List
<
CompoEntryParticipant
>
compoEntryParticipants
;
@OneToMany
(
mappedBy
=
"creator"
)
@OrderBy
(
"id"
)
@OrderBy
()
private
List
<
CompoEntry
>
compoEntries
;
@OneToMany
(
mappedBy
=
"creator"
,
cascade
=
CascadeType
.
ALL
)
private
List
<
PlaceGroup
>
placeGroups
=
new
ArrayList
<
PlaceGroup
>();
@OneToMany
(
mappedBy
=
"user"
)
@OrderBy
private
List
<
GroupMembership
>
groupMemberships
;
/**
* The places this user has registered into.
*/
@OneToMany
(
mappedBy
=
"currentUser"
,
fetch
=
FetchType
.
LAZY
)
@OrderBy
(
Place
.
ID_COLUMN
)
@OrderBy
()
private
List
<
Place
>
currentPlaces
;
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"user"
)
private
List
<
PrintedCard
>
printedCards
;
@OneToMany
(
mappedBy
=
"user"
)
@OrderBy
(
AccountEvent
.
ID_COLUMN
)
@OrderBy
()
private
List
<
AccountEvent
>
accountEvents
;
@OneToMany
(
mappedBy
=
"user"
)
@OrderBy
(
Bill
.
ID_COLUMN
)
@OrderBy
()
private
List
<
Bill
>
bills
;
@OneToMany
(
mappedBy
=
"seller"
)
...
...
code/LanBortalWeb/WebContent/menu/list.xhtml
View file @
63fbadf
...
...
@@ -2,7 +2,7 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:f=
"http://java.sun.com/jsf/core"
>
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.org/ui"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
...
...
@@ -11,42 +11,25 @@
<ui:define
name=
"content"
>
<h1>
#{i18n['menulist.header']}
</h1>
<h:panelGrid
columns=
"2"
>
<h:form>
<p:tree
value=
"#{menuListView.root}"
var=
"node"
id=
"tree"
selectionMode=
"single"
selection=
"#{menuListView.selectedNode}"
>
<p:treeNode
id=
"treeNode"
>
<h:outputText
value=
"#{i18n[node.key]}"
id=
"lblNode"
/>
</p:treeNode>
</p:tree>
<h:commandButton
value=
"Display Selected"
actionListener=
"#{menuListView.showMenuitem()}"
id=
"btnDisplay"
/>
</h:form>
<h:form
rendered=
"#{menuListView.selectedMenuitemAvailable}"
>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
for=
"key"
value=
"#{i18n['menuitem.key']}"
/>
<h:outputText
id=
"key"
value=
"#{menuListView.selectedMenuitem.key}"
/>
<h:message
for=
"key"
/>
</h:panelGrid>
</h:form>
</h:panelGrid>
<h:dataTable
styleClass=
"bordertable"
id=
"menulist"
value=
"#{menuListView.menus}"
var=
"menu"
>
<h:column>
<f:facet
name=
"header"
>
#
</f:facet>
<h:outputText
value=
"#{menu.id}"
/>
</h:column>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['menu.name']}"
/>
</f:facet>
<h:outputText
value=
"#{menu.key}"
/>
</h:column>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['menu.sort']}"
/>
</f:facet>
<h:outputText
value=
"#{menu.sort}"
/>
</h:column>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['menu.item']}"
/>
</f:facet>
<h:outputText
value=
"#{menu.item}"
/>
</h:column>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['menu.sort']}"
/>
</f:facet>
<h:outputText
value=
"#{menu.sort}"
/>
</h:column>
<h:column>
<h:commandButton
action=
"#{menuListView.selectMenu}"
value=
"#{i18n['menu.select']}"
/>
</h:column>
</h:dataTable>
</ui:define>
</ui:composition>
</h:body>
...
...
code/LanBortalWeb/WebContent/resources/primefaces-bortal/theme.css
View file @
63fbadf
...
...
@@ -60,7 +60,7 @@ a {
.ui-widget-header
{
border
:
1px
solid
#a8a8a8
;
background
:
#c4c4c4
url("#{resource['primefaces-
treco
:images/ui-bg_highlight-soft_100_c4c4c4_1x100.png']}")
50%
50%
repeat-x
;
background
:
#c4c4c4
url("#{resource['primefaces-
bortal
:images/ui-bg_highlight-soft_100_c4c4c4_1x100.png']}")
50%
50%
repeat-x
;
background
:
#c4c4c4
linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0.8
),
rgba
(
255
,
255
,
255
,
0
));
background
:
#c4c4c4
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
from
(
rgba
(
255
,
255
,
255
,
0.8
)),
to
(
rgba
(
255
,
255
,
255
,
0
)));
background
:
#c4c4c4
-moz-linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0.8
),
rgba
(
255
,
255
,
255
,
0
));
/* filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#DDFFFFFF, endColorstr=#00FFFFFF); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#DDFFFFFF, endColorstr=#00FFFFFF)"; */
...
...
@@ -78,7 +78,7 @@ a {
.ui-state-default
,
.ui-widget-content
.ui-state-default
,
.ui-widget-header
.ui-state-default
{
border
:
1px
solid
#a8a8a8
;
background
:
#c4c4c4
url("#{resource['primefaces-
treco
:images/ui-bg_highlight-hard_80_c4c4c4_1x100.png']}")
50%
50%
repeat-x
;
background
:
#c4c4c4
url("#{resource['primefaces-
bortal
:images/ui-bg_highlight-hard_80_c4c4c4_1x100.png']}")
50%
50%
repeat-x
;
background
:
#c4c4c4
linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0.8
),
rgba
(
255
,
255
,
255
,
0
));
background
:
#c4c4c4
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
from
(
rgba
(
255
,
255
,
255
,
0.8
)),
to
(
rgba
(
255
,
255
,
255
,
0
)));
background
:
#c4c4c4
-moz-linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0.8
),
rgba
(
255
,
255
,
255
,
0
));
/* filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#DDFFFFFF, endColorstr=#00FFFFFF); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#DDFFFFFF, endColorstr=#00FFFFFF)"; */
...
...
@@ -101,7 +101,7 @@ a {
.ui-state-hover
,
.ui-widget-content
.ui-state-hover
,
.ui-widget-header
.ui-state-hover
,
.ui-state-focus
,
.ui-widget-content
.ui-state-focus
,
.ui-widget-header
.ui-state-focus
{
border
:
1px
solid
#7096ab
;
background
:
#85b2cb
url("#{resource['primefaces-
treco
:images/ui-bg_highlight-hard_80_85b2cb_1x100.png']}")
50%
50%
repeat-x
;
background
:
#85b2cb
url("#{resource['primefaces-
bortal
:images/ui-bg_highlight-hard_80_85b2cb_1x100.png']}")
50%
50%
repeat-x
;
background
:
#85b2cb
linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0.6
),
rgba
(
255
,
255
,
255
,
0
));
background
:
#85b2cb
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
from
(
rgba
(
255
,
255
,
255
,
0.6
)),
to
(
rgba
(
255
,
255
,
255
,
0
)));
background
:
#85b2cb
-moz-linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0.6
),
rgba
(
255
,
255
,
255
,
0
));
/* filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#CCFFFFFF, endColorstr=#00FFFFFF); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#CCFFFFFF, endColorstr=#00FFFFFF)"; */
...
...
@@ -125,7 +125,7 @@ a {
.ui-state-active
,
.ui-widget-content
.ui-state-active
,
.ui-widget-header
.ui-state-active
{
border
:
1px
solid
#7096ab
;
background
:
#85b2cb
url("#{resource['primefaces-
treco
:images/ui-bg_inset-hard_65_85b2cb_1x100.png']}")
50%
50%
repeat-x
;
background
:
#85b2cb
url("#{resource['primefaces-
bortal
:images/ui-bg_inset-hard_65_85b2cb_1x100.png']}")
50%
50%
repeat-x
;
background
:
#85b2cb
linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0
),
rgba
(
255
,
255
,
255
,
0.4
));
background
:
#85b2cb
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
from
(
rgba
(
255
,
255
,
255
,
0
)),
to
(
rgba
(
255
,
255
,
255
,
0.4
)));
background
:
#85b2cb
-moz-linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0
),
rgba
(
255
,
255
,
255
,
0.4
));
/* filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF, endColorstr=#CCFFFFFF); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF, endColorstr=#CCFFFFFF)"; */
...
...
@@ -168,7 +168,7 @@ a {
.ui-state-error
,
.ui-widget-content
.ui-state-error
,
.ui-widget-header
.ui-state-error
{
border
:
1px
solid
#cd0a0a
;
background
:
#fef1ec
url("#{resource['primefaces-
treco
:images/ui-bg_inset-soft_95_fef1ec_1x100.png']}")
50%
bottom
repeat-x
;
background
:
#fef1ec
url("#{resource['primefaces-
bortal
:images/ui-bg_inset-soft_95_fef1ec_1x100.png']}")
50%
bottom
repeat-x
;
background
:
#fef1ec
linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0.8
),
rgba
(
255
,
255
,
255
,
0
));
background
:
#fef1ec
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
from
(
rgba
(
255
,
255
,
255
,
0.8
)),
to
(
rgba
(
255
,
255
,
255
,
0
)));
background
:
#fef1ec
-moz-linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0.8
),
rgba
(
255
,
255
,
255
,
0
));
/* filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#DDFFFFFF, endColorstr=#00FFFFFF); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#DDFFFFFF, endColorstr=#00FFFFFF)";*/
...
...
@@ -207,35 +207,35 @@ a {
{
width
:
16px
;
height
:
16px
;
background-image
:
url("#{resource['primefaces-
treco
:images/ui-icons_616161_256x240.png']}")
;
background-image
:
url("#{resource['primefaces-
bortal
:images/ui-icons_616161_256x240.png']}")
;
}
.ui-widget-content
.ui-icon
{
background-image
:
url("#{resource['primefaces-
treco
:images/ui-icons_616161_256x240.png']}")
;
background-image
:
url("#{resource['primefaces-
bortal
:images/ui-icons_616161_256x240.png']}")
;
}
.ui-widget-header
.ui-icon
{
background-image
:
url("#{resource['primefaces-
treco
:images/ui-icons_898989_256x240.png']}")
;
background-image
:
url("#{resource['primefaces-
bortal
:images/ui-icons_898989_256x240.png']}")
;
}
.ui-state-default
.ui-icon
{
background-image
:
url("#{resource['primefaces-
treco
:images/ui-icons_38667f_256x240.png']}")
;
background-image
:
url("#{resource['primefaces-
bortal
:images/ui-icons_38667f_256x240.png']}")
;
}
.ui-state-hover
.ui-icon
,
.ui-state-focus
.ui-icon
{
background-image
:
url("#{resource['primefaces-
treco
:images/ui-icons_38667f_256x240.png']}")
;
background-image
:
url("#{resource['primefaces-
bortal
:images/ui-icons_38667f_256x240.png']}")
;
}
.ui-state-active
.ui-icon
{
background-image
:
url("#{resource['primefaces-
treco
:images/ui-icons_38667f_256x240.png']}")
;
background-image
:
url("#{resource['primefaces-
bortal
:images/ui-icons_38667f_256x240.png']}")
;
}
.ui-state-highlight
.ui-icon
{
background-image
:
url("#{resource['primefaces-
treco
:images/ui-icons_2e83ff_256x240.png']}")
;
background-image
:
url("#{resource['primefaces-
bortal
:images/ui-icons_2e83ff_256x240.png']}")
;
}
.ui-state-error
.ui-icon
,
.ui-state-error-text
.ui-icon
{
background-image
:
url("#{resource['primefaces-
treco
:images/ui-icons_cd0a0a_256x240.png']}")
;
background-image
:
url("#{resource['primefaces-
bortal
:images/ui-icons_cd0a0a_256x240.png']}")
;
}
/* positioning */
...
...
@@ -1018,7 +1018,7 @@ a {
/* Overlays */
.ui-widget-overlay
{
background
:
#2d5972
url("#{resource['primefaces-
treco
:images/ui-bg_flat_0_2d5972_40x100.png']}")
50%
50%
repeat-x
;
background
:
#2d5972
url("#{resource['primefaces-
bortal
:images/ui-bg_flat_0_2d5972_40x100.png']}")
50%
50%
repeat-x
;
opacity
:
.30
;
filter
:
Alpha
(
Opacity
=
30
);
}
...
...
@@ -1026,7 +1026,7 @@ a {
{
margin
:
-8px
0
0
-8px
;
padding
:
8px
;
background
:
#4f4f4f
url("#{resource['primefaces-
treco
:images/ui-bg_flat_0_4f4f4f_40x100.png']}")
50%
50%
repeat-x
;
background
:
#4f4f4f
url("#{resource['primefaces-
bortal
:images/ui-bg_flat_0_4f4f4f_40x100.png']}")
50%
50%
repeat-x
;
opacity
:
.30
;
filter
:
Alpha
(
Opacity
=
30
);
-moz-border-radius
:
8px
;
...
...
@@ -1233,7 +1233,7 @@ a {
}
.ui-menu
{
background
:
#c4c4c4
url("#{resource['primefaces-
treco
:images/ui-bg_highlight-hard_80_c4c4c4_1x100.png']}")
top
repeat-x
;
background
:
#c4c4c4
url("#{resource['primefaces-
bortal
:images/ui-bg_highlight-hard_80_c4c4c4_1x100.png']}")
top
repeat-x
;
background
:
#c4c4c4
linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0.8
),
rgba
(
255
,
255
,
255
,
0
));
background
:
#c4c4c4
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
from
(
rgba
(
255
,
255
,
255
,
0.8
)),
to
(
rgba
(
255
,
255
,
255
,
0
)));
background
:
#c4c4c4
-moz-linear-gradient
(
top
,
rgba
(
255
,
255
,
255
,
0.8
),
rgba
(
255
,
255
,
255
,
0
));
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/menu/MenuListView.java
View file @
63fbadf
...
...
@@ -4,10 +4,12 @@ import java.util.List;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.faces.model.ListDataModel
;
import
javax.inject.Named
;
import
org.primefaces.model.DefaultTreeNode
;
import
org.primefaces.model.TreeNode
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.beans.MenubeanLocal
;
import
fi.insomnia.bortal.enums.apps.ContentPermission
;
...
...
@@ -19,38 +21,72 @@ import fi.insomnia.bortal.web.cdiview.GenericCDIView;
public
class
MenuListView
extends
GenericCDIView
{
private
static
final
long
serialVersionUID
=
-
2894852135260235581L
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
MenuListView
.
class
);
@EJB
private
MenubeanLocal
menubean
;
private
ListDataModel
<
MenuNavigation
>
menus
;
private
DefaultTreeNode
root
;
private
TreeNode
selectedNode
;
private
TreeNode
root
;
public
boolean
isSelectedMenuitemAvailable
()
{
return
getSelectedMenuitem
()
!=
null
;
}
public
void
initList
()
{
if
(
super
.
requirePermissions
(
ContentPermission
.
MANAGE_MENU
))
{
root
=
new
DefaultTreeNode
(
"Root"
,
null
);
parseTree
(
menubean
.
getTopmenus
(),
root
);
setRoot
(
new
DefaultTreeNode
(
"Root"
,
null
));
parseTree
(
menubean
.
getTopmenus
(),
getRoot
());
// menus = new
// ListDataModel<MenuNavigation>(menubean.getTopmenus()));
super
.
beginConversation
();
}
}
private
void
parseTree
(
List
<
MenuNavigation
>
menus
,
DefaultTreeNode
parent
)
{
private
static
void
parseTree
(
List
<
MenuNavigation
>
menus
,
TreeNode
parent
)
{
for
(
MenuNavigation
m
:
menus
)
{
DefaultTreeNode
self
=
new
DefaultTreeNode
(
m
,
parent
);
if
(
m
.
getChildren
()
!=
null
)
{
if
(
m
.
getChildren
()
!=
null
&&
!
m
.
getChildren
().
isEmpty
()
)
{
parseTree
(
m
.
getChildren
(),
self
);
}
}
}
public
MenuNavigation
getSelectedMenuitem
()
{
MenuNavigation
ret
=
null
;
if
(
selectedNode
!=
null
&&
selectedNode
.
getData
()
instanceof
MenuNavigation
)
{
ret
=
(
MenuNavigation
)
selectedNode
.
getData
();
}
logger
.
info
(
"Returning selected menuitem {} "
,
ret
);
return
ret
;
}
public
void
showMenuitem
()
{
logger
.
info
(
"Selected menuitem {}, nodeData {}"
,
selectedNode
,
selectedNode
.
getData
());
}
public
TreeNode
getSelectedNode
()
{
return
selectedNode
;
}
public
void
setSelectedNode
(
TreeNode
selectedNode
)
{
this
.
selectedNode
=
selectedNode
;
}
public
ListDataModel
<
MenuNavigation
>
getMenus
()
{
return
menus
;
public
TreeNode
getRoot
()
{
return
root
;
}
public
void
set
Menus
(
ListDataModel
<
MenuNavigation
>
menus
)
{
this
.
menus
=
menus
;
public
void
set
Root
(
TreeNode
root
)
{
this
.
root
=
root
;
}
}
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserView.java
View file @
63fbadf
...
...
@@ -186,7 +186,10 @@ public class UserView extends GenericCDIView {
canSave
=
getCurrentUser
().
equals
(
user
)
||
permbean
.
hasPermission
(
UserPermission
.
MODIFY
);
this
.
beginConversation
();
logger
.
info
(
"Accountevents for user {}"
,
user
.
getAccountEvents
().
size
());
}
}
public
void
initValidateView
()
{
...
...
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