Skip to content

Commit caea00f

Browse files
committed
Merge branch 'registration' of https://github.com/secondsun/ting
2 parents 1576e2a + d798c67 commit caea00f

12 files changed

Lines changed: 523 additions & 258 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.devnexus.ting.model;
2+
3+
import com.devnexus.ting.model.BaseModelObject;
4+
import com.devnexus.ting.model.Event;
5+
import java.util.HashSet;
6+
import java.util.Set;
7+
import javax.persistence.Cacheable;
8+
import javax.persistence.CascadeType;
9+
import javax.persistence.Entity;
10+
import javax.persistence.ManyToMany;
11+
import javax.persistence.ManyToOne;
12+
import javax.validation.constraints.NotNull;
13+
import javax.xml.bind.annotation.XmlAccessType;
14+
import javax.xml.bind.annotation.XmlAccessorType;
15+
import javax.xml.bind.annotation.XmlRootElement;
16+
import javax.xml.bind.annotation.XmlTransient;
17+
import org.hibernate.annotations.Cache;
18+
import org.hibernate.annotations.CacheConcurrencyStrategy;
19+
20+
@Entity
21+
@XmlRootElement
22+
@XmlAccessorType(XmlAccessType.FIELD)
23+
public class EventSignup extends BaseModelObject {
24+
25+
@ManyToMany(cascade = CascadeType.ALL)
26+
private Set<PurchaseGroup> groups = new HashSet<>();
27+
28+
@ManyToOne
29+
//@JoinColumn(name="EVENT_ID")
30+
@NotNull
31+
@XmlTransient
32+
private Event event;
33+
34+
public Set<PurchaseGroup> getGroups() {
35+
return groups;
36+
}
37+
38+
public void setGroups(Set<PurchaseGroup> groups) {
39+
this.groups = groups;
40+
}
41+
42+
public Event getEvent() {
43+
return event;
44+
}
45+
46+
public void setEvent(Event event) {
47+
this.event = event;
48+
}
49+
50+
51+
52+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package com.devnexus.ting.model;
2+
3+
import com.devnexus.ting.model.BaseModelObject;
4+
import com.devnexus.ting.model.Event;
5+
import java.util.HashSet;
6+
import java.util.Set;
7+
import javax.persistence.Cacheable;
8+
import javax.persistence.CascadeType;
9+
import javax.persistence.Entity;
10+
import javax.persistence.ManyToMany;
11+
import javax.persistence.ManyToOne;
12+
import javax.validation.constraints.NotNull;
13+
import javax.validation.constraints.Size;
14+
import javax.xml.bind.annotation.XmlAccessType;
15+
import javax.xml.bind.annotation.XmlAccessorType;
16+
import javax.xml.bind.annotation.XmlRootElement;
17+
import javax.xml.bind.annotation.XmlTransient;
18+
import org.hibernate.annotations.Cache;
19+
import org.hibernate.annotations.CacheConcurrencyStrategy;
20+
import org.hibernate.validator.constraints.NotEmpty;
21+
22+
/**
23+
* A purchase group is a collection if Items of which only one may be purchased.
24+
*
25+
* @author summers
26+
*/
27+
@Entity
28+
@XmlRootElement
29+
@XmlAccessorType(XmlAccessType.FIELD)
30+
public class PurchaseGroup extends BaseModelObject {
31+
32+
@ManyToMany(cascade = CascadeType.ALL)
33+
private Set<PurchaseItem> items = new HashSet<>();
34+
35+
@ManyToOne
36+
//@JoinColumn(name="EVENT_ID")
37+
@NotNull
38+
@XmlTransient
39+
private Event event;
40+
41+
@NotEmpty
42+
@Size(max = 255)
43+
protected String label;
44+
45+
@ManyToOne
46+
@XmlTransient
47+
protected EventSignup eventSignup;
48+
49+
public Set<PurchaseItem> getItems() {
50+
return items;
51+
}
52+
53+
public void setItems(Set<PurchaseItem> items) {
54+
this.items = items;
55+
}
56+
57+
public Event getEvent() {
58+
return event;
59+
}
60+
61+
public void setEvent(Event event) {
62+
this.event = event;
63+
}
64+
65+
public String getLabel() {
66+
return label;
67+
}
68+
69+
public void setLabel(String label) {
70+
this.label = label;
71+
}
72+
73+
public EventSignup getEventSignup() {
74+
return eventSignup;
75+
}
76+
77+
public void setEventSignup(EventSignup eventSignup) {
78+
this.eventSignup = eventSignup;
79+
}
80+
81+
82+
83+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package com.devnexus.ting.model;
2+
3+
4+
import com.devnexus.ting.model.BaseModelObject;
5+
import com.devnexus.ting.model.Event;
6+
import java.math.BigDecimal;
7+
import java.util.Date;
8+
import javax.persistence.Cacheable;
9+
import javax.persistence.Entity;
10+
import javax.persistence.ManyToOne;
11+
import javax.persistence.Temporal;
12+
import javax.persistence.TemporalType;
13+
import javax.validation.constraints.NotNull;
14+
import javax.validation.constraints.Size;
15+
import javax.xml.bind.annotation.XmlAccessType;
16+
import javax.xml.bind.annotation.XmlAccessorType;
17+
import javax.xml.bind.annotation.XmlRootElement;
18+
import javax.xml.bind.annotation.XmlTransient;
19+
import org.hibernate.annotations.Cache;
20+
import org.hibernate.annotations.CacheConcurrencyStrategy;
21+
import org.hibernate.validator.constraints.NotEmpty;
22+
23+
@Entity
24+
@XmlRootElement
25+
@XmlAccessorType(XmlAccessType.FIELD)
26+
public class PurchaseItem extends BaseModelObject {
27+
28+
@ManyToOne
29+
@XmlTransient
30+
private PurchaseGroup purchaseGroup;
31+
32+
@ManyToOne
33+
//@JoinColumn(name="EVENT_ID")
34+
@NotNull
35+
@XmlTransient
36+
private Event event;
37+
38+
@NotEmpty
39+
@Size(max = 255)
40+
protected String label;
41+
42+
@Size(max = 255)
43+
private String value;
44+
45+
@NotNull
46+
private BigDecimal price;
47+
48+
@Temporal(TemporalType.DATE)
49+
private Date openDate;
50+
51+
@Temporal(TemporalType.DATE)
52+
private Date closeDate;
53+
54+
public PurchaseGroup getPurchaseGroup() {
55+
return purchaseGroup;
56+
}
57+
58+
public void setPurchaseGroup(PurchaseGroup purchaseGroup) {
59+
this.purchaseGroup = purchaseGroup;
60+
}
61+
62+
public Event getEvent() {
63+
return event;
64+
}
65+
66+
public void setEvent(Event event) {
67+
this.event = event;
68+
}
69+
70+
public String getLabel() {
71+
return label;
72+
}
73+
74+
public void setLabel(String label) {
75+
this.label = label;
76+
}
77+
78+
public BigDecimal getPrice() {
79+
return price;
80+
}
81+
82+
public void setPrice(BigDecimal price) {
83+
this.price = price;
84+
}
85+
86+
public Date getOpenDate() {
87+
return openDate;
88+
}
89+
90+
public void setOpenDate(Date openDate) {
91+
this.openDate = openDate;
92+
}
93+
94+
public Date getCloseDate() {
95+
return closeDate;
96+
}
97+
98+
public void setCloseDate(Date closeDate) {
99+
this.closeDate = closeDate;
100+
}
101+
102+
103+
104+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.devnexus.ting.repository;
2+
3+
import com.devnexus.ting.model.EventSignup;
4+
import com.devnexus.ting.repository.BaseRepository;
5+
6+
public interface EventSignupRepository extends BaseRepository<EventSignup, Long>, EventSignupRepositoryCustom {
7+
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.devnexus.ting.repository;
2+
3+
import com.devnexus.ting.model.EventSignup;
4+
5+
public interface EventSignupRepositoryCustom {
6+
7+
EventSignup getByEventKey(String eventKey);
8+
9+
10+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2002-2011 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.devnexus.ting.repository.jpa;
17+
18+
import com.devnexus.ting.repository.EventSignupRepositoryCustom;
19+
import com.devnexus.ting.model.EventSignup;
20+
import javax.persistence.EntityManager;
21+
import javax.persistence.PersistenceContext;
22+
import org.springframework.stereotype.Repository;
23+
24+
@Repository("eventSignupDao")
25+
public class EventSignupRepositoryImpl
26+
implements EventSignupRepositoryCustom {
27+
28+
29+
@PersistenceContext
30+
private EntityManager entityManager;
31+
32+
33+
@Override
34+
public EventSignup getByEventKey(String eventKey) {
35+
return entityManager.createQuery("select es from EventSignup es "
36+
+ " join es.event e "
37+
+ "where e.eventKey = :eventKey", EventSignup.class)
38+
.setParameter("eventKey", eventKey)
39+
.getSingleResult();
40+
}
41+
42+
}

src/main/java/com/devnexus/ting/web/config/PersistenceConfig.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public class PersistenceConfig {
5757
public Jaxb2Marshaller jaxbMarshaller() {
5858
Jaxb2Marshaller jaxbMarshaller = new Jaxb2Marshaller();
5959
jaxbMarshaller.setClassesToBeBound(
60+
6061
com.devnexus.ting.model.Evaluation.class,
6162
com.devnexus.ting.model.EvaluationList.class,
6263
com.devnexus.ting.model.Event.class,
@@ -71,7 +72,9 @@ public Jaxb2Marshaller jaxbMarshaller() {
7172
com.devnexus.ting.model.SpeakerList.class,
7273
com.devnexus.ting.model.ScheduleItemType.class,
7374
com.devnexus.ting.model.CfpSubmission.class,
74-
com.devnexus.ting.model.CfpSubmissionList.class
75+
com.devnexus.ting.model.CfpSubmissionList.class,
76+
com.devnexus.ting.model.PurchaseGroup.class,
77+
com.devnexus.ting.model.PurchaseItem.class
7578
);
7679
return jaxbMarshaller;
7780
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2002-2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.devnexus.ting.web.controller.admin;
17+
18+
19+
import javax.servlet.http.HttpServletRequest;
20+
import javax.validation.Validator;
21+
22+
import org.springframework.beans.factory.annotation.Autowired;
23+
import org.springframework.stereotype.Controller;
24+
import org.springframework.ui.ModelMap;
25+
import org.springframework.web.bind.annotation.RequestMapping;
26+
import org.springframework.web.bind.annotation.RequestMethod;
27+
import org.springframework.web.bind.annotation.RequestParam;
28+
import com.devnexus.ting.core.service.BusinessService;
29+
30+
/**
31+
*
32+
* Used to manage registration forms and validation/combination rules.
33+
*
34+
* @author Summers Pittman
35+
*
36+
*/
37+
@Controller("adminRegistrationController")
38+
public class RegistrationController {
39+
40+
@Autowired private BusinessService businessService;
41+
42+
@Autowired private Validator validator;
43+
44+
@RequestMapping(value="/admin/registration", method=RequestMethod.GET)
45+
public String getSpeakers(ModelMap model, HttpServletRequest request,
46+
@RequestParam(value="eventId", required=false) Long eventId) {
47+
48+
return "/admin/manage-registration";
49+
}
50+
51+
}

0 commit comments

Comments
 (0)