org.jminor.framework.client.model
Class DefaultEntityApplicationModel

java.lang.Object
  extended by org.jminor.framework.client.model.DefaultEntityApplicationModel
All Implemented Interfaces:
Refreshable, EntityApplicationModel

public abstract class DefaultEntityApplicationModel
extends Object
implements EntityApplicationModel

A central application model class.


Constructor Summary
DefaultEntityApplicationModel(EntityConnectionProvider connectionProvider)
          Instantiates a new DefaultEntityApplicationModel
 
Method Summary
 EntityModel addMainApplicationModel(EntityModel detailModel)
          Adds the given detail model to this model
 void addMainApplicationModels(EntityModel... mainApplicationModels)
          Adds the given detail models to this model.
 void clear()
          Clears all data from this refreshable instance
 EntityConnectionProvider getConnectionProvider()
          
static TreeModel getDependencyTreeModel()
           
static TreeModel getDependencyTreeModel(String domainID)
           
 EntityModel getMainApplicationModel(Class<? extends EntityModel> modelClass)
          
 EntityModel getMainApplicationModel(String entityID)
          
 List<? extends EntityModel> getMainApplicationModels()
          
 User getUser()
          
protected  void handleLogin()
          Called after a login has been performed Override to add a login handler.
protected  void handleLogout()
          Called after a logout has been performed.
protected abstract  void loadDomainModel()
          This method should load the domain model, for example by instantiating the domain model class or simply loading it by name
 void login(User user)
          Logs in the given user
 void logout()
          Log out from this application model
 void refresh()
          Performs a refresh
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEntityApplicationModel

public DefaultEntityApplicationModel(EntityConnectionProvider connectionProvider)
Instantiates a new DefaultEntityApplicationModel

Parameters:
connectionProvider - the EntityConnectionProvider instance
Method Detail

logout

public final void logout()
Log out from this application model

Specified by:
logout in interface EntityApplicationModel

login

public final void login(User user)
Logs in the given user

Specified by:
login in interface EntityApplicationModel
Parameters:
user - the user to login

getUser

public final User getUser()

Specified by:
getUser in interface EntityApplicationModel
Returns:
the current user

getConnectionProvider

public final EntityConnectionProvider getConnectionProvider()

Specified by:
getConnectionProvider in interface EntityApplicationModel
Returns:
the EntityConnectionProvider instance being used by this EntityApplicationModel

addMainApplicationModels

public final void addMainApplicationModels(EntityModel... mainApplicationModels)
Adds the given detail models to this model.

Specified by:
addMainApplicationModels in interface EntityApplicationModel
Parameters:
mainApplicationModels - the detail models to add

addMainApplicationModel

public final EntityModel addMainApplicationModel(EntityModel detailModel)
Adds the given detail model to this model

Specified by:
addMainApplicationModel in interface EntityApplicationModel
Parameters:
detailModel - the detail model
Returns:
the detail model just added

getMainApplicationModels

public final List<? extends EntityModel> getMainApplicationModels()

Specified by:
getMainApplicationModels in interface EntityApplicationModel
Returns:
an unmodifiable List containing the main application models

refresh

public final void refresh()
Performs a refresh

Specified by:
refresh in interface Refreshable

clear

public final void clear()
Clears all data from this refreshable instance

Specified by:
clear in interface Refreshable

getMainApplicationModel

public final EntityModel getMainApplicationModel(Class<? extends EntityModel> modelClass)

Specified by:
getMainApplicationModel in interface EntityApplicationModel
Parameters:
modelClass - the model class
Returns:
the EntityModel of the given type

getMainApplicationModel

public final EntityModel getMainApplicationModel(String entityID)

Specified by:
getMainApplicationModel in interface EntityApplicationModel
Parameters:
entityID - the entity ID
Returns:
the EntityModel based on the given entityID

getDependencyTreeModel

public static TreeModel getDependencyTreeModel()
Returns:
a tree model showing the dependencies between entities via foreign keys

getDependencyTreeModel

public static TreeModel getDependencyTreeModel(String domainID)
Parameters:
domainID - the ID of the domain for which to return a dependency tree model
Returns:
a tree model showing the dependencies between entities via foreign keys

loadDomainModel

protected abstract void loadDomainModel()
This method should load the domain model, for example by instantiating the domain model class or simply loading it by name


handleLogout

protected void handleLogout()
Called after a logout has been performed. Override to add a logout handler.


handleLogin

protected void handleLogin()
Called after a login has been performed Override to add a login handler.