Community contributed extensions

the module project is hosted by google code at mandubian-play-crud-siena under MIT license

CRUD Siena Play! module How-to

The CRUD (Create, Read, Update, Delete) Siena module generates a fully usable web interface for your Siena Model objects.

Enable Siena support to your Play! project

Note Just call this command to get last siena version:

play install siena

Install CrudSiena module

For Play! <1.1_, install CrudSiena <=1.01:

play install crudsiena-1.01

For Play! >=1.1_, install CrudSiena >=1.1:

play install crudsiena-1.x


Your Siena entity shall inherit SienaSupport

Note this is exactly the sister class of Play! default class JpaSupport (from Play! version 1.0x)

For example:

@Table("employees")
public class Employee extends SienaSupport {

        @Id(Generator.AUTO_INCREMENT)
        public Long id; 

        @Column("first_name")
        @Max(100) @NotNull
        public String firstName;      
  
        @Column("last_name")
        @Max(200) @NotNull
        public String lastName;     
   
        @Column("contact_info")
        public Json contactInfo;     
              
        @Column("hire_date")
        public Date hireDate;

        @Column("fire_date")
        @DateTime	// displays a timepicker
        public Date fireDate;
          
        @Column("boss") 
        @Index("boss_index")
        public Employee boss;       
 
        @Filter("boss")
        public Query<Employee> employees;               

        @Embedded
        public Image profileImage;        

        @Embedded
        public List<Image> otherImages;

        @Embedded
        public Map<String, Image> stillImages;        

        @EmbeddedMap
        public class Image {
                public String filename;
                public String title;
                public int views;
        }        

        public static Query<Employee> all() {
                return Model.all(Employee.class);
        }        

        public String toString() {
                return firstName + " " + lastName;
        }
}


Please be aware of the possibility to manage:

For more information about Siena, go directly to Siena site

Create a controller inheriting class CRUD for each Siena entity requiring CRUD support

Note this is exactly the sister class of Play! default controller CRUD

The name of the Controller class corresponding to a model class can be:

For example:

public class Employee extends controllers.CRUD {    
}

For example:

public class Employees extends controllers.CRUD {    
}

For example:

@For(models.Employee.class)
public class Employees extends controllers.CRUD {
}

Enable routes to the CRUD module

At the beginning of your conf/routes file, add:

*    /admin    module:crudsiena

You can get more information at original CRUD module site

Play Validation with Siena annotations

These are Siena model Annotations managed by the CrudSiena module:

Play Validation with Play annotations

These are Play Annotations managed by the CrudSiena module:

You can’t use Play! binding annotations

Specific CrudSiena annotations

(thanks to Spreiter301 for his contribution... see googlecode issue)
Be careful this annotation calls DB requests that can be quite heavy so it might impact your application performance. (I will try to provide a mechanism to control where this annotation is applied but it is not so trivial)

Known Limitations

GAE