@ -19,6 +19,7 @@ import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderCacheUtil ;
import com.liferay.portal.kernel.dao.orm.FinderCacheUtil ;
import com.liferay.portal.kernel.dao.orm.FinderPath ;
import com.liferay.portal.kernel.dao.orm.FinderPath ;
import com.liferay.portal.kernel.dao.orm.Query ;
import com.liferay.portal.kernel.dao.orm.Query ;
import com.liferay.portal.kernel.dao.orm.QueryPos ;
import com.liferay.portal.kernel.dao.orm.QueryUtil ;
import com.liferay.portal.kernel.dao.orm.QueryUtil ;
import com.liferay.portal.kernel.dao.orm.Session ;
import com.liferay.portal.kernel.dao.orm.Session ;
import com.liferay.portal.kernel.exception.SystemException ;
import com.liferay.portal.kernel.exception.SystemException ;
@ -29,9 +30,12 @@ import com.liferay.portal.kernel.util.InstanceFactory;
import com.liferay.portal.kernel.util.OrderByComparator ;
import com.liferay.portal.kernel.util.OrderByComparator ;
import com.liferay.portal.kernel.util.PropsKeys ;
import com.liferay.portal.kernel.util.PropsKeys ;
import com.liferay.portal.kernel.util.PropsUtil ;
import com.liferay.portal.kernel.util.PropsUtil ;
import com.liferay.portal.kernel.util.SetUtil ;
import com.liferay.portal.kernel.util.StringBundler ;
import com.liferay.portal.kernel.util.StringBundler ;
import com.liferay.portal.kernel.util.StringPool ;
import com.liferay.portal.kernel.util.StringUtil ;
import com.liferay.portal.kernel.util.StringUtil ;
import com.liferay.portal.kernel.util.UnmodifiableList ;
import com.liferay.portal.kernel.util.UnmodifiableList ;
import com.liferay.portal.kernel.util.Validator ;
import com.liferay.portal.model.CacheModel ;
import com.liferay.portal.model.CacheModel ;
import com.liferay.portal.model.ModelListener ;
import com.liferay.portal.model.ModelListener ;
import com.liferay.portal.service.persistence.impl.BasePersistenceImpl ;
import com.liferay.portal.service.persistence.impl.BasePersistenceImpl ;
@ -47,6 +51,7 @@ import java.io.Serializable;
import java.util.ArrayList ;
import java.util.ArrayList ;
import java.util.Collections ;
import java.util.Collections ;
import java.util.List ;
import java.util.List ;
import java.util.Set ;
/ * *
/ * *
* The persistence implementation for the sportello service .
* The persistence implementation for the sportello service .
@ -81,6 +86,255 @@ public class SportelloPersistenceImpl extends BasePersistenceImpl<Sportello>
public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath ( SportelloModelImpl . ENTITY_CACHE_ENABLED ,
public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath ( SportelloModelImpl . ENTITY_CACHE_ENABLED ,
SportelloModelImpl . FINDER_CACHE_ENABLED , Long . class ,
SportelloModelImpl . FINDER_CACHE_ENABLED , Long . class ,
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION , "countAll" , new String [ 0 ] ) ;
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION , "countAll" , new String [ 0 ] ) ;
public static final FinderPath FINDER_PATH_FETCH_BY_LOGINNAME = new FinderPath ( SportelloModelImpl . ENTITY_CACHE_ENABLED ,
SportelloModelImpl . FINDER_CACHE_ENABLED , SportelloImpl . class ,
FINDER_CLASS_NAME_ENTITY , "fetchByLoginName" ,
new String [ ] { String . class . getName ( ) } ,
SportelloModelImpl . LOGINNAME_COLUMN_BITMASK ) ;
public static final FinderPath FINDER_PATH_COUNT_BY_LOGINNAME = new FinderPath ( SportelloModelImpl . ENTITY_CACHE_ENABLED ,
SportelloModelImpl . FINDER_CACHE_ENABLED , Long . class ,
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION , "countByLoginName" ,
new String [ ] { String . class . getName ( ) } ) ;
/ * *
* Returns the sportello where loginName = & # 63 ; or throws a { @link it . mwg . sicilia . sue . NoSuchSportelloException } if it could not be found .
*
* @param loginName the login name
* @return the matching sportello
* @throws it . mwg . sicilia . sue . NoSuchSportelloException if a matching sportello could not be found
* @throws SystemException if a system exception occurred
* /
@Override
public Sportello findByLoginName ( String loginName )
throws NoSuchSportelloException , SystemException {
Sportello sportello = fetchByLoginName ( loginName ) ;
if ( sportello = = null ) {
StringBundler msg = new StringBundler ( 4 ) ;
msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ;
msg . append ( "loginName=" ) ;
msg . append ( loginName ) ;
msg . append ( StringPool . CLOSE_CURLY_BRACE ) ;
if ( _log . isWarnEnabled ( ) ) {
_log . warn ( msg . toString ( ) ) ;
}
throw new NoSuchSportelloException ( msg . toString ( ) ) ;
}
return sportello ;
}
/ * *
* Returns the sportello where loginName = & # 63 ; or returns < code > null < / code > if it could not be found . Uses the finder cache .
*
* @param loginName the login name
* @return the matching sportello , or < code > null < / code > if a matching sportello could not be found
* @throws SystemException if a system exception occurred
* /
@Override
public Sportello fetchByLoginName ( String loginName )
throws SystemException {
return fetchByLoginName ( loginName , true ) ;
}
/ * *
* Returns the sportello where loginName = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache .
*
* @param loginName the login name
* @param retrieveFromCache whether to use the finder cache
* @return the matching sportello , or < code > null < / code > if a matching sportello could not be found
* @throws SystemException if a system exception occurred
* /
@Override
public Sportello fetchByLoginName ( String loginName ,
boolean retrieveFromCache ) throws SystemException {
Object [ ] finderArgs = new Object [ ] { loginName } ;
Object result = null ;
if ( retrieveFromCache ) {
result = FinderCacheUtil . getResult ( FINDER_PATH_FETCH_BY_LOGINNAME ,
finderArgs , this ) ;
}
if ( result instanceof Sportello ) {
Sportello sportello = ( Sportello ) result ;
if ( ! Validator . equals ( loginName , sportello . getLoginName ( ) ) ) {
result = null ;
}
}
if ( result = = null ) {
StringBundler query = new StringBundler ( 3 ) ;
query . append ( _SQL_SELECT_SPORTELLO_WHERE ) ;
boolean bindLoginName = false ;
if ( loginName = = null ) {
query . append ( _FINDER_COLUMN_LOGINNAME_LOGINNAME_1 ) ;
}
else if ( loginName . equals ( StringPool . BLANK ) ) {
query . append ( _FINDER_COLUMN_LOGINNAME_LOGINNAME_3 ) ;
}
else {
bindLoginName = true ;
query . append ( _FINDER_COLUMN_LOGINNAME_LOGINNAME_2 ) ;
}
String sql = query . toString ( ) ;
Session session = null ;
try {
session = openSession ( ) ;
Query q = session . createQuery ( sql ) ;
QueryPos qPos = QueryPos . getInstance ( q ) ;
if ( bindLoginName ) {
qPos . add ( loginName ) ;
}
List < Sportello > list = q . list ( ) ;
if ( list . isEmpty ( ) ) {
FinderCacheUtil . putResult ( FINDER_PATH_FETCH_BY_LOGINNAME ,
finderArgs , list ) ;
}
else {
if ( ( list . size ( ) > 1 ) & & _log . isWarnEnabled ( ) ) {
_log . warn (
"SportelloPersistenceImpl.fetchByLoginName(String, boolean) with parameters (" +
StringUtil . merge ( finderArgs ) +
") yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder." ) ;
}
Sportello sportello = list . get ( 0 ) ;
result = sportello ;
cacheResult ( sportello ) ;
if ( ( sportello . getLoginName ( ) = = null ) | |
! sportello . getLoginName ( ) . equals ( loginName ) ) {
FinderCacheUtil . putResult ( FINDER_PATH_FETCH_BY_LOGINNAME ,
finderArgs , sportello ) ;
}
}
}
catch ( Exception e ) {
FinderCacheUtil . removeResult ( FINDER_PATH_FETCH_BY_LOGINNAME ,
finderArgs ) ;
throw processException ( e ) ;
}
finally {
closeSession ( session ) ;
}
}
if ( result instanceof List < ? > ) {
return null ;
}
else {
return ( Sportello ) result ;
}
}
/ * *
* Removes the sportello where loginName = & # 63 ; from the database .
*
* @param loginName the login name
* @return the sportello that was removed
* @throws SystemException if a system exception occurred
* /
@Override
public Sportello removeByLoginName ( String loginName )
throws NoSuchSportelloException , SystemException {
Sportello sportello = findByLoginName ( loginName ) ;
return remove ( sportello ) ;
}
/ * *
* Returns the number of sportellos where loginName = & # 63 ; .
*
* @param loginName the login name
* @return the number of matching sportellos
* @throws SystemException if a system exception occurred
* /
@Override
public int countByLoginName ( String loginName ) throws SystemException {
FinderPath finderPath = FINDER_PATH_COUNT_BY_LOGINNAME ;
Object [ ] finderArgs = new Object [ ] { loginName } ;
Long count = ( Long ) FinderCacheUtil . getResult ( finderPath , finderArgs ,
this ) ;
if ( count = = null ) {
StringBundler query = new StringBundler ( 2 ) ;
query . append ( _SQL_COUNT_SPORTELLO_WHERE ) ;
boolean bindLoginName = false ;
if ( loginName = = null ) {
query . append ( _FINDER_COLUMN_LOGINNAME_LOGINNAME_1 ) ;
}
else if ( loginName . equals ( StringPool . BLANK ) ) {
query . append ( _FINDER_COLUMN_LOGINNAME_LOGINNAME_3 ) ;
}
else {
bindLoginName = true ;
query . append ( _FINDER_COLUMN_LOGINNAME_LOGINNAME_2 ) ;
}
String sql = query . toString ( ) ;
Session session = null ;
try {
session = openSession ( ) ;
Query q = session . createQuery ( sql ) ;
QueryPos qPos = QueryPos . getInstance ( q ) ;
if ( bindLoginName ) {
qPos . add ( loginName ) ;
}
count = ( Long ) q . uniqueResult ( ) ;
FinderCacheUtil . putResult ( finderPath , finderArgs , count ) ;
}
catch ( Exception e ) {
FinderCacheUtil . removeResult ( finderPath , finderArgs ) ;
throw processException ( e ) ;
}
finally {
closeSession ( session ) ;
}
}
return count . intValue ( ) ;
}
private static final String _FINDER_COLUMN_LOGINNAME_LOGINNAME_1 = "sportello.loginName IS NULL" ;
private static final String _FINDER_COLUMN_LOGINNAME_LOGINNAME_2 = "sportello.loginName = ?" ;
private static final String _FINDER_COLUMN_LOGINNAME_LOGINNAME_3 = "(sportello.loginName IS NULL OR sportello.loginName = '')" ;
public SportelloPersistenceImpl ( ) {
public SportelloPersistenceImpl ( ) {
setModelClass ( Sportello . class ) ;
setModelClass ( Sportello . class ) ;
@ -96,6 +350,9 @@ public class SportelloPersistenceImpl extends BasePersistenceImpl<Sportello>
EntityCacheUtil . putResult ( SportelloModelImpl . ENTITY_CACHE_ENABLED ,
EntityCacheUtil . putResult ( SportelloModelImpl . ENTITY_CACHE_ENABLED ,
SportelloImpl . class , sportello . getPrimaryKey ( ) , sportello ) ;
SportelloImpl . class , sportello . getPrimaryKey ( ) , sportello ) ;
FinderCacheUtil . putResult ( FINDER_PATH_FETCH_BY_LOGINNAME ,
new Object [ ] { sportello . getLoginName ( ) } , sportello ) ;
sportello . resetOriginalValues ( ) ;
sportello . resetOriginalValues ( ) ;
}
}
@ -152,6 +409,8 @@ public class SportelloPersistenceImpl extends BasePersistenceImpl<Sportello>
FinderCacheUtil . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ;
FinderCacheUtil . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ;
FinderCacheUtil . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ;
FinderCacheUtil . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ;
clearUniqueFindersCache ( sportello ) ;
}
}
@Override
@Override
@ -162,6 +421,49 @@ public class SportelloPersistenceImpl extends BasePersistenceImpl<Sportello>
for ( Sportello sportello : sportellos ) {
for ( Sportello sportello : sportellos ) {
EntityCacheUtil . removeResult ( SportelloModelImpl . ENTITY_CACHE_ENABLED ,
EntityCacheUtil . removeResult ( SportelloModelImpl . ENTITY_CACHE_ENABLED ,
SportelloImpl . class , sportello . getPrimaryKey ( ) ) ;
SportelloImpl . class , sportello . getPrimaryKey ( ) ) ;
clearUniqueFindersCache ( sportello ) ;
}
}
protected void cacheUniqueFindersCache ( Sportello sportello ) {
if ( sportello . isNew ( ) ) {
Object [ ] args = new Object [ ] { sportello . getLoginName ( ) } ;
FinderCacheUtil . putResult ( FINDER_PATH_COUNT_BY_LOGINNAME , args ,
Long . valueOf ( 1 ) ) ;
FinderCacheUtil . putResult ( FINDER_PATH_FETCH_BY_LOGINNAME , args ,
sportello ) ;
}
else {
SportelloModelImpl sportelloModelImpl = ( SportelloModelImpl ) sportello ;
if ( ( sportelloModelImpl . getColumnBitmask ( ) &
FINDER_PATH_FETCH_BY_LOGINNAME . getColumnBitmask ( ) ) ! = 0 ) {
Object [ ] args = new Object [ ] { sportello . getLoginName ( ) } ;
FinderCacheUtil . putResult ( FINDER_PATH_COUNT_BY_LOGINNAME , args ,
Long . valueOf ( 1 ) ) ;
FinderCacheUtil . putResult ( FINDER_PATH_FETCH_BY_LOGINNAME , args ,
sportello ) ;
}
}
}
protected void clearUniqueFindersCache ( Sportello sportello ) {
SportelloModelImpl sportelloModelImpl = ( SportelloModelImpl ) sportello ;
Object [ ] args = new Object [ ] { sportello . getLoginName ( ) } ;
FinderCacheUtil . removeResult ( FINDER_PATH_COUNT_BY_LOGINNAME , args ) ;
FinderCacheUtil . removeResult ( FINDER_PATH_FETCH_BY_LOGINNAME , args ) ;
if ( ( sportelloModelImpl . getColumnBitmask ( ) &
FINDER_PATH_FETCH_BY_LOGINNAME . getColumnBitmask ( ) ) ! = 0 ) {
args = new Object [ ] { sportelloModelImpl . getOriginalLoginName ( ) } ;
FinderCacheUtil . removeResult ( FINDER_PATH_COUNT_BY_LOGINNAME , args ) ;
FinderCacheUtil . removeResult ( FINDER_PATH_FETCH_BY_LOGINNAME , args ) ;
}
}
}
}
@ -299,13 +601,16 @@ public class SportelloPersistenceImpl extends BasePersistenceImpl<Sportello>
FinderCacheUtil . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ;
FinderCacheUtil . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ;
if ( isNew ) {
if ( isNew | | ! SportelloModelImpl . COLUMN_BITMASK_ENABLED ) {
FinderCacheUtil . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ;
FinderCacheUtil . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ;
}
}
EntityCacheUtil . putResult ( SportelloModelImpl . ENTITY_CACHE_ENABLED ,
EntityCacheUtil . putResult ( SportelloModelImpl . ENTITY_CACHE_ENABLED ,
SportelloImpl . class , sportello . getPrimaryKey ( ) , sportello ) ;
SportelloImpl . class , sportello . getPrimaryKey ( ) , sportello ) ;
clearUniqueFindersCache ( sportello ) ;
cacheUniqueFindersCache ( sportello ) ;
return sportello ;
return sportello ;
}
}
@ -326,6 +631,9 @@ public class SportelloPersistenceImpl extends BasePersistenceImpl<Sportello>
sportelloImpl . setUserName ( sportello . getUserName ( ) ) ;
sportelloImpl . setUserName ( sportello . getUserName ( ) ) ;
sportelloImpl . setCreateDate ( sportello . getCreateDate ( ) ) ;
sportelloImpl . setCreateDate ( sportello . getCreateDate ( ) ) ;
sportelloImpl . setModifiedDate ( sportello . getModifiedDate ( ) ) ;
sportelloImpl . setModifiedDate ( sportello . getModifiedDate ( ) ) ;
sportelloImpl . setLoginName ( sportello . getLoginName ( ) ) ;
sportelloImpl . setPassword ( sportello . getPassword ( ) ) ;
sportelloImpl . setNonce ( sportello . getNonce ( ) ) ;
return sportelloImpl ;
return sportelloImpl ;
}
}
@ -603,6 +911,11 @@ public class SportelloPersistenceImpl extends BasePersistenceImpl<Sportello>
return count . intValue ( ) ;
return count . intValue ( ) ;
}
}
@Override
protected Set < String > getBadColumnNames ( ) {
return _badColumnNames ;
}
/ * *
/ * *
* Initializes the sportello persistence .
* Initializes the sportello persistence .
* /
* /
@ -636,12 +949,18 @@ public class SportelloPersistenceImpl extends BasePersistenceImpl<Sportello>
}
}
private static final String _SQL_SELECT_SPORTELLO = "SELECT sportello FROM Sportello sportello" ;
private static final String _SQL_SELECT_SPORTELLO = "SELECT sportello FROM Sportello sportello" ;
private static final String _SQL_SELECT_SPORTELLO_WHERE = "SELECT sportello FROM Sportello sportello WHERE " ;
private static final String _SQL_COUNT_SPORTELLO = "SELECT COUNT(sportello) FROM Sportello sportello" ;
private static final String _SQL_COUNT_SPORTELLO = "SELECT COUNT(sportello) FROM Sportello sportello" ;
private static final String _SQL_COUNT_SPORTELLO_WHERE = "SELECT COUNT(sportello) FROM Sportello sportello WHERE " ;
private static final String _ORDER_BY_ENTITY_ALIAS = "sportello." ;
private static final String _ORDER_BY_ENTITY_ALIAS = "sportello." ;
private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Sportello exists with the primary key " ;
private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Sportello exists with the primary key " ;
private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Sportello exists with the key {" ;
private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = GetterUtil . getBoolean ( PropsUtil . get (
private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = GetterUtil . getBoolean ( PropsUtil . get (
PropsKeys . HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE ) ) ;
PropsKeys . HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE ) ) ;
private static Log _log = LogFactoryUtil . getLog ( SportelloPersistenceImpl . class ) ;
private static Log _log = LogFactoryUtil . getLog ( SportelloPersistenceImpl . class ) ;
private static Set < String > _badColumnNames = SetUtil . fromArray ( new String [ ] {
"password"
} ) ;
private static Sportello _nullSportello = new SportelloImpl ( ) {
private static Sportello _nullSportello = new SportelloImpl ( ) {
@Override
@Override
public Object clone ( ) {
public Object clone ( ) {