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 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
;
package
fi
.
insomnia
.
bortal
.
beans
;
import
javax.ejb.Local
;
import
javax.ejb.Local
;
@Local
import
fi.insomnia.bortal.model.Compo
;
public
interface
VotingBeanLocal
{
@Local
}
public
interface
VotingBeanLocal
{
public
void
createCompo
(
Compo
c
);
}
code/LanBortalWeb/WebContent/voting/create.xhtml
View file @
66f784a
<!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:users=
"http://java.sun.com/jsf/composite/cditools/user"
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"
>
xmlns:p=
"http://primefaces.org/ui"
>
<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="#{newsListView.initView}" /-->
<!-- f:event type="preRenderView" listener="#{newsListView.initView}" /-->
</f:metadata>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<!-- <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> -->
<h1>
#{i18n['voting.create.header']}
</h1>
<h1>
#{i18n['voting.create.header']}
</h1>
<p>
#{i18n['voting.create.description']}
</p>
<p>
#{i18n['voting.create.description']}
</p>
<div>
<div>
<h:form>
<h:form>
<h:panelGrid
columns=
"3"
>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
value=
"#{i18n['voting.create.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=
"#{i18n['voting.create.description']}:"
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=
"#{i18n['voting.create.maxParticipants']}:"
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=
"#{i18n['voting.create.compoStart']}:"
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=
"#{i18n['voting.create.compoEnd']}:"
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=
"#{i18n['voting.create.voteStart']}:"
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=
"#{i18n['voting.create.voteEnd']}:"
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=
"#{i18n['voting.create.submitStart']}:"
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=
"#{i18n['voting.create.submitEnd']}:"
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=
"#{i18n['voting.create.createButton']}"
/>
<h:commandButton
action=
"#{votingCreateView.send}"
value=
"#{i18n['voting.create.createButton']}"
/>
</h:panelGrid>
</h:panelGrid>
</h:form>
</h:form>
</div>
</div>
<div
class=
"clearfix"
></div>
<div
class=
"clearfix"
></div>
</ui:define>
</ui:define>
</ui:composition>
</ui:composition>
</h:body>
</h:body>
</html>
</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
;
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
voting
;
import
java.util.Date
;
import
java.util.Calendar
;
import
java.util.Date
;
import
javax.ejb.EJB
;
import
javax.faces.bean.ManagedBean
;
import
javax.ejb.EJB
;
import
javax.faces.bean.RequestScoped
;
import
javax.faces.bean.ManagedBean
;
import
javax.inject.Named
;
import
javax.faces.bean.RequestScoped
;
import
javax.validation.constraints.Min
;
import
javax.inject.Named
;
import
javax.validation.constraints.Size
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.Size
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.Length
;
import
fi.insomnia.bortal.beans.VotingBeanLocal
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
import
fi.insomnia.bortal.beans.VotingBeanLocal
;
import
fi.insomnia.bortal.model.Compo
;
@ManagedBean
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
@Named
@RequestScoped
@ManagedBean
public
class
VotingCreateView
extends
GenericCDIView
{
@Named
@RequestScoped
/**
public
class
VotingCreateView
extends
GenericCDIView
{
*
*/
/**
private
static
final
long
serialVersionUID
=
4677679766671547462L
;
*
*/
@EJB
private
static
final
long
serialVersionUID
=
4677679766671547462L
;
private
VotingBeanLocal
votbean
;
@EJB
@Size
(
min
=
4
,
message
=
"{voting.create.nameError}"
)
private
VotingBeanLocal
votbean
;
private
String
name
;
private
String
description
;
@Size
(
min
=
4
,
message
=
"{voting.create.nameError}"
)
@Min
(
value
=
1
,
message
=
"{voting.create.participantsError}"
)
private
String
name
;
private
Integer
maxParticipants
;
private
String
description
;
private
Date
compoStart
;
@Min
(
value
=
1
,
message
=
"{voting.create.participantsError}"
)
private
Integer
maxParticipants
;
private
Date
compoEnd
;
private
Date
voteStart
;
private
Calendar
compoStart
;
private
Date
voteEnd
;
private
Calendar
compoEnd
;
private
Date
submitStart
;
private
Calendar
voteStart
;
private
Date
submitEnd
;
private
Calendar
voteEnd
;
private
Calendar
submitStart
;
public
String
getName
()
{
private
Calendar
submitEnd
;
return
name
;
}
public
String
getName
()
{
public
void
setName
(
String
name
)
{
return
name
;
this
.
name
=
name
;
}
}
public
void
setName
(
String
name
)
{
public
String
getDescription
()
{
this
.
name
=
name
;
return
description
;
}
}
public
String
getDescription
()
{
public
void
setDescription
(
String
description
)
{
return
description
;
this
.
description
=
description
;
}
}
public
void
setDescription
(
String
description
)
{
public
Integer
getMaxParticipants
()
{
this
.
description
=
description
;
return
maxParticipants
;
}
}
public
Integer
getMaxParticipants
()
{
public
void
setMaxParticipants
(
Integer
maxParticipants
)
{
return
maxParticipants
;
this
.
maxParticipants
=
maxParticipants
;
}
}
public
void
setMaxParticipants
(
Integer
maxParticipants
)
{
public
Date
getCompoStart
()
{
this
.
maxParticipants
=
maxParticipants
;
return
compoStart
;
}
}
public
Calendar
getCompoStart
()
{
public
void
setCompoStart
(
Date
compoStart
)
{
return
compoStart
;
this
.
compoStart
=
compoStart
;
}
}
public
void
setCompoStart
(
Calendar
compoStart
)
{
public
Date
getCompoEnd
()
{
this
.
compoStart
=
compoStart
;
return
compoEnd
;
}
}
public
Calendar
getCompoEnd
()
{
public
void
setCompoEnd
(
Date
compoEnd
)
{
return
compoEnd
;
this
.
compoEnd
=
compoEnd
;
}
}
public
void
setCompoEnd
(
Calendar
compoEnd
)
{
public
Date
getVoteStart
()
{
this
.
compoEnd
=
compoEnd
;
return
voteStart
;
}
}
public
Calendar
getVoteStart
()
{
public
void
setVoteStart
(
Date
voteStart
)
{
return
voteStart
;
this
.
voteStart
=
voteStart
;
}
}
public
void
setVoteStart
(
Calendar
voteStart
)
{
public
Date
getVoteEnd
()
{
this
.
voteStart
=
voteStart
;
return
voteEnd
;
}
}
public
Calendar
getVoteEnd
()
{
public
void
setVoteEnd
(
Date
voteEnd
)
{
return
voteEnd
;
this
.
voteEnd
=
voteEnd
;
}
}
public
void
setVoteEnd
(
Calendar
voteEnd
)
{
public
Date
getSubmitStart
()
{
this
.
voteEnd
=
voteEnd
;
return
submitStart
;
}
}
public
Calendar
getSubmitStart
()
{
public
void
setSubmitStart
(
Date
submitStart
)
{
return
submitStart
;
this
.
submitStart
=
submitStart
;
}
}
public
void
setSubmitStart
(
Calendar
submitStart
)
{
public
Date
getSubmitEnd
()
{
this
.
submitStart
=
submitStart
;
return
submitEnd
;
}
}
public
Calendar
getSubmitEnd
()
{
public
void
setSubmitEnd
(
Date
submitEnd
)
{
return
submitEnd
;
this
.
submitEnd
=
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