org.jasig.portal
Class EntityTypes

java.lang.Object
  extended by org.jasig.portal.EntityTypes

public class EntityTypes
extends Object

This class provides access to the entity types used by IBasicEntities and the classes in org.jasig.portal.groups and org.jasig.portal.concurrency.

Each type is associated with an Integer used to represent the type in the portal data store. This class translates between the Integer and Class values.

Version:
$Revision: 19776 $
Author:
Dan Ellentuck
See Also:
IBasicEntity

Field Summary
static Class GROUP_ENTITY_TYPE
           
static Class LEAF_ENTITY_TYPE
           
static int NULL_TYPE_ID
           
 
Method Summary
 void addEntityTypeIfNecessary(Class newType, String description)
          Check if we have the type in our cache.
static void addIfNecessary(Class newType, String description)
          Add the new type if it does not already exist.
 void deleteEntityType(Class type)
          Synchronize on update lock to serialize adds, deletes and updates while letting reads proceed.
 Iterator getAllEntityTypeIDs()
           
 Iterator getAllEntityTypes()
           
static String getDescriptiveName(Class type)
          Interface to the entity types cache.
 String getDescriptiveNameForType(Class type)
          Interface to the entity types cache.
 Integer getEntityIDFromType(Class type)
          Interface to the entity types cache.
static Class getEntityType(Integer typeID)
          Interface to the entity types cache.
 Class getEntityTypeFromID(Integer id)
          Interface to the entity types cache.
static Integer getEntityTypeID(Class type)
          Interface to the entity types cache.
static void refresh()
          Interface to the entity types cache.
 void setEntityTypesByID(Map m)
           
 void setEntityTypesByType(Map m)
           
static EntityTypes singleton()
           
static EntityTypes singleton(DataSource ds)
           
 void updateEntityType(Class type, String newDescription)
          Synchronize on update lock to serialize adds, deletes and updates while letting reads proceed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_TYPE_ID

public static int NULL_TYPE_ID

GROUP_ENTITY_TYPE

public static Class GROUP_ENTITY_TYPE

LEAF_ENTITY_TYPE

public static Class LEAF_ENTITY_TYPE
Method Detail

addIfNecessary

public static void addIfNecessary(Class newType,
                                  String description)
                           throws Exception
Add the new type if it does not already exist.

Throws:
Exception

addEntityTypeIfNecessary

public void addEntityTypeIfNecessary(Class newType,
                                     String description)
                              throws Exception
Check if we have the type in our cache. If not, re-retrieve. Someone might have added it since we last retrieved. If the type is not found, try to add it to the store. If the add is not successful, re-retrieve again. If the type is still not found, rethrow the SQLException. Synchronize on update lock to serialize adds, deletes and updates while letting reads proceed.

Throws:
Exception

deleteEntityType

public void deleteEntityType(Class type)
                      throws SQLException
Synchronize on update lock to serialize adds, deletes and updates while letting reads proceed.

Throws:
SQLException

getAllEntityTypeIDs

public Iterator getAllEntityTypeIDs()
Returns:
java.util.Iterator

getAllEntityTypes

public Iterator getAllEntityTypes()
Returns:
java.util.Iterator

getDescriptiveName

public static String getDescriptiveName(Class type)
Interface to the entity types cache.

Returns:
java.lang.String

getDescriptiveNameForType

public String getDescriptiveNameForType(Class type)
Interface to the entity types cache.

Returns:
java.lang.String

getEntityIDFromType

public Integer getEntityIDFromType(Class type)
Interface to the entity types cache.

Returns:
java.lang.Integer

getEntityType

public static Class getEntityType(Integer typeID)
Interface to the entity types cache.

Returns:
java.lang.Class

getEntityTypeFromID

public Class getEntityTypeFromID(Integer id)
Interface to the entity types cache.

Returns:
java.lang.Class

getEntityTypeID

public static Integer getEntityTypeID(Class type)
Interface to the entity types cache.

Returns:
java.lang.Class

refresh

public static void refresh()
Interface to the entity types cache.


setEntityTypesByID

public void setEntityTypesByID(Map m)

setEntityTypesByType

public void setEntityTypesByType(Map m)

singleton

public static EntityTypes singleton()
Returns:
org.jasig.portal.EntityTypes

singleton

public static EntityTypes singleton(DataSource ds)
Returns:
org.jasig.portal.EntityTypes

updateEntityType

public void updateEntityType(Class type,
                             String newDescription)
                      throws Exception
Synchronize on update lock to serialize adds, deletes and updates while letting reads proceed.

Throws:
Exception


Copyright © 2010 Jasig. All Rights Reserved.