Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.scaffolding
Interface ScaffoldDomain

All Known Implementing Classes:
  DefaultScaffoldDomain, GrailsScaffoldDomain

    public interface ScaffoldDomain

The main interface used by scaffolded controllers to access instances of persistent classes

Since:
  30 Nov 2005
Author:
  Graeme Rocher

Method Summary
`Object` | `delete(Serializable id)`
`List` | `find(String[] by, Object[] q)` Finds all the persistent instances for the specified properties and query values
`List` | `find(String[] by, Object[] q, int max)`
`List` | `find(String[] by, Object[] q, int max, int offset)`
`List` | `find(String by, Object q)` Finds all persistent instances for the specified property name and value
`List` | `find(String by, Object q, int max)`
`List` | `find(String by, Object q, int max, int offset)`
`Object` | `get(Serializable id)` Retrieves an persistent class instance for the specified id
`String` | `getIdentityPropertyName()`
`String` | `getName()`
`Class` | `getPersistentClass()` Retrieves the scaffolded persistent class
`String` | `getPluralName()` Returns the plural name of the domain
`String` | `getSingularName()` Returns the singular name of the domain
`List` | `list()`
`List` | `list(int max)`
`List` | `list(int max, int offset)`
`List` | `list(int max, int offset, String sort)`
`List` | `list(int max, int offset, String sort, String order)`
`Object` | `newInstance()`
`boolean` | `save(Object domainObject, ScaffoldCallback callback)` Saves an instance of the persistent class using the specified properties
`void` | `setIdentityPropertyName(String identityPropertyName)` Sets the name of the identity property so that type conversion can be performed
`void` | `setPersistentClass(Class clazz)` Sets the persistent class used by the scaffold domain
`void` | `setSessionFactory(Object sessionFactory)` Sets the session factory used by the persistent implementation
`void` | `setValidator(Validator validator)` Sets the validator to use
`boolean` | `update(Object domainObject, ScaffoldCallback callback)` Updates an existing instance

Method Detail

### setIdentityPropertyName

    void setIdentityPropertyName(String identityPropertyName)

  Sets the name of the identity property so that type conversion can be performed

  Parameters:
    `identityPropertyName` -

### setValidator

    void setValidator(Validator validator)

  Sets the validator to use

  Parameters:
    `validator` -

### getPersistentClass

    Class getPersistentClass()

  Retrieves the scaffolded persistent class

### list

    List list()

  Returns:
    All persistent instances of the scaffolded class

### list

    List list(int max)

  Parameters:
    `max` - The maximum number of instances to return
  Returns:
    All persistent instances up to the maximum specified value

### list

    List list(int max,
              int offset)

  Parameters:
    `max` - The maximum number to return
    `offset` - The offset position
  Returns:
    All persistent instances up to the maximum, offset by the specified value

### list

    List list(int max,
              int offset,
              String sort)

  Parameters:
    `max` - The maximum number to return (Set to -1 for no maximum)
    `offset` - The offset position (Set to -1 for no offset)
    `sort` - The property name to sort by
  Returns:
    All persistent instances up to the maximum, offset by the specified value

### list

    List list(int max,
              int offset,
              String sort,
              String order)

  Parameters:
    `max` - The maximum number to return (Set to -1 for no maximum)
    `offset` - The offset position (Set to -1 for no offset)
    `order` - either "ASC" for ascending or "DESC" for descending
    `sort` - The property name to sort by
  Returns:
    All persistent instances up to the maximum, offset by the specified value

### find

    List find(String by,
              Object q)

  Finds all persistent instances for the specified property name and value

  Parameters:
    `by` - The property to find by
    `q` - The query criteria
  Returns:
    A list of found persistent instances

### find

    List find(String by,
              Object q,
              int max)

  Parameters:
    `max` - The maximum number of results to return
  See Also:
    `for description`

### find

    List find(String by,
              Object q,
              int max,
              int offset)

  Parameters:
    `max` - The maximum number of results to return
    `offset` - The offset position
  See Also:
    `for description`

### find

    List find(String[] by,
              Object[] q)

  Finds all the persistent instances for the specified properties and query values

  Parameters:
    `by` - The properties to find by
    `q` - The query values
  Returns:
    A list of persistent instances

### find

    List find(String[] by,
              Object[] q,
              int max)

  Parameters:
    `max` - The maximum number of results to return
  See Also:
    `for description`

### find

    List find(String[] by,
              Object[] q,
              int max,
              int offset)

  Parameters:
    `max` - The maximum number of results to return
    `offset` - The offset position
  See Also:
    `for description`

### save

    boolean save(Object domainObject,
                 ScaffoldCallback callback)

  Saves an instance of the persistent class using the specified properties

  Parameters:
    `domainObject` - The domain object to save
    `callback` - Any validation errors that may have occured during saving
  Returns:
    The saved instance or null if save was unsuccessful

### update

    boolean update(Object domainObject,
                   ScaffoldCallback callback)

  Updates an existing instance

  Parameters:
    `callback` -
    `domainObject` -
  Returns:
    The updated instance

### delete

    Object delete(Serializable id)

  Parameters:
    `id` -
  Returns:
    The instance identified by id, if it existed

### get

    Object get(Serializable id)

  Retrieves an persistent class instance for the specified id

  Parameters:
    `id` -
  Returns:
    The instance identified by id, if it exists

### getPluralName

    String getPluralName()

  Returns the plural name of the domain

  Returns:
    The non-null plural name of the domain

### getSingularName

    String getSingularName()

  Returns the singular name of the domain

  Returns:
    The non-null singular name of the domain

### getIdentityPropertyName

    String getIdentityPropertyName()

  Returns:
    The identity property name

### getName

    String getName()

  Returns:
    The full name of the domain class

### newInstance

    Object newInstance()

  Returns:
    A new instance of the domain class

### setPersistentClass

    void setPersistentClass(Class clazz)

  Sets the persistent class used by the scaffold domain

  Parameters:
    `clazz` - The persistent class

### setSessionFactory

    void setSessionFactory(Object sessionFactory)

  Sets the session factory used by the persistent implementation

  Parameters:
    `sessionFactory` - The session factory to use

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2005-2006 The Grails project