Package com.logicaldoc.core.security.user

# Class HibernateGroupDAO

java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<Group>
com.logicaldoc.core.security.user.HibernateGroupDAO

All Implemented Interfaces:
  `PersistentObjectDAO<Group>`, `GroupDAO`

@Repository("groupDAO") @Transactional public class HibernateGroupDAO extends HibernatePersistentObjectDAO<Group> implements GroupDAO
Hibernate implementation of `GroupDAO`

Since:
  3.0
Author:
  Alessandro Gasparini - LogicalDOC

## Field Summary

### Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO

`ENTITY`

## Method Summary

Modifier and Type
Method
Description
`void`
`delete(long groupId, int code)`
This method deletes an entity and you can give a deletion code
`boolean`
`exists(String groupname, long tenantId)`
`Collection<String>`
`findAllGroupNames(long tenantId)`
This method selects all group names
`Collection<Group>`
`findByLikeName(String name, long tenantId)`
This method finds a Group by name.
`Group`
`findByName(String name, long tenantId)`
Finds a group by name.
`void`
`fixGuestPermissions(Group group)`
If the user is guest, we remove not admitted permissions
`MenuDAO`
`getMenuDAO()`
`void`
`inheritACLs(Group group, long parentGroupId)`
This method replicates all ACLs of the parent group to another group.
`void`
`initialize(Group group)`
Doesn't do anything by default
`void`
`insert(Group group, long parentGroupId)`
This method persists a new group object.
`void`
`setMenuDAO(MenuDAO menuDAO)`
`void`
`store(Group group)`
This method persists the entity object

### Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO

`bulkUpdate, count, deleteAll, evict, evict, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findIdsByWhere, getDatabaseMetadata, jdbcUpdate, jdbcUpdate, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, setSessionFactory`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO

`bulkUpdate, count, count, count, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, isMariaDB, isMySQL, isOracle, isPostgreSQL, isSQLServer, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString`

## Method Details

### getMenuDAO

public MenuDAO getMenuDAO()

### setMenuDAO

public void setMenuDAO(MenuDAO menuDAO)

### delete

public void delete(long groupId, int code) throws PersistenceException
Description copied from interface: `PersistentObjectDAO`
This method deletes an entity and you can give a deletion code

Specified by:
  `delete` in interface `PersistentObjectDAO<Group>`
Overrides:
  `delete` in class `HibernatePersistentObjectDAO<Group>`
Parameters:
  `groupId` - ID of the entity which should be deleted
  `code` - Deletion code
Throws:
  `PersistenceException` - raised in case of errors in the database

### exists

public boolean exists(String groupname, long tenantId) throws PersistenceException

Throws:
  `PersistenceException`

### findAllGroupNames

public Collection<String> findAllGroupNames(long tenantId) throws PersistenceException
Description copied from interface: `GroupDAO`
This method selects all group names

Specified by:
  `findAllGroupNames` in interface `GroupDAO`
Parameters:
  `tenantId` - identifier of the tenant
Returns:
  collection of all the group names
Throws:
  `PersistenceException` - Error in the database

### findByName

public Group findByName(String name, long tenantId) throws PersistenceException
Description copied from interface: `GroupDAO`
Finds a group by name.

Specified by:
  `findByName` in interface `GroupDAO`
Parameters:
  `name` - name of wanted group.
  `tenantId` - ID of the owning tenant
Returns:
  Wanted group or null.
Throws:
  `PersistenceException` - Error in the database

### insert

public void insert(Group group, long parentGroupId) throws PersistenceException
Description copied from interface: `GroupDAO`
This method persists a new group object. All permissions and extended attributes of the parent group will be replicated.

Specified by:
  `insert` in interface `GroupDAO`
Parameters:
  `group` - Group which should be stored in a database.
  `parentGroupId` - ID of the group this group inherits ACLs from
Throws:
  `PersistenceException` - Error in the database

### inheritACLs

public void inheritACLs(Group group, long parentGroupId) throws PersistenceException
Description copied from interface: `GroupDAO`
This method replicates all ACLs of the parent group to another group.

Attention: The group(groupId) ACLs will be discarded.

Specified by:
  `inheritACLs` in interface `GroupDAO`
Parameters:
  `group` - The group to be altered.
  `parentGroupId` - The group whose ACLs will be inherited.
Throws:
  `PersistenceException` - Error in the database

### findByLikeName

public Collection<Group> findByLikeName(String name, long tenantId) throws PersistenceException
Description copied from interface: `GroupDAO`
This method finds a Group by name.

Specified by:
  `findByLikeName` in interface `GroupDAO`
Parameters:
  `name` - The name of wanted Group.
  `tenantId` - ID of the owning tenant
Returns:
  Collection of selected groups.
Throws:
  `PersistenceException` - Error in the database

### initialize

public void initialize(Group group)
Description copied from class: `HibernatePersistentObjectDAO`
Doesn't do anything by default

Specified by:
  `initialize` in interface `GroupDAO`
Specified by:
  `initialize` in interface `PersistentObjectDAO<Group>`
Overrides:
  `initialize` in class `HibernatePersistentObjectDAO<Group>`
Parameters:
  `group` - The entity to be initialised

### store

public void store(Group group) throws PersistenceException
Description copied from interface: `PersistentObjectDAO`
This method persists the entity object

Specified by:
  `store` in interface `PersistentObjectDAO<Group>`
Overrides:
  `store` in class `HibernatePersistentObjectDAO<Group>`
Parameters:
  `group` - entity to be stored
Throws:
  `PersistenceException` - raised in case of errors in the database

### fixGuestPermissions

public void fixGuestPermissions(Group group) throws PersistenceException
If the user is guest, we remove not admitted permissions

Specified by:
  `fixGuestPermissions` in interface `GroupDAO`
Throws:
  `PersistenceException` - Error in the DB
  `NumberFormatException`