org.opensubsystems.inventory.logic.impl
Class UnitControllerImpl

java.lang.Object
  extended by org.opensubsystems.core.logic.impl.StatelessControllerImpl
      extended by org.opensubsystems.inventory.logic.impl.UnitControllerImpl
All Implemented Interfaces:
java.io.Serializable, javax.ejb.EnterpriseBean, javax.ejb.SessionBean, org.opensubsystems.core.logic.BasicDataController, org.opensubsystems.core.logic.DataController, org.opensubsystems.core.logic.ModifiableDataController, org.opensubsystems.core.logic.StatelessController, UnitController, org.opensubsystems.security.logic.SecureController

public class UnitControllerImpl
extends org.opensubsystems.core.logic.impl.StatelessControllerImpl
implements UnitController

Implementation of UnitController interface to manage units.

Version:
$Id: UnitControllerImpl.java,v 1.11 2007/01/28 06:54:42 bastafidli Exp $
Author:
Peter Satury
See Also:
Serialized Form
Code reviewer:
TODO: Review this code
Code reviewed:
XDoclet tag:
type="Stateless" name="UnitController" jndi-name="org.opensubsystems.inventory.logic.UnitControllerRemote" local-jndi-name="org.opensubsystems.inventory.logic.UnitController"
XDoclet tag:
local-extends="javax.ejb.EJBLocalObject, org.opensubsystems.inventory.logic.UnitController" extends="javax.ejb.EJBObject, org.opensubsystems.inventory.logic.UnitController"
XDoclet tag:
type="Session" view-type="local" home="org.opensubsystems.security.logic.AuthorizationControllerHome" business="org.opensubsystems.security.logic.AuthorizationControllerLocal" ejb-name="AuthorizationController" ref-name="org.opensubsystems.security.logic.AuthorizationController"
XDoclet tag:
ejb-name="UnitController" jndi-name="org.opensubsystems.inventory.logic.UnitControllerRemote"
XDoclet tag:
ejb-ref-name="org.opensubsystems.security.logic.AuthorizationController" jndi-name="org.opensubsystems.security.logic.AuthorizationControllerRemote"
XDoclet tag:
ref-name="org.opensubsystems.security.logic.AuthorizationController" jndi-name="org.opensubsystems.security.logic.AuthorizationControllerRemote"
XDoclet tag:
ejb-ref-name="org.opensubsystems.security.logic.AuthorizationController" jndi-name="org.opensubsystems.security.logic.AuthorizationControllerRemote"

Field Summary
protected  org.opensubsystems.security.logic.AuthorizationController m_authorityControl
          Authorization controller used to check access rights.
protected  ItemFactory m_itemFactory
          Factory to use to execute persistence operations.
protected  UnitFactory m_unitFactory
          Factory to use to execute persistence operations.
 
Constructor Summary
UnitControllerImpl()
          Default constructor.
 
Method Summary
 Unit adjustUnit(int iUnitId, java.sql.Timestamp modificationDate, int iNewAvailableItemCount)
          Change the available count for given unit to a given value.
protected  int checkAccess(int iId, int iAction)
          Check access for given data object based on categories on which rights can be enforces.
 void constructor()
          
 org.opensubsystems.core.data.DataObject create(org.opensubsystems.core.data.DataObject data)
          
 void delete(int iId)
          
 org.opensubsystems.core.data.DataObject get(int iId)
          
 org.opensubsystems.security.data.SecurityDefinition[] getSecurityDefinitions()
          
 org.opensubsystems.core.data.ModifiableDataObject save(org.opensubsystems.core.data.ModifiableDataObject data)
          
 
Methods inherited from class org.opensubsystems.core.logic.impl.StatelessControllerImpl
ejbActivate, ejbPassivate, ejbRemove, setSessionContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_itemFactory

protected ItemFactory m_itemFactory
Factory to use to execute persistence operations.


m_unitFactory

protected UnitFactory m_unitFactory
Factory to use to execute persistence operations.


m_authorityControl

protected org.opensubsystems.security.logic.AuthorizationController m_authorityControl
Authorization controller used to check access rights.

Constructor Detail

UnitControllerImpl

public UnitControllerImpl()
Default constructor.

Method Detail

get

public org.opensubsystems.core.data.DataObject get(int iId)
                                            throws org.opensubsystems.core.error.OSSException

Specified by:
get in interface org.opensubsystems.core.logic.DataController
Throws:
org.opensubsystems.core.error.OSSException
XDoclet tag:
XDoclet tag:
type="Supports"

create

public org.opensubsystems.core.data.DataObject create(org.opensubsystems.core.data.DataObject data)
                                               throws org.opensubsystems.core.error.OSSException

Specified by:
create in interface org.opensubsystems.core.logic.BasicDataController
Throws:
org.opensubsystems.core.error.OSSException
XDoclet tag:
XDoclet tag:
type="Required"

delete

public void delete(int iId)
            throws org.opensubsystems.core.error.OSSException

Specified by:
delete in interface org.opensubsystems.core.logic.BasicDataController
Throws:
org.opensubsystems.core.error.OSSException
XDoclet tag:
XDoclet tag:
type="Required"

save

public org.opensubsystems.core.data.ModifiableDataObject save(org.opensubsystems.core.data.ModifiableDataObject data)
                                                       throws org.opensubsystems.core.error.OSSException

Specified by:
save in interface org.opensubsystems.core.logic.ModifiableDataController
Throws:
org.opensubsystems.core.error.OSSException
XDoclet tag:
XDoclet tag:
type="Required"

adjustUnit

public Unit adjustUnit(int iUnitId,
                       java.sql.Timestamp modificationDate,
                       int iNewAvailableItemCount)
                throws org.opensubsystems.core.error.OSSException
Change the available count for given unit to a given value. Note that this is not changing the available count BY a value, but TO a value. TODO: Improve: This method assumes that when the available count in inventory is adjusted items were either found or lost. In future extend this with flag representing action since items could have been transfered from or to inventory or rented andreturned. TODO: For Miro: Review this method, it may not be correct, since the counts are cached in the item by having method which suggest that the amounts are changed in unit it may not change them in item.

Specified by:
adjustUnit in interface UnitController
Parameters:
iUnitId - - unit id to change the available count
modificationDate - - modification date of the unit
iNewAvailableItemCount - - new available count, the available count
Returns:
InventoryItem - modified unit or null if there was a problem
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getSecurityDefinitions

public org.opensubsystems.security.data.SecurityDefinition[] getSecurityDefinitions()

Specified by:
getSecurityDefinitions in interface org.opensubsystems.security.logic.SecureController
XDoclet tag:
XDoclet tag:
type="Supports"

constructor

public void constructor()
                 throws org.opensubsystems.core.error.OSSException

Specified by:
constructor in interface org.opensubsystems.core.logic.StatelessController
Overrides:
constructor in class org.opensubsystems.core.logic.impl.StatelessControllerImpl
Throws:
org.opensubsystems.core.error.OSSException
XDoclet tag:
XDoclet tag:
type="Supports"

checkAccess

protected int checkAccess(int iId,
                          int iAction)
                   throws org.opensubsystems.core.error.OSSException
Check access for given data object based on categories on which rights can be enforces. Since the security for this data object is not dependent on the actual data elements (categories) it is sufficient to specify id of the data object.

Parameters:
iId - - id of data object to check
iAction - - action to check for, one of the ActionConstants.RIGHT_XXX constants
Returns:
int - AccessRight.ACCESS_GRANTED or AccessRight.ACCESS_DENIED
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured


Copyright © 2003 - 2006 OpenSubsystems s.r.o.