Ontimize 5.2072EN

com.ontimize.db
Class SQLEntity

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended bycom.ontimize.db.SQLEntity
All Implemented Interfaces:
DirectSQLQueryEntity, Entity, java.rmi.Remote, java.io.Serializable

public abstract class SQLEntity
extends java.rmi.server.UnicastRemoteObject
implements DirectSQLQueryEntity

This entity allows to execute a SQL statement directly against a database.
If the application has permissions this entity must have permission for the action 'Sql_execute_query'

See Also:
Serialized Form

Field Summary
static java.lang.String ACTION_EXECUTE_SQL_QUERY
          Parameter to set the execute sql permissions in the xml server permission definition
protected  DatabaseConnectionManager connectionsManager
           
protected  EntityReferenceLocator locator
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
SQLEntity(EntityReferenceLocator locator, DatabaseConnectionManager dbManager, int port)
          SQL Entity constructor.
 
Method Summary
 void checkPermissions(int sessionId, java.lang.String action)
           
 EntityResult createEntityResultForSessionId(int sessionId)
           
 EntityResult delete(java.util.Hashtable keys, int sessionId)
          This method is not allowed in this entity.
 EntityResult execute(java.lang.String sql, int sessionId)
          Execute the specified sql statement against the database
 java.lang.String getEntityName()
           
 EntityResult insert(java.util.Hashtable values, int sessionId)
          This method is not allowed in this entity.
 EntityResult query(java.util.Hashtable keys, java.util.Vector attributes, int sessionId)
          This method is not allowed in this entity.
 EntityResult update(java.util.Hashtable values, java.util.Hashtable keys, int sessionId)
          This method is not allowed in this entity.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTION_EXECUTE_SQL_QUERY

public static final java.lang.String ACTION_EXECUTE_SQL_QUERY
Parameter to set the execute sql permissions in the xml server permission definition

See Also:
Constant Field Values

connectionsManager

protected DatabaseConnectionManager connectionsManager

locator

protected EntityReferenceLocator locator
Constructor Detail

SQLEntity

public SQLEntity(EntityReferenceLocator locator,
                 DatabaseConnectionManager dbManager,
                 int port)
          throws java.lang.Exception
SQL Entity constructor.

Parameters:
locator - Entity reference locator object
dbManager - Database manager
port - Port number
Throws:
java.lang.Exception
Method Detail

query

public EntityResult query(java.util.Hashtable keys,
                          java.util.Vector attributes,
                          int sessionId)
                   throws java.lang.Exception
This method is not allowed in this entity. Always throw an exception

Specified by:
query in interface Entity
Parameters:
keys - a Hashtable specifying conditions that must comply the set of records returned. Cannot be null.
attributes - a list of columns or attributes that must be recovered for each record returned. Cannot be null. If empty, all attributes should be returned.
sessionId - a integer identifying the user or session that performs the action.
Returns:
a EntityResult with the resulting set of data. This result can be empty if no results exist, and if an error has ocurred this will be indicated in the result.
Throws:
java.lang.Exception - if any exception occurs

update

public EntityResult update(java.util.Hashtable values,
                           java.util.Hashtable keys,
                           int sessionId)
                    throws java.lang.Exception
This method is not allowed in this entity. Always throw an exception

Specified by:
update in interface Entity
Parameters:
values - the data for updating the records to. The keys specify the attributes (or columns) and the values, the values for these columns.
keys - the conditions that the records to be updated must fulfill. The keys specify the attributes (or columns) and the values, the values for these columns.
sessionId - a integer identifying the user or session that performs the action.
Returns:
a EntityResult. This result will have an error code if error has occurred.
Throws:
java.lang.Exception - if any exception occurs

insert

public EntityResult insert(java.util.Hashtable values,
                           int sessionId)
                    throws java.lang.Exception
This method is not allowed in this entity. Always throw an exception

Specified by:
insert in interface Entity
Parameters:
values - a Hashtable specifying pairs of key-value corresponding to the attribute (or column of a table in a database) and the value that must be stored.
sessionId - a integer identifying the user or session that performs the action.
Returns:
a EntityResult. This result will have an error code if error has ocurred.
Throws:
java.lang.Exception - if any exception occurs

delete

public EntityResult delete(java.util.Hashtable keys,
                           int sessionId)
                    throws java.lang.Exception
This method is not allowed in this entity. Always throw an exception

Specified by:
delete in interface Entity
Parameters:
keys - the conditions that the records to be deleted must fulfill. The keys specify the attributes (or columns) and the values, the values for these columns.
sessionId - a integer identifying the user or session that performs the action.
Returns:
a EntityResult. This result will have an error code if error has occurred.
Throws:
java.lang.Exception - if any exception occurs

createEntityResultForSessionId

public EntityResult createEntityResultForSessionId(int sessionId)

checkPermissions

public void checkPermissions(int sessionId,
                             java.lang.String action)
                      throws NotInPeriodException,
                             GeneralSecurityException,
                             SessionNotFoundException
Throws:
NotInPeriodException
GeneralSecurityException
SessionNotFoundException

getEntityName

public java.lang.String getEntityName()

execute

public EntityResult execute(java.lang.String sql,
                            int sessionId)
                     throws java.lang.Exception
Description copied from interface: DirectSQLQueryEntity
Execute the specified sql statement against the database

Specified by:
execute in interface DirectSQLQueryEntity
Parameters:
sql - SQL to execute
sessionId - User session identifier
Returns:
Throws:
java.lang.Exception

Ontimize