org.kuali.student.common.ui.client.mvc
Class DataModel

java.lang.Object
  extended by org.kuali.student.common.ui.client.mvc.DataModel
All Implemented Interfaces:
Model

public class DataModel
extends Object
implements Model

The data model for Kuali Student. Data is stored in a map of maps and is accessed through a QueryPath.

Author:
Kuali Student Team
See Also:
QueryPath

Nested Class Summary
static interface DataModel.QueryCallback<T>
           
 
Constructor Summary
DataModel()
           
DataModel(ModelDefinition definition, Data root)
           
DataModel(String name)
           
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addModelChangeHandler(ModelChangeHandler handler)
          Adds a ModelChangeHandler that will be invoked for ModelChangeEvents
<T> T
get(QueryPath path)
           
<T> T
get(String path)
           
 ModelDefinition getDefinition()
           
 Metadata getMetadata(QueryPath path)
           
 String getModelName()
           
 String getParentPath()
           
 Data getRoot()
           
 Data.DataType getType(QueryPath path)
           
 boolean isValidPath(String sPath)
          Checks to see if data exists for the path passed in
 Map<QueryPath,Object> query(QueryPath path)
           
 Map<QueryPath,Object> query(String path)
           
 void remove(QueryPath path)
           
 void resetRoot()
           
 void set(QueryPath path, Boolean value)
           
 void set(QueryPath path, Data.Value value)
           
 void set(QueryPath path, Data value)
           
 void set(QueryPath path, Date value)
           
 void set(QueryPath path, Double value)
           
 void set(QueryPath path, Float value)
           
 void set(QueryPath path, Integer value)
           
 void set(QueryPath path, Long value)
           
 void set(QueryPath path, Short value)
           
 void set(QueryPath path, String value)
           
 void setDefinition(ModelDefinition definition)
           
 void setModelName(String modelName)
           
 void setParentPath(String parentPath)
          If the root element for this is a child of another data object, then the parent path must be set to the path where this child data object can be found.
 void setRoot(Data root)
          Set the top level data for this DataModel
 void validate(Callback<List<ValidationResultInfo>> callback)
          Validates this data model against its ModelDefinition/Metadata and returns the result to the callback
 void validateField(FieldDescriptor fd, Callback<List<ValidationResultInfo>> callback)
          Validates a single field
 void validateForMetadata(Metadata metadata, Callback<List<ValidationResultInfo>> callback)
          Validates this data model against the given metadata and returns the result to the callback
 void validateNextState(Callback<List<ValidationResultInfo>> callback)
          Validates this data model against the next state in its ModelDefinition and returns the result to the callback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataModel

public DataModel()

DataModel

public DataModel(String name)

DataModel

public DataModel(ModelDefinition definition,
                 Data root)
Method Detail

getModelName

public String getModelName()

setModelName

public void setModelName(String modelName)

get

public <T> T get(QueryPath path)

get

public <T> T get(String path)

getRoot

public Data getRoot()
Returns:
the root

resetRoot

public void resetRoot()

remove

public void remove(QueryPath path)

query

public Map<QueryPath,Object> query(QueryPath path)
Parameters:
path - The path in the data model
Returns:
A map containing the path/value pairs for all matching elements, or an empty map if no matching values found.

query

public Map<QueryPath,Object> query(String path)
Parameters:
path - The path in the data model
Returns:
A map containing the path/value pairs for all matching elements, or an empty map if no matching values found.

set

public void set(QueryPath path,
                Data value)

set

public void set(QueryPath path,
                Integer value)

set

public void set(QueryPath path,
                String value)

set

public void set(QueryPath path,
                Long value)

set

public void set(QueryPath path,
                Short value)

set

public void set(QueryPath path,
                Double value)

set

public void set(QueryPath path,
                Float value)

set

public void set(QueryPath path,
                Boolean value)

set

public void set(QueryPath path,
                Date value)

set

public void set(QueryPath path,
                Data.Value value)

getType

public Data.DataType getType(QueryPath path)

getMetadata

public Metadata getMetadata(QueryPath path)

setRoot

public void setRoot(Data root)
Set the top level data for this DataModel

Parameters:
root - the root to set

addModelChangeHandler

public com.google.gwt.event.shared.HandlerRegistration addModelChangeHandler(ModelChangeHandler handler)
Description copied from interface: Model
Adds a ModelChangeHandler that will be invoked for ModelChangeEvents

Specified by:
addModelChangeHandler in interface Model
Parameters:
handler - the handler to add
Returns:
HandlerRegistration that can be used to unregister the handler later

getDefinition

public ModelDefinition getDefinition()

setDefinition

public void setDefinition(ModelDefinition definition)

getParentPath

public String getParentPath()

setParentPath

public void setParentPath(String parentPath)
If the root element for this is a child of another data object, then the parent path must be set to the path where this child data object can be found.

Parameters:
parentPath -

validate

public void validate(Callback<List<ValidationResultInfo>> callback)
Validates this data model against its ModelDefinition/Metadata and returns the result to the callback

Parameters:
callback -

validateNextState

public void validateNextState(Callback<List<ValidationResultInfo>> callback)
Validates this data model against the next state in its ModelDefinition and returns the result to the callback

Parameters:
callback -

validateForMetadata

public void validateForMetadata(Metadata metadata,
                                Callback<List<ValidationResultInfo>> callback)
Validates this data model against the given metadata and returns the result to the callback

Parameters:
metadata -
callback -

validateField

public void validateField(FieldDescriptor fd,
                          Callback<List<ValidationResultInfo>> callback)
Validates a single field

Parameters:
fd -
callback -

isValidPath

public boolean isValidPath(String sPath)
Checks to see if data exists for the path passed in

Parameters:
sPath -
Returns:


Copyright © 2004-2013 The Kuali Foundation. All Rights Reserved.