Package com.logicaldoc.core.metadata

# Interface AttributeOptionDAO

All Superinterfaces:
  `PersistentObjectDAO<AttributeOption>`

All Known Implementing Classes:
  `HibernateAttributeOptionDAO`

public interface AttributeOptionDAO extends PersistentObjectDAO<AttributeOption>
DAO for `AttributeOption` handling.

Since:
  6.1
Author:
  Marco Meschieri - LogicalDOC

## Field Summary

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

`ENTITY`

## Method Summary

Modifier and Type
Method
Description
`void`
`deleteBySetIdAndAttribute(long setId, String attribute)`
This method deletes options.
`void`
`deleteOrphaned(long setId, Collection<String> currentAttributes)`
This method deletes the orphaned options of a given template
`List<AttributeOption>`
`findByAttribute(long setId, String attribute)`
This finds all the options for a given attribute.
`List<AttributeOption>`
`findByAttributeAndCategory(long setId, String attribute, String category)`
This finds all the options for a given attribute.
`Map<String,List<AttributeOption>>`
`findByAttributeAsMap(long setId, String attribute)`
This finds all the options for a given attribute and groups them by category.
`static AttributeOptionDAO`
`get()`
Gets the object available in the application context

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

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

## Method Details

### get

static AttributeOptionDAO get()
Gets the object available in the application context

Returns:
  the instance of this object in the application context

### deleteBySetIdAndAttribute

void deleteBySetIdAndAttribute(long setId, String attribute) throws PersistenceException
This method deletes options.

Parameters:
  `setId` - ID of the attribute set
  `attribute` - Name of the attribute (optional)
Throws:
  `PersistenceException` - Error in the database

### deleteOrphaned

void deleteOrphaned(long setId, Collection<String> currentAttributes) throws PersistenceException
This method deletes the orphaned options of a given template

Parameters:
  `setId` - ID of the attribute set
  `currentAttributes` - Names of the attributes of the actual template
Throws:
  `PersistenceException` - Error in the database

### findByAttribute

List<AttributeOption> findByAttribute(long setId, String attribute) throws PersistenceException
This finds all the options for a given attribute. The list is ordered by position asc.

Parameters:
  `setId` - The attribute set id
  `attribute` - The attribute name (Optional)
Returns:
  The ordered list of options
Throws:
  `PersistenceException` - Error in the database

### findByAttributeAsMap

Map<String,List<AttributeOption>> findByAttributeAsMap(long setId, String attribute) throws PersistenceException
This finds all the options for a given attribute and groups them by category. The list is ordered by position asc.

Parameters:
  `setId` - The attribute set id
  `attribute` - The attribute name
Returns:
  The map of opions, key is the category
Throws:
  `PersistenceException` - Error in the database

### findByAttributeAndCategory

List<AttributeOption> findByAttributeAndCategory(long setId, String attribute, String category) throws PersistenceException
This finds all the options for a given attribute. The list is ordered by position asc.

Parameters:
  `setId` - The attribute set id
  `attribute` - The attribute name (Optional)
  `category` - The category (Optional)
Returns:
  The ordered list of options
Throws:
  `PersistenceException` - Error in the database