Skip to content

Commit

Permalink
Remove Row entity. Assume rectangular geometry for sections and impli…
Browse files Browse the repository at this point in the history
…cit (i.e. sequential) row numbering
  • Loading branch information
mbogoevici authored and pmuir committed May 28, 2012
1 parent 4d1f924 commit 5b06f42
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 559 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -266,7 +266,7 @@
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<version>7.1.0.CR1</version>
<version>7.1.0.CR1b</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -314,7 +314,7 @@
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-remote</artifactId>
<version>7.1.0.CR1</version>
<version>7.1.0.CR1b</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
90 changes: 0 additions & 90 deletions src/main/java/org/jboss/jdf/example/ticketmonster/model/Row.java

This file was deleted.

This file was deleted.

21 changes: 15 additions & 6 deletions src/main/java/org/jboss/jdf/example/ticketmonster/model/Seat.java
Expand Up @@ -2,6 +2,7 @@

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.validation.constraints.Min;

/**
Expand All @@ -10,23 +11,31 @@
@Embeddable
public class Seat {

@ManyToOne
private Row row;
@Min(1)
private int rowNumber;

@Min(1)
private int number;

@ManyToOne
private Section section;

/** Constructor for persistence */
private Seat() {
}

public Seat(Row row, int number) {
this.row = row;
public Seat(Section section, int rowNumber, int number) {
this.section = section;
this.rowNumber = rowNumber;
this.number = number;
}

public Row getRow() {
return row;
public Section getSection() {
return section;
}

public int getRowNumber() {
return rowNumber;
}

public int getNumber() {
Expand Down
@@ -1,18 +1,13 @@
package org.jboss.jdf.example.ticketmonster.model;

import static javax.persistence.CascadeType.ALL;
import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.validation.constraints.Min;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.validator.constraints.NotEmpty;
Expand Down Expand Up @@ -42,21 +37,15 @@ public class Section implements Serializable {
@NotEmpty
private String description;

/**
* The total seating capacity of the section
*/
@Min(0)
private int capacity;

/**
* The layout to which this section belongs
*/
@ManyToOne
private Venue venue;

@OneToMany(mappedBy = "section", cascade = ALL)
@NotEmpty
private Set<Row> sectionRows = new HashSet<Row>();
private int numberOfRows;

private int rowCapacity;

public Long getId() {
return id;
Expand All @@ -82,28 +71,32 @@ public void setDescription(String description) {
this.description = description;
}

public int getCapacity() {
return capacity;
public int getNumberOfRows() {
return numberOfRows;
}

public void setCapacity(int capacity) {
this.capacity = capacity;
public void setNumberOfRows(int numberOfRows) {
this.numberOfRows = numberOfRows;
}

public Venue getVenue() {
return venue;
public int getRowCapacity() {
return rowCapacity;
}

public void setVenue(Venue venue) {
this.venue = venue;
public void setRowCapacity(int rowCapacity) {
this.rowCapacity = rowCapacity;
}

public int getCapacity() {
return this.rowCapacity * this.numberOfRows;
}

public Set<Row> getSectionRows() {
return sectionRows;
public Venue getVenue() {
return venue;
}

public void setSectionRows(Set<Row> sectionRows) {
this.sectionRows = sectionRows;
public void setVenue(Venue venue) {
this.venue = venue;
}

@Override
Expand Down

0 comments on commit 5b06f42

Please sign in to comment.