Skip to content

Commit

Permalink
Various fixes:
Browse files Browse the repository at this point in the history
* Generate UI for all entities to avoid Forge/Metawidget bug
* Tidy up imports and remove * imports which Forge can't cope with
* Move default instantiation to entity
  • Loading branch information
pmuir committed May 28, 2012
1 parent 73270a8 commit efbd2d9
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 35 deletions.
9 changes: 1 addition & 8 deletions admin_layer.fsh
Expand Up @@ -12,14 +12,7 @@ scaffold setup;

@/* Scaffold CRUD views for the entities that an admin would start drilling down into the data model from */;

scaffold from-entity org.jboss.jdf.example.ticketmonster.model.Event.java;
scaffold from-entity org.jboss.jdf.example.ticketmonster.model.EventCategory.java;
scaffold from-entity org.jboss.jdf.example.ticketmonster.model.TicketCategory.java;
scaffold from-entity org.jboss.jdf.example.ticketmonster.model.Venue.java;


echo Due to a bug in Forge Scaffold, we need to manually fix some source errors at this point;
wait;
scaffold from-entity org.jboss.jdf.example.ticketmonster.model.*

@/* Deploy this to JBoss AS 7 to see the result */;
build clean package jboss-as:deploy;
Expand Down
@@ -1,5 +1,9 @@
package org.jboss.jdf.example.ticketmonster.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
Expand All @@ -9,9 +13,6 @@
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import java.util.Set;
import java.util.Date;

import org.hibernate.validator.constraints.NotEmpty;

/**
Expand All @@ -29,7 +30,7 @@ public class Booking {
@OneToMany(fetch = FetchType.EAGER, mappedBy = "booking")
@NotEmpty
@Valid
private Set<Allocation> allocations;
private Set<Allocation> allocations = new HashSet<Allocation>();

@ManyToOne
@Valid
Expand All @@ -39,7 +40,7 @@ public class Booking {
private String cancellationCode;

@NotNull
private Date createdOn;
private Date createdOn = new Date();

public Long getId() {
return id;
Expand Down
@@ -1,15 +1,11 @@
package org.jboss.jdf.example.ticketmonster.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

Expand Down
@@ -1,7 +1,5 @@
package org.jboss.jdf.example.ticketmonster.model;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

import java.io.Serializable;

import javax.persistence.Basic;
Expand All @@ -12,6 +10,8 @@
import javax.persistence.Id;
import javax.persistence.Lob;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

/**
* A reference to a media object such as images, sound bites, video recordings, that can
* be used in the application.
Expand Down
Expand Up @@ -8,7 +8,6 @@
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;

/**
Expand Down
Expand Up @@ -5,7 +5,6 @@
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
Expand Down
Expand Up @@ -10,10 +10,7 @@
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlTransient;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.validator.constraints.NotEmpty;

Expand Down
@@ -1,19 +1,16 @@
package org.jboss.jdf.example.ticketmonster.model;

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

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.validator.constraints.NotEmpty;

Expand Down
Expand Up @@ -6,7 +6,6 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

Expand Down
@@ -1,11 +1,17 @@
package org.jboss.jdf.example.ticketmonster.model;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

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

import javax.persistence.*;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

/**
* Represents a single venue
Expand Down
Expand Up @@ -9,9 +9,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.xml.bind.annotation.XmlTransient;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;

/**
Expand Down
Expand Up @@ -67,8 +67,6 @@ public Response createBooking(@FormParam("email") String email,
Performance performance = getEntityManager().find(Performance.class, performanceId);
Booking booking = new Booking();
booking.setCustomer(customer);
booking.setCreatedOn(new Date());
booking.setAllocations(new HashSet<Allocation> ());
if (ticketCounts.length != priceCategoryIds.length) {
Map<String, String> entity = new HashMap<String, String>();
entity.put("cause", "There must be as many pr as tickets");
Expand Down

0 comments on commit efbd2d9

Please sign in to comment.