it.eng.spagobi.kpi.ou.dao
Class OrganizationalUnitDAOImpl

java.lang.Object
  extended by it.eng.spagobi.commons.dao.AbstractHibernateDAO
      extended by it.eng.spagobi.kpi.ou.dao.OrganizationalUnitDAOImpl
All Implemented Interfaces:
IOrganizationalUnitDAO

public class OrganizationalUnitDAOImpl
extends AbstractHibernateDAO
implements IOrganizationalUnitDAO

Author:
Davide Zerbetto (davide.zerbetto@eng.it)

Constructor Summary
OrganizationalUnitDAOImpl()
           
 
Method Summary
 void eraseGrant(java.lang.Integer grantId)
          Removes a grant
 void eraseHierarchy(java.lang.Integer hierarchyId)
          Removes the hierarchy
 void eraseNodeGrant(OrganizationalUnitGrantNode grantNode)
          Remove the grant nodes of a grant
 void eraseNodeGrants(java.lang.Integer grantId)
          Remove all the grant nodes of a grant(a grant node is an association between a hierarchy node and a KPI model instance node in the context of a grant)
 void eraseOrganizationalUnit(java.lang.Integer ouId)
          Removes the organizational unit
 void eraseOrganizationalUnitNode(OrganizationalUnitNode node)
          Removes a node from the structure with its descendants
 boolean existsNodeInHierarchy(java.lang.String path, java.lang.Integer hierarchyId)
          Checks if the input path exists in the given hierarchy
 java.util.List<OrganizationalUnitNode> getChildrenNodes(java.lang.Integer nodeId)
           
 java.util.List<OrganizationalUnitNodeWithGrant> getChildrenNodesWithGrants(java.lang.Integer nodeId, java.lang.Integer grantId)
           
 java.util.List<OrganizationalUnitGrantNode> getGrants(java.lang.Integer kpiModelInstanceId)
          Retrieves the grants associated the KPI model instance node identified by the input integer
 java.util.List<OrganizationalUnitGrant> getGrantsList()
           
 java.util.List<OrganizationalUnitGrantNode> getGrantsValidByDate(java.lang.Integer kpiModelInstanceId, java.util.Date now)
          Retrieves the grants associated the KPI model instance node identified by the input integer, valid in the real time
 java.util.List<OrganizationalUnitHierarchy> getHierarchiesList()
           
 OrganizationalUnitHierarchy getHierarchy(java.lang.Integer id)
           
 java.util.List<OrganizationalUnitGrantNode> getNodeGrants(java.lang.Integer nodeId, java.lang.Integer grantId)
           
 java.util.List<OrganizationalUnitNode> getNodes()
          Retrieves all ou nodes
 OrganizationalUnit getOrganizationalUnit(java.lang.Integer id)
           
 OrganizationalUnit getOrganizationalUnitByLabelAndName(java.lang.String label, java.lang.String name)
           
 java.util.List<OrganizationalUnit> getOrganizationalUnitList()
           
 OrganizationalUnitNode getOrganizationalUnitNode(java.lang.String path, java.lang.Integer hierarchyId)
          Retrieve the node with the input path in the given hierarchy
 OrganizationalUnitNode getRootNode(java.lang.Integer hierarchyId)
           
 OrganizationalUnitNodeWithGrant getRootNodeWithGrants(java.lang.Integer hierarchyId, java.lang.Integer grantId)
           
 void insertGrant(OrganizationalUnitGrant grant)
          Inserts a new grant
 void insertHierarchy(OrganizationalUnitHierarchy h)
          Inserts the hierarchy
 void insertNodeGrants(java.util.List<OrganizationalUnitGrantNode> grantNodes)
          Inserts a list of grant nodes (a grant node is an association between a hierarchy node and a KPI model instance node in the context of a grant)
 void insertOrganizationalUnit(OrganizationalUnit ou)
          Inserts the organizational unit
 void insertOrganizationalUnitNode(OrganizationalUnitNode aNode)
          Inserts the input node in the hierarchy
 void modifyGrant(OrganizationalUnitGrant grant)
          Modify a grant
 void modifyHierarchy(OrganizationalUnitHierarchy h)
          Modifies the hierarchy
 void modifyOrganizationalUnit(OrganizationalUnit ou)
          Modifies the organizational unit
 OrganizationalUnit toOrganizationalUnit(SbiOrgUnit hibOrgUnit)
           
 OrganizationalUnitGrant toOrganizationalUnitGrant(SbiOrgUnitGrant hibGrant, org.hibernate.Session aSession)
           
 OrganizationalUnitGrantNode toOrganizationalUnitGrantNode(SbiOrgUnitGrantNodes hibGrantNode, org.hibernate.Session aSession)
           
 OrganizationalUnitHierarchy toOrganizationalUnitHierarchy(SbiOrgUnitHierarchies hibOrgUnitHierarchies)
           
 OrganizationalUnitNode toOrganizationalUnitNode(SbiOrgUnitNodes hibOrgUnitNode)
           
 
