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 66f784a9
authored
May 12, 2012
by
Juho Salli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compon luontia beaneihi
1 parent
74c80ebc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
196 additions
and
176 deletions
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/VotingBeanLocal.java
code/LanBortalWeb/WebContent/voting/create.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCreateView.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/VotingBeanLocal.java
View file @
66f784a
package
fi
.
insomnia
.
bortal
.
beans
;
import
javax.ejb.Local
;
@Local
public
interface
VotingBeanLocal
{
}
package
fi
.
insomnia
.
bortal
.
beans
;
import
javax.ejb.Local
;
import
fi.insomnia.bortal.model.Compo
;
@Local
public
interface
VotingBeanLocal
{
public
void
createCompo
(
Compo
c
);
}
code/LanBortalWeb/WebContent/voting/create.xhtml
View file @
66f784a
<!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: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:p=
"http://primefaces.org/ui"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<!-- f:event type="preRenderView" listener="#{newsListView.initView}" /-->
</f:metadata>
<ui:define
name=
"content"
>
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<h1>
#{i18n['voting.create.header']}
</h1>
<p>
#{i18n['voting.create.description']}
</p>
<div>
<h:form>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
value=
"#{i18n['voting.create.name']}:"
for=
"name"
/>
<h:inputText
value=
"#{votingCreateView.name}"
id=
"name"
/>
<h:message
for=
"name"
/>
<h:outputLabel
value=
"#{i18n['voting.create.description']}:"
for=
"desc"
/>
<h:inputText
value=
"#{votingCreateView.description}"
id=
"desc"
/>
<h:message
for=
"desc"
/>
<h:outputLabel
value=
"#{i18n['voting.create.maxParticipants']}:"
for=
"maxPar"
/>
<h:inputText
value=
"#{votingCreateView.maxParticipants}"
id=
"maxPar"
/>
<h:message
for=
"maxPar"
/>
<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"
/>
<h:message
for=
"cStart"
/>
<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"
/>
<h:message
for=
"cEnd"
/>
<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"
/>
<h:message
for=
"vStart"
/>
<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"
/>
<h:message
for=
"vEnd"
/>
<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"
/>
<h:message
for=
"sStart"
/>
<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"
/>
<h:message
for=
"sEnd"
/>
<h:commandButton
value=
"#{i18n['voting.create.createButton']}"
/>
</h:panelGrid>
</h:form>
</div>
<div
class=
"clearfix"
></div>
</ui:define>
</ui:composition>
</h:body>
<!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: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:p=
"http://primefaces.org/ui"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<!-- f:event type="preRenderView" listener="#{newsListView.initView}" /-->
</f:metadata>
<ui:define
name=
"content"
>
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<h1>
#{i18n['voting.create.header']}
</h1>
<p>
#{i18n['voting.create.description']}
</p>
<div>
<h:form>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
value=
"#{i18n['voting.create.name']}:"
for=
"name"
/>
<h:inputText
value=
"#{votingCreateView.name}"
id=
"name"
/>
<h:message
for=
"name"
/>
<h:outputLabel
value=
"#{i18n['voting.create.description']}:"
for=
"desc"
/>
<h:inputText
value=
"#{votingCreateView.description}"
id=
"desc"
/>
<h:message
for=
"desc"
/>
<h:outputLabel
value=
"#{i18n['voting.create.maxParticipants']}:"
for=
"maxPar"
/>
<h:inputText
value=
"#{votingCreateView.maxParticipants}"
id=
"maxPar"
/>
<h:message
for=
"maxPar"
/>
<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"
/>
<h:message
for=
"cStart"
/>
<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"
/>
<h:message
for=
"cEnd"
/>
<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"
/>
<h:message
for=
"vStart"
/>
<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"
/>
<h:message
for=
"vEnd"
/>
<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"
/>
<h:message
for=
"sStart"
/>
<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"
/>
<h:message
for=
"sEnd"
/>
<h:commandButton
action=
"#{votingCreateView.send}"
value=
"#{i18n['voting.create.createButton']}"
/>
</h:panelGrid>
</h:form>
</div>
<div
class=
"clearfix"
></div>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCreateView.java
View file @
66f784a
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
voting
;
import
java.util.Date
;
import
javax.ejb.EJB
;
import
javax.faces.bean.ManagedBean
;
import
javax.faces.bean.RequestScoped
;
import
javax.inject.Named
;
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.web.cdiview.GenericCDIView
;
@ManagedBean
@Named
@RequestScoped
public
class
VotingCreateView
extends
GenericCDIView
{
/**
*
*/
private
static
final
long
serialVersionUID
=
4677679766671547462L
;
@EJB
private
VotingBeanLocal
votbean
;
@Size
(
min
=
4
,
message
=
"{voting.create.nameError}"
)
private
String
name
;
private
String
description
;
@Min
(
value
=
1
,
message
=
"{voting.create.participantsError}"
)
private
Integer
maxParticipants
;
private
Date
compoStart
;
private
Date
compoEnd
;
private
Date
voteStart
;
private
Date
voteEnd
;
private
Date
submitStart
;
private
Date
submitEnd
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
Integer
getMaxParticipants
()
{
return
maxParticipants
;
}
public
void
setMaxParticipants
(
Integer
maxParticipants
)
{
this
.
maxParticipants
=
maxParticipants
;
}
public
Date
getCompoStart
()
{
return
compoStart
;
}
public
void
setCompoStart
(
Date
compoStart
)
{
this
.
compoStart
=
compoStart
;
}
public
Date
getCompoEnd
()
{
return
compoEnd
;
}
public
void
setCompoEnd
(
Date
compoEnd
)
{
this
.
compoEnd
=
compoEnd
;
}
public
Date
getVoteStart
()
{
return
voteStart
;
}
public
void
setVoteStart
(
Date
voteStart
)
{
this
.
voteStart
=
voteStart
;
}
public
Date
getVoteEnd
()
{
return
voteEnd
;
}
public
void
setVoteEnd
(
Date
voteEnd
)
{
this
.
voteEnd
=
voteEnd
;
}
public
Date
getSubmitStart
()
{
return
submitStart
;
}
public
void
setSubmitStart
(
Date
submitStart
)
{
this
.
submitStart
=
submitStart
;
}
public
Date
getSubmitEnd
()
{
return
submitEnd
;
}
public
void
setSubmitEnd
(
Date
submitEnd
)
{
this
.
submitEnd
=
submitEnd
;
}
}
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
voting
;
import
java.util.Calendar
;
import
java.util.Date
;
import
javax.ejb.EJB
;
import
javax.faces.bean.ManagedBean
;
import
javax.faces.bean.RequestScoped
;
import
javax.inject.Named
;
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.model.Compo
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
@ManagedBean
@Named
@RequestScoped
public
class
VotingCreateView
extends
GenericCDIView
{
/**
*
*/
private
static
final
long
serialVersionUID
=
4677679766671547462L
;
@EJB
private
VotingBeanLocal
votbean
;
@Size
(
min
=
4
,
message
=
"{voting.create.nameError}"
)
private
String
name
;
private
String
description
;
@Min
(
value
=
1
,
message
=
"{voting.create.participantsError}"
)
private
Integer
maxParticipants
;
private
Calendar
compoStart
;
private
Calendar
compoEnd
;
private
Calendar
voteStart
;
private
Calendar
voteEnd
;
private
Calendar
submitStart
;
private
Calendar
submitEnd
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
Integer
getMaxParticipants
()
{
return
maxParticipants
;
}
public
void
setMaxParticipants
(
Integer
maxParticipants
)
{
this
.
maxParticipants
=
maxParticipants
;
}
public
Calendar
getCompoStart
()
{
return
compoStart
;
}
public
void
setCompoStart
(
Calendar
compoStart
)
{
this
.
compoStart
=
compoStart
;
}
public
Calendar
getCompoEnd
()
{
return
compoEnd
;
}
public
void
setCompoEnd
(
Calendar
compoEnd
)
{
this
.
compoEnd
=
compoEnd
;
}
public
Calendar
getVoteStart
()
{
return
voteStart
;
}
public
void
setVoteStart
(
Calendar
voteStart
)
{
this
.
voteStart
=
voteStart
;
}
public
Calendar
getVoteEnd
()
{
return
voteEnd
;
}
public
void
setVoteEnd
(
Calendar
voteEnd
)
{
this
.
voteEnd
=
voteEnd
;
}
public
Calendar
getSubmitStart
()
{
return
submitStart
;
}
public
void
setSubmitStart
(
Calendar
submitStart
)
{
this
.
submitStart
=
submitStart
;
}
public
Calendar
getSubmitEnd
()
{
return
submitEnd
;
}
public
void
setSubmitEnd
(
Calendar
submitEnd
)
{
this
.
submitEnd
=
submitEnd
;
}
public
String
send
(){
Compo
co
=
new
Compo
();
co
.
setName
(
name
);
co
.
setDescription
(
description
);
co
.
setMaxParticipantCount
(
maxParticipants
);
co
.
setStartTime
(
compoStart
);
// tässä laitetaan loppumisaika
co
.
setVoteStart
(
voteStart
);
co
.
setVoteEnd
(
voteEnd
);
co
.
setSubmitStart
(
submitStart
);
co
.
setSubmitEnd
(
submitEnd
);
votbean
.
createCompo
(
co
);
return
"success."
;
}
}
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