Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7e8a04f3
authored
May 12, 2012
by
Juho Salli
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.insomnia.fi:/data/bortal
2 parents
45a87859
dceb91a2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
138 additions
and
0 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/VotingBean.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/VotingBeanLocal.java
code/LanBortalWeb/WebContent/voting/addentry.xhtml
code/LanBortalWeb/src/ValidationMessages_fi.properties
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCompoAddEntryView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/VotingBean.java
View file @
7e8a04f
package
fi
.
insomnia
.
bortal
.
beans
;
package
fi
.
insomnia
.
bortal
.
beans
;
import
java.util.Calendar
;
import
java.util.List
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.ejb.LocalBean
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
javax.ejb.Stateless
;
import
fi.insomnia.bortal.facade.CompoEntryFacade
;
import
fi.insomnia.bortal.facade.CompoEntryFileFacade
;
import
fi.insomnia.bortal.facade.CompoFacade
;
import
fi.insomnia.bortal.facade.CompoFacade
;
import
fi.insomnia.bortal.facade.VoteFacade
;
import
fi.insomnia.bortal.facade.VoteFacade
;
import
fi.insomnia.bortal.model.Compo
;
import
fi.insomnia.bortal.model.Compo
;
import
fi.insomnia.bortal.model.CompoEntry
;
import
fi.insomnia.bortal.model.CompoEntry
;
import
fi.insomnia.bortal.model.CompoEntryFile
;
import
fi.insomnia.bortal.model.Vote
;
import
fi.insomnia.bortal.model.Vote
;
/**
/**
...
@@ -22,9 +26,15 @@ public class VotingBean implements VotingBeanLocal {
...
@@ -22,9 +26,15 @@ public class VotingBean implements VotingBeanLocal {
@EJB
@EJB
private
CompoFacade
compoFacade
;
private
CompoFacade
compoFacade
;
@EJB
@EJB
private
CompoEntryFacade
compoEntryFacade
;
@EJB
private
CompoEntryFileFacade
compoEntryFileFacade
;
@EJB
private
VoteFacade
voteFacade
;
private
VoteFacade
voteFacade
;
@EJB
@EJB
private
EventBean
eventBean
;
private
EventBean
eventBean
;
@EJB
private
PermissionBeanLocal
permissionBean
;
/**
/**
* Default constructor.
* Default constructor.
...
@@ -41,6 +51,14 @@ public class VotingBean implements VotingBeanLocal {
...
@@ -41,6 +51,14 @@ public class VotingBean implements VotingBeanLocal {
c
.
setEvent
(
eventBean
.
getCurrentEvent
());
c
.
setEvent
(
eventBean
.
getCurrentEvent
());
compoFacade
.
create
(
c
);
compoFacade
.
create
(
c
);
}
}
public
void
addEntry
(
CompoEntry
compoEntry
,
CompoEntryFile
compoEntryFile
)
{
compoEntry
.
setCreated
(
Calendar
.
getInstance
());
compoEntry
.
setCreator
(
permissionBean
.
getCurrentUser
());
compoEntryFacade
.
create
(
compoEntry
);
compoEntryFileFacade
.
create
(
compoEntryFile
);
}
public
List
<
Compo
>
getCompoList
()
{
public
List
<
Compo
>
getCompoList
()
{
return
compoFacade
.
getList
();
return
compoFacade
.
getList
();
...
...
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/VotingBeanLocal.java
View file @
7e8a04f
...
@@ -5,9 +5,12 @@ import java.util.List;
...
@@ -5,9 +5,12 @@ import java.util.List;
import
javax.ejb.Local
;
import
javax.ejb.Local
;
import
fi.insomnia.bortal.model.Compo
;
import
fi.insomnia.bortal.model.Compo
;
import
fi.insomnia.bortal.model.CompoEntry
;
import
fi.insomnia.bortal.model.CompoEntryFile
;
@Local
@Local
public
interface
VotingBeanLocal
{
public
interface
VotingBeanLocal
{
public
void
createCompo
(
Compo
c
);
public
void
createCompo
(
Compo
c
);
public
void
addEntry
(
CompoEntry
compoEntry
,
CompoEntryFile
compoEntryFile
);
public
List
<
Compo
>
getCompoList
();
public
List
<
Compo
>
getCompoList
();
}
}
code/LanBortalWeb/WebContent/voting/addentry.xhtml
0 → 100644
View file @
7e8a04f
<!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.compoentryadd.title']}
</h1>
<p>
#{i18n['voting.compoentryadd.description']}
</p>
<h:form
enctype=
"multipart/form-data"
>
<h:panelGrid
columns=
"3"
>
<h:outputLabel
value=
"#{i18n['voting.compoentryadd.entryname']}"
for=
"name"
/>
<h:inputText
value=
"#{votingCompoAddEntryView.name}"
id=
"name"
/>
<h:message
for=
"name"
/>
<h:outputLabel
value=
"#{i18n['voting.compoentryadd.notes']}"
for=
"notes"
/>
<h:inputTextarea
value=
"#{votingCompoAddEntryView.notes}"
id=
"notes"
/>
<h:message
for=
"notes"
/>
<h:outputLabel
value=
"#{i18n['voting.compoentryadd.screenmessage']}"
for=
"screenmessage"
/>
<h:inputTextarea
value=
"#{votingCompoAddEntryView.screenMessage}"
id=
"screenmessage"
/>
<h:message
for=
"screenmessage"
/>
<h:outputLabel
value=
"#{i18n['voting.compoentryadd.file']}"
for=
"uploadedfile"
/>
<p:fileUpload
value=
"#{votingCompoAddEntryView.uploadedFile}"
id=
"uploadedfile"
mode=
"simple"
/>
<h:message
for=
"uploadedfile"
/>
<h:commandButton
action=
"#{votingCompoAddEntryView.send()}"
value=
"moi"
/>
</h:panelGrid>
</h:form>
<div
class=
"clearfix"
></div>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/LanBortalWeb/src/ValidationMessages_fi.properties
View file @
7e8a04f
...
@@ -4,3 +4,4 @@ javax.validation.constraints.NotNull.message=Kentt ei saa olla tyhj
...
@@ -4,3 +4,4 @@ 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.participantsError
=
Osallistujia pit olla yksi tai enemmn.
voting.create.nameError
=
Nimen pit olla yli 3 merkki pitk.
voting.create.nameError
=
Nimen pit olla yli 3 merkki pitk.
javax.validation.constraints.NotEmpty.message
=
Kentt ei saa olla tyhj
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/voting/VotingCompoAddEntryView.java
0 → 100644
View file @
7e8a04f
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
voting
;
import
java.util.Calendar
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.RequestScoped
;
import
javax.faces.bean.ManagedBean
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
org.hibernate.validator.constraints.NotEmpty
;
import
org.primefaces.model.UploadedFile
;
import
fi.insomnia.bortal.beans.VotingBeanLocal
;
import
fi.insomnia.bortal.model.Compo
;
import
fi.insomnia.bortal.model.CompoEntry
;
import
fi.insomnia.bortal.model.CompoEntryFile
;
@ManagedBean
@RequestScoped
public
class
VotingCompoAddEntryView
{
@EJB
VotingBeanLocal
votingBean
;
@NotNull
private
String
name
;
private
String
notes
;
private
String
screenMessage
;
@NotNull
private
UploadedFile
uploadedFile
;
public
UploadedFile
getUploadedFile
()
{
return
uploadedFile
;
}
public
void
setUploadedFile
(
UploadedFile
uploadedFile
)
{
this
.
uploadedFile
=
uploadedFile
;
}
public
String
getScreenMessage
()
{
return
screenMessage
;
}
public
void
setScreenMessage
(
String
screenMessage
)
{
this
.
screenMessage
=
screenMessage
;
}
public
String
getNotes
()
{
return
notes
;
}
public
void
setNotes
(
String
notes
)
{
this
.
notes
=
notes
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
void
send
()
{
CompoEntry
compoEntry
=
new
CompoEntry
();
compoEntry
.
setName
(
name
);
compoEntry
.
setNotes
(
notes
);
compoEntry
.
setScreenMessage
(
screenMessage
);
compoEntry
.
setCompo
(
null
);
CompoEntryFile
cef
=
new
CompoEntryFile
(
compoEntry
);
cef
.
setFileData
(
this
.
uploadedFile
.
getContents
());
cef
.
setFileName
(
uploadedFile
.
getFileName
());
votingBean
.
addEntry
(
compoEntry
,
cef
);
}
}
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