--- /dev/null
+/**
+ * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ */
+
+package com.pentila.entSavoie.publicSite.service.persistence;
+
+import com.liferay.portal.NoSuchModelException;
+import com.liferay.portal.kernel.bean.BeanReference;
+import com.liferay.portal.kernel.cache.CacheRegistryUtil;
+import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
+import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
+import com.liferay.portal.kernel.dao.orm.FinderPath;
+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.Session;
+import com.liferay.portal.kernel.exception.SystemException;
+import com.liferay.portal.kernel.log.Log;
+import com.liferay.portal.kernel.log.LogFactoryUtil;
+import com.liferay.portal.kernel.portlet.PortletClassLoaderUtil;
+import com.liferay.portal.kernel.util.GetterUtil;
+import com.liferay.portal.kernel.util.InstanceFactory;
+import com.liferay.portal.kernel.util.OrderByComparator;
+import com.liferay.portal.kernel.util.PropsKeys;
+import com.liferay.portal.kernel.util.PropsUtil;
+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.model.CacheModel;
+import com.liferay.portal.model.ModelListener;
+import com.liferay.portal.service.persistence.BatchSessionUtil;
+import com.liferay.portal.service.persistence.ResourcePersistence;
+import com.liferay.portal.service.persistence.UserPersistence;
+import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
+
+import com.pentila.entSavoie.publicSite.NoSuchSiteEtabException;
+import com.pentila.entSavoie.publicSite.model.SiteEtab;
+import com.pentila.entSavoie.publicSite.model.impl.SiteEtabImpl;
+import com.pentila.entSavoie.publicSite.model.impl.SiteEtabModelImpl;
+
+import java.io.Serializable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * The persistence implementation for the site etab service.
+ *
+ * <p>
+ * Caching information and settings can be found in <code>portal.properties</code>
+ * </p>
+ *
+ * @author Mathieu Amblard et Benjamin Apprederisse
+ * @see SiteEtabPersistence
+ * @see SiteEtabUtil
+ * @generated
+ */
+public class SiteEtabPersistenceImpl extends BasePersistenceImpl<SiteEtab>
+ implements SiteEtabPersistence {
+ /*
+ * NOTE FOR DEVELOPERS:
+ *
+ * Never modify or reference this class directly. Always use {@link SiteEtabUtil} to access the site etab persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
+ */
+ public static final String FINDER_CLASS_NAME_ENTITY = SiteEtabImpl.class.getName();
+ public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
+ ".List1";
+ public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
+ ".List2";
+ public static final FinderPath FINDER_PATH_FETCH_BY_ORGANIZATIONID = new FinderPath(SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabModelImpl.FINDER_CACHE_ENABLED, SiteEtabImpl.class,
+ FINDER_CLASS_NAME_ENTITY, "fetchByorganizationId",
+ new String[] { Long.class.getName() },
+ SiteEtabModelImpl.ORGANIZATIONID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_ORGANIZATIONID = new FinderPath(SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByorganizationId",
+ new String[] { Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabModelImpl.FINDER_CACHE_ENABLED, SiteEtabImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabModelImpl.FINDER_CACHE_ENABLED, SiteEtabImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
+
+ /**
+ * Caches the site etab in the entity cache if it is enabled.
+ *
+ * @param siteEtab the site etab
+ */
+ public void cacheResult(SiteEtab siteEtab) {
+ EntityCacheUtil.putResult(SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabImpl.class, siteEtab.getPrimaryKey(), siteEtab);
+
+ FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ORGANIZATIONID,
+ new Object[] { Long.valueOf(siteEtab.getOrganizationId()) },
+ siteEtab);
+
+ siteEtab.resetOriginalValues();
+ }
+
+ /**
+ * Caches the site etabs in the entity cache if it is enabled.
+ *
+ * @param siteEtabs the site etabs
+ */
+ public void cacheResult(List<SiteEtab> siteEtabs) {
+ for (SiteEtab siteEtab : siteEtabs) {
+ if (EntityCacheUtil.getResult(
+ SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabImpl.class, siteEtab.getPrimaryKey()) == null) {
+ cacheResult(siteEtab);
+ }
+ else {
+ siteEtab.resetOriginalValues();
+ }
+ }
+ }
+
+ /**
+ * Clears the cache for all site etabs.
+ *
+ * <p>
+ * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
+ * </p>
+ */
+ @Override
+ public void clearCache() {
+ if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
+ CacheRegistryUtil.clear(SiteEtabImpl.class.getName());
+ }
+
+ EntityCacheUtil.clearCache(SiteEtabImpl.class.getName());
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ /**
+ * Clears the cache for the site etab.
+ *
+ * <p>
+ * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
+ * </p>
+ */
+ @Override
+ public void clearCache(SiteEtab siteEtab) {
+ EntityCacheUtil.removeResult(SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabImpl.class, siteEtab.getPrimaryKey());
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+
+ clearUniqueFindersCache(siteEtab);
+ }
+
+ @Override
+ public void clearCache(List<SiteEtab> siteEtabs) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+
+ for (SiteEtab siteEtab : siteEtabs) {
+ EntityCacheUtil.removeResult(SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabImpl.class, siteEtab.getPrimaryKey());
+
+ clearUniqueFindersCache(siteEtab);
+ }
+ }
+
+ protected void clearUniqueFindersCache(SiteEtab siteEtab) {
+ FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_ORGANIZATIONID,
+ new Object[] { Long.valueOf(siteEtab.getOrganizationId()) });
+ }
+
+ /**
+ * Creates a new site etab with the primary key. Does not add the site etab to the database.
+ *
+ * @param siteEtabId the primary key for the new site etab
+ * @return the new site etab
+ */
+ public SiteEtab create(long siteEtabId) {
+ SiteEtab siteEtab = new SiteEtabImpl();
+
+ siteEtab.setNew(true);
+ siteEtab.setPrimaryKey(siteEtabId);
+
+ return siteEtab;
+ }
+
+ /**
+ * Removes the site etab with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param siteEtabId the primary key of the site etab
+ * @return the site etab that was removed
+ * @throws com.pentila.entSavoie.publicSite.NoSuchSiteEtabException if a site etab with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SiteEtab remove(long siteEtabId)
+ throws NoSuchSiteEtabException, SystemException {
+ return remove(Long.valueOf(siteEtabId));
+ }
+
+ /**
+ * Removes the site etab with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param primaryKey the primary key of the site etab
+ * @return the site etab that was removed
+ * @throws com.pentila.entSavoie.publicSite.NoSuchSiteEtabException if a site etab with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public SiteEtab remove(Serializable primaryKey)
+ throws NoSuchSiteEtabException, SystemException {
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ SiteEtab siteEtab = (SiteEtab)session.get(SiteEtabImpl.class,
+ primaryKey);
+
+ if (siteEtab == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
+ }
+
+ throw new NoSuchSiteEtabException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ primaryKey);
+ }
+
+ return remove(siteEtab);
+ }
+ catch (NoSuchSiteEtabException nsee) {
+ throw nsee;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ @Override
+ protected SiteEtab removeImpl(SiteEtab siteEtab) throws SystemException {
+ siteEtab = toUnwrappedModel(siteEtab);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.delete(session, siteEtab);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ clearCache(siteEtab);
+
+ return siteEtab;
+ }
+
+ @Override
+ public SiteEtab updateImpl(
+ com.pentila.entSavoie.publicSite.model.SiteEtab siteEtab, boolean merge)
+ throws SystemException {
+ siteEtab = toUnwrappedModel(siteEtab);
+
+ boolean isNew = siteEtab.isNew();
+
+ SiteEtabModelImpl siteEtabModelImpl = (SiteEtabModelImpl)siteEtab;
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.update(session, siteEtab, merge);
+
+ siteEtab.setNew(false);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+
+ if (isNew || !SiteEtabModelImpl.COLUMN_BITMASK_ENABLED) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ EntityCacheUtil.putResult(SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabImpl.class, siteEtab.getPrimaryKey(), siteEtab);
+
+ if (isNew) {
+ FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ORGANIZATIONID,
+ new Object[] { Long.valueOf(siteEtab.getOrganizationId()) },
+ siteEtab);
+ }
+ else {
+ if ((siteEtabModelImpl.getColumnBitmask() &
+ FINDER_PATH_FETCH_BY_ORGANIZATIONID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(siteEtabModelImpl.getOriginalOrganizationId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ORGANIZATIONID,
+ args);
+
+ FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_ORGANIZATIONID,
+ args);
+
+ FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ORGANIZATIONID,
+ new Object[] { Long.valueOf(siteEtab.getOrganizationId()) },
+ siteEtab);
+ }
+ }
+
+ return siteEtab;
+ }
+
+ protected SiteEtab toUnwrappedModel(SiteEtab siteEtab) {
+ if (siteEtab instanceof SiteEtabImpl) {
+ return siteEtab;
+ }
+
+ SiteEtabImpl siteEtabImpl = new SiteEtabImpl();
+
+ siteEtabImpl.setNew(siteEtab.isNew());
+ siteEtabImpl.setPrimaryKey(siteEtab.getPrimaryKey());
+
+ siteEtabImpl.setSiteEtabId(siteEtab.getSiteEtabId());
+ siteEtabImpl.setOrganizationId(siteEtab.getOrganizationId());
+ siteEtabImpl.setUrl(siteEtab.getUrl());
+ siteEtabImpl.setUrlWordpress(siteEtab.getUrlWordpress());
+ siteEtabImpl.setSiteWordpress(siteEtab.isSiteWordpress());
+ siteEtabImpl.setOrganizationName(siteEtab.getOrganizationName());
+ siteEtabImpl.setSiteActive(siteEtab.isSiteActive());
+ siteEtabImpl.setWordpressActive(siteEtab.isWordpressActive());
+
+ return siteEtabImpl;
+ }
+
+ /**
+ * Returns the site etab with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
+ *
+ * @param primaryKey the primary key of the site etab
+ * @return the site etab
+ * @throws com.liferay.portal.NoSuchModelException if a site etab with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public SiteEtab findByPrimaryKey(Serializable primaryKey)
+ throws NoSuchModelException, SystemException {
+ return findByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the site etab with the primary key or throws a {@link com.pentila.entSavoie.publicSite.NoSuchSiteEtabException} if it could not be found.
+ *
+ * @param siteEtabId the primary key of the site etab
+ * @return the site etab
+ * @throws com.pentila.entSavoie.publicSite.NoSuchSiteEtabException if a site etab with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SiteEtab findByPrimaryKey(long siteEtabId)
+ throws NoSuchSiteEtabException, SystemException {
+ SiteEtab siteEtab = fetchByPrimaryKey(siteEtabId);
+
+ if (siteEtab == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + siteEtabId);
+ }
+
+ throw new NoSuchSiteEtabException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ siteEtabId);
+ }
+
+ return siteEtab;
+ }
+
+ /**
+ * Returns the site etab with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param primaryKey the primary key of the site etab
+ * @return the site etab, or <code>null</code> if a site etab with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public SiteEtab fetchByPrimaryKey(Serializable primaryKey)
+ throws SystemException {
+ return fetchByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the site etab with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param siteEtabId the primary key of the site etab
+ * @return the site etab, or <code>null</code> if a site etab with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SiteEtab fetchByPrimaryKey(long siteEtabId)
+ throws SystemException {
+ SiteEtab siteEtab = (SiteEtab)EntityCacheUtil.getResult(SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabImpl.class, siteEtabId);
+
+ if (siteEtab == _nullSiteEtab) {
+ return null;
+ }
+
+ if (siteEtab == null) {
+ Session session = null;
+
+ boolean hasException = false;
+
+ try {
+ session = openSession();
+
+ siteEtab = (SiteEtab)session.get(SiteEtabImpl.class,
+ Long.valueOf(siteEtabId));
+ }
+ catch (Exception e) {
+ hasException = true;
+
+ throw processException(e);
+ }
+ finally {
+ if (siteEtab != null) {
+ cacheResult(siteEtab);
+ }
+ else if (!hasException) {
+ EntityCacheUtil.putResult(SiteEtabModelImpl.ENTITY_CACHE_ENABLED,
+ SiteEtabImpl.class, siteEtabId, _nullSiteEtab);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return siteEtab;
+ }
+
+ /**
+ * Returns the site etab where organizationId = ? or throws a {@link com.pentila.entSavoie.publicSite.NoSuchSiteEtabException} if it could not be found.
+ *
+ * @param organizationId the organization ID
+ * @return the matching site etab
+ * @throws com.pentila.entSavoie.publicSite.NoSuchSiteEtabException if a matching site etab could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SiteEtab findByorganizationId(long organizationId)
+ throws NoSuchSiteEtabException, SystemException {
+ SiteEtab siteEtab = fetchByorganizationId(organizationId);
+
+ if (siteEtab == null) {
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("organizationId=");
+ msg.append(organizationId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ if (_log.isWarnEnabled()) {
+ _log.warn(msg.toString());
+ }
+
+ throw new NoSuchSiteEtabException(msg.toString());
+ }
+
+ return siteEtab;
+ }
+
+ /**
+ * Returns the site etab where organizationId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
+ *
+ * @param organizationId the organization ID
+ * @return the matching site etab, or <code>null</code> if a matching site etab could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SiteEtab fetchByorganizationId(long organizationId)
+ throws SystemException {
+ return fetchByorganizationId(organizationId, true);
+ }
+
+ /**
+ * Returns the site etab where organizationId = ? or returns <code>null</code> if it could not be found, optionally using the finder cache.
+ *
+ * @param organizationId the organization ID
+ * @param retrieveFromCache whether to use the finder cache
+ * @return the matching site etab, or <code>null</code> if a matching site etab could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public SiteEtab fetchByorganizationId(long organizationId,
+ boolean retrieveFromCache) throws SystemException {
+ Object[] finderArgs = new Object[] { organizationId };
+
+ Object result = null;
+
+ if (retrieveFromCache) {
+ result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_ORGANIZATIONID,
+ finderArgs, this);
+ }
+
+ if (result instanceof SiteEtab) {
+ SiteEtab siteEtab = (SiteEtab)result;
+
+ if ((organizationId != siteEtab.getOrganizationId())) {
+ result = null;
+ }
+ }
+
+ if (result == null) {
+ StringBundler query = new StringBundler(2);
+
+ query.append(_SQL_SELECT_SITEETAB_WHERE);
+
+ query.append(_FINDER_COLUMN_ORGANIZATIONID_ORGANIZATIONID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(organizationId);
+
+ List<SiteEtab> list = q.list();
+
+ result = list;
+
+ SiteEtab siteEtab = null;
+
+ if (list.isEmpty()) {
+ FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ORGANIZATIONID,
+ finderArgs, list);
+ }
+ else {
+ siteEtab = list.get(0);
+
+ cacheResult(siteEtab);
+
+ if ((siteEtab.getOrganizationId() != organizationId)) {
+ FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ORGANIZATIONID,
+ finderArgs, siteEtab);
+ }
+ }
+
+ return siteEtab;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (result == null) {
+ FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_ORGANIZATIONID,
+ finderArgs);
+ }
+
+ closeSession(session);
+ }
+ }
+ else {
+ if (result instanceof List<?>) {
+ return null;
+ }
+ else {
+ return (SiteEtab)result;
+ }
+ }
+ }
+
+ /**
+ * Returns all the site etabs.
+ *
+ * @return the site etabs
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SiteEtab> findAll() throws SystemException {
+ return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the site etabs.
+ *
+ * <p>
+ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
+ * </p>
+ *
+ * @param start the lower bound of the range of site etabs
+ * @param end the upper bound of the range of site etabs (not inclusive)
+ * @return the range of site etabs
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SiteEtab> findAll(int start, int end) throws SystemException {
+ return findAll(start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the site etabs.
+ *
+ * <p>
+ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
+ * </p>
+ *
+ * @param start the lower bound of the range of site etabs
+ * @param end the upper bound of the range of site etabs (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of site etabs
+ * @throws SystemException if a system exception occurred
+ */
+ public List<SiteEtab> findAll(int start, int end,
+ OrderByComparator orderByComparator) throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = new Object[] { start, end, orderByComparator };
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
+ finderArgs = FINDER_ARGS_EMPTY;
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
+ finderArgs = new Object[] { start, end, orderByComparator };
+ }
+
+ List<SiteEtab> list = (List<SiteEtab>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if (list == null) {
+ StringBundler query = null;
+ String sql = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(2 +
+ (orderByComparator.getOrderByFields().length * 3));
+
+ query.append(_SQL_SELECT_SITEETAB);
+
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+
+ sql = query.toString();
+ }
+ else {
+ sql = _SQL_SELECT_SITEETAB;
+ }
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ if (orderByComparator == null) {
+ list = (List<SiteEtab>)QueryUtil.list(q, getDialect(),
+ start, end, false);
+
+ Collections.sort(list);
+ }
+ else {
+ list = (List<SiteEtab>)QueryUtil.list(q, getDialect(),
+ start, end);
+ }
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (list == null) {
+ FinderCacheUtil.removeResult(finderPath, finderArgs);
+ }
+ else {
+ cacheResult(list);
+
+ FinderCacheUtil.putResult(finderPath, finderArgs, list);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * Removes the site etab where organizationId = ? from the database.
+ *
+ * @param organizationId the organization ID
+ * @return the site etab that was removed
+ * @throws SystemException if a system exception occurred
+ */
+ public SiteEtab removeByorganizationId(long organizationId)
+ throws NoSuchSiteEtabException, SystemException {
+ SiteEtab siteEtab = findByorganizationId(organizationId);
+
+ return remove(siteEtab);
+ }
+
+ /**
+ * Removes all the site etabs from the database.
+ *
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeAll() throws SystemException {
+ for (SiteEtab siteEtab : findAll()) {
+ remove(siteEtab);
+ }
+ }
+
+ /**
+ * Returns the number of site etabs where organizationId = ?.
+ *
+ * @param organizationId the organization ID
+ * @return the number of matching site etabs
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByorganizationId(long organizationId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { organizationId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ORGANIZATIONID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(2);
+
+ query.append(_SQL_COUNT_SITEETAB_WHERE);
+
+ query.append(_FINDER_COLUMN_ORGANIZATIONID_ORGANIZATIONID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(organizationId);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ORGANIZATIONID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of site etabs.
+ *
+ * @return the number of site etabs
+ * @throws SystemException if a system exception occurred
+ */
+ public int countAll() throws SystemException {
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
+ FINDER_ARGS_EMPTY, this);
+
+ if (count == null) {
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(_SQL_COUNT_SITEETAB);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
+ FINDER_ARGS_EMPTY, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Initializes the site etab persistence.
+ */
+ public void afterPropertiesSet() {
+ String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
+ com.liferay.util.service.ServiceProps.get(
+ "value.object.listener.com.pentila.entSavoie.publicSite.model.SiteEtab")));
+
+ if (listenerClassNames.length > 0) {
+ try {
+ List<ModelListener<SiteEtab>> listenersList = new ArrayList<ModelListener<SiteEtab>>();
+
+ for (String listenerClassName : listenerClassNames) {
+ listenersList.add((ModelListener<SiteEtab>)InstanceFactory.newInstance(
+ PortletClassLoaderUtil.getClassLoader(),
+ listenerClassName, (Class<?>[])null, (Object[])null));
+ }
+
+ listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
+ }
+ catch (Exception e) {
+ _log.error(e);
+ }
+ }
+ }
+
+ public void destroy() {
+ EntityCacheUtil.removeCache(SiteEtabImpl.class.getName());
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @BeanReference(type = SiteEtabPersistence.class)
+ protected SiteEtabPersistence siteEtabPersistence;
+ @BeanReference(type = SiteWordpressAdminPersistence.class)
+ protected SiteWordpressAdminPersistence siteWordpressAdminPersistence;
+ @BeanReference(type = ResourcePersistence.class)
+ protected ResourcePersistence resourcePersistence;
+ @BeanReference(type = UserPersistence.class)
+ protected UserPersistence userPersistence;
+ private static final String _SQL_SELECT_SITEETAB = "SELECT siteEtab FROM SiteEtab siteEtab";
+ private static final String _SQL_SELECT_SITEETAB_WHERE = "SELECT siteEtab FROM SiteEtab siteEtab WHERE ";
+ private static final String _SQL_COUNT_SITEETAB = "SELECT COUNT(siteEtab) FROM SiteEtab siteEtab";
+ private static final String _SQL_COUNT_SITEETAB_WHERE = "SELECT COUNT(siteEtab) FROM SiteEtab siteEtab WHERE ";
+ private static final String _FINDER_COLUMN_ORGANIZATIONID_ORGANIZATIONID_2 = "siteEtab.organizationId = ?";
+ private static final String _ORDER_BY_ENTITY_ALIAS = "siteEtab.";
+ private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SiteEtab exists with the primary key ";
+ private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SiteEtab exists with the key {";
+ private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = GetterUtil.getBoolean(PropsUtil.get(
+ PropsKeys.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE));
+ private static Log _log = LogFactoryUtil.getLog(SiteEtabPersistenceImpl.class);
+ private static SiteEtab _nullSiteEtab = new SiteEtabImpl() {
+ @Override
+ public Object clone() {
+ return this;
+ }
+
+ @Override
+ public CacheModel<SiteEtab> toCacheModel() {
+ return _nullSiteEtabCacheModel;
+ }
+ };
+
+ private static CacheModel<SiteEtab> _nullSiteEtabCacheModel = new CacheModel<SiteEtab>() {
+ public SiteEtab toEntityModel() {
+ return _nullSiteEtab;
+ }
+ };
+}
\ No newline at end of file