Methods inherited from class it.eng.spagobi.commons.dao.AbstractHibernateDAO
getSession, logException, rollbackIfActiveAndClose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrganizationalUnitDAOImpl

public OrganizationalUnitDAOImpl()
Method Detail

getOrganizationalUnitList

public java.util.List<OrganizationalUnit> getOrganizationalUnitList()
Specified by:
getOrganizationalUnitList in interface IOrganizationalUnitDAO
Returns:
the list of OU

getHierarchiesList

public java.util.List<OrganizationalUnitHierarchy> getHierarchiesList()
Specified by:
getHierarchiesList in interface IOrganizationalUnitDAO
Returns:
the list of hierarchies

getOrganizationalUnit

public OrganizationalUnit getOrganizationalUnit(java.lang.Integer id)
Specified by:
getOrganizationalUnit in interface IOrganizationalUnitDAO
Returns:
the OU with the given identifier

getHierarchy

public OrganizationalUnitHierarchy getHierarchy(java.lang.Integer id)
Specified by:
getHierarchy in interface IOrganizationalUnitDAO
Returns:
the Hierarchy with the given identifier

getRootNode

public OrganizationalUnitNode getRootNode(java.lang.Integer hierarchyId)
Specified by:
getRootNode in interface IOrganizationalUnitDAO
Returns:
the root node for a single hierarchy

getChildrenNodes

public java.util.List<OrganizationalUnitNode> getChildrenNodes(java.lang.Integer nodeId)
Specified by:
getChildrenNodes in interface IOrganizationalUnitDAO
Returns:
the list of children nodes for a single node of a hierarchy

getGrantsList

public java.util.List<OrganizationalUnitGrant> getGrantsList()
Specified by:
getGrantsList in interface IOrganizationalUnitDAO
Returns:
the list of grants (i.e. association between a KPI model instance and a OU hierarchy)

getNodeGrants

public java.util.List<OrganizationalUnitGrantNode> getNodeGrants(java.lang.Integer nodeId,
                                                                 java.lang.Integer grantId)
Specified by:
getNodeGrants in interface IOrganizationalUnitDAO
Returns:
the list of grants for a single node of a hierarchy (i.e. association between a KPI model instance node and a OU hierarchy node)

eraseOrganizationalUnit

public void eraseOrganizationalUnit(java.lang.Integer ouId)
Description copied from interface: IOrganizationalUnitDAO
Removes the organizational unit

Specified by:
eraseOrganizationalUnit in interface IOrganizationalUnitDAO

insertOrganizationalUnit

public void insertOrganizationalUnit(OrganizationalUnit ou)
Description copied from interface: IOrganizationalUnitDAO
Inserts the organizational unit

Specified by:
insertOrganizationalUnit in interface IOrganizationalUnitDAO

modifyOrganizationalUnit

public void modifyOrganizationalUnit(OrganizationalUnit ou)
Description copied from interface: IOrganizationalUnitDAO
Modifies the organizational unit

Specified by:
modifyOrganizationalUnit in interface IOrganizationalUnitDAO

eraseHierarchy

public void eraseHierarchy(java.lang.Integer hierarchyId)
Description copied from interface: IOrganizationalUnitDAO
Removes the hierarchy

Specified by:
eraseHierarchy in interface IOrganizationalUnitDAO

insertHierarchy

public void insertHierarchy(OrganizationalUnitHierarchy h)
Description copied from interface: IOrganizationalUnitDAO
Inserts the hierarchy

Specified by:
insertHierarchy in interface IOrganizationalUnitDAO

modifyHierarchy

public void modifyHierarchy(OrganizationalUnitHierarchy h)
Description copied from interface: IOrganizationalUnitDAO
Modifies the hierarchy

Specified by:
modifyHierarchy in interface IOrganizationalUnitDAO

eraseOrganizationalUnitNode

public void eraseOrganizationalUnitNode(OrganizationalUnitNode node)
Description copied from interface: IOrganizationalUnitDAO
Removes a node from the structure with its descendants

Specified by:
eraseOrganizationalUnitNode in interface IOrganizationalUnitDAO
Parameters:
node - The node to be removed

existsNodeInHierarchy

public boolean existsNodeInHierarchy(java.lang.String path,
                                     java.lang.Integer hierarchyId)
Description copied from interface: IOrganizationalUnitDAO
Checks if the input path exists in the given hierarchy

Specified by:
existsNodeInHierarchy in interface IOrganizationalUnitDAO
hierarchyId - The hierarchy identifier
Returns:
true if the path exists in the given hierarchy, false otherwise

getOrganizationalUnitNode

public OrganizationalUnitNode getOrganizationalUnitNode(java.lang.String path,
                                                        java.lang.Integer hierarchyId)
Description copied from interface: IOrganizationalUnitDAO
Retrieve the node with the input path in the given hierarchy

Specified by:
getOrganizationalUnitNode in interface IOrganizationalUnitDAO
hierarchyId - The hierarchy identifier
Returns:
the node with the input path in the given hierarchy

insertOrganizationalUnitNode

