Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
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 5d3fcbb0
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
8fdabbb1
62422ab9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
216 additions
and
177 deletions
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/VotingBeanLocal.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Compo.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 @
5d3fcbb
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/LanBortalDatabase/src/fi/insomnia/bortal/model/Compo.java
View file @
5d3fcbb
...
...
@@ -51,7 +51,7 @@ public class Compo extends GenericEntity {
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
startTime
;
@Column
(
name
=
"compo_
start
"
)
@Column
(
name
=
"compo_
end
"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
endTime
;
...
...
code/LanBortalWeb/WebContent/voting/create.xhtml
View file @
5d3fcbb
<!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 @
5d3fcbb
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.enterprise.context.ConversationScoped
;
import
javax.enterprise.context.RequestScoped
;
import
javax.faces.bean.ManagedBean
;
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
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
;
}
public
String
send
(){
Compo
co
=
new
Compo
();
co
.
setName
(
name
);
co
.
setDescription
(
description
);
co
.
setMaxParticipantCount
(
maxParticipants
);
Calendar
ct
=
Calendar
.
getInstance
();
ct
.
setTime
(
compoStart
);
co
.
setStartTime
(
ct
);
Calendar
ce
=
Calendar
.
getInstance
();
ce
.
setTime
(
compoEnd
);
co
.
setEndTime
(
ce
);
Calendar
vs
=
Calendar
.
getInstance
();
vs
.
setTime
(
voteStart
);
co
.
setVoteStart
(
vs
);
Calendar
ve
=
Calendar
.
getInstance
();
ve
.
setTime
(
voteEnd
);
co
.
setVoteEnd
(
ve
);
Calendar
ss
=
Calendar
.
getInstance
();
ss
.
setTime
(
submitStart
);
co
.
setSubmitStart
(
ss
);
Calendar
se
=
Calendar
.
getInstance
();
se
.
setTime
(
submitEnd
);
co
.
setSubmitEnd
(
se
);
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