com.knowgate.acl
Class ACLDomain

java.lang.Object
  extended by com.knowgate.dataobjs.DBPersist
      extended by com.knowgate.acl.ACLDomain
All Implemented Interfaces:
java.util.Map

public final class ACLDomain
extends DBPersist

Security Domain Management Functions


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static short ClassId
           
 
Fields inherited from class com.knowgate.dataobjs.DBPersist
AllVals, sAuditCls, sAuditUsr, sTransactId
 
Constructor Summary
ACLDomain()
          Default constructor
ACLDomain(JDCConnection oConn, int iIdDomain)
          Constructs ACLDomain and load attributes from k_domains table
 
Method Summary
 boolean delete(JDCConnection oConn)
          Delete a register from database The deleted register will be the one matching this DBPersist primary key, as set at constructor or load() method.
static boolean delete(JDCConnection oConn, int iDomainId)
          Fully delete a domain and ALL its associated data This method will perform the following actions
1.
static java.lang.Integer forWorkArea(java.sql.Connection oConn, java.lang.String sWorkAreaId)
          Get Domain to which a given WorkArea belongs
static java.lang.Integer forWorkArea(JDCConnection oConn, java.lang.String sWorkAreaId)
          Get Domain to which a given WorkArea belongs
static int getIdFromName(JDCConnection oConn, java.lang.String sDomainNm)
          Gets domain identifier given its name Calls k_get_domain_id stored procedure and gets id_domaingiven nm_domain
static void main(java.lang.String[] argv)
           
 boolean store(JDCConnection oConn)
          Store a register at database representing this instance of DBPersist Insertions and updates : The store method automatically manages register insertions and updates.
 
Methods inherited from class com.knowgate.dataobjs.DBPersist
allcaps, allcaps, changelog, clear, clone, containsKey, containsValue, entrySet, exists, get, get, getAuditClassName, getCreationDate, getDate, getDateFormated, getDateShort, getDateTime, getDateTime24, getDecimal, getDecimalFormated, getDecimalFormated, getDouble, getDoubleFormated, getFloat, getFloatFormated, getInt, getInteger, getIntervalPart, getItemMap, getItems, getMoney, getShort, getSQLDate, getSQLTime, getString, getStringNull, getTable, getTable, getTableName, getTime, getTimeOfDay, getTimestamp, getUIdFromName, isEmpty, isNull, iterator, keySet, load, load, parseXML, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, putAll, putAll, remove, remove, replace, replace, replace, replace, replace, replace, replace, setAuditTransact, setAuditUser, size, toLowerCase, toUpperCase, toXML, toXML, toXML, toXML, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

ClassId

public static final short ClassId
See Also:
Constant Field Values
Constructor Detail

ACLDomain

public ACLDomain()
Default constructor


ACLDomain

public ACLDomain(JDCConnection oConn,
                 int iIdDomain)
          throws java.sql.SQLException

Constructs ACLDomain and load attributes from k_domains table

Parameters:
oConn - Database Connection
iIdDomain - Domain Identifier (id_domain field at k_domains table)
Throws:
java.sql.SQLException
Method Detail

store

public boolean store(JDCConnection oConn)
              throws java.sql.SQLException
Description copied from class: DBPersist

Store a register at database representing this instance of DBPersist

Insertions and updates : The store method automatically manages register insertions and updates. If the stored object already exists at database then it is updated, if it does not exists then it is inserted. A primary key violation error is never thrown so ther is no need to call delete() method before re-writing an existing object.

NULL fields : All values not set calling put() methods for DBPersist will be assumed to be NULL. If a not nullable field is not set then an SQLException will be raised.
On storing an already existing object all values will we overwrited, so is a DBPersist is not fully loaded before storing it, values not set by calling put() methods that already were present at database will be lost.

Overrides:
store in class DBPersist
Parameters:
oConn - Database Connection
Returns:
boolean true if register was stored for the first time, false if register already existed.
Throws:
java.sql.SQLException
See Also:
DBPersist.store(JDCConnection)

delete

public boolean delete(JDCConnection oConn)
               throws java.sql.SQLException
Description copied from class: DBPersist

Delete a register from database

The deleted register will be the one matching this DBPersist primary key, as set at constructor or load() method.

Overrides:
delete in class DBPersist
Parameters:
oConn - Database connection
Returns:
true if register was successfully erased, false if not.
Throws:
java.sql.SQLException
See Also:
delete(JDCConnection,int)

delete

public static boolean delete(JDCConnection oConn,
                             int iDomainId)
                      throws java.sql.SQLException,
                             java.io.IOException

Fully delete a domain and ALL its associated data

This method will perform the following actions
1. Delete WorkAreas from this domain
2. Delete categories owned by users of this domain
3. Delete Security groups from domain
4. Delete domain users

Parameters:
oConn - Database Connection
iDomainId - Domain Identifier
Returns:
Throws:
java.sql.SQLException
java.io.IOException
See Also:
ACLUser.delete(JDCConnection,String), Category.delete(JDCConnection,String), WorkArea.delete(JDCConnection,String)

forWorkArea

public static java.lang.Integer forWorkArea(java.sql.Connection oConn,
                                            java.lang.String sWorkAreaId)
                                     throws java.sql.SQLException
Get Domain to which a given WorkArea belongs

Parameters:
oConn - JDCConnection
sWorkAreaId - String WorkArea GUID
Returns:
Integer Domain Id. or null if no WorkArea with such GUID was found
Throws:
java.sql.SQLException

forWorkArea

public static java.lang.Integer forWorkArea(JDCConnection oConn,
                                            java.lang.String sWorkAreaId)
                                     throws java.sql.SQLException
Get Domain to which a given WorkArea belongs

Parameters:
oConn - JDCConnection
sWorkAreaId - String WorkArea GUID
Returns:
Integer Domain Id. or null if no WorkArea with such GUID was found
Throws:
java.sql.SQLException

getIdFromName

public static int getIdFromName(JDCConnection oConn,
                                java.lang.String sDomainNm)
                         throws java.sql.SQLException

Gets domain identifier given its name

Calls k_get_domain_id stored procedure and gets id_domaingiven nm_domain

Parameters:
oConn - Database Connection
sDomainNm - Domain name (nm_domain from k_domains table)
Returns:
Domain Identifier
Throws:
java.sql.SQLException

main

public static void main(java.lang.String[] argv)
                 throws java.sql.SQLException,
                        java.lang.NumberFormatException
Throws:
java.sql.SQLException
java.lang.NumberFormatException