public void insertOrganizationalUnitNode(OrganizationalUnitNode aNode)
Description copied from interface: IOrganizationalUnitDAO
Inserts the input node in the hierarchy

Specified by:
insertOrganizationalUnitNode in interface IOrganizationalUnitDAO

insertGrant

public void insertGrant(OrganizationalUnitGrant grant)
Description copied from interface: IOrganizationalUnitDAO
Inserts a new grant

Specified by:
insertGrant in interface IOrganizationalUnitDAO

modifyGrant

public void modifyGrant(OrganizationalUnitGrant grant)
Description copied from interface: IOrganizationalUnitDAO
Modify a grant

Specified by:
modifyGrant in interface IOrganizationalUnitDAO

eraseNodeGrants

public void eraseNodeGrants(java.lang.Integer grantId)
Description copied from interface: IOrganizationalUnitDAO
Remove all the grant nodes of a grant(a grant node is an association between a hierarchy node and a KPI model instance node in the context of a grant)

Specified by:
eraseNodeGrants in interface IOrganizationalUnitDAO

eraseGrant

public void eraseGrant(java.lang.Integer grantId)
Description copied from interface: IOrganizationalUnitDAO
Removes a grant

Specified by:
eraseGrant in interface IOrganizationalUnitDAO
Parameters:
grantId - The grant identifier

insertNodeGrants

public void insertNodeGrants(java.util.List<OrganizationalUnitGrantNode> grantNodes)
Description copied from interface: IOrganizationalUnitDAO
Inserts a list of grant nodes (a grant node is an association between a hierarchy node and a KPI model instance node in the context of a grant)

Specified by:
insertNodeGrants in interface IOrganizationalUnitDAO

getRootNodeWithGrants

public OrganizationalUnitNodeWithGrant getRootNodeWithGrants(java.lang.Integer hierarchyId,
                                                             java.lang.Integer grantId)
Specified by:
getRootNodeWithGrants in interface IOrganizationalUnitDAO
Returns:
the root node (with grants) for a single hierarchy

getChildrenNodesWithGrants

public java.util.List<OrganizationalUnitNodeWithGrant> getChildrenNodesWithGrants(java.lang.Integer nodeId,
                                                                                  java.lang.Integer grantId)
Specified by:
getChildrenNodesWithGrants in interface IOrganizationalUnitDAO
Returns:
the list of children nodes for a single node of a hierarchy

getGrants

public java.util.List<OrganizationalUnitGrantNode> getGrants(java.lang.Integer kpiModelInstanceId)
Description copied from interface: IOrganizationalUnitDAO
Retrieves the grants associated the KPI model instance node identified by the input integer

Specified by:
getGrants in interface IOrganizationalUnitDAO
Returns:
the grants associated the KPI model instance node identified by the input integer

getGrantsValidByDate

public java.util.List<OrganizationalUnitGrantNode> getGrantsValidByDate(java.lang.Integer kpiModelInstanceId,
                                                                        java.util.Date now)
Description copied from interface: IOrganizationalUnitDAO
Retrieves the grants associated the KPI model instance node identified by the input integer, valid in the real time

Specified by:
getGrantsValidByDate in interface IOrganizationalUnitDAO
Returns:
the grants associated the KPI model instance node identified by the input integer

toOrganizationalUnitGrant

public OrganizationalUnitGrant toOrganizationalUnitGrant(SbiOrgUnitGrant hibGrant,
                                                         org.hibernate.Session aSession)

toOrganizationalUnit

public OrganizationalUnit toOrganizationalUnit(SbiOrgUnit hibOrgUnit)

toOrganizationalUnitHierarchy

public OrganizationalUnitHierarchy toOrganizationalUnitHierarchy(SbiOrgUnitHierarchies hibOrgUnitHierarchies)

toOrganizationalUnitNode

public OrganizationalUnitNode toOrganizationalUnitNode(SbiOrgUnitNodes hibOrgUnitNode)

toOrganizationalUnitGrantNode

public OrganizationalUnitGrantNode toOrganizationalUnitGrantNode(SbiOrgUnitGrantNodes hibGrantNode,
                                                                 org.hibernate.Session aSession)

getOrganizationalUnitByLabelAndName

public OrganizationalUnit getOrganizationalUnitByLabelAndName(java.lang.String label,
                                                              java.lang.String name)
Specified by:
getOrganizationalUnitByLabelAndName in interface IOrganizationalUnitDAO
Returns:
the OU with the given label and name (unique key)

getNodes

public java.util.List<OrganizationalUnitNode> getNodes()
Description copied from interface: IOrganizationalUnitDAO
Retrieves all ou nodes

Specified by:
getNodes in interface IOrganizationalUnitDAO
Returns:
all the ou nodes

eraseNodeGrant

public void eraseNodeGrant(OrganizationalUnitGrantNode grantNode)
Description copied from interface: IOrganizationalUnitDAO
Remove the grant nodes of a grant

Specified by:
eraseNodeGrant in interface IOrganizationalUnitDAO
Parameters:
grantNode - to erase