Commit 62422ab9 by Juho Salli

Kantaan (melkein) kirjoittuu compo

1 parent c76e8049
...@@ -51,7 +51,7 @@ public class Compo extends GenericEntity { ...@@ -51,7 +51,7 @@ public class Compo extends GenericEntity {
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Calendar startTime; private Calendar startTime;
@Column(name = "compo_start") @Column(name = "compo_end")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Calendar endTime; private Calendar endTime;
......
...@@ -4,8 +4,9 @@ import java.util.Calendar; ...@@ -4,8 +4,9 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.enterprise.context.RequestScoped;
import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedBean;
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 javax.validation.constraints.Size;
...@@ -35,12 +36,12 @@ public class VotingCreateView extends GenericCDIView { ...@@ -35,12 +36,12 @@ public class VotingCreateView extends GenericCDIView {
@Min(value=1, message="{voting.create.participantsError}") @Min(value=1, message="{voting.create.participantsError}")
private Integer maxParticipants; private Integer maxParticipants;
private Calendar compoStart; private Date compoStart;
private Calendar compoEnd; private Date compoEnd;
private Calendar voteStart; private Date voteStart;
private Calendar voteEnd; private Date voteEnd;
private Calendar submitStart; private Date submitStart;
private Calendar submitEnd; private Date submitEnd;
public String getName() { public String getName() {
return name; return name;
...@@ -60,40 +61,40 @@ public class VotingCreateView extends GenericCDIView { ...@@ -60,40 +61,40 @@ public class VotingCreateView extends GenericCDIView {
public void setMaxParticipants(Integer maxParticipants) { public void setMaxParticipants(Integer maxParticipants) {
this.maxParticipants = maxParticipants; this.maxParticipants = maxParticipants;
} }
public Calendar getCompoStart() { public Date getCompoStart() {
return compoStart; return compoStart;
} }
public void setCompoStart(Calendar compoStart) { public void setCompoStart(Date compoStart) {
this.compoStart = compoStart; this.compoStart = compoStart;
} }
public Calendar getCompoEnd() { public Date getCompoEnd() {
return compoEnd; return compoEnd;
} }
public void setCompoEnd(Calendar compoEnd) { public void setCompoEnd(Date compoEnd) {
this.compoEnd = compoEnd; this.compoEnd = compoEnd;
} }
public Calendar getVoteStart() { public Date getVoteStart() {
return voteStart; return voteStart;
} }
public void setVoteStart(Calendar voteStart) { public void setVoteStart(Date voteStart) {
this.voteStart = voteStart; this.voteStart = voteStart;
} }
public Calendar getVoteEnd() { public Date getVoteEnd() {
return voteEnd; return voteEnd;
} }
public void setVoteEnd(Calendar voteEnd) { public void setVoteEnd(Date voteEnd) {
this.voteEnd = voteEnd; this.voteEnd = voteEnd;
} }
public Calendar getSubmitStart() { public Date getSubmitStart() {
return submitStart; return submitStart;
} }
public void setSubmitStart(Calendar submitStart) { public void setSubmitStart(Date submitStart) {
this.submitStart = submitStart; this.submitStart = submitStart;
} }
public Calendar getSubmitEnd() { public Date getSubmitEnd() {
return submitEnd; return submitEnd;
} }
public void setSubmitEnd(Calendar submitEnd) { public void setSubmitEnd(Date submitEnd) {
this.submitEnd = submitEnd; this.submitEnd = submitEnd;
} }
...@@ -102,12 +103,30 @@ public class VotingCreateView extends GenericCDIView { ...@@ -102,12 +103,30 @@ public class VotingCreateView extends GenericCDIView {
co.setName(name); co.setName(name);
co.setDescription(description); co.setDescription(description);
co.setMaxParticipantCount(maxParticipants); co.setMaxParticipantCount(maxParticipants);
co.setStartTime(compoStart);
// tässä laitetaan loppumisaika Calendar ct = Calendar.getInstance();
co.setVoteStart(voteStart); ct.setTime(compoStart);
co.setVoteEnd(voteEnd); co.setStartTime(ct);
co.setSubmitStart(submitStart);
co.setSubmitEnd(submitEnd); 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); votbean.createCompo(co);
return "success."; return "success.";
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!