org.alfresco.repo.domain.hibernate
Class HibernateLocaleDAOImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by org.alfresco.repo.domain.hibernate.HibernateLocaleDAOImpl
All Implemented Interfaces:
LocaleDAO, org.springframework.beans.factory.InitializingBean

public class HibernateLocaleDAOImpl
extends org.springframework.orm.hibernate3.support.HibernateDaoSupport
implements LocaleDAO

Hibernate-specific implementation of the Locale DAO interface.

Since Locales are system-wide and immutable, we can cache lookups in both directions.

Since:
2.2.1

Constructor Summary
HibernateLocaleDAOImpl()
           
 
Method Summary
 org.alfresco.util.Pair getDefaultLocalePair()
           
 org.alfresco.util.Pair getLocalePair(java.util.Locale locale)
           
 org.alfresco.util.Pair getLocalePair(java.lang.Long id)
           
 org.alfresco.util.Pair getOrCreateDefaultLocalePair()
          Find or create the details representing the default locale.
 org.alfresco.util.Pair getOrCreateLocalePair(java.util.Locale locale)
          Gets the locale ID for an existing instance or creates a new entity if one doesn't exist.
 void setLocaleIdCache(SimpleCache localeIdCache)
           
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateLocaleDAOImpl

public HibernateLocaleDAOImpl()
Method Detail

setLocaleIdCache

public void setLocaleIdCache(SimpleCache localeIdCache)

getLocalePair

public org.alfresco.util.Pair getLocalePair(java.util.Locale locale)
Specified by:
getLocalePair in interface LocaleDAO
Returns:
the locale or null if no such locale exists

getDefaultLocalePair

public org.alfresco.util.Pair getDefaultLocalePair()
Specified by:
getDefaultLocalePair in interface LocaleDAO
Returns:
the locale pair for the default locale. Although the Locale object will be populated, the ID will point to an instance that generically refers to the system's default locale i.e. the value returned can vary depending on the executing thread's default locale.

getLocalePair

public org.alfresco.util.Pair getLocalePair(java.lang.Long id)
Specified by:
getLocalePair in interface LocaleDAO
Parameters:
id - the unique ID of the entity
Returns:
the locale (never null)

getOrCreateLocalePair

public org.alfresco.util.Pair getOrCreateLocalePair(java.util.Locale locale)
Description copied from interface: LocaleDAO
Gets the locale ID for an existing instance or creates a new entity if one doesn't exist.

Specified by:
getOrCreateLocalePair in interface LocaleDAO
Returns:
the locale - never null

getOrCreateDefaultLocalePair

public org.alfresco.util.Pair getOrCreateDefaultLocalePair()
Description copied from interface: LocaleDAO
Find or create the details representing the default locale.

Specified by:
getOrCreateDefaultLocalePair in interface LocaleDAO
Returns:
the locale pair for the default locale. Although the Locale object will be populated, the ID will point to an instance that generically refers to the system's default locale i.e. the value returned can vary depending on the executing thread's default locale.


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.