--- /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.agenda.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.kernel.util.Validator;
+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.agenda.NoSuchRessourceException;
+import com.pentila.entSavoie.agenda.model.Ressource;
+import com.pentila.entSavoie.agenda.model.impl.RessourceImpl;
+import com.pentila.entSavoie.agenda.model.impl.RessourceModelImpl;
+
+import java.io.Serializable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * The persistence implementation for the ressource service.
+ *
+ * <p>
+ * Caching information and settings can be found in <code>portal.properties</code>
+ * </p>
+ *
+ * @author Igor Barma
+ * @see RessourcePersistence
+ * @see RessourceUtil
+ * @generated
+ */
+public class RessourcePersistenceImpl extends BasePersistenceImpl<Ressource>
+ implements RessourcePersistence {
+ /*
+ * NOTE FOR DEVELOPERS:
+ *
+ * Never modify or reference this class directly. Always use {@link RessourceUtil} to access the ressource persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
+ */
+ public static final String FINDER_CLASS_NAME_ENTITY = RessourceImpl.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_WITH_PAGINATION_FIND_BY_IDCREATOR_CDTUSERID =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findByidcreator_cdtUserId",
+ new String[] {
+ Long.class.getName(), Long.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_IDCREATOR_CDTUSERID =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findByidcreator_cdtUserId",
+ new String[] { Long.class.getName(), Long.class.getName() },
+ RessourceModelImpl.IDCREATOR_COLUMN_BITMASK |
+ RessourceModelImpl.CDTUSERID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_IDCREATOR_CDTUSERID = new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countByidcreator_cdtUserId",
+ new String[] { Long.class.getName(), Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_IDCREATOR_KIND =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByidcreator_kind",
+ new String[] {
+ Long.class.getName(), Integer.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_IDCREATOR_KIND =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByidcreator_kind",
+ new String[] { Long.class.getName(), Integer.class.getName() },
+ RessourceModelImpl.IDCREATOR_COLUMN_BITMASK |
+ RessourceModelImpl.KIND_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_IDCREATOR_KIND = new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByidcreator_kind",
+ new String[] { Long.class.getName(), Integer.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_KIND_ETABID =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBykind_etabId",
+ new String[] {
+ Integer.class.getName(), Long.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_KIND_ETABID =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBykind_etabId",
+ new String[] { Integer.class.getName(), Long.class.getName() },
+ RessourceModelImpl.KIND_COLUMN_BITMASK |
+ RessourceModelImpl.ETABID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_KIND_ETABID = new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countBykind_etabId",
+ new String[] { Integer.class.getName(), Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_KIND_ETABID_NAME =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBykind_etabId_name",
+ new String[] {
+ Integer.class.getName(), Long.class.getName(),
+ String.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_KIND_ETABID_NAME =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findBykind_etabId_name",
+ new String[] {
+ Integer.class.getName(), Long.class.getName(),
+ String.class.getName()
+ },
+ RessourceModelImpl.KIND_COLUMN_BITMASK |
+ RessourceModelImpl.ETABID_COLUMN_BITMASK |
+ RessourceModelImpl.NAME_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_KIND_ETABID_NAME = new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countBykind_etabId_name",
+ new String[] {
+ Integer.class.getName(), Long.class.getName(),
+ String.class.getName()
+ });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findByressourceType_scope_kind_forcePubli",
+ new String[] {
+ Integer.class.getName(), Integer.class.getName(),
+ Integer.class.getName(), Boolean.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findByressourceType_scope_kind_forcePubli",
+ new String[] {
+ Integer.class.getName(), Integer.class.getName(),
+ Integer.class.getName(), Boolean.class.getName()
+ },
+ RessourceModelImpl.RESSOURCETYPE_COLUMN_BITMASK |
+ RessourceModelImpl.SCOPE_COLUMN_BITMASK |
+ RessourceModelImpl.KIND_COLUMN_BITMASK |
+ RessourceModelImpl.FORCEPUBLI_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countByressourceType_scope_kind_forcePubli",
+ new String[] {
+ Integer.class.getName(), Integer.class.getName(),
+ Integer.class.getName(), Boolean.class.getName()
+ });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findByetabId_ressourceType_scope_kind_forcePubli",
+ new String[] {
+ Long.class.getName(), Integer.class.getName(),
+ Integer.class.getName(), Integer.class.getName(),
+ Boolean.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findByetabId_ressourceType_scope_kind_forcePubli",
+ new String[] {
+ Long.class.getName(), Integer.class.getName(),
+ Integer.class.getName(), Integer.class.getName(),
+ Boolean.class.getName()
+ },
+ RessourceModelImpl.ETABID_COLUMN_BITMASK |
+ RessourceModelImpl.RESSOURCETYPE_COLUMN_BITMASK |
+ RessourceModelImpl.SCOPE_COLUMN_BITMASK |
+ RessourceModelImpl.KIND_COLUMN_BITMASK |
+ RessourceModelImpl.FORCEPUBLI_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countByetabId_ressourceType_scope_kind_forcePubli",
+ new String[] {
+ Long.class.getName(), Integer.class.getName(),
+ Integer.class.getName(), Integer.class.getName(),
+ Boolean.class.getName()
+ });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findByressourceType_scope_forcePubli",
+ new String[] {
+ Integer.class.getName(), Integer.class.getName(),
+ Boolean.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findByressourceType_scope_forcePubli",
+ new String[] {
+ Integer.class.getName(), Integer.class.getName(),
+ Boolean.class.getName()
+ },
+ RessourceModelImpl.RESSOURCETYPE_COLUMN_BITMASK |
+ RessourceModelImpl.SCOPE_COLUMN_BITMASK |
+ RessourceModelImpl.FORCEPUBLI_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countByressourceType_scope_forcePubli",
+ new String[] {
+ Integer.class.getName(), Integer.class.getName(),
+ Boolean.class.getName()
+ });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findByetabId_ressourceType_scope_forcePubli",
+ new String[] {
+ Long.class.getName(), Integer.class.getName(),
+ Integer.class.getName(), Boolean.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findByetabId_ressourceType_scope_forcePubli",
+ new String[] {
+ Long.class.getName(), Integer.class.getName(),
+ Integer.class.getName(), Boolean.class.getName()
+ },
+ RessourceModelImpl.ETABID_COLUMN_BITMASK |
+ RessourceModelImpl.RESSOURCETYPE_COLUMN_BITMASK |
+ RessourceModelImpl.SCOPE_COLUMN_BITMASK |
+ RessourceModelImpl.FORCEPUBLI_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countByetabId_ressourceType_scope_forcePubli",
+ new String[] {
+ Long.class.getName(), Integer.class.getName(),
+ Integer.class.getName(), Boolean.class.getName()
+ });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ETABID_NAME =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByetabId_name",
+ new String[] {
+ Long.class.getName(), String.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_NAME =
+ new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByetabId_name",
+ new String[] { Long.class.getName(), String.class.getName() },
+ RessourceModelImpl.ETABID_COLUMN_BITMASK |
+ RessourceModelImpl.NAME_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_ETABID_NAME = new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByetabId_name",
+ new String[] { Long.class.getName(), String.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, RessourceImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
+
+ /**
+ * Caches the ressource in the entity cache if it is enabled.
+ *
+ * @param ressource the ressource
+ */
+ public void cacheResult(Ressource ressource) {
+ EntityCacheUtil.putResult(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceImpl.class, ressource.getPrimaryKey(), ressource);
+
+ ressource.resetOriginalValues();
+ }
+
+ /**
+ * Caches the ressources in the entity cache if it is enabled.
+ *
+ * @param ressources the ressources
+ */
+ public void cacheResult(List<Ressource> ressources) {
+ for (Ressource ressource : ressources) {
+ if (EntityCacheUtil.getResult(
+ RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceImpl.class, ressource.getPrimaryKey()) == null) {
+ cacheResult(ressource);
+ }
+ else {
+ ressource.resetOriginalValues();
+ }
+ }
+ }
+
+ /**
+ * Clears the cache for all ressources.
+ *
+ * <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(RessourceImpl.class.getName());
+ }
+
+ EntityCacheUtil.clearCache(RessourceImpl.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 ressource.
+ *
+ * <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(Ressource ressource) {
+ EntityCacheUtil.removeResult(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceImpl.class, ressource.getPrimaryKey());
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @Override
+ public void clearCache(List<Ressource> ressources) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+
+ for (Ressource ressource : ressources) {
+ EntityCacheUtil.removeResult(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceImpl.class, ressource.getPrimaryKey());
+ }
+ }
+
+ /**
+ * Creates a new ressource with the primary key. Does not add the ressource to the database.
+ *
+ * @param idRessource the primary key for the new ressource
+ * @return the new ressource
+ */
+ public Ressource create(long idRessource) {
+ Ressource ressource = new RessourceImpl();
+
+ ressource.setNew(true);
+ ressource.setPrimaryKey(idRessource);
+
+ return ressource;
+ }
+
+ /**
+ * Removes the ressource with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param idRessource the primary key of the ressource
+ * @return the ressource that was removed
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource remove(long idRessource)
+ throws NoSuchRessourceException, SystemException {
+ return remove(Long.valueOf(idRessource));
+ }
+
+ /**
+ * Removes the ressource with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param primaryKey the primary key of the ressource
+ * @return the ressource that was removed
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public Ressource remove(Serializable primaryKey)
+ throws NoSuchRessourceException, SystemException {
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Ressource ressource = (Ressource)session.get(RessourceImpl.class,
+ primaryKey);
+
+ if (ressource == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
+ }
+
+ throw new NoSuchRessourceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ primaryKey);
+ }
+
+ return remove(ressource);
+ }
+ catch (NoSuchRessourceException nsee) {
+ throw nsee;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ @Override
+ protected Ressource removeImpl(Ressource ressource)
+ throws SystemException {
+ ressource = toUnwrappedModel(ressource);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.delete(session, ressource);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ clearCache(ressource);
+
+ return ressource;
+ }
+
+ @Override
+ public Ressource updateImpl(
+ com.pentila.entSavoie.agenda.model.Ressource ressource, boolean merge)
+ throws SystemException {
+ ressource = toUnwrappedModel(ressource);
+
+ boolean isNew = ressource.isNew();
+
+ RessourceModelImpl ressourceModelImpl = (RessourceModelImpl)ressource;
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.update(session, ressource, merge);
+
+ ressource.setNew(false);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+
+ if (isNew || !RessourceModelImpl.COLUMN_BITMASK_ENABLED) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ else {
+ if ((ressourceModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_IDCREATOR_CDTUSERID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(ressourceModelImpl.getOriginalIdcreator()),
+ Long.valueOf(ressourceModelImpl.getOriginalCdtUserId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_IDCREATOR_CDTUSERID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_IDCREATOR_CDTUSERID,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(ressourceModelImpl.getIdcreator()),
+ Long.valueOf(ressourceModelImpl.getCdtUserId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_IDCREATOR_CDTUSERID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_IDCREATOR_CDTUSERID,
+ args);
+ }
+
+ if ((ressourceModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_IDCREATOR_KIND.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(ressourceModelImpl.getOriginalIdcreator()),
+ Integer.valueOf(ressourceModelImpl.getOriginalKind())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_IDCREATOR_KIND,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_IDCREATOR_KIND,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(ressourceModelImpl.getIdcreator()),
+ Integer.valueOf(ressourceModelImpl.getKind())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_IDCREATOR_KIND,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_IDCREATOR_KIND,
+ args);
+ }
+
+ if ((ressourceModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_KIND_ETABID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Integer.valueOf(ressourceModelImpl.getOriginalKind()),
+ Long.valueOf(ressourceModelImpl.getOriginalEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_KIND_ETABID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_KIND_ETABID,
+ args);
+
+ args = new Object[] {
+ Integer.valueOf(ressourceModelImpl.getKind()),
+ Long.valueOf(ressourceModelImpl.getEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_KIND_ETABID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_KIND_ETABID,
+ args);
+ }
+
+ if ((ressourceModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_KIND_ETABID_NAME.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Integer.valueOf(ressourceModelImpl.getOriginalKind()),
+ Long.valueOf(ressourceModelImpl.getOriginalEtabId()),
+
+ ressourceModelImpl.getOriginalName()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_KIND_ETABID_NAME,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_KIND_ETABID_NAME,
+ args);
+
+ args = new Object[] {
+ Integer.valueOf(ressourceModelImpl.getKind()),
+ Long.valueOf(ressourceModelImpl.getEtabId()),
+
+ ressourceModelImpl.getName()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_KIND_ETABID_NAME,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_KIND_ETABID_NAME,
+ args);
+ }
+
+ if ((ressourceModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Integer.valueOf(ressourceModelImpl.getOriginalRessourceType()),
+ Integer.valueOf(ressourceModelImpl.getOriginalScope()),
+ Integer.valueOf(ressourceModelImpl.getOriginalKind()),
+ Boolean.valueOf(ressourceModelImpl.getOriginalForcePubli())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ args);
+
+ args = new Object[] {
+ Integer.valueOf(ressourceModelImpl.getRessourceType()),
+ Integer.valueOf(ressourceModelImpl.getScope()),
+ Integer.valueOf(ressourceModelImpl.getKind()),
+ Boolean.valueOf(ressourceModelImpl.getForcePubli())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ args);
+ }
+
+ if ((ressourceModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(ressourceModelImpl.getOriginalEtabId()),
+ Integer.valueOf(ressourceModelImpl.getOriginalRessourceType()),
+ Integer.valueOf(ressourceModelImpl.getOriginalScope()),
+ Integer.valueOf(ressourceModelImpl.getOriginalKind()),
+ Boolean.valueOf(ressourceModelImpl.getOriginalForcePubli())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(ressourceModelImpl.getEtabId()),
+ Integer.valueOf(ressourceModelImpl.getRessourceType()),
+ Integer.valueOf(ressourceModelImpl.getScope()),
+ Integer.valueOf(ressourceModelImpl.getKind()),
+ Boolean.valueOf(ressourceModelImpl.getForcePubli())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ args);
+ }
+
+ if ((ressourceModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Integer.valueOf(ressourceModelImpl.getOriginalRessourceType()),
+ Integer.valueOf(ressourceModelImpl.getOriginalScope()),
+ Boolean.valueOf(ressourceModelImpl.getOriginalForcePubli())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ args);
+
+ args = new Object[] {
+ Integer.valueOf(ressourceModelImpl.getRessourceType()),
+ Integer.valueOf(ressourceModelImpl.getScope()),
+ Boolean.valueOf(ressourceModelImpl.getForcePubli())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ args);
+ }
+
+ if ((ressourceModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(ressourceModelImpl.getOriginalEtabId()),
+ Integer.valueOf(ressourceModelImpl.getOriginalRessourceType()),
+ Integer.valueOf(ressourceModelImpl.getOriginalScope()),
+ Boolean.valueOf(ressourceModelImpl.getOriginalForcePubli())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(ressourceModelImpl.getEtabId()),
+ Integer.valueOf(ressourceModelImpl.getRessourceType()),
+ Integer.valueOf(ressourceModelImpl.getScope()),
+ Boolean.valueOf(ressourceModelImpl.getForcePubli())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ args);
+ }
+
+ if ((ressourceModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_NAME.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(ressourceModelImpl.getOriginalEtabId()),
+
+ ressourceModelImpl.getOriginalName()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ETABID_NAME,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_NAME,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(ressourceModelImpl.getEtabId()),
+
+ ressourceModelImpl.getName()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ETABID_NAME,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_NAME,
+ args);
+ }
+ }
+
+ EntityCacheUtil.putResult(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceImpl.class, ressource.getPrimaryKey(), ressource);
+
+ return ressource;
+ }
+
+ protected Ressource toUnwrappedModel(Ressource ressource) {
+ if (ressource instanceof RessourceImpl) {
+ return ressource;
+ }
+
+ RessourceImpl ressourceImpl = new RessourceImpl();
+
+ ressourceImpl.setNew(ressource.isNew());
+ ressourceImpl.setPrimaryKey(ressource.getPrimaryKey());
+
+ ressourceImpl.setIdRessource(ressource.getIdRessource());
+ ressourceImpl.setIdcreator(ressource.getIdcreator());
+ ressourceImpl.setName(ressource.getName());
+ ressourceImpl.setDescription(ressource.getDescription());
+ ressourceImpl.setRessourceType(ressource.getRessourceType());
+ ressourceImpl.setScope(ressource.getScope());
+ ressourceImpl.setColor(ressource.getColor());
+ ressourceImpl.setEtabId(ressource.getEtabId());
+ ressourceImpl.setKind(ressource.getKind());
+ ressourceImpl.setForcePubli(ressource.isForcePubli());
+ ressourceImpl.setCdtUserId(ressource.getCdtUserId());
+ ressourceImpl.setRessource(ressource.isRessource());
+ ressourceImpl.setEcriture(ressource.isEcriture());
+ ressourceImpl.setFiltreCours(ressource.getFiltreCours());
+ ressourceImpl.setClasse(ressource.getClasse());
+ ressourceImpl.setMatiere(ressource.getMatiere());
+ ressourceImpl.setOnlyMyClass(ressource.isOnlyMyClass());
+
+ return ressourceImpl;
+ }
+
+ /**
+ * Returns the ressource 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 ressource
+ * @return the ressource
+ * @throws com.liferay.portal.NoSuchModelException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public Ressource findByPrimaryKey(Serializable primaryKey)
+ throws NoSuchModelException, SystemException {
+ return findByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the ressource with the primary key or throws a {@link com.pentila.entSavoie.agenda.NoSuchRessourceException} if it could not be found.
+ *
+ * @param idRessource the primary key of the ressource
+ * @return the ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByPrimaryKey(long idRessource)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByPrimaryKey(idRessource);
+
+ if (ressource == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + idRessource);
+ }
+
+ throw new NoSuchRessourceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ idRessource);
+ }
+
+ return ressource;
+ }
+
+ /**
+ * Returns the ressource with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param primaryKey the primary key of the ressource
+ * @return the ressource, or <code>null</code> if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public Ressource fetchByPrimaryKey(Serializable primaryKey)
+ throws SystemException {
+ return fetchByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the ressource with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param idRessource the primary key of the ressource
+ * @return the ressource, or <code>null</code> if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByPrimaryKey(long idRessource)
+ throws SystemException {
+ Ressource ressource = (Ressource)EntityCacheUtil.getResult(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceImpl.class, idRessource);
+
+ if (ressource == _nullRessource) {
+ return null;
+ }
+
+ if (ressource == null) {
+ Session session = null;
+
+ boolean hasException = false;
+
+ try {
+ session = openSession();
+
+ ressource = (Ressource)session.get(RessourceImpl.class,
+ Long.valueOf(idRessource));
+ }
+ catch (Exception e) {
+ hasException = true;
+
+ throw processException(e);
+ }
+ finally {
+ if (ressource != null) {
+ cacheResult(ressource);
+ }
+ else if (!hasException) {
+ EntityCacheUtil.putResult(RessourceModelImpl.ENTITY_CACHE_ENABLED,
+ RessourceImpl.class, idRessource, _nullRessource);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return ressource;
+ }
+
+ /**
+ * Returns all the ressources where idcreator = ? and cdtUserId = ?.
+ *
+ * @param idcreator the idcreator
+ * @param cdtUserId the cdt user ID
+ * @return the matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByidcreator_cdtUserId(long idcreator,
+ long cdtUserId) throws SystemException {
+ return findByidcreator_cdtUserId(idcreator, cdtUserId,
+ QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the ressources where idcreator = ? and cdtUserId = ?.
+ *
+ * <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 idcreator the idcreator
+ * @param cdtUserId the cdt user ID
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @return the range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByidcreator_cdtUserId(long idcreator,
+ long cdtUserId, int start, int end) throws SystemException {
+ return findByidcreator_cdtUserId(idcreator, cdtUserId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the ressources where idcreator = ? and cdtUserId = ?.
+ *
+ * <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 idcreator the idcreator
+ * @param cdtUserId the cdt user ID
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByidcreator_cdtUserId(long idcreator,
+ long cdtUserId, int start, int end, OrderByComparator orderByComparator)
+ throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_IDCREATOR_CDTUSERID;
+ finderArgs = new Object[] { idcreator, cdtUserId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_IDCREATOR_CDTUSERID;
+ finderArgs = new Object[] {
+ idcreator, cdtUserId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Ressource> list = (List<Ressource>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Ressource ressource : list) {
+ if ((idcreator != ressource.getIdcreator()) ||
+ (cdtUserId != ressource.getCdtUserId())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(4 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_CDTUSERID_IDCREATOR_2);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_CDTUSERID_CDTUSERID_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(idcreator);
+
+ qPos.add(cdtUserId);
+
+ list = (List<Ressource>)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;
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where idcreator = ? and cdtUserId = ?.
+ *
+ * @param idcreator the idcreator
+ * @param cdtUserId the cdt user ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByidcreator_cdtUserId_First(long idcreator,
+ long cdtUserId, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByidcreator_cdtUserId_First(idcreator,
+ cdtUserId, orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("idcreator=");
+ msg.append(idcreator);
+
+ msg.append(", cdtUserId=");
+ msg.append(cdtUserId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where idcreator = ? and cdtUserId = ?.
+ *
+ * @param idcreator the idcreator
+ * @param cdtUserId the cdt user ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByidcreator_cdtUserId_First(long idcreator,
+ long cdtUserId, OrderByComparator orderByComparator)
+ throws SystemException {
+ List<Ressource> list = findByidcreator_cdtUserId(idcreator, cdtUserId,
+ 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where idcreator = ? and cdtUserId = ?.
+ *
+ * @param idcreator the idcreator
+ * @param cdtUserId the cdt user ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByidcreator_cdtUserId_Last(long idcreator,
+ long cdtUserId, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByidcreator_cdtUserId_Last(idcreator,
+ cdtUserId, orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("idcreator=");
+ msg.append(idcreator);
+
+ msg.append(", cdtUserId=");
+ msg.append(cdtUserId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where idcreator = ? and cdtUserId = ?.
+ *
+ * @param idcreator the idcreator
+ * @param cdtUserId the cdt user ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByidcreator_cdtUserId_Last(long idcreator,
+ long cdtUserId, OrderByComparator orderByComparator)
+ throws SystemException {
+ int count = countByidcreator_cdtUserId(idcreator, cdtUserId);
+
+ List<Ressource> list = findByidcreator_cdtUserId(idcreator, cdtUserId,
+ count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the ressources before and after the current ressource in the ordered set where idcreator = ? and cdtUserId = ?.
+ *
+ * @param idRessource the primary key of the current ressource
+ * @param idcreator the idcreator
+ * @param cdtUserId the cdt user ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource[] findByidcreator_cdtUserId_PrevAndNext(long idRessource,
+ long idcreator, long cdtUserId, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = findByPrimaryKey(idRessource);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Ressource[] array = new RessourceImpl[3];
+
+ array[0] = getByidcreator_cdtUserId_PrevAndNext(session, ressource,
+ idcreator, cdtUserId, orderByComparator, true);
+
+ array[1] = ressource;
+
+ array[2] = getByidcreator_cdtUserId_PrevAndNext(session, ressource,
+ idcreator, cdtUserId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Ressource getByidcreator_cdtUserId_PrevAndNext(Session session,
+ Ressource ressource, long idcreator, long cdtUserId,
+ OrderByComparator orderByComparator, boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_CDTUSERID_IDCREATOR_2);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_CDTUSERID_CDTUSERID_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(idcreator);
+
+ qPos.add(cdtUserId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(ressource);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Ressource> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the ressources where idcreator = ? and kind = ?.
+ *
+ * @param idcreator the idcreator
+ * @param kind the kind
+ * @return the matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByidcreator_kind(long idcreator, int kind)
+ throws SystemException {
+ return findByidcreator_kind(idcreator, kind, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the ressources where idcreator = ? and kind = ?.
+ *
+ * <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 idcreator the idcreator
+ * @param kind the kind
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @return the range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByidcreator_kind(long idcreator, int kind,
+ int start, int end) throws SystemException {
+ return findByidcreator_kind(idcreator, kind, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the ressources where idcreator = ? and kind = ?.
+ *
+ * <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 idcreator the idcreator
+ * @param kind the kind
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByidcreator_kind(long idcreator, int kind,
+ int start, int end, OrderByComparator orderByComparator)
+ throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_IDCREATOR_KIND;
+ finderArgs = new Object[] { idcreator, kind };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_IDCREATOR_KIND;
+ finderArgs = new Object[] {
+ idcreator, kind,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Ressource> list = (List<Ressource>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Ressource ressource : list) {
+ if ((idcreator != ressource.getIdcreator()) ||
+ (kind != ressource.getKind())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(4 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_KIND_IDCREATOR_2);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_KIND_KIND_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(idcreator);
+
+ qPos.add(kind);
+
+ list = (List<Ressource>)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;
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where idcreator = ? and kind = ?.
+ *
+ * @param idcreator the idcreator
+ * @param kind the kind
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByidcreator_kind_First(long idcreator, int kind,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByidcreator_kind_First(idcreator, kind,
+ orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("idcreator=");
+ msg.append(idcreator);
+
+ msg.append(", kind=");
+ msg.append(kind);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where idcreator = ? and kind = ?.
+ *
+ * @param idcreator the idcreator
+ * @param kind the kind
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByidcreator_kind_First(long idcreator, int kind,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<Ressource> list = findByidcreator_kind(idcreator, kind, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where idcreator = ? and kind = ?.
+ *
+ * @param idcreator the idcreator
+ * @param kind the kind
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByidcreator_kind_Last(long idcreator, int kind,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByidcreator_kind_Last(idcreator, kind,
+ orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("idcreator=");
+ msg.append(idcreator);
+
+ msg.append(", kind=");
+ msg.append(kind);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where idcreator = ? and kind = ?.
+ *
+ * @param idcreator the idcreator
+ * @param kind the kind
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByidcreator_kind_Last(long idcreator, int kind,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByidcreator_kind(idcreator, kind);
+
+ List<Ressource> list = findByidcreator_kind(idcreator, kind, count - 1,
+ count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the ressources before and after the current ressource in the ordered set where idcreator = ? and kind = ?.
+ *
+ * @param idRessource the primary key of the current ressource
+ * @param idcreator the idcreator
+ * @param kind the kind
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource[] findByidcreator_kind_PrevAndNext(long idRessource,
+ long idcreator, int kind, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = findByPrimaryKey(idRessource);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Ressource[] array = new RessourceImpl[3];
+
+ array[0] = getByidcreator_kind_PrevAndNext(session, ressource,
+ idcreator, kind, orderByComparator, true);
+
+ array[1] = ressource;
+
+ array[2] = getByidcreator_kind_PrevAndNext(session, ressource,
+ idcreator, kind, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Ressource getByidcreator_kind_PrevAndNext(Session session,
+ Ressource ressource, long idcreator, int kind,
+ OrderByComparator orderByComparator, boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_KIND_IDCREATOR_2);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_KIND_KIND_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(idcreator);
+
+ qPos.add(kind);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(ressource);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Ressource> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the ressources where kind = ? and etabId = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @return the matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findBykind_etabId(int kind, long etabId)
+ throws SystemException {
+ return findBykind_etabId(kind, etabId, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the ressources where kind = ? and etabId = ?.
+ *
+ * <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 kind the kind
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @return the range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findBykind_etabId(int kind, long etabId, int start,
+ int end) throws SystemException {
+ return findBykind_etabId(kind, etabId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the ressources where kind = ? and etabId = ?.
+ *
+ * <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 kind the kind
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findBykind_etabId(int kind, long etabId, int start,
+ int end, OrderByComparator orderByComparator) throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_KIND_ETABID;
+ finderArgs = new Object[] { kind, etabId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_KIND_ETABID;
+ finderArgs = new Object[] {
+ kind, etabId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Ressource> list = (List<Ressource>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Ressource ressource : list) {
+ if ((kind != ressource.getKind()) ||
+ (etabId != ressource.getEtabId())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(4 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_KIND_2);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_ETABID_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(kind);
+
+ qPos.add(etabId);
+
+ list = (List<Ressource>)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;
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where kind = ? and etabId = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findBykind_etabId_First(int kind, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchBykind_etabId_First(kind, etabId,
+ orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("kind=");
+ msg.append(kind);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where kind = ? and etabId = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchBykind_etabId_First(int kind, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<Ressource> list = findBykind_etabId(kind, etabId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where kind = ? and etabId = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findBykind_etabId_Last(int kind, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchBykind_etabId_Last(kind, etabId,
+ orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("kind=");
+ msg.append(kind);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where kind = ? and etabId = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchBykind_etabId_Last(int kind, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countBykind_etabId(kind, etabId);
+
+ List<Ressource> list = findBykind_etabId(kind, etabId, count - 1,
+ count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the ressources before and after the current ressource in the ordered set where kind = ? and etabId = ?.
+ *
+ * @param idRessource the primary key of the current ressource
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource[] findBykind_etabId_PrevAndNext(long idRessource,
+ int kind, long etabId, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = findByPrimaryKey(idRessource);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Ressource[] array = new RessourceImpl[3];
+
+ array[0] = getBykind_etabId_PrevAndNext(session, ressource, kind,
+ etabId, orderByComparator, true);
+
+ array[1] = ressource;
+
+ array[2] = getBykind_etabId_PrevAndNext(session, ressource, kind,
+ etabId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Ressource getBykind_etabId_PrevAndNext(Session session,
+ Ressource ressource, int kind, long etabId,
+ OrderByComparator orderByComparator, boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_KIND_2);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_ETABID_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(kind);
+
+ qPos.add(etabId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(ressource);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Ressource> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the ressources where kind = ? and etabId = ? and name = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param name the name
+ * @return the matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findBykind_etabId_name(int kind, long etabId,
+ String name) throws SystemException {
+ return findBykind_etabId_name(kind, etabId, name, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the ressources where kind = ? and etabId = ? and name = ?.
+ *
+ * <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 kind the kind
+ * @param etabId the etab ID
+ * @param name the name
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @return the range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findBykind_etabId_name(int kind, long etabId,
+ String name, int start, int end) throws SystemException {
+ return findBykind_etabId_name(kind, etabId, name, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the ressources where kind = ? and etabId = ? and name = ?.
+ *
+ * <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 kind the kind
+ * @param etabId the etab ID
+ * @param name the name
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findBykind_etabId_name(int kind, long etabId,
+ String name, int start, int end, OrderByComparator orderByComparator)
+ throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_KIND_ETABID_NAME;
+ finderArgs = new Object[] { kind, etabId, name };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_KIND_ETABID_NAME;
+ finderArgs = new Object[] {
+ kind, etabId, name,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Ressource> list = (List<Ressource>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Ressource ressource : list) {
+ if ((kind != ressource.getKind()) ||
+ (etabId != ressource.getEtabId()) ||
+ !Validator.equals(name, ressource.getName())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(5 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(4);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_KIND_2);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_ETABID_2);
+
+ if (name == null) {
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_NAME_1);
+ }
+ else {
+ if (name.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_NAME_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_NAME_2);
+ }
+ }
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(kind);
+
+ qPos.add(etabId);
+
+ if (name != null) {
+ qPos.add(name);
+ }
+
+ list = (List<Ressource>)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;
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where kind = ? and etabId = ? and name = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param name the name
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findBykind_etabId_name_First(int kind, long etabId,
+ String name, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchBykind_etabId_name_First(kind, etabId, name,
+ orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(8);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("kind=");
+ msg.append(kind);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(", name=");
+ msg.append(name);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where kind = ? and etabId = ? and name = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param name the name
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchBykind_etabId_name_First(int kind, long etabId,
+ String name, OrderByComparator orderByComparator)
+ throws SystemException {
+ List<Ressource> list = findBykind_etabId_name(kind, etabId, name, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where kind = ? and etabId = ? and name = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param name the name
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findBykind_etabId_name_Last(int kind, long etabId,
+ String name, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchBykind_etabId_name_Last(kind, etabId, name,
+ orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(8);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("kind=");
+ msg.append(kind);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(", name=");
+ msg.append(name);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where kind = ? and etabId = ? and name = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param name the name
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchBykind_etabId_name_Last(int kind, long etabId,
+ String name, OrderByComparator orderByComparator)
+ throws SystemException {
+ int count = countBykind_etabId_name(kind, etabId, name);
+
+ List<Ressource> list = findBykind_etabId_name(kind, etabId, name,
+ count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the ressources before and after the current ressource in the ordered set where kind = ? and etabId = ? and name = ?.
+ *
+ * @param idRessource the primary key of the current ressource
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param name the name
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource[] findBykind_etabId_name_PrevAndNext(long idRessource,
+ int kind, long etabId, String name, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = findByPrimaryKey(idRessource);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Ressource[] array = new RessourceImpl[3];
+
+ array[0] = getBykind_etabId_name_PrevAndNext(session, ressource,
+ kind, etabId, name, orderByComparator, true);
+
+ array[1] = ressource;
+
+ array[2] = getBykind_etabId_name_PrevAndNext(session, ressource,
+ kind, etabId, name, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Ressource getBykind_etabId_name_PrevAndNext(Session session,
+ Ressource ressource, int kind, long etabId, String name,
+ OrderByComparator orderByComparator, boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_KIND_2);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_ETABID_2);
+
+ if (name == null) {
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_NAME_1);
+ }
+ else {
+ if (name.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_NAME_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_NAME_2);
+ }
+ }
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(kind);
+
+ qPos.add(etabId);
+
+ if (name != null) {
+ qPos.add(name);
+ }
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(ressource);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Ressource> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the ressources where ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @return the matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByressourceType_scope_kind_forcePubli(
+ int ressourceType, int scope, int kind, boolean forcePubli)
+ throws SystemException {
+ return findByressourceType_scope_kind_forcePubli(ressourceType, scope,
+ kind, forcePubli, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the ressources where ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * <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 ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @return the range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByressourceType_scope_kind_forcePubli(
+ int ressourceType, int scope, int kind, boolean forcePubli, int start,
+ int end) throws SystemException {
+ return findByressourceType_scope_kind_forcePubli(ressourceType, scope,
+ kind, forcePubli, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the ressources where ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * <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 ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByressourceType_scope_kind_forcePubli(
+ int ressourceType, int scope, int kind, boolean forcePubli, int start,
+ int end, OrderByComparator orderByComparator) throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI;
+ finderArgs = new Object[] { ressourceType, scope, kind, forcePubli };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI;
+ finderArgs = new Object[] {
+ ressourceType, scope, kind, forcePubli,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Ressource> list = (List<Ressource>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Ressource ressource : list) {
+ if ((ressourceType != ressource.getRessourceType()) ||
+ (scope != ressource.getScope()) ||
+ (kind != ressource.getKind()) ||
+ (forcePubli != ressource.getForcePubli())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(5);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_KIND_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_FORCEPUBLI_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(kind);
+
+ qPos.add(forcePubli);
+
+ list = (List<Ressource>)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;
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByressourceType_scope_kind_forcePubli_First(
+ int ressourceType, int scope, int kind, boolean forcePubli,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByressourceType_scope_kind_forcePubli_First(ressourceType,
+ scope, kind, forcePubli, orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(10);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("ressourceType=");
+ msg.append(ressourceType);
+
+ msg.append(", scope=");
+ msg.append(scope);
+
+ msg.append(", kind=");
+ msg.append(kind);
+
+ msg.append(", forcePubli=");
+ msg.append(forcePubli);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByressourceType_scope_kind_forcePubli_First(
+ int ressourceType, int scope, int kind, boolean forcePubli,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<Ressource> list = findByressourceType_scope_kind_forcePubli(ressourceType,
+ scope, kind, forcePubli, 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByressourceType_scope_kind_forcePubli_Last(
+ int ressourceType, int scope, int kind, boolean forcePubli,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByressourceType_scope_kind_forcePubli_Last(ressourceType,
+ scope, kind, forcePubli, orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(10);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("ressourceType=");
+ msg.append(ressourceType);
+
+ msg.append(", scope=");
+ msg.append(scope);
+
+ msg.append(", kind=");
+ msg.append(kind);
+
+ msg.append(", forcePubli=");
+ msg.append(forcePubli);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByressourceType_scope_kind_forcePubli_Last(
+ int ressourceType, int scope, int kind, boolean forcePubli,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByressourceType_scope_kind_forcePubli(ressourceType,
+ scope, kind, forcePubli);
+
+ List<Ressource> list = findByressourceType_scope_kind_forcePubli(ressourceType,
+ scope, kind, forcePubli, count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the ressources before and after the current ressource in the ordered set where ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param idRessource the primary key of the current ressource
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource[] findByressourceType_scope_kind_forcePubli_PrevAndNext(
+ long idRessource, int ressourceType, int scope, int kind,
+ boolean forcePubli, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = findByPrimaryKey(idRessource);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Ressource[] array = new RessourceImpl[3];
+
+ array[0] = getByressourceType_scope_kind_forcePubli_PrevAndNext(session,
+ ressource, ressourceType, scope, kind, forcePubli,
+ orderByComparator, true);
+
+ array[1] = ressource;
+
+ array[2] = getByressourceType_scope_kind_forcePubli_PrevAndNext(session,
+ ressource, ressourceType, scope, kind, forcePubli,
+ orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Ressource getByressourceType_scope_kind_forcePubli_PrevAndNext(
+ Session session, Ressource ressource, int ressourceType, int scope,
+ int kind, boolean forcePubli, OrderByComparator orderByComparator,
+ boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_KIND_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_FORCEPUBLI_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(kind);
+
+ qPos.add(forcePubli);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(ressource);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Ressource> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the ressources where etabId = ? and ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @return the matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByetabId_ressourceType_scope_kind_forcePubli(
+ long etabId, int ressourceType, int scope, int kind, boolean forcePubli)
+ throws SystemException {
+ return findByetabId_ressourceType_scope_kind_forcePubli(etabId,
+ ressourceType, scope, kind, forcePubli, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the ressources where etabId = ? and ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * <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 etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @return the range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByetabId_ressourceType_scope_kind_forcePubli(
+ long etabId, int ressourceType, int scope, int kind,
+ boolean forcePubli, int start, int end) throws SystemException {
+ return findByetabId_ressourceType_scope_kind_forcePubli(etabId,
+ ressourceType, scope, kind, forcePubli, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the ressources where etabId = ? and ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * <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 etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByetabId_ressourceType_scope_kind_forcePubli(
+ long etabId, int ressourceType, int scope, int kind,
+ boolean forcePubli, int start, int end,
+ OrderByComparator orderByComparator) throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI;
+ finderArgs = new Object[] {
+ etabId, ressourceType, scope, kind, forcePubli
+ };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI;
+ finderArgs = new Object[] {
+ etabId, ressourceType, scope, kind, forcePubli,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Ressource> list = (List<Ressource>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Ressource ressource : list) {
+ if ((etabId != ressource.getEtabId()) ||
+ (ressourceType != ressource.getRessourceType()) ||
+ (scope != ressource.getScope()) ||
+ (kind != ressource.getKind()) ||
+ (forcePubli != ressource.getForcePubli())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(7 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(6);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_ETABID_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_KIND_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_FORCEPUBLI_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(etabId);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(kind);
+
+ qPos.add(forcePubli);
+
+ list = (List<Ressource>)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;
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where etabId = ? and ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByetabId_ressourceType_scope_kind_forcePubli_First(
+ long etabId, int ressourceType, int scope, int kind,
+ boolean forcePubli, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByetabId_ressourceType_scope_kind_forcePubli_First(etabId,
+ ressourceType, scope, kind, forcePubli, orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(12);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("etabId=");
+ msg.append(etabId);
+
+ msg.append(", ressourceType=");
+ msg.append(ressourceType);
+
+ msg.append(", scope=");
+ msg.append(scope);
+
+ msg.append(", kind=");
+ msg.append(kind);
+
+ msg.append(", forcePubli=");
+ msg.append(forcePubli);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where etabId = ? and ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByetabId_ressourceType_scope_kind_forcePubli_First(
+ long etabId, int ressourceType, int scope, int kind,
+ boolean forcePubli, OrderByComparator orderByComparator)
+ throws SystemException {
+ List<Ressource> list = findByetabId_ressourceType_scope_kind_forcePubli(etabId,
+ ressourceType, scope, kind, forcePubli, 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where etabId = ? and ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByetabId_ressourceType_scope_kind_forcePubli_Last(
+ long etabId, int ressourceType, int scope, int kind,
+ boolean forcePubli, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByetabId_ressourceType_scope_kind_forcePubli_Last(etabId,
+ ressourceType, scope, kind, forcePubli, orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(12);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("etabId=");
+ msg.append(etabId);
+
+ msg.append(", ressourceType=");
+ msg.append(ressourceType);
+
+ msg.append(", scope=");
+ msg.append(scope);
+
+ msg.append(", kind=");
+ msg.append(kind);
+
+ msg.append(", forcePubli=");
+ msg.append(forcePubli);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where etabId = ? and ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByetabId_ressourceType_scope_kind_forcePubli_Last(
+ long etabId, int ressourceType, int scope, int kind,
+ boolean forcePubli, OrderByComparator orderByComparator)
+ throws SystemException {
+ int count = countByetabId_ressourceType_scope_kind_forcePubli(etabId,
+ ressourceType, scope, kind, forcePubli);
+
+ List<Ressource> list = findByetabId_ressourceType_scope_kind_forcePubli(etabId,
+ ressourceType, scope, kind, forcePubli, count - 1, count,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the ressources before and after the current ressource in the ordered set where etabId = ? and ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param idRessource the primary key of the current ressource
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource[] findByetabId_ressourceType_scope_kind_forcePubli_PrevAndNext(
+ long idRessource, long etabId, int ressourceType, int scope, int kind,
+ boolean forcePubli, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = findByPrimaryKey(idRessource);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Ressource[] array = new RessourceImpl[3];
+
+ array[0] = getByetabId_ressourceType_scope_kind_forcePubli_PrevAndNext(session,
+ ressource, etabId, ressourceType, scope, kind, forcePubli,
+ orderByComparator, true);
+
+ array[1] = ressource;
+
+ array[2] = getByetabId_ressourceType_scope_kind_forcePubli_PrevAndNext(session,
+ ressource, etabId, ressourceType, scope, kind, forcePubli,
+ orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Ressource getByetabId_ressourceType_scope_kind_forcePubli_PrevAndNext(
+ Session session, Ressource ressource, long etabId, int ressourceType,
+ int scope, int kind, boolean forcePubli,
+ OrderByComparator orderByComparator, boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_ETABID_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_KIND_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_FORCEPUBLI_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(etabId);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(kind);
+
+ qPos.add(forcePubli);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(ressource);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Ressource> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the ressources where ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @return the matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByressourceType_scope_forcePubli(
+ int ressourceType, int scope, boolean forcePubli)
+ throws SystemException {
+ return findByressourceType_scope_forcePubli(ressourceType, scope,
+ forcePubli, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the ressources where ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * <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 ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @return the range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByressourceType_scope_forcePubli(
+ int ressourceType, int scope, boolean forcePubli, int start, int end)
+ throws SystemException {
+ return findByressourceType_scope_forcePubli(ressourceType, scope,
+ forcePubli, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the ressources where ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * <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 ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByressourceType_scope_forcePubli(
+ int ressourceType, int scope, boolean forcePubli, int start, int end,
+ OrderByComparator orderByComparator) throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI;
+ finderArgs = new Object[] { ressourceType, scope, forcePubli };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI;
+ finderArgs = new Object[] {
+ ressourceType, scope, forcePubli,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Ressource> list = (List<Ressource>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Ressource ressource : list) {
+ if ((ressourceType != ressource.getRessourceType()) ||
+ (scope != ressource.getScope()) ||
+ (forcePubli != ressource.getForcePubli())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(5 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(4);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_FORCEPUBLI_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(forcePubli);
+
+ list = (List<Ressource>)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;
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByressourceType_scope_forcePubli_First(
+ int ressourceType, int scope, boolean forcePubli,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByressourceType_scope_forcePubli_First(ressourceType,
+ scope, forcePubli, orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(8);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("ressourceType=");
+ msg.append(ressourceType);
+
+ msg.append(", scope=");
+ msg.append(scope);
+
+ msg.append(", forcePubli=");
+ msg.append(forcePubli);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByressourceType_scope_forcePubli_First(
+ int ressourceType, int scope, boolean forcePubli,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<Ressource> list = findByressourceType_scope_forcePubli(ressourceType,
+ scope, forcePubli, 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByressourceType_scope_forcePubli_Last(
+ int ressourceType, int scope, boolean forcePubli,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByressourceType_scope_forcePubli_Last(ressourceType,
+ scope, forcePubli, orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(8);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("ressourceType=");
+ msg.append(ressourceType);
+
+ msg.append(", scope=");
+ msg.append(scope);
+
+ msg.append(", forcePubli=");
+ msg.append(forcePubli);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByressourceType_scope_forcePubli_Last(
+ int ressourceType, int scope, boolean forcePubli,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByressourceType_scope_forcePubli(ressourceType, scope,
+ forcePubli);
+
+ List<Ressource> list = findByressourceType_scope_forcePubli(ressourceType,
+ scope, forcePubli, count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the ressources before and after the current ressource in the ordered set where ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param idRessource the primary key of the current ressource
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource[] findByressourceType_scope_forcePubli_PrevAndNext(
+ long idRessource, int ressourceType, int scope, boolean forcePubli,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = findByPrimaryKey(idRessource);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Ressource[] array = new RessourceImpl[3];
+
+ array[0] = getByressourceType_scope_forcePubli_PrevAndNext(session,
+ ressource, ressourceType, scope, forcePubli,
+ orderByComparator, true);
+
+ array[1] = ressource;
+
+ array[2] = getByressourceType_scope_forcePubli_PrevAndNext(session,
+ ressource, ressourceType, scope, forcePubli,
+ orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Ressource getByressourceType_scope_forcePubli_PrevAndNext(
+ Session session, Ressource ressource, int ressourceType, int scope,
+ boolean forcePubli, OrderByComparator orderByComparator,
+ boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_FORCEPUBLI_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(forcePubli);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(ressource);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Ressource> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the ressources where etabId = ? and ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @return the matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByetabId_ressourceType_scope_forcePubli(
+ long etabId, int ressourceType, int scope, boolean forcePubli)
+ throws SystemException {
+ return findByetabId_ressourceType_scope_forcePubli(etabId,
+ ressourceType, scope, forcePubli, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the ressources where etabId = ? and ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * <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 etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @return the range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByetabId_ressourceType_scope_forcePubli(
+ long etabId, int ressourceType, int scope, boolean forcePubli,
+ int start, int end) throws SystemException {
+ return findByetabId_ressourceType_scope_forcePubli(etabId,
+ ressourceType, scope, forcePubli, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the ressources where etabId = ? and ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * <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 etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByetabId_ressourceType_scope_forcePubli(
+ long etabId, int ressourceType, int scope, boolean forcePubli,
+ int start, int end, OrderByComparator orderByComparator)
+ throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI;
+ finderArgs = new Object[] { etabId, ressourceType, scope, forcePubli };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI;
+ finderArgs = new Object[] {
+ etabId, ressourceType, scope, forcePubli,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Ressource> list = (List<Ressource>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Ressource ressource : list) {
+ if ((etabId != ressource.getEtabId()) ||
+ (ressourceType != ressource.getRessourceType()) ||
+ (scope != ressource.getScope()) ||
+ (forcePubli != ressource.getForcePubli())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(5);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_ETABID_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_FORCEPUBLI_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(etabId);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(forcePubli);
+
+ list = (List<Ressource>)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;
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where etabId = ? and ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByetabId_ressourceType_scope_forcePubli_First(
+ long etabId, int ressourceType, int scope, boolean forcePubli,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByetabId_ressourceType_scope_forcePubli_First(etabId,
+ ressourceType, scope, forcePubli, orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(10);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("etabId=");
+ msg.append(etabId);
+
+ msg.append(", ressourceType=");
+ msg.append(ressourceType);
+
+ msg.append(", scope=");
+ msg.append(scope);
+
+ msg.append(", forcePubli=");
+ msg.append(forcePubli);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where etabId = ? and ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByetabId_ressourceType_scope_forcePubli_First(
+ long etabId, int ressourceType, int scope, boolean forcePubli,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<Ressource> list = findByetabId_ressourceType_scope_forcePubli(etabId,
+ ressourceType, scope, forcePubli, 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where etabId = ? and ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByetabId_ressourceType_scope_forcePubli_Last(
+ long etabId, int ressourceType, int scope, boolean forcePubli,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByetabId_ressourceType_scope_forcePubli_Last(etabId,
+ ressourceType, scope, forcePubli, orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(10);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("etabId=");
+ msg.append(etabId);
+
+ msg.append(", ressourceType=");
+ msg.append(ressourceType);
+
+ msg.append(", scope=");
+ msg.append(scope);
+
+ msg.append(", forcePubli=");
+ msg.append(forcePubli);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where etabId = ? and ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByetabId_ressourceType_scope_forcePubli_Last(
+ long etabId, int ressourceType, int scope, boolean forcePubli,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByetabId_ressourceType_scope_forcePubli(etabId,
+ ressourceType, scope, forcePubli);
+
+ List<Ressource> list = findByetabId_ressourceType_scope_forcePubli(etabId,
+ ressourceType, scope, forcePubli, count - 1, count,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the ressources before and after the current ressource in the ordered set where etabId = ? and ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param idRessource the primary key of the current ressource
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource[] findByetabId_ressourceType_scope_forcePubli_PrevAndNext(
+ long idRessource, long etabId, int ressourceType, int scope,
+ boolean forcePubli, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = findByPrimaryKey(idRessource);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Ressource[] array = new RessourceImpl[3];
+
+ array[0] = getByetabId_ressourceType_scope_forcePubli_PrevAndNext(session,
+ ressource, etabId, ressourceType, scope, forcePubli,
+ orderByComparator, true);
+
+ array[1] = ressource;
+
+ array[2] = getByetabId_ressourceType_scope_forcePubli_PrevAndNext(session,
+ ressource, etabId, ressourceType, scope, forcePubli,
+ orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Ressource getByetabId_ressourceType_scope_forcePubli_PrevAndNext(
+ Session session, Ressource ressource, long etabId, int ressourceType,
+ int scope, boolean forcePubli, OrderByComparator orderByComparator,
+ boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_ETABID_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_FORCEPUBLI_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(etabId);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(forcePubli);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(ressource);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Ressource> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the ressources where etabId = ? and name = ?.
+ *
+ * @param etabId the etab ID
+ * @param name the name
+ * @return the matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByetabId_name(long etabId, String name)
+ throws SystemException {
+ return findByetabId_name(etabId, name, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the ressources where etabId = ? and name = ?.
+ *
+ * <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 etabId the etab ID
+ * @param name the name
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @return the range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByetabId_name(long etabId, String name,
+ int start, int end) throws SystemException {
+ return findByetabId_name(etabId, name, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the ressources where etabId = ? and name = ?.
+ *
+ * <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 etabId the etab ID
+ * @param name the name
+ * @param start the lower bound of the range of ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findByetabId_name(long etabId, String name,
+ int start, int end, OrderByComparator orderByComparator)
+ throws SystemException {
+ FinderPath finderPath = null;
+ Object[] finderArgs = null;
+
+ if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
+ (orderByComparator == null)) {
+ finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ETABID_NAME;
+ finderArgs = new Object[] { etabId, name };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ETABID_NAME;
+ finderArgs = new Object[] {
+ etabId, name,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Ressource> list = (List<Ressource>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Ressource ressource : list) {
+ if ((etabId != ressource.getEtabId()) ||
+ !Validator.equals(name, ressource.getName())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(4 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_ETABID_NAME_ETABID_2);
+
+ if (name == null) {
+ query.append(_FINDER_COLUMN_ETABID_NAME_NAME_1);
+ }
+ else {
+ if (name.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_ETABID_NAME_NAME_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_ETABID_NAME_NAME_2);
+ }
+ }
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(etabId);
+
+ if (name != null) {
+ qPos.add(name);
+ }
+
+ list = (List<Ressource>)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;
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where etabId = ? and name = ?.
+ *
+ * @param etabId the etab ID
+ * @param name the name
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByetabId_name_First(long etabId, String name,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByetabId_name_First(etabId, name,
+ orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("etabId=");
+ msg.append(etabId);
+
+ msg.append(", name=");
+ msg.append(name);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the first ressource in the ordered set where etabId = ? and name = ?.
+ *
+ * @param etabId the etab ID
+ * @param name the name
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByetabId_name_First(long etabId, String name,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<Ressource> list = findByetabId_name(etabId, name, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where etabId = ? and name = ?.
+ *
+ * @param etabId the etab ID
+ * @param name the name
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource findByetabId_name_Last(long etabId, String name,
+ OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = fetchByetabId_name_Last(etabId, name,
+ orderByComparator);
+
+ if (ressource != null) {
+ return ressource;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("etabId=");
+ msg.append(etabId);
+
+ msg.append(", name=");
+ msg.append(name);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchRessourceException(msg.toString());
+ }
+
+ /**
+ * Returns the last ressource in the ordered set where etabId = ? and name = ?.
+ *
+ * @param etabId the etab ID
+ * @param name the name
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching ressource, or <code>null</code> if a matching ressource could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource fetchByetabId_name_Last(long etabId, String name,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByetabId_name(etabId, name);
+
+ List<Ressource> list = findByetabId_name(etabId, name, count - 1,
+ count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the ressources before and after the current ressource in the ordered set where etabId = ? and name = ?.
+ *
+ * @param idRessource the primary key of the current ressource
+ * @param etabId the etab ID
+ * @param name the name
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next ressource
+ * @throws com.pentila.entSavoie.agenda.NoSuchRessourceException if a ressource with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Ressource[] findByetabId_name_PrevAndNext(long idRessource,
+ long etabId, String name, OrderByComparator orderByComparator)
+ throws NoSuchRessourceException, SystemException {
+ Ressource ressource = findByPrimaryKey(idRessource);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Ressource[] array = new RessourceImpl[3];
+
+ array[0] = getByetabId_name_PrevAndNext(session, ressource, etabId,
+ name, orderByComparator, true);
+
+ array[1] = ressource;
+
+ array[2] = getByetabId_name_PrevAndNext(session, ressource, etabId,
+ name, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Ressource getByetabId_name_PrevAndNext(Session session,
+ Ressource ressource, long etabId, String name,
+ OrderByComparator orderByComparator, boolean previous) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(6 +
+ (orderByComparator.getOrderByFields().length * 6));
+ }
+ else {
+ query = new StringBundler(3);
+ }
+
+ query.append(_SQL_SELECT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_ETABID_NAME_ETABID_2);
+
+ if (name == null) {
+ query.append(_FINDER_COLUMN_ETABID_NAME_NAME_1);
+ }
+ else {
+ if (name.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_ETABID_NAME_NAME_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_ETABID_NAME_NAME_2);
+ }
+ }
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(etabId);
+
+ if (name != null) {
+ qPos.add(name);
+ }
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(ressource);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Ressource> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the ressources.
+ *
+ * @return the ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findAll() throws SystemException {
+ return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the ressources.
+ *
+ * <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 ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @return the range of ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> findAll(int start, int end)
+ throws SystemException {
+ return findAll(start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the ressources.
+ *
+ * <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 ressources
+ * @param end the upper bound of the range of ressources (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Ressource> 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<Ressource> list = (List<Ressource>)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_RESSOURCE);
+
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+
+ sql = query.toString();
+ }
+ else {
+ sql = _SQL_SELECT_RESSOURCE;
+ }
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ if (orderByComparator == null) {
+ list = (List<Ressource>)QueryUtil.list(q, getDialect(),
+ start, end, false);
+
+ Collections.sort(list);
+ }
+ else {
+ list = (List<Ressource>)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 all the ressources where idcreator = ? and cdtUserId = ? from the database.
+ *
+ * @param idcreator the idcreator
+ * @param cdtUserId the cdt user ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByidcreator_cdtUserId(long idcreator, long cdtUserId)
+ throws SystemException {
+ for (Ressource ressource : findByidcreator_cdtUserId(idcreator,
+ cdtUserId)) {
+ remove(ressource);
+ }
+ }
+
+ /**
+ * Removes all the ressources where idcreator = ? and kind = ? from the database.
+ *
+ * @param idcreator the idcreator
+ * @param kind the kind
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByidcreator_kind(long idcreator, int kind)
+ throws SystemException {
+ for (Ressource ressource : findByidcreator_kind(idcreator, kind)) {
+ remove(ressource);
+ }
+ }
+
+ /**
+ * Removes all the ressources where kind = ? and etabId = ? from the database.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeBykind_etabId(int kind, long etabId)
+ throws SystemException {
+ for (Ressource ressource : findBykind_etabId(kind, etabId)) {
+ remove(ressource);
+ }
+ }
+
+ /**
+ * Removes all the ressources where kind = ? and etabId = ? and name = ? from the database.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param name the name
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeBykind_etabId_name(int kind, long etabId, String name)
+ throws SystemException {
+ for (Ressource ressource : findBykind_etabId_name(kind, etabId, name)) {
+ remove(ressource);
+ }
+ }
+
+ /**
+ * Removes all the ressources where ressourceType = ? and scope = ? and kind = ? and forcePubli = ? from the database.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByressourceType_scope_kind_forcePubli(int ressourceType,
+ int scope, int kind, boolean forcePubli) throws SystemException {
+ for (Ressource ressource : findByressourceType_scope_kind_forcePubli(
+ ressourceType, scope, kind, forcePubli)) {
+ remove(ressource);
+ }
+ }
+
+ /**
+ * Removes all the ressources where etabId = ? and ressourceType = ? and scope = ? and kind = ? and forcePubli = ? from the database.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByetabId_ressourceType_scope_kind_forcePubli(
+ long etabId, int ressourceType, int scope, int kind, boolean forcePubli)
+ throws SystemException {
+ for (Ressource ressource : findByetabId_ressourceType_scope_kind_forcePubli(
+ etabId, ressourceType, scope, kind, forcePubli)) {
+ remove(ressource);
+ }
+ }
+
+ /**
+ * Removes all the ressources where ressourceType = ? and scope = ? and forcePubli = ? from the database.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByressourceType_scope_forcePubli(int ressourceType,
+ int scope, boolean forcePubli) throws SystemException {
+ for (Ressource ressource : findByressourceType_scope_forcePubli(
+ ressourceType, scope, forcePubli)) {
+ remove(ressource);
+ }
+ }
+
+ /**
+ * Removes all the ressources where etabId = ? and ressourceType = ? and scope = ? and forcePubli = ? from the database.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByetabId_ressourceType_scope_forcePubli(long etabId,
+ int ressourceType, int scope, boolean forcePubli)
+ throws SystemException {
+ for (Ressource ressource : findByetabId_ressourceType_scope_forcePubli(
+ etabId, ressourceType, scope, forcePubli)) {
+ remove(ressource);
+ }
+ }
+
+ /**
+ * Removes all the ressources where etabId = ? and name = ? from the database.
+ *
+ * @param etabId the etab ID
+ * @param name the name
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByetabId_name(long etabId, String name)
+ throws SystemException {
+ for (Ressource ressource : findByetabId_name(etabId, name)) {
+ remove(ressource);
+ }
+ }
+
+ /**
+ * Removes all the ressources from the database.
+ *
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeAll() throws SystemException {
+ for (Ressource ressource : findAll()) {
+ remove(ressource);
+ }
+ }
+
+ /**
+ * Returns the number of ressources where idcreator = ? and cdtUserId = ?.
+ *
+ * @param idcreator the idcreator
+ * @param cdtUserId the cdt user ID
+ * @return the number of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByidcreator_cdtUserId(long idcreator, long cdtUserId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { idcreator, cdtUserId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_IDCREATOR_CDTUSERID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_CDTUSERID_IDCREATOR_2);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_CDTUSERID_CDTUSERID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(idcreator);
+
+ qPos.add(cdtUserId);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_IDCREATOR_CDTUSERID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of ressources where idcreator = ? and kind = ?.
+ *
+ * @param idcreator the idcreator
+ * @param kind the kind
+ * @return the number of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByidcreator_kind(long idcreator, int kind)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { idcreator, kind };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_IDCREATOR_KIND,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_KIND_IDCREATOR_2);
+
+ query.append(_FINDER_COLUMN_IDCREATOR_KIND_KIND_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(idcreator);
+
+ qPos.add(kind);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_IDCREATOR_KIND,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of ressources where kind = ? and etabId = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @return the number of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public int countBykind_etabId(int kind, long etabId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { kind, etabId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_KIND_ETABID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_KIND_2);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_ETABID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(kind);
+
+ qPos.add(etabId);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_KIND_ETABID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of ressources where kind = ? and etabId = ? and name = ?.
+ *
+ * @param kind the kind
+ * @param etabId the etab ID
+ * @param name the name
+ * @return the number of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public int countBykind_etabId_name(int kind, long etabId, String name)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { kind, etabId, name };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_KIND_ETABID_NAME,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(4);
+
+ query.append(_SQL_COUNT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_KIND_2);
+
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_ETABID_2);
+
+ if (name == null) {
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_NAME_1);
+ }
+ else {
+ if (name.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_NAME_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_KIND_ETABID_NAME_NAME_2);
+ }
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(kind);
+
+ qPos.add(etabId);
+
+ if (name != null) {
+ qPos.add(name);
+ }
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_KIND_ETABID_NAME,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of ressources where ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @return the number of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByressourceType_scope_kind_forcePubli(int ressourceType,
+ int scope, int kind, boolean forcePubli) throws SystemException {
+ Object[] finderArgs = new Object[] {
+ ressourceType, scope, kind, forcePubli
+ };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(5);
+
+ query.append(_SQL_COUNT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_KIND_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_FORCEPUBLI_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(kind);
+
+ qPos.add(forcePubli);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of ressources where etabId = ? and ressourceType = ? and scope = ? and kind = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param kind the kind
+ * @param forcePubli the force publi
+ * @return the number of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByetabId_ressourceType_scope_kind_forcePubli(long etabId,
+ int ressourceType, int scope, int kind, boolean forcePubli)
+ throws SystemException {
+ Object[] finderArgs = new Object[] {
+ etabId, ressourceType, scope, kind, forcePubli
+ };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(6);
+
+ query.append(_SQL_COUNT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_ETABID_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_KIND_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_FORCEPUBLI_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(etabId);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(kind);
+
+ qPos.add(forcePubli);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of ressources where ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @return the number of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByressourceType_scope_forcePubli(int ressourceType,
+ int scope, boolean forcePubli) throws SystemException {
+ Object[] finderArgs = new Object[] { ressourceType, scope, forcePubli };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(4);
+
+ query.append(_SQL_COUNT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_FORCEPUBLI_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(forcePubli);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of ressources where etabId = ? and ressourceType = ? and scope = ? and forcePubli = ?.
+ *
+ * @param etabId the etab ID
+ * @param ressourceType the ressource type
+ * @param scope the scope
+ * @param forcePubli the force publi
+ * @return the number of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByetabId_ressourceType_scope_forcePubli(long etabId,
+ int ressourceType, int scope, boolean forcePubli)
+ throws SystemException {
+ Object[] finderArgs = new Object[] {
+ etabId, ressourceType, scope, forcePubli
+ };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(5);
+
+ query.append(_SQL_COUNT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_ETABID_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_RESSOURCETYPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_SCOPE_2);
+
+ query.append(_FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_FORCEPUBLI_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(etabId);
+
+ qPos.add(ressourceType);
+
+ qPos.add(scope);
+
+ qPos.add(forcePubli);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of ressources where etabId = ? and name = ?.
+ *
+ * @param etabId the etab ID
+ * @param name the name
+ * @return the number of matching ressources
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByetabId_name(long etabId, String name)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { etabId, name };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ETABID_NAME,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_RESSOURCE_WHERE);
+
+ query.append(_FINDER_COLUMN_ETABID_NAME_ETABID_2);
+
+ if (name == null) {
+ query.append(_FINDER_COLUMN_ETABID_NAME_NAME_1);
+ }
+ else {
+ if (name.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_ETABID_NAME_NAME_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_ETABID_NAME_NAME_2);
+ }
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(etabId);
+
+ if (name != null) {
+ qPos.add(name);
+ }
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ETABID_NAME,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of ressources.
+ *
+ * @return the number of ressources
+ * @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_RESSOURCE);
+
+ 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 ressource persistence.
+ */
+ public void afterPropertiesSet() {
+ String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
+ com.liferay.util.service.ServiceProps.get(
+ "value.object.listener.com.pentila.entSavoie.agenda.model.Ressource")));
+
+ if (listenerClassNames.length > 0) {
+ try {
+ List<ModelListener<Ressource>> listenersList = new ArrayList<ModelListener<Ressource>>();
+
+ for (String listenerClassName : listenerClassNames) {
+ listenersList.add((ModelListener<Ressource>)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(RessourceImpl.class.getName());
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @BeanReference(type = EventAgendaPersistence.class)
+ protected EventAgendaPersistence eventAgendaPersistence;
+ @BeanReference(type = RessourcePersistence.class)
+ protected RessourcePersistence ressourcePersistence;
+ @BeanReference(type = RessourceRolePersistence.class)
+ protected RessourceRolePersistence ressourceRolePersistence;
+ @BeanReference(type = RessourceUserPersistence.class)
+ protected RessourceUserPersistence ressourceUserPersistence;
+ @BeanReference(type = ResourcePersistence.class)
+ protected ResourcePersistence resourcePersistence;
+ @BeanReference(type = UserPersistence.class)
+ protected UserPersistence userPersistence;
+ private static final String _SQL_SELECT_RESSOURCE = "SELECT ressource FROM Ressource ressource";
+ private static final String _SQL_SELECT_RESSOURCE_WHERE = "SELECT ressource FROM Ressource ressource WHERE ";
+ private static final String _SQL_COUNT_RESSOURCE = "SELECT COUNT(ressource) FROM Ressource ressource";
+ private static final String _SQL_COUNT_RESSOURCE_WHERE = "SELECT COUNT(ressource) FROM Ressource ressource WHERE ";
+ private static final String _FINDER_COLUMN_IDCREATOR_CDTUSERID_IDCREATOR_2 = "ressource.idcreator = ? AND ";
+ private static final String _FINDER_COLUMN_IDCREATOR_CDTUSERID_CDTUSERID_2 = "ressource.cdtUserId = ?";
+ private static final String _FINDER_COLUMN_IDCREATOR_KIND_IDCREATOR_2 = "ressource.idcreator = ? AND ";
+ private static final String _FINDER_COLUMN_IDCREATOR_KIND_KIND_2 = "ressource.kind = ?";
+ private static final String _FINDER_COLUMN_KIND_ETABID_KIND_2 = "ressource.kind = ? AND ";
+ private static final String _FINDER_COLUMN_KIND_ETABID_ETABID_2 = "ressource.etabId = ?";
+ private static final String _FINDER_COLUMN_KIND_ETABID_NAME_KIND_2 = "ressource.kind = ? AND ";
+ private static final String _FINDER_COLUMN_KIND_ETABID_NAME_ETABID_2 = "ressource.etabId = ? AND ";
+ private static final String _FINDER_COLUMN_KIND_ETABID_NAME_NAME_1 = "ressource.name IS NULL";
+ private static final String _FINDER_COLUMN_KIND_ETABID_NAME_NAME_2 = "ressource.name = ?";
+ private static final String _FINDER_COLUMN_KIND_ETABID_NAME_NAME_3 = "(ressource.name IS NULL OR ressource.name = ?)";
+ private static final String _FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_RESSOURCETYPE_2 =
+ "ressource.ressourceType = ? AND ";
+ private static final String _FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_SCOPE_2 =
+ "ressource.scope = ? AND ";
+ private static final String _FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_KIND_2 =
+ "ressource.kind = ? AND ";
+ private static final String _FINDER_COLUMN_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_FORCEPUBLI_2 =
+ "ressource.forcePubli = ?";
+ private static final String _FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_ETABID_2 =
+ "ressource.etabId = ? AND ";
+ private static final String _FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_RESSOURCETYPE_2 =
+ "ressource.ressourceType = ? AND ";
+ private static final String _FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_SCOPE_2 =
+ "ressource.scope = ? AND ";
+ private static final String _FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_KIND_2 =
+ "ressource.kind = ? AND ";
+ private static final String _FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_KIND_FORCEPUBLI_FORCEPUBLI_2 =
+ "ressource.forcePubli = ?";
+ private static final String _FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_RESSOURCETYPE_2 =
+ "ressource.ressourceType = ? AND ";
+ private static final String _FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_SCOPE_2 =
+ "ressource.scope = ? AND ";
+ private static final String _FINDER_COLUMN_RESSOURCETYPE_SCOPE_FORCEPUBLI_FORCEPUBLI_2 =
+ "ressource.forcePubli = ?";
+ private static final String _FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_ETABID_2 =
+ "ressource.etabId = ? AND ";
+ private static final String _FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_RESSOURCETYPE_2 =
+ "ressource.ressourceType = ? AND ";
+ private static final String _FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_SCOPE_2 =
+ "ressource.scope = ? AND ";
+ private static final String _FINDER_COLUMN_ETABID_RESSOURCETYPE_SCOPE_FORCEPUBLI_FORCEPUBLI_2 =
+ "ressource.forcePubli = ?";
+ private static final String _FINDER_COLUMN_ETABID_NAME_ETABID_2 = "ressource.etabId = ? AND ";
+ private static final String _FINDER_COLUMN_ETABID_NAME_NAME_1 = "ressource.name IS NULL";
+ private static final String _FINDER_COLUMN_ETABID_NAME_NAME_2 = "ressource.name = ?";
+ private static final String _FINDER_COLUMN_ETABID_NAME_NAME_3 = "(ressource.name IS NULL OR ressource.name = ?)";
+ private static final String _ORDER_BY_ENTITY_ALIAS = "ressource.";
+ private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Ressource exists with the primary key ";
+ private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Ressource 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(RessourcePersistenceImpl.class);
+ private static Ressource _nullRessource = new RessourceImpl() {
+ @Override
+ public Object clone() {
+ return this;
+ }
+
+ @Override
+ public CacheModel<Ressource> toCacheModel() {
+ return _nullRessourceCacheModel;
+ }
+ };
+
+ private static CacheModel<Ressource> _nullRessourceCacheModel = new CacheModel<Ressource>() {
+ public Ressource toEntityModel() {
+ return _nullRessource;
+ }
+ };
+}
\ No newline at end of file