net.sourceforge.pain.data
Class Role

java.lang.Object
  extended bynet.sourceforge.pain.db.DbObject
      extended bynet.sourceforge.pain.data.Role
Direct Known Subclasses:
Prototype

public abstract class Role
extends DbObject

role can be considered as type of object, every object could have only one role of the specified class


Field Summary
protected static int LAST_BASE_FIELD_INDEX
           
 
Constructor Summary
  Role()
          used by db during startup
protected Role(PainDB db)
           
 
Method Summary
 Role addRole(java.lang.Class typeClass)
           
 void delete()
          will delete whole object with all roles
protected  int fillSuperSchema(byte[] types, java.lang.String[] names)
          Every Role subclass MUST call provideSuperSchema();
 AffectData getAffectData(int affectType)
           
 java.util.Iterator getAffects()
           
 Role getRole(java.lang.Class typeClass)
          helpers: Used to avoid explicit owner extraction before cast to another type
 java.lang.String getRoleClientProperty(java.lang.String propertyName)
          dynamic role properties are properties used by clients, but not typical for the role by itself Example: room coords on area editor grid properties assignet to the role but not to the object and removed when role is removed from object
 java.util.Iterator getRoleTriggers()
          remove method for this iterator will delete trigger as dbobject
protected  java.lang.Class[] getSuperroles()
          PAiN has dynamic inheritance model, every type(role) should know own superroles with deep=1 this method could be overriden by impl returns array of Role classes
 java.util.Iterator getTriggersByEventType(int eventType)
          remove method for this iterator will delete trigger as dbobject
 boolean hasSubroles()
           
 boolean is(java.lang.Class typeClass)
           
 boolean isAffected(int affectType)
           
 void removeRole(java.lang.Class typeClass)
           
 java.util.Iterator rolesIterator()
           
 boolean sameObjectAs(Role obj)
           
 void setRoleClientProperty(java.lang.String propertyName, java.lang.String value)
          dynamic role properties are properties used by clients, but not typical for the role by itself Example: room coords on area editor grid properties assignet to the role but not to the object and removed when role is removed from object
 
Methods inherited from class net.sourceforge.pain.db.DbObject
getArrayList, getBoolean, getByte, getByteArray, getByteArrayForRead, getChar, getCharArray, getCharArrayForRead, getDB, getDbClass, getDouble, getFloat, getInt, getIntArray, getIntArrayForRead, getIntKeyMap, getLinkedList, getList, getLong, getOid, getReference, getRefSet, getShort, getString, getStringArray, getStringArrayForRead, getStringKeyMap, getStringMap, getStringSet, isClean, isDeleted, isDetached, isDirty, isNew, provideSchema, setBoolean, setByte, setByteArray, setChar, setCharArray, setDouble, setFloat, setInt, setIntArray, setLong, setReference, setShort, setString, setStringArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAST_BASE_FIELD_INDEX

protected static final int LAST_BASE_FIELD_INDEX
See Also:
Constant Field Values
Constructor Detail

Role

public Role()
used by db during startup


Role

protected Role(PainDB db)
Method Detail

fillSuperSchema

protected final int fillSuperSchema(byte[] types,
                                    java.lang.String[] names)
Every Role subclass MUST call provideSuperSchema();


getSuperroles

protected java.lang.Class[] getSuperroles()
PAiN has dynamic inheritance model, every type(role) should know own superroles with deep=1 this method could be overriden by impl returns array of Role classes


hasSubroles

public final boolean hasSubroles()

getRole

public final Role getRole(java.lang.Class typeClass)
helpers: Used to avoid explicit owner extraction before cast to another type


is

public final boolean is(java.lang.Class typeClass)

addRole

public final Role addRole(java.lang.Class typeClass)
                   throws java.lang.Exception
Throws:
java.lang.Exception

removeRole

public final void removeRole(java.lang.Class typeClass)
                      throws java.lang.Exception
Throws:
java.lang.Exception

sameObjectAs

public boolean sameObjectAs(Role obj)

rolesIterator

public final java.util.Iterator rolesIterator()

delete

public void delete()
will delete whole object with all roles

Overrides:
delete in class DbObject

getTriggersByEventType

public final java.util.Iterator getTriggersByEventType(int eventType)
remove method for this iterator will delete trigger as dbobject


getRoleTriggers

public final java.util.Iterator getRoleTriggers()
remove method for this iterator will delete trigger as dbobject


getAffects

public final java.util.Iterator getAffects()

isAffected

public final boolean isAffected(int affectType)

getAffectData

public final AffectData getAffectData(int affectType)

getRoleClientProperty

public final java.lang.String getRoleClientProperty(java.lang.String propertyName)
dynamic role properties are properties used by clients, but not typical for the role by itself Example: room coords on area editor grid properties assignet to the role but not to the object and removed when role is removed from object


setRoleClientProperty

public final void setRoleClientProperty(java.lang.String propertyName,
                                        java.lang.String value)
dynamic role properties are properties used by clients, but not typical for the role by itself Example: room coords on area editor grid properties assignet to the role but not to the object and removed when role is removed from object