Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
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 91e9c541
authored
May 12, 2012
by
Antti Tonkyra
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.insomnia.fi:/data/bortal
2 parents
1e6c8df6
d79a313d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
436 additions
and
84 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ReaderBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/SalespointBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/SalespointFacade.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/ReaderBeanLocal.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/SalespointBeanLocal.java
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/BortalApplication.java
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/apps/SalespointPermission.java
code/LanBortalWeb/WebContent/WEB-INF/web.xml
code/LanBortalWeb/WebContent/index.xhtml
code/LanBortalWeb/WebContent/resources/cditools/salespoint/list.xhtml
code/LanBortalWeb/WebContent/resources/cditools/shop/readerevents.xhtml
code/LanBortalWeb/WebContent/resources/style/insomnia2/css/tyyli.css
code/LanBortalWeb/WebContent/salespoint/list.xhtml
code/LanBortalWeb/WebContent/shop/assocToUser.xhtml
code/LanBortalWeb/WebContent/shop/createBill.xhtml
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
code/LanBortalWeb/WebContent/voting/create.xhtml
code/LanBortalWeb/src/ValidationMessages_en.properties
code/LanBortalWeb/src/ValidationMessages_fi.properties
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_en.properties
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/GenericCDIView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/actionlog/ActionLogCreateView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/content/PageOutputView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ProductShopView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ReaderView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/SalespointListView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCreateView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingDateValidator.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ReaderBean.java
View file @
91e9c54
...
@@ -30,6 +30,8 @@ public class ReaderBean implements ReaderBeanLocal {
...
@@ -30,6 +30,8 @@ public class ReaderBean implements ReaderBeanLocal {
private
CardTemplateBeanLocal
cardtemplatebean
;
private
CardTemplateBeanLocal
cardtemplatebean
;
@EJB
@EJB
private
ReaderEventFacade
readerEventFacade
;
private
ReaderEventFacade
readerEventFacade
;
@EJB
private
EventBeanLocal
eventbean
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ReaderBean
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ReaderBean
.
class
);
...
@@ -168,4 +170,13 @@ public class ReaderBean implements ReaderBeanLocal {
...
@@ -168,4 +170,13 @@ public class ReaderBean implements ReaderBeanLocal {
return
readerEventFacade
.
findLastEvents
(
reader
,
20
);
return
readerEventFacade
.
findLastEvents
(
reader
,
20
);
}
}
@Override
public
ReaderEvent
getEvent
(
Integer
eventid
)
{
ReaderEvent
ret
=
readerEventFacade
.
find
(
eventid
);
if
(!
ret
.
getReader
().
getEvent
().
equals
(
eventbean
.
getCurrentEvent
()))
{
ret
=
null
;
}
return
ret
;
}
}
}
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/SalespointBean.java
0 → 100644
View file @
91e9c54
package
fi
.
insomnia
.
bortal
.
beans
;
import
java.util.List
;
import
javax.annotation.security.DeclareRoles
;
import
javax.ejb.EJB
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.enums.apps.SalespointPermission
;
import
fi.insomnia.bortal.facade.SalespointFacade
;
import
fi.insomnia.bortal.model.salespoint.Salespoint
;
/**
* Session Bean implementation class SalespointBean
*/
@Stateless
@LocalBean
@DeclareRoles
({
SalespointPermission
.
S_VIEW
,
SalespointPermission
.
S_MODIFY
})
public
class
SalespointBean
implements
SalespointBeanLocal
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SalespointBean
.
class
);
@EJB
SalespointFacade
salespointFacade
;
public
SalespointBean
()
{
}
@Override
public
List
<
Salespoint
>
findAll
()
{
List
<
Salespoint
>
list
=
salespointFacade
.
findAll
();
if
(
list
!=
null
)
logger
.
debug
(
"Found {} salespoints"
,
list
.
size
());
return
list
;
}
}
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/SalespointFacade.java
0 → 100644
View file @
91e9c54
package
fi
.
insomnia
.
bortal
.
facade
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Root
;
import
fi.insomnia.bortal.beans.EventBeanLocal
;
import
fi.insomnia.bortal.model.salespoint.Salespoint
;
import
fi.insomnia.bortal.model.salespoint.Salespoint_
;
/**
* Session Bean implementation class SalespointFacade
*/
@Stateless
@LocalBean
public
class
SalespointFacade
extends
IntegerPkGenericFacade
<
Salespoint
>
{
@EJB
private
EventBeanLocal
eventbean
;
public
SalespointFacade
()
{
super
(
Salespoint
.
class
);
}
public
List
<
Salespoint
>
findAll
()
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
Salespoint
>
cq
=
cb
.
createQuery
(
Salespoint
.
class
);
Root
<
Salespoint
>
root
=
cq
.
from
(
Salespoint
.
class
);
cq
.
where
(
cb
.
equal
(
root
.
get
(
Salespoint_
.
event
),
eventbean
.
getCurrentEvent
()));
return
getEm
().
createQuery
(
cq
).
getResultList
();
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/ReaderBeanLocal.java
View file @
91e9c54
...
@@ -23,4 +23,6 @@ public interface ReaderBeanLocal {
...
@@ -23,4 +23,6 @@ public interface ReaderBeanLocal {
List
<
ReaderEvent
>
getReaderEvents
(
Integer
readerId
);
List
<
ReaderEvent
>
getReaderEvents
(
Integer
readerId
);
ReaderEvent
getEvent
(
Integer
eventid
);
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/SalespointBeanLocal.java
0 → 100644
View file @
91e9c54
package
fi
.
insomnia
.
bortal
.
beans
;
import
java.util.List
;
import
javax.ejb.Local
;
import
fi.insomnia.bortal.model.salespoint.Salespoint
;
@Local
public
interface
SalespointBeanLocal
{
List
<
Salespoint
>
findAll
();
}
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/BortalApplication.java
View file @
91e9c54
...
@@ -6,6 +6,7 @@ import fi.insomnia.bortal.enums.apps.IAppPermission;
...
@@ -6,6 +6,7 @@ import fi.insomnia.bortal.enums.apps.IAppPermission;
import
fi.insomnia.bortal.enums.apps.LayoutPermission
;
import
fi.insomnia.bortal.enums.apps.LayoutPermission
;
import
fi.insomnia.bortal.enums.apps.MapPermission
;
import
fi.insomnia.bortal.enums.apps.MapPermission
;
import
fi.insomnia.bortal.enums.apps.PollPermission
;
import
fi.insomnia.bortal.enums.apps.PollPermission
;
import
fi.insomnia.bortal.enums.apps.SalespointPermission
;
import
fi.insomnia.bortal.enums.apps.ShopPermission
;
import
fi.insomnia.bortal.enums.apps.ShopPermission
;
import
fi.insomnia.bortal.enums.apps.TerminalPermission
;
import
fi.insomnia.bortal.enums.apps.TerminalPermission
;
import
fi.insomnia.bortal.enums.apps.UserPermission
;
import
fi.insomnia.bortal.enums.apps.UserPermission
;
...
@@ -19,6 +20,7 @@ public enum BortalApplication {
...
@@ -19,6 +20,7 @@ public enum BortalApplication {
CONTENT
(
"News, pages and other dynamic content"
,
ContentPermission
.
class
),
CONTENT
(
"News, pages and other dynamic content"
,
ContentPermission
.
class
),
TERMINAL
(
"Sales and self help terminal roles"
,
TerminalPermission
.
class
),
TERMINAL
(
"Sales and self help terminal roles"
,
TerminalPermission
.
class
),
LAYOUT
(
"Layoutstuff"
,
LayoutPermission
.
class
),
LAYOUT
(
"Layoutstuff"
,
LayoutPermission
.
class
),
SALESPOINT
(
"Managing salespoints"
,
SalespointPermission
.
class
),
;
;
...
...
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/apps/SalespointPermission.java
0 → 100644
View file @
91e9c54
package
fi
.
insomnia
.
bortal
.
enums
.
apps
;
import
fi.insomnia.bortal.enums.BortalApplication
;
public
enum
SalespointPermission
implements
IAppPermission
{
VIEW
(
"View salespoints"
),
MODIFY
(
"Modify salespoints"
);
public
static
final
String
S_VIEW
=
"SALESPOINT/VIEW"
;
public
static
final
String
S_MODIFY
=
"SALESPOINT/MODIFY"
;
private
final
String
description
;
private
final
String
fullName
;
private
SalespointPermission
(
String
desc
)
{
description
=
desc
;
fullName
=
new
StringBuilder
().
append
(
getParent
().
toString
())
.
append
(
DELIMITER
).
append
(
toString
()).
toString
();
}
@Override
public
BortalApplication
getParent
()
{
return
BortalApplication
.
SALESPOINT
;
}
@Override
public
String
getDescription
()
{
return
description
;
}
@Override
public
String
getFullName
()
{
return
fullName
;
}
}
code/LanBortalWeb/WebContent/WEB-INF/web.xml
View file @
91e9c54
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
<web-app
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://java.sun.com/xml/ns/javaee"
xmlns:web=
"http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id=
"WebApp_ID"
version=
"3.0"
>
xmlns=
"http://java.sun.com/xml/ns/javaee"
xmlns:web=
"http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id=
"WebApp_ID"
version=
"3.0"
>
<display-name>
LanBortalWeb
</display-name>
<display-name>
LanBortalWeb
</display-name>
<session-config>
<session-config>
<session-timeout>
30
</session-timeout>
<session-timeout>
30
</session-timeout>
</session-config>
</session-config>
<context-param>
<context-param>
<param-name>
javax.faces.PROJECT_STAGE
</param-name>
<param-name>
javax.faces.PROJECT_STAGE
</param-name>
<!--<param-value>Development</param-value> -->
<param-value>
Production
</param-value>
<param-value>
Production
</param-value>
</context-param>
</context-param>
<context-param>
<context-param>
...
@@ -55,7 +51,6 @@
...
@@ -55,7 +51,6 @@
<servlet-name>
UserCardServlet
</servlet-name>
<servlet-name>
UserCardServlet
</servlet-name>
<url-pattern>
/UserCard
</url-pattern>
<url-pattern>
/UserCard
</url-pattern>
</servlet-mapping>
</servlet-mapping>
<servlet>
<servlet>
<servlet-name>
CardTemplateServlet
</servlet-name>
<servlet-name>
CardTemplateServlet
</servlet-name>
<servlet-class>
fi.insomnia.bortal.servlet.CardTemplateServlet
</servlet-class>
<servlet-class>
fi.insomnia.bortal.servlet.CardTemplateServlet
</servlet-class>
...
@@ -64,8 +59,6 @@
...
@@ -64,8 +59,6 @@
<servlet-name>
CardTemplateServlet
</servlet-name>
<servlet-name>
CardTemplateServlet
</servlet-name>
<url-pattern>
/CardTemplate
</url-pattern>
<url-pattern>
/CardTemplate
</url-pattern>
</servlet-mapping>
</servlet-mapping>
<servlet>
<servlet>
<servlet-name>
PlaceMap
</servlet-name>
<servlet-name>
PlaceMap
</servlet-name>
<servlet-class>
fi.insomnia.bortal.servlet.PlaceMap
</servlet-class>
<servlet-class>
fi.insomnia.bortal.servlet.PlaceMap
</servlet-class>
...
@@ -76,7 +69,6 @@
...
@@ -76,7 +69,6 @@
<url-pattern>
*.wtf
</url-pattern>
<url-pattern>
*.wtf
</url-pattern>
<url-pattern>
/faces/*
</url-pattern>
<url-pattern>
/faces/*
</url-pattern>
</servlet-mapping>
</servlet-mapping>
<filter>
<filter>
<display-name>
PrimefacesFileupload
</display-name>
<display-name>
PrimefacesFileupload
</display-name>
<filter-name>
PrimeFacesFileupload
</filter-name>
<filter-name>
PrimeFacesFileupload
</filter-name>
...
@@ -86,7 +78,6 @@
...
@@ -86,7 +78,6 @@
<filter-name>
PrimeFacesFileupload
</filter-name>
<filter-name>
PrimeFacesFileupload
</filter-name>
<servlet-name>
Faces Servlet
</servlet-name>
<servlet-name>
Faces Servlet
</servlet-name>
</filter-mapping>
</filter-mapping>
<filter>
<filter>
<display-name>
HostnameFilter
</display-name>
<display-name>
HostnameFilter
</display-name>
<filter-name>
HostnameFilter
</filter-name>
<filter-name>
HostnameFilter
</filter-name>
...
@@ -129,12 +120,6 @@
...
@@ -129,12 +120,6 @@
<servlet-name>
PrintBill
</servlet-name>
<servlet-name>
PrintBill
</servlet-name>
<url-pattern>
/PrintBill
</url-pattern>
<url-pattern>
/PrintBill
</url-pattern>
</servlet-mapping>
</servlet-mapping>
<!-- <error-page> <error-code>401</error-code> <location>/permissionDeniedRedirect.jsp</location>
</error-page> <error-page> <error-code>403</error-code> <location>/permissionDeniedRedirect.jsp</location>
</error-page> <error-page> <exception-type>fi.insomnia.bortal.exceptions.PermissionDeniedException</exception-type>
<location>/permissionDeniedRedirect.jsp</location> </error-page> <error-page>
<exception-type>javax.servlet.ServletException</exception-type> <location>/permissionDeniedRedirect.jsp</location>
</error-page> -->
<persistence-unit-ref>
<persistence-unit-ref>
<persistence-unit-ref-name>
BortalEMF
</persistence-unit-ref-name>
<persistence-unit-ref-name>
BortalEMF
</persistence-unit-ref-name>
</persistence-unit-ref>
</persistence-unit-ref>
...
@@ -148,7 +133,4 @@
...
@@ -148,7 +133,4 @@
<servlet-name>
PlaceGroupPdf
</servlet-name>
<servlet-name>
PlaceGroupPdf
</servlet-name>
<url-pattern>
/PlaceGroupPdf
</url-pattern>
<url-pattern>
/PlaceGroupPdf
</url-pattern>
</servlet-mapping>
</servlet-mapping>
</web-app>
</web-app>
\ No newline at end of file
code/LanBortalWeb/WebContent/index.xhtml
View file @
91e9c54
...
@@ -5,13 +5,17 @@
...
@@ -5,13 +5,17 @@
</h:head>
</h:head>
<h:body>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:event
type=
"preRenderView"
listener=
"#{pageOutputView.initView('index')}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<h:outputLabel
rendered=
"#{sessionHandler.isInDevelopmentMode()}"
>
<h:outputLabel
rendered=
"#{sessionHandler.isInDevelopmentMode()}"
>
Development-tilassa.
Development-tilassa.
Vaihda web.xml-tiedostosta ohjelman tila (javax.faces.PROJECT_STAGE) Productioniksi ennen kuin julkaiset ohjelman tuotantoon.
Vaihda web.xml-tiedostosta ohjelman tila (javax.faces.PROJECT_STAGE) Productioniksi ennen kuin julkaiset ohjelman tuotantoon.
</h:outputLabel>
</h:outputLabel>
<ui:repeat
var=
"cont1"
value=
"#{pageOutputView.contents}"
>
<h:outputText
value=
"#{cont1.content}"
escape=
"false"
/>
</ui:repeat>
</ui:define>
</ui:define>
</ui:composition>
</ui:composition>
</h:body>
</h:body>
...
...
code/LanBortalWeb/WebContent/resources/cditools/salespoint/list.xhtml
0 → 100644
View file @
91e9c54
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:composite=
"http://java.sun.com/jsf/composite"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
>
<composite:interface>
</composite:interface>
<composite:implementation>
<h:outputText
rendered=
"#{salespointListView.salespoints.rowCount le 0}"
value=
"#{i18n['salespoint.noSalespoints']}"
/>
<h:form
rendered=
"#{salespointListView.salespoints.rowCount gt 0}"
>
<h:dataTable
styleClass=
"bordertable"
id=
"salespointList"
value=
"#{salespointListView.salespoints}"
var=
"salespoint"
>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"${i18n['salespoint.name']}"
/>
</f:facet>
<h:outputText
value=
"#{salespoint.name}"
/>
</h:column>
<h:column
rendered=
"#{billListView.canEditSalespoint}"
>
<h:link
outcome=
"/salespoint/edit"
value=
"#{i18n['salespoint.edit']}"
>
<f:param
name=
"salespointid"
value=
"#{salespoint.id}"
/>
</h:link>
</h:column>
</h:dataTable>
</h:form>
</composite:implementation>
</html>
\ No newline at end of file
code/LanBortalWeb/WebContent/resources/cditools/shop/readerevents.xhtml
View file @
91e9c54
...
@@ -40,8 +40,13 @@
...
@@ -40,8 +40,13 @@
<h:outputText
value=
"#{event.gamePoint}"
/>
<h:outputText
value=
"#{event.gamePoint}"
/>
</h:column>
</h:column>
<h:column>
<h:column>
<h:commandButton
rendered=
"#{empty event.printedCard}"
action=
"#{readerView.selectEvent()}"
value=
"#{i18n['readerevent.associateToUser']}"
/>
<h:link
rendered=
"#{!empty event.printedCard}"
outcome=
"/shop/shopToUser"
value=
"#{i18n['readerevent.shopToUser']}"
>
<h:commandButton
rendered=
"#{!empty event.printedCard}"
action=
"#{readerView.selectEvent()}"
value=
"#{i18n['readerevent.shopToUser']}"
/>
<f:param
name=
"userid"
value=
"#{event.printedCard.user.id}"
/>
</h:link>
<h:link
rendered=
"#{empty event.printedCard}"
outcome=
"/shop/assocToUser"
value=
"#{i18n['readerevent.associateToUser']}"
>
<f:param
name=
"eventid"
value=
"#{event.id}"
/>
</h:link>
</h:column>
</h:column>
</h:dataTable>
</h:dataTable>
...
...
code/LanBortalWeb/WebContent/resources/style/insomnia2/css/tyyli.css
View file @
91e9c54
...
@@ -22,7 +22,6 @@ body,html {
...
@@ -22,7 +22,6 @@ body,html {
#logo
h1
{
#logo
h1
{
margin
:
5px
;
margin
:
5px
;
color
:
white
:
color
:
white
:
}
}
#logo
a
{
#logo
a
{
...
@@ -197,3 +196,7 @@ a:hover {
...
@@ -197,3 +196,7 @@ a:hover {
color
:
#fff
;
color
:
#fff
;
float
:
left
;
float
:
left
;
}
}
td
ul
{
margin
:
0
;
}
\ No newline at end of file
code/LanBortalWeb/WebContent/salespoint/list.xhtml
0 → 100644
View file @
91e9c54
<!DOCTYPE html
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:salespoint=
"http://java.sun.com/jsf/composite/cditools/salespoint"
xmlns:f=
"http://java.sun.com/jsf/core"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{salespointListView.init}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<salespoint:list
/>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/LanBortalWeb/WebContent/shop/assocToUser.xhtml
View file @
91e9c54
...
@@ -6,19 +6,19 @@
...
@@ -6,19 +6,19 @@
<h:body>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:metadata>
<f:viewParam
name=
"
userid"
value=
"#{userView.user
id}"
/>
<f:viewParam
name=
"
eventid"
value=
"#{readerView.event
id}"
/>
<f:event
type=
"preRenderView"
listener=
"#{
productShopView.init
View}"
/>
<f:event
type=
"preRenderView"
listener=
"#{
readerView.initUserassoc
View}"
/>
</f:metadata>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<h:outputText
rendered=
"#{
!empty readerView.rfidevent
.event}"
value=
"#{i18n['rfidevent.empty']}"
/>
<h:outputText
rendered=
"#{
empty readerView
.event}"
value=
"#{i18n['rfidevent.empty']}"
/>
<h:panelGrid
columns=
"2"
rendered=
"#{
empty readerView.rfidevent
.event}"
>
<h:panelGrid
columns=
"2"
rendered=
"#{
!empty readerView
.event}"
>
<h:outputLabel
value=
"#{i18n['rfidevent.reader']}:"
/>
<h:outputLabel
value=
"#{i18n['rfidevent.reader']}:"
/>
<h:outputText
value=
"#{readerView.
rfidevent.reader
}"
/>
<h:outputText
value=
"#{readerView.
event.reader.description
}"
/>
<h:outputLabel
value=
"#{i18n['rfidevent.tag']}:"
/>
<h:outputLabel
value=
"#{i18n['rfidevent.tag']}:"
/>
<h:outputText
value=
"#{readerView.
rfidevent.tag
}"
/>
<h:outputText
value=
"#{readerView.
event.value
}"
/>
<h:outputLabel
value=
"#{i18n['rfidevent.insertplacecode']}"
/>
<h:outputLabel
value=
"#{i18n['rfidevent.insertplacecode']}"
/>
...
...
code/LanBortalWeb/WebContent/shop/createBill.xhtml
View file @
91e9c54
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{productShopView.initView}"
/>
<f:event
type=
"preRenderView"
listener=
"#{productShopView.init
Bill
View}"
/>
</f:metadata>
</f:metadata>
<ui:define
name=
"title"
>
<ui:define
name=
"title"
>
<h1>
#{i18n['page.product.createBill.header']}
</h1>
<h1>
#{i18n['page.product.createBill.header']}
</h1>
...
...
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
View file @
91e9c54
<!DOCTYPE html
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
"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"
<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:f=
"http://java.sun.com/jsf/core"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:products=
"http://java.sun.com/jsf/composite/cditools/products"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
>
xmlns:products=
"http://java.sun.com/jsf/composite/cditools/products"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
>
<h:body>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:metadata>
<f:event
type=
"preRenderView"
listener=
"#{productShopView.initView}"
/>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{userView.initView}"
/>
<f:event
type=
"preRenderView"
listener=
"#{productShopView.initShopView}"
/>
</f:metadata>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
...
@@ -28,9 +28,7 @@
...
@@ -28,9 +28,7 @@
<h:outputText
value=
"#{i18n['product.shopInstant']}"
/>
<h:outputText
value=
"#{i18n['product.shopInstant']}"
/>
<h:selectBooleanCheckbox
value=
"#{productShopView.payInstant}"
/>
<h:selectBooleanCheckbox
value=
"#{productShopView.payInstant}"
/>
<products:shop
commitaction=
"#{productShopView.commitShoppingCart()}"
items=
"#{productShopView.shoppingcart}"
<products:shop
commitaction=
"#{productShopView.commitShoppingCart()}"
items=
"#{productShopView.shoppingcart}"
commitValue=
"#{i18n['productshop.commit']}"
/>
commitValue=
"#{i18n['productshop.commit']}"
/>
</h:form>
</h:form>
</ui:define>
</ui:define>
...
...
code/LanBortalWeb/WebContent/voting/create.xhtml
View file @
91e9c54
...
@@ -19,43 +19,43 @@
...
@@ -19,43 +19,43 @@
<div>
<div>
<h:form>
<h:form>
<h:panelGrid
columns=
"3"
>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
value=
"
Name
"
for=
"name"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.name']}:
"
for=
"name"
/>
<h:inputText
value=
"#{votingCreateView.name}"
id=
"name"
/>
<h:inputText
value=
"#{votingCreateView.name}"
id=
"name"
/>
<h:message
for=
"name"
/>
<h:message
for=
"name"
/>
<h:outputLabel
value=
"
Kuvaus
:"
for=
"desc"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.description']}
:"
for=
"desc"
/>
<h:inputText
value=
"#{votingCreateView.description}"
id=
"desc"
/>
<h:inputText
value=
"#{votingCreateView.description}"
id=
"desc"
/>
<h:message
for=
"desc"
/>
<h:message
for=
"desc"
/>
<h:outputLabel
value=
"
Max osallistujat
:"
for=
"maxPar"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.maxParticipants']}
:"
for=
"maxPar"
/>
<h:inputText
value=
"#{votingCreateView.maxParticipants}"
id=
"maxPar"
/>
<h:inputText
value=
"#{votingCreateView.maxParticipants}"
id=
"maxPar"
/>
<h:message
for=
"maxPar"
/>
<h:message
for=
"maxPar"
/>
<h:outputLabel
value=
"
Compo start
"
for=
"cStart"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.compoStart']}:
"
for=
"cStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveCStart}"
value=
"#{votingCreateView.compoStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveCStart}"
value=
"#{votingCreateView.compoStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cStart"
/>
<h:message
for=
"cStart"
/>
<h:message
for=
"cStart"
/>
<h:outputLabel
value=
"
Compo end
"
for=
"cEnd"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.compoEnd']}:
"
for=
"cEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateCompo}"
value=
"#{votingCreateView.compoEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateCompo}"
value=
"#{votingCreateView.compoEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"cEnd"
/>
<h:message
for=
"cEnd"
/>
<h:message
for=
"cEnd"
/>
<h:outputLabel
value=
"
Vote start
"
for=
"vStart"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.voteStart']}:
"
for=
"vStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveVStart}"
value=
"#{votingCreateView.voteStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveVStart}"
value=
"#{votingCreateView.voteStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vStart"
/>
<h:message
for=
"vStart"
/>
<h:message
for=
"vStart"
/>
<h:outputLabel
value=
"
Vote end
"
for=
"vEnd"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.voteEnd']}:
"
for=
"vEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateVote}"
value=
"#{votingCreateView.voteEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateVote}"
value=
"#{votingCreateView.voteEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"vEnd"
/>
<h:message
for=
"vEnd"
/>
<h:message
for=
"vEnd"
/>
<h:outputLabel
value=
"
Submit start
"
for=
"sStart"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.submitStart']}:
"
for=
"sStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveSStart}"
value=
"#{votingCreateView.submitStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sStart"
/>
<p:calendar
validator=
"#{votingDateValidator.saveSStart}"
value=
"#{votingCreateView.submitStart}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sStart"
/>
<h:message
for=
"sStart"
/>
<h:message
for=
"sStart"
/>
<h:outputLabel
value=
"
Submit end
"
for=
"sEnd"
/>
<h:outputLabel
value=
"
#{i18n['voting.create.submitEnd']}:
"
for=
"sEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateSubmit}"
value=
"#{votingCreateView.submitEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sEnd"
/>
<p:calendar
validator=
"#{votingDateValidator.validateSubmit}"
value=
"#{votingCreateView.submitEnd}"
pattern=
"dd/MM/yyyy HH:mm"
id=
"sEnd"
/>
<h:message
for=
"sEnd"
/>
<h:message
for=
"sEnd"
/>
<h:commandButton
value=
"
Luo
"
/>
<h:commandButton
value=
"
#{i18n['voting.create.createButton']}
"
/>
</h:panelGrid>
</h:panelGrid>
</h:form>
</h:form>
...
...
code/LanBortalWeb/src/ValidationMessages_en.properties
View file @
91e9c54
...
@@ -2,3 +2,5 @@ user.nickSizeMessage=Nick has to be at least {min} characters long.
...
@@ -2,3 +2,5 @@ user.nickSizeMessage=Nick has to be at least {min} characters long.
user.emailregex
=
Field must contain an email address.
user.emailregex
=
Field must contain an email address.
javax.validation.constraints.NotNull.message
=
Field can not be empty
javax.validation.constraints.NotNull.message
=
Field can not be empty
voting.create.participantsError
=
Value must be 1 or over.
voting.create.nameError
=
Name must be longer than 3 chars.
code/LanBortalWeb/src/ValidationMessages_fi.properties
View file @
91e9c54
...
@@ -2,3 +2,5 @@ user.nickSizeMessage=Nimimerkin pit olla vhintn {min} merkki pitk.
...
@@ -2,3 +2,5 @@ user.nickSizeMessage=Nimimerkin pit olla vhintn {min} merkki pitk.
user.emailregex
=
Kentss pit olla shkpostiosoite.
user.emailregex
=
Kentss pit olla shkpostiosoite.
javax.validation.constraints.NotNull.message
=
Kentt ei saa olla tyhj
javax.validation.constraints.NotNull.message
=
Kentt ei saa olla tyhj
actionlog.message.tooshort
=
Kahva ei kelpaa! (Viestisi on liian lyhyt :)
actionlog.message.tooshort
=
Kahva ei kelpaa! (Viestisi on liian lyhyt :)
voting.create.participantsError
=
Osallistujia pit olla yksi tai enemmn.
voting.create.nameError
=
Nimen pit olla yli 3 merkki pitk.
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_en.properties
View file @
91e9c54
...
@@ -525,3 +525,16 @@ userview.userExists = Username already exists! please select another.
...
@@ -525,3 +525,16 @@ userview.userExists = Username already exists! please select another.
viewexpired.body
=
Please login again.
viewexpired.body
=
Please login again.
viewexpired.title
=
Login expired. Please login again.
viewexpired.title
=
Login expired. Please login again.
voting.create.compoEnd
=
End time
voting.create.compoStart
=
Start time
voting.create.createButton
=
Create
voting.create.dateValidatorEndDate
=
End time before start time.
voting.create.description
=
Description
voting.create.header
=
Create compo
voting.create.maxParticipants
=
Max participants
voting.create.name
=
Name
voting.create.submitEnd
=
Submit close
voting.create.submitStart
=
Submit start
voting.create.voteEnd
=
Voting close
voting.create.voteStart
=
Voting start
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
View file @
91e9c54
This diff is collapsed.
Click to expand it.
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/GenericCDIView.java
View file @
91e9c54
...
@@ -90,6 +90,7 @@ public abstract class GenericCDIView implements Serializable {
...
@@ -90,6 +90,7 @@ public abstract class GenericCDIView implements Serializable {
}
}
protected
void
addFaceMessage
(
String
string
,
Object
...
params
)
{
protected
void
addFaceMessage
(
String
string
,
Object
...
params
)
{
FacesContext
.
getCurrentInstance
().
addMessage
(
null
,
new
FacesMessage
(
I18n
.
get
(
string
,
params
)));
FacesContext
.
getCurrentInstance
().
addMessage
(
null
,
new
FacesMessage
(
I18n
.
get
(
string
,
params
)));
}
}
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/actionlog/ActionLogCreateView.java
View file @
91e9c54
...
@@ -19,6 +19,7 @@ public class ActionLogCreateView extends GenericCDIView {
...
@@ -19,6 +19,7 @@ public class ActionLogCreateView extends GenericCDIView {
@EJB
@EJB
private
ActionLogBeanLocal
actionLogBean
;
private
ActionLogBeanLocal
actionLogBean
;
@Size
(
min
=
4
,
message
=
"{actionlog.message.tooshort}"
)
@Size
(
min
=
4
,
message
=
"{actionlog.message.tooshort}"
)
private
String
message
;
private
String
message
;
private
Role
role
;
private
Role
role
;
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/content/PageOutputView.java
View file @
91e9c54
...
@@ -30,6 +30,12 @@ public class PageOutputView extends GenericCDIView {
...
@@ -30,6 +30,12 @@ public class PageOutputView extends GenericCDIView {
initView
();
initView
();
}
}
public
void
initView
(
String
name
)
{
this
.
name
=
name
;
initView
();
}
public
void
initView
()
{
public
void
initView
()
{
if
(
name
==
null
||
name
.
isEmpty
())
{
if
(
name
==
null
||
name
.
isEmpty
())
{
setContents
(
pagebean
.
findContentsForUser
(
id
));
setContents
(
pagebean
.
findContentsForUser
(
id
));
...
@@ -47,14 +53,6 @@ public class PageOutputView extends GenericCDIView {
...
@@ -47,14 +53,6 @@ public class PageOutputView extends GenericCDIView {
return
id
;
return
id
;
}
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
void
setId
(
Integer
id
)
{
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ProductShopView.java
View file @
91e9c54
...
@@ -50,20 +50,24 @@ public class ProductShopView extends GenericCDIView {
...
@@ -50,20 +50,24 @@ public class ProductShopView extends GenericCDIView {
@Inject
@Inject
private
BillListView
billListView
;
private
BillListView
billListView
;
public
void
initView
()
{
public
void
initBillView
()
boolean
ok
=
true
;
{
if
(!
permbean
.
isCurrentUser
(
user
))
{
if
(
requirePermissions
(
ShopPermission
.
LIST_USERPRODUCTS
))
{
ok
=
requirePermissions
(
ShopPermission
.
SHOP_TO_OTHERS
);
}
if
(
ok
&&
shoppingcart
==
null
)
{
if
(
permbean
.
hasPermission
(
ShopPermission
.
LIST_ALL_PRODUCTS
))
{
shoppingcart
=
new
ListDataModel
<
ProductShopItem
>(
ProductShopItem
.
productList
(
productBean
.
getProducts
()));
}
else
if
(
requirePermissions
(
ShopPermission
.
LIST_USERPRODUCTS
))
{
shoppingcart
=
new
ListDataModel
<
ProductShopItem
>(
ProductShopItem
.
productList
(
productBean
.
listUserShoppableProducts
()));
shoppingcart
=
new
ListDataModel
<
ProductShopItem
>(
ProductShopItem
.
productList
(
productBean
.
listUserShoppableProducts
()));
logger
.
debug
(
"Initialized billing shoppingcart to {}"
,
shoppingcart
);
this
.
beginConversation
();
}
}
}
logger
.
info
(
"Initialized shoppingcart to {}"
,
shoppingcart
);
public
void
initShopView
()
{
if
(
requirePermissions
(
ShopPermission
.
SHOP_TO_OTHERS
))
{
shoppingcart
=
new
ListDataModel
<
ProductShopItem
>(
ProductShopItem
.
productList
(
productBean
.
listUserShoppableProducts
()));
logger
.
debug
(
"Initialized shoppingcart to {}"
,
shoppingcart
);
this
.
beginConversation
();
this
.
beginConversation
();
}
}
}
}
public
String
add
(
Integer
count
)
public
String
add
(
Integer
count
)
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ReaderView.java
View file @
91e9c54
...
@@ -4,13 +4,16 @@ import java.util.List;
...
@@ -4,13 +4,16 @@ import java.util.List;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.faces.model.ListDataModel
;
import
javax.inject.Inject
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
javax.inject.Named
;
import
fi.insomnia.bortal.beans.ReaderBeanLocal
;
import
fi.insomnia.bortal.beans.ReaderBeanLocal
;
import
fi.insomnia.bortal.beans.UserBeanLocal
;
import
fi.insomnia.bortal.enums.apps.ShopPermission
;
import
fi.insomnia.bortal.enums.apps.ShopPermission
;
import
fi.insomnia.bortal.
model.Reader
;
import
fi.insomnia.bortal.
enums.apps.UserPermission
;
import
fi.insomnia.bortal.model.ReaderEvent
;
import
fi.insomnia.bortal.model.ReaderEvent
;
import
fi.insomnia.bortal.model.User
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
@Named
@Named
...
@@ -19,29 +22,51 @@ public class ReaderView extends GenericCDIView {
...
@@ -19,29 +22,51 @@ public class ReaderView extends GenericCDIView {
private
static
final
long
serialVersionUID
=
802344850073689859L
;
private
static
final
long
serialVersionUID
=
802344850073689859L
;
private
Integer
eventid
;
private
String
placecode
;
private
String
usersearch
;
private
ListDataModel
<
User
>
userlist
;
@Inject
@Inject
private
ReaderNameContainer
namecontainer
;
private
ReaderNameContainer
namecontainer
;
@EJB
@EJB
private
ReaderBeanLocal
readerbean
;
private
ReaderBeanLocal
readerbean
;
private
List
<
Reader
>
readers
;
private
ReaderEvent
event
;
public
void
initReaderList
()
{
@EJB
super
.
requirePermissions
(
ShopPermission
.
SHOP_TO_OTHERS
);
private
UserBeanLocal
userbean
;
public
void
initUserassocView
()
{
if
(
super
.
requirePermissions
(
UserPermission
.
CREATE_NEW
))
{
event
=
readerbean
.
getEvent
(
eventid
);
super
.
beginConversation
();
}
}
}
public
List
<
ReaderEvent
>
getReaderEvents
()
public
String
searchforuser
()
{
{
return
readerbean
.
getReaderEvents
(
namecontainer
.
getReaderId
());
if
(
usersearch
==
null
||
usersearch
.
length
()
<
2
)
{
super
.
addFaceMessage
(
"user.tooShortSearch"
);
}
else
{
userlist
=
new
ListDataModel
<
User
>(
userbean
.
getUsers
(
0
,
0
,
null
,
usersearch
).
getResults
());
}
}
public
List
<
Reader
>
getReaders
()
return
null
;
{
if
(
readers
==
null
)
{
readers
=
readerbean
.
getReaders
();
}
}
return
readers
;
public
void
initReaderList
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
SHOP_TO_OTHERS
))
{
}
}
public
List
<
ReaderEvent
>
getReaderEvents
()
{
return
readerbean
.
getReaderEvents
(
namecontainer
.
getReaderId
());
}
}
public
ReaderNameContainer
getNamecontainer
()
{
public
ReaderNameContainer
getNamecontainer
()
{
...
@@ -52,4 +77,44 @@ public class ReaderView extends GenericCDIView {
...
@@ -52,4 +77,44 @@ public class ReaderView extends GenericCDIView {
this
.
namecontainer
=
namecontainer
;
this
.
namecontainer
=
namecontainer
;
}
}
public
Integer
getEventid
()
{
return
eventid
;
}
public
void
setEventid
(
Integer
eventid
)
{
this
.
eventid
=
eventid
;
}
public
ReaderEvent
getEvent
()
{
return
event
;
}
public
void
setEvent
(
ReaderEvent
event
)
{
this
.
event
=
event
;
}
public
String
getPlacecode
()
{
return
placecode
;
}
public
void
setPlacecode
(
String
placecode
)
{
this
.
placecode
=
placecode
;
}
public
String
getUsersearch
()
{
return
usersearch
;
}
public
void
setUsersearch
(
String
usersearch
)
{
this
.
usersearch
=
usersearch
;
}
public
ListDataModel
<
User
>
getUserlist
()
{
return
userlist
;
}
public
void
setUserlist
(
ListDataModel
<
User
>
userlist
)
{
this
.
userlist
=
userlist
;
}
}
}
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/SalespointListView.java
0 → 100644
View file @
91e9c54
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
shop
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.faces.model.ListDataModel
;
import
javax.inject.Named
;
import
fi.insomnia.bortal.beans.SalespointBeanLocal
;
import
fi.insomnia.bortal.enums.apps.SalespointPermission
;
import
fi.insomnia.bortal.model.salespoint.Salespoint
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
/**
* Session Bean implementation class SalespointListView
*/
@Named
@ConversationScoped
public
class
SalespointListView
extends
GenericCDIView
{
@EJB
private
SalespointBeanLocal
salespointBean
;
private
static
final
long
serialVersionUID
=
-
8990414681240360892L
;
private
ListDataModel
<
Salespoint
>
salespoints
;
private
boolean
modifySalespoint
;
public
SalespointListView
()
{
}
public
void
init
()
{
if
(
super
.
requirePermissions
(
SalespointPermission
.
VIEW
))
{
beginConversation
();
salespoints
=
new
ListDataModel
<
Salespoint
>(
salespointBean
.
findAll
());
modifySalespoint
=
permbean
.
hasPermission
(
SalespointPermission
.
MODIFY
);
}
}
public
ListDataModel
<
Salespoint
>
getSalespoints
()
{
return
salespoints
;
}
public
void
setSalespoints
(
ListDataModel
<
Salespoint
>
salespoints
)
{
this
.
salespoints
=
salespoints
;
}
public
boolean
canEditSalespoint
()
{
return
modifySalespoint
;
}
}
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCreateView.java
View file @
91e9c54
...
@@ -7,6 +7,9 @@ import javax.faces.bean.ManagedBean;
...
@@ -7,6 +7,9 @@ import javax.faces.bean.ManagedBean;
import
javax.faces.bean.RequestScoped
;
import
javax.faces.bean.RequestScoped
;
import
javax.inject.Named
;
import
javax.inject.Named
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.Size
;
import
org.hibernate.validator.constraints.Length
;
import
fi.insomnia.bortal.beans.VotingBeanLocal
;
import
fi.insomnia.bortal.beans.VotingBeanLocal
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
...
@@ -24,10 +27,10 @@ public class VotingCreateView extends GenericCDIView {
...
@@ -24,10 +27,10 @@ public class VotingCreateView extends GenericCDIView {
@EJB
@EJB
private
VotingBeanLocal
votbean
;
private
VotingBeanLocal
votbean
;
@
Min
(
value
=
4
,
message
=
"Nimen pitää olla pidempi kuin 4 merkkiä.
"
)
@
Size
(
min
=
4
,
message
=
"{voting.create.nameError}
"
)
private
String
name
;
private
String
name
;
private
String
description
;
private
String
description
;
@Min
(
value
=
1
,
message
=
"
Min osallistujia 1.
"
)
@Min
(
value
=
1
,
message
=
"
{voting.create.participantsError}
"
)
private
Integer
maxParticipants
;
private
Integer
maxParticipants
;
private
Date
compoStart
;
private
Date
compoStart
;
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingDateValidator.java
View file @
91e9c54
...
@@ -10,11 +10,14 @@ import javax.faces.context.FacesContext;
...
@@ -10,11 +10,14 @@ import javax.faces.context.FacesContext;
import
javax.faces.validator.ValidatorException
;
import
javax.faces.validator.ValidatorException
;
import
javax.inject.Inject
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
javax.inject.Named
;
import
javax.servlet.jsp.tagext.ValidationMessage
;
import
org.eclipse.persistence.exceptions.ValidationException
;
import
org.eclipse.persistence.exceptions.ValidationException
;
import
org.hibernate.validator.util.LoggerFactory
;
import
org.hibernate.validator.util.LoggerFactory
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
fi.insomnia.bortal.utilities.I18n
;
@Named
@Named
@RequestScoped
@RequestScoped
...
@@ -34,7 +37,8 @@ public class VotingDateValidator implements Serializable {
...
@@ -34,7 +37,8 @@ public class VotingDateValidator implements Serializable {
//UIComponent foo = ui.findComponent("cStart");
//UIComponent foo = ui.findComponent("cStart");
//logger.info("uielement {} ", foo);
//logger.info("uielement {} ", foo);
if
(
endDate
.
before
(
cStart
))
{
if
(
endDate
.
before
(
cStart
))
{
message
(
new
FacesMessage
(
"Loppumispvm ennen alkua. KORJAA SE."
));
message
(
new
FacesMessage
(
I18n
.
get
(
"voting.create.dateValidatorEndDate"
)));
}
}
}
}
...
@@ -47,7 +51,7 @@ public class VotingDateValidator implements Serializable {
...
@@ -47,7 +51,7 @@ public class VotingDateValidator implements Serializable {
public
void
validateVote
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
public
void
validateVote
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
Date
endDate
=
(
Date
)
object
;
Date
endDate
=
(
Date
)
object
;
if
(
endDate
.
before
(
vStart
))
{
if
(
endDate
.
before
(
vStart
))
{
message
(
new
FacesMessage
(
"Loppumispvm ennen alkua. NOT VALID."
));
message
(
new
FacesMessage
(
I18n
.
get
(
"voting.create.dateValidatorEndDate"
)
));
}
}
}
}
...
@@ -58,7 +62,7 @@ public class VotingDateValidator implements Serializable {
...
@@ -58,7 +62,7 @@ public class VotingDateValidator implements Serializable {
public
void
validateSubmit
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
public
void
validateSubmit
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
Date
endDate
=
(
Date
)
object
;
Date
endDate
=
(
Date
)
object
;
if
(
endDate
.
before
(
sStart
))
{
if
(
endDate
.
before
(
sStart
))
{
message
(
new
FacesMessage
(
"Loppumispvm ennen aloitusta. IS AN ERROR."
));
message
(
new
FacesMessage
(
I18n
.
get
(
"voting.create.dateValidatorEndDate"
)
));
}
}
}
}
...
...
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