org.tentackle.appworx
Interface ContextDependable

All Known Implementing Classes:
AppDbObject, AppDbPseudoObject, History, PartialAppDbObject, Security

public interface ContextDependable

Interface all AppDbObjects must implement.
In multitenant applications the interface must be subclassed.

Author:
harald
See Also:
ContextDb

Method Summary
 ContextDb getBaseContext()
          Gets the minimum context, i.e.
 ContextDb getContextDb()
          Gets the database application context this object belongs to.
 long getContextId()
          Gets the ID of the root object describing the context of this object.
 String getSqlContextCondition()
          Gets the additional condition to be used in the WHERE clause describing the context.
 ContextDb makeValidContext()
          Creates a valid context for this object.
Useful if the object has been loaded without a context or to make the least significant context the object can live in.
 void setContextDb(ContextDb contextDb)
          Sets this object's database application context.
 void setContextId()
          Determines the object-ID(s) of the root object(s) of the context and sets the attributes of the database object accordingly.
 

Method Detail

getContextDb

ContextDb getContextDb()
Gets the database application context this object belongs to.

Returns:
the context

setContextDb

void setContextDb(ContextDb contextDb)
Sets this object's database application context.

Parameters:
contextDb -

setContextId

void setContextId()
Determines the object-ID(s) of the root object(s) of the context and sets the attributes of the database object accordingly.


getContextId

long getContextId()
Gets the ID of the root object describing the context of this object.

Returns:
the ID of the root object, 0 if in default context (no context)

getSqlContextCondition

String getSqlContextCondition()
Gets the additional condition to be used in the WHERE clause describing the context.
 Example: return " AND " + FIELD_TENANTID + "=?";
 

Returns:
the condition, null if none necessary

getBaseContext

ContextDb getBaseContext()
Gets the minimum context, i.e. the one that is sufficient for this object. Objects may have a "higher" context they live in.

Returns:
the base context, never null

makeValidContext

ContextDb makeValidContext()
Creates a valid context for this object.
Useful if the object has been loaded without a context or to make the least significant context the object can live in.

Returns:
the new context, never null


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de