--- /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.gestionMenus.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.gestionMenus.NoSuchInternationalMenuException;
+import com.pentila.entSavoie.gestionMenus.model.InternationalMenu;
+import com.pentila.entSavoie.gestionMenus.model.impl.InternationalMenuImpl;
+import com.pentila.entSavoie.gestionMenus.model.impl.InternationalMenuModelImpl;
+
+import java.io.Serializable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * The persistence implementation for the international menu service.
+ *
+ * <p>
+ * Caching information and settings can be found in <code>portal.properties</code>
+ * </p>
+ *
+ * @author DIMIER Cedric et TARDY Camille
+ * @see InternationalMenuPersistence
+ * @see InternationalMenuUtil
+ * @generated
+ */
+public class InternationalMenuPersistenceImpl extends BasePersistenceImpl<InternationalMenu>
+ implements InternationalMenuPersistence {
+ /*
+ * NOTE FOR DEVELOPERS:
+ *
+ * Never modify or reference this class directly. Always use {@link InternationalMenuUtil} to access the international menu persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
+ */
+ public static final String FINDER_CLASS_NAME_ENTITY = InternationalMenuImpl.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_ENTITYMENUID =
+ new FinderPath(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuModelImpl.FINDER_CACHE_ENABLED,
+ InternationalMenuImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByentityMenuId",
+ new String[] {
+ 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_ENTITYMENUID =
+ new FinderPath(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuModelImpl.FINDER_CACHE_ENABLED,
+ InternationalMenuImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByentityMenuId",
+ new String[] { Long.class.getName() },
+ InternationalMenuModelImpl.ENTITYMENUID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_ENTITYMENUID = new FinderPath(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByentityMenuId",
+ new String[] { Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_ENTITYMENUID_LOCALE =
+ new FinderPath(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuModelImpl.FINDER_CACHE_ENABLED,
+ InternationalMenuImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findByentityMenuId_locale",
+ 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_ENTITYMENUID_LOCALE =
+ new FinderPath(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuModelImpl.FINDER_CACHE_ENABLED,
+ InternationalMenuImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findByentityMenuId_locale",
+ new String[] { Long.class.getName(), String.class.getName() },
+ InternationalMenuModelImpl.ENTITYMENUID_COLUMN_BITMASK |
+ InternationalMenuModelImpl.LOCALE_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_ENTITYMENUID_LOCALE = new FinderPath(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countByentityMenuId_locale",
+ new String[] { Long.class.getName(), String.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuModelImpl.FINDER_CACHE_ENABLED,
+ InternationalMenuImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuModelImpl.FINDER_CACHE_ENABLED,
+ InternationalMenuImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
+
+ /**
+ * Caches the international menu in the entity cache if it is enabled.
+ *
+ * @param internationalMenu the international menu
+ */
+ public void cacheResult(InternationalMenu internationalMenu) {
+ EntityCacheUtil.putResult(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuImpl.class, internationalMenu.getPrimaryKey(),
+ internationalMenu);
+
+ internationalMenu.resetOriginalValues();
+ }
+
+ /**
+ * Caches the international menus in the entity cache if it is enabled.
+ *
+ * @param internationalMenus the international menus
+ */
+ public void cacheResult(List<InternationalMenu> internationalMenus) {
+ for (InternationalMenu internationalMenu : internationalMenus) {
+ if (EntityCacheUtil.getResult(
+ InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuImpl.class,
+ internationalMenu.getPrimaryKey()) == null) {
+ cacheResult(internationalMenu);
+ }
+ else {
+ internationalMenu.resetOriginalValues();
+ }
+ }
+ }
+
+ /**
+ * Clears the cache for all international menus.
+ *
+ * <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(InternationalMenuImpl.class.getName());
+ }
+
+ EntityCacheUtil.clearCache(InternationalMenuImpl.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 international menu.
+ *
+ * <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(InternationalMenu internationalMenu) {
+ EntityCacheUtil.removeResult(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuImpl.class, internationalMenu.getPrimaryKey());
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @Override
+ public void clearCache(List<InternationalMenu> internationalMenus) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+
+ for (InternationalMenu internationalMenu : internationalMenus) {
+ EntityCacheUtil.removeResult(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuImpl.class, internationalMenu.getPrimaryKey());
+ }
+ }
+
+ /**
+ * Creates a new international menu with the primary key. Does not add the international menu to the database.
+ *
+ * @param iternationalMenuId the primary key for the new international menu
+ * @return the new international menu
+ */
+ public InternationalMenu create(long iternationalMenuId) {
+ InternationalMenu internationalMenu = new InternationalMenuImpl();
+
+ internationalMenu.setNew(true);
+ internationalMenu.setPrimaryKey(iternationalMenuId);
+
+ return internationalMenu;
+ }
+
+ /**
+ * Removes the international menu with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param iternationalMenuId the primary key of the international menu
+ * @return the international menu that was removed
+ * @throws com.pentila.entSavoie.gestionMenus.NoSuchInternationalMenuException if a international menu with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu remove(long iternationalMenuId)
+ throws NoSuchInternationalMenuException, SystemException {
+ return remove(Long.valueOf(iternationalMenuId));
+ }
+
+ /**
+ * Removes the international menu with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param primaryKey the primary key of the international menu
+ * @return the international menu that was removed
+ * @throws com.pentila.entSavoie.gestionMenus.NoSuchInternationalMenuException if a international menu with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public InternationalMenu remove(Serializable primaryKey)
+ throws NoSuchInternationalMenuException, SystemException {
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ InternationalMenu internationalMenu = (InternationalMenu)session.get(InternationalMenuImpl.class,
+ primaryKey);
+
+ if (internationalMenu == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
+ }
+
+ throw new NoSuchInternationalMenuException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ primaryKey);
+ }
+
+ return remove(internationalMenu);
+ }
+ catch (NoSuchInternationalMenuException nsee) {
+ throw nsee;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ @Override
+ protected InternationalMenu removeImpl(InternationalMenu internationalMenu)
+ throws SystemException {
+ internationalMenu = toUnwrappedModel(internationalMenu);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.delete(session, internationalMenu);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ clearCache(internationalMenu);
+
+ return internationalMenu;
+ }
+
+ @Override
+ public InternationalMenu updateImpl(
+ com.pentila.entSavoie.gestionMenus.model.InternationalMenu internationalMenu,
+ boolean merge) throws SystemException {
+ internationalMenu = toUnwrappedModel(internationalMenu);
+
+ boolean isNew = internationalMenu.isNew();
+
+ InternationalMenuModelImpl internationalMenuModelImpl = (InternationalMenuModelImpl)internationalMenu;
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.update(session, internationalMenu, merge);
+
+ internationalMenu.setNew(false);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+
+ if (isNew || !InternationalMenuModelImpl.COLUMN_BITMASK_ENABLED) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ else {
+ if ((internationalMenuModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTITYMENUID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(internationalMenuModelImpl.getOriginalEntityMenuId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ENTITYMENUID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTITYMENUID,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(internationalMenuModelImpl.getEntityMenuId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ENTITYMENUID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTITYMENUID,
+ args);
+ }
+
+ if ((internationalMenuModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTITYMENUID_LOCALE.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(internationalMenuModelImpl.getOriginalEntityMenuId()),
+
+ internationalMenuModelImpl.getOriginalLocale()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ENTITYMENUID_LOCALE,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTITYMENUID_LOCALE,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(internationalMenuModelImpl.getEntityMenuId()),
+
+ internationalMenuModelImpl.getLocale()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ENTITYMENUID_LOCALE,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTITYMENUID_LOCALE,
+ args);
+ }
+ }
+
+ EntityCacheUtil.putResult(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuImpl.class, internationalMenu.getPrimaryKey(),
+ internationalMenu);
+
+ return internationalMenu;
+ }
+
+ protected InternationalMenu toUnwrappedModel(
+ InternationalMenu internationalMenu) {
+ if (internationalMenu instanceof InternationalMenuImpl) {
+ return internationalMenu;
+ }
+
+ InternationalMenuImpl internationalMenuImpl = new InternationalMenuImpl();
+
+ internationalMenuImpl.setNew(internationalMenu.isNew());
+ internationalMenuImpl.setPrimaryKey(internationalMenu.getPrimaryKey());
+
+ internationalMenuImpl.setIternationalMenuId(internationalMenu.getIternationalMenuId());
+ internationalMenuImpl.setEntityMenuId(internationalMenu.getEntityMenuId());
+ internationalMenuImpl.setLocale(internationalMenu.getLocale());
+ internationalMenuImpl.setMenuName(internationalMenu.getMenuName());
+
+ return internationalMenuImpl;
+ }
+
+ /**
+ * Returns the international menu 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 international menu
+ * @return the international menu
+ * @throws com.liferay.portal.NoSuchModelException if a international menu with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public InternationalMenu findByPrimaryKey(Serializable primaryKey)
+ throws NoSuchModelException, SystemException {
+ return findByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the international menu with the primary key or throws a {@link com.pentila.entSavoie.gestionMenus.NoSuchInternationalMenuException} if it could not be found.
+ *
+ * @param iternationalMenuId the primary key of the international menu
+ * @return the international menu
+ * @throws com.pentila.entSavoie.gestionMenus.NoSuchInternationalMenuException if a international menu with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu findByPrimaryKey(long iternationalMenuId)
+ throws NoSuchInternationalMenuException, SystemException {
+ InternationalMenu internationalMenu = fetchByPrimaryKey(iternationalMenuId);
+
+ if (internationalMenu == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ iternationalMenuId);
+ }
+
+ throw new NoSuchInternationalMenuException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ iternationalMenuId);
+ }
+
+ return internationalMenu;
+ }
+
+ /**
+ * Returns the international menu with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param primaryKey the primary key of the international menu
+ * @return the international menu, or <code>null</code> if a international menu with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public InternationalMenu fetchByPrimaryKey(Serializable primaryKey)
+ throws SystemException {
+ return fetchByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the international menu with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param iternationalMenuId the primary key of the international menu
+ * @return the international menu, or <code>null</code> if a international menu with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu fetchByPrimaryKey(long iternationalMenuId)
+ throws SystemException {
+ InternationalMenu internationalMenu = (InternationalMenu)EntityCacheUtil.getResult(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuImpl.class, iternationalMenuId);
+
+ if (internationalMenu == _nullInternationalMenu) {
+ return null;
+ }
+
+ if (internationalMenu == null) {
+ Session session = null;
+
+ boolean hasException = false;
+
+ try {
+ session = openSession();
+
+ internationalMenu = (InternationalMenu)session.get(InternationalMenuImpl.class,
+ Long.valueOf(iternationalMenuId));
+ }
+ catch (Exception e) {
+ hasException = true;
+
+ throw processException(e);
+ }
+ finally {
+ if (internationalMenu != null) {
+ cacheResult(internationalMenu);
+ }
+ else if (!hasException) {
+ EntityCacheUtil.putResult(InternationalMenuModelImpl.ENTITY_CACHE_ENABLED,
+ InternationalMenuImpl.class, iternationalMenuId,
+ _nullInternationalMenu);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return internationalMenu;
+ }
+
+ /**
+ * Returns all the international menus where entityMenuId = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @return the matching international menus
+ * @throws SystemException if a system exception occurred
+ */
+ public List<InternationalMenu> findByentityMenuId(long entityMenuId)
+ throws SystemException {
+ return findByentityMenuId(entityMenuId, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the international menus where entityMenuId = ?.
+ *
+ * <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 entityMenuId the entity menu ID
+ * @param start the lower bound of the range of international menus
+ * @param end the upper bound of the range of international menus (not inclusive)
+ * @return the range of matching international menus
+ * @throws SystemException if a system exception occurred
+ */
+ public List<InternationalMenu> findByentityMenuId(long entityMenuId,
+ int start, int end) throws SystemException {
+ return findByentityMenuId(entityMenuId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the international menus where entityMenuId = ?.
+ *
+ * <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 entityMenuId the entity menu ID
+ * @param start the lower bound of the range of international menus
+ * @param end the upper bound of the range of international menus (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching international menus
+ * @throws SystemException if a system exception occurred
+ */
+ public List<InternationalMenu> findByentityMenuId(long entityMenuId,
+ 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_ENTITYMENUID;
+ finderArgs = new Object[] { entityMenuId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ENTITYMENUID;
+ finderArgs = new Object[] {
+ entityMenuId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<InternationalMenu> list = (List<InternationalMenu>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (InternationalMenu internationalMenu : list) {
+ if ((entityMenuId != internationalMenu.getEntityMenuId())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(3 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(2);
+ }
+
+ query.append(_SQL_SELECT_INTERNATIONALMENU_WHERE);
+
+ query.append(_FINDER_COLUMN_ENTITYMENUID_ENTITYMENUID_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(entityMenuId);
+
+ list = (List<InternationalMenu>)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 international menu in the ordered set where entityMenuId = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching international menu
+ * @throws com.pentila.entSavoie.gestionMenus.NoSuchInternationalMenuException if a matching international menu could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu findByentityMenuId_First(long entityMenuId,
+ OrderByComparator orderByComparator)
+ throws NoSuchInternationalMenuException, SystemException {
+ InternationalMenu internationalMenu = fetchByentityMenuId_First(entityMenuId,
+ orderByComparator);
+
+ if (internationalMenu != null) {
+ return internationalMenu;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("entityMenuId=");
+ msg.append(entityMenuId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchInternationalMenuException(msg.toString());
+ }
+
+ /**
+ * Returns the first international menu in the ordered set where entityMenuId = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching international menu, or <code>null</code> if a matching international menu could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu fetchByentityMenuId_First(long entityMenuId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<InternationalMenu> list = findByentityMenuId(entityMenuId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last international menu in the ordered set where entityMenuId = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching international menu
+ * @throws com.pentila.entSavoie.gestionMenus.NoSuchInternationalMenuException if a matching international menu could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu findByentityMenuId_Last(long entityMenuId,
+ OrderByComparator orderByComparator)
+ throws NoSuchInternationalMenuException, SystemException {
+ InternationalMenu internationalMenu = fetchByentityMenuId_Last(entityMenuId,
+ orderByComparator);
+
+ if (internationalMenu != null) {
+ return internationalMenu;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("entityMenuId=");
+ msg.append(entityMenuId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchInternationalMenuException(msg.toString());
+ }
+
+ /**
+ * Returns the last international menu in the ordered set where entityMenuId = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching international menu, or <code>null</code> if a matching international menu could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu fetchByentityMenuId_Last(long entityMenuId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByentityMenuId(entityMenuId);
+
+ List<InternationalMenu> list = findByentityMenuId(entityMenuId,
+ count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the international menus before and after the current international menu in the ordered set where entityMenuId = ?.
+ *
+ * @param iternationalMenuId the primary key of the current international menu
+ * @param entityMenuId the entity menu ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next international menu
+ * @throws com.pentila.entSavoie.gestionMenus.NoSuchInternationalMenuException if a international menu with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu[] findByentityMenuId_PrevAndNext(
+ long iternationalMenuId, long entityMenuId,
+ OrderByComparator orderByComparator)
+ throws NoSuchInternationalMenuException, SystemException {
+ InternationalMenu internationalMenu = findByPrimaryKey(iternationalMenuId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ InternationalMenu[] array = new InternationalMenuImpl[3];
+
+ array[0] = getByentityMenuId_PrevAndNext(session,
+ internationalMenu, entityMenuId, orderByComparator, true);
+
+ array[1] = internationalMenu;
+
+ array[2] = getByentityMenuId_PrevAndNext(session,
+ internationalMenu, entityMenuId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected InternationalMenu getByentityMenuId_PrevAndNext(Session session,
+ InternationalMenu internationalMenu, long entityMenuId,
+ 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_INTERNATIONALMENU_WHERE);
+
+ query.append(_FINDER_COLUMN_ENTITYMENUID_ENTITYMENUID_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(entityMenuId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(internationalMenu);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<InternationalMenu> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the international menus where entityMenuId = ? and locale = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @param locale the locale
+ * @return the matching international menus
+ * @throws SystemException if a system exception occurred
+ */
+ public List<InternationalMenu> findByentityMenuId_locale(
+ long entityMenuId, String locale) throws SystemException {
+ return findByentityMenuId_locale(entityMenuId, locale,
+ QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the international menus where entityMenuId = ? and locale = ?.
+ *
+ * <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 entityMenuId the entity menu ID
+ * @param locale the locale
+ * @param start the lower bound of the range of international menus
+ * @param end the upper bound of the range of international menus (not inclusive)
+ * @return the range of matching international menus
+ * @throws SystemException if a system exception occurred
+ */
+ public List<InternationalMenu> findByentityMenuId_locale(
+ long entityMenuId, String locale, int start, int end)
+ throws SystemException {
+ return findByentityMenuId_locale(entityMenuId, locale, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the international menus where entityMenuId = ? and locale = ?.
+ *
+ * <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 entityMenuId the entity menu ID
+ * @param locale the locale
+ * @param start the lower bound of the range of international menus
+ * @param end the upper bound of the range of international menus (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching international menus
+ * @throws SystemException if a system exception occurred
+ */
+ public List<InternationalMenu> findByentityMenuId_locale(
+ long entityMenuId, String locale, 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_ENTITYMENUID_LOCALE;
+ finderArgs = new Object[] { entityMenuId, locale };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_ENTITYMENUID_LOCALE;
+ finderArgs = new Object[] {
+ entityMenuId, locale,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<InternationalMenu> list = (List<InternationalMenu>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (InternationalMenu internationalMenu : list) {
+ if ((entityMenuId != internationalMenu.getEntityMenuId()) ||
+ !Validator.equals(locale, internationalMenu.getLocale())) {
+ 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_INTERNATIONALMENU_WHERE);
+
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_ENTITYMENUID_2);
+
+ if (locale == null) {
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_1);
+ }
+ else {
+ if (locale.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_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(entityMenuId);
+
+ if (locale != null) {
+ qPos.add(locale);
+ }
+
+ list = (List<InternationalMenu>)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 international menu in the ordered set where entityMenuId = ? and locale = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @param locale the locale
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching international menu
+ * @throws com.pentila.entSavoie.gestionMenus.NoSuchInternationalMenuException if a matching international menu could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu findByentityMenuId_locale_First(
+ long entityMenuId, String locale, OrderByComparator orderByComparator)
+ throws NoSuchInternationalMenuException, SystemException {
+ InternationalMenu internationalMenu = fetchByentityMenuId_locale_First(entityMenuId,
+ locale, orderByComparator);
+
+ if (internationalMenu != null) {
+ return internationalMenu;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("entityMenuId=");
+ msg.append(entityMenuId);
+
+ msg.append(", locale=");
+ msg.append(locale);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchInternationalMenuException(msg.toString());
+ }
+
+ /**
+ * Returns the first international menu in the ordered set where entityMenuId = ? and locale = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @param locale the locale
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching international menu, or <code>null</code> if a matching international menu could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu fetchByentityMenuId_locale_First(
+ long entityMenuId, String locale, OrderByComparator orderByComparator)
+ throws SystemException {
+ List<InternationalMenu> list = findByentityMenuId_locale(entityMenuId,
+ locale, 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last international menu in the ordered set where entityMenuId = ? and locale = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @param locale the locale
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching international menu
+ * @throws com.pentila.entSavoie.gestionMenus.NoSuchInternationalMenuException if a matching international menu could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu findByentityMenuId_locale_Last(long entityMenuId,
+ String locale, OrderByComparator orderByComparator)
+ throws NoSuchInternationalMenuException, SystemException {
+ InternationalMenu internationalMenu = fetchByentityMenuId_locale_Last(entityMenuId,
+ locale, orderByComparator);
+
+ if (internationalMenu != null) {
+ return internationalMenu;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("entityMenuId=");
+ msg.append(entityMenuId);
+
+ msg.append(", locale=");
+ msg.append(locale);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchInternationalMenuException(msg.toString());
+ }
+
+ /**
+ * Returns the last international menu in the ordered set where entityMenuId = ? and locale = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @param locale the locale
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching international menu, or <code>null</code> if a matching international menu could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu fetchByentityMenuId_locale_Last(
+ long entityMenuId, String locale, OrderByComparator orderByComparator)
+ throws SystemException {
+ int count = countByentityMenuId_locale(entityMenuId, locale);
+
+ List<InternationalMenu> list = findByentityMenuId_locale(entityMenuId,
+ locale, count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the international menus before and after the current international menu in the ordered set where entityMenuId = ? and locale = ?.
+ *
+ * @param iternationalMenuId the primary key of the current international menu
+ * @param entityMenuId the entity menu ID
+ * @param locale the locale
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next international menu
+ * @throws com.pentila.entSavoie.gestionMenus.NoSuchInternationalMenuException if a international menu with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public InternationalMenu[] findByentityMenuId_locale_PrevAndNext(
+ long iternationalMenuId, long entityMenuId, String locale,
+ OrderByComparator orderByComparator)
+ throws NoSuchInternationalMenuException, SystemException {
+ InternationalMenu internationalMenu = findByPrimaryKey(iternationalMenuId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ InternationalMenu[] array = new InternationalMenuImpl[3];
+
+ array[0] = getByentityMenuId_locale_PrevAndNext(session,
+ internationalMenu, entityMenuId, locale, orderByComparator,
+ true);
+
+ array[1] = internationalMenu;
+
+ array[2] = getByentityMenuId_locale_PrevAndNext(session,
+ internationalMenu, entityMenuId, locale, orderByComparator,
+ false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected InternationalMenu getByentityMenuId_locale_PrevAndNext(
+ Session session, InternationalMenu internationalMenu,
+ long entityMenuId, String locale, 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_INTERNATIONALMENU_WHERE);
+
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_ENTITYMENUID_2);
+
+ if (locale == null) {
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_1);
+ }
+ else {
+ if (locale.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_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(entityMenuId);
+
+ if (locale != null) {
+ qPos.add(locale);
+ }
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(internationalMenu);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<InternationalMenu> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the international menus.
+ *
+ * @return the international menus
+ * @throws SystemException if a system exception occurred
+ */
+ public List<InternationalMenu> findAll() throws SystemException {
+ return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the international menus.
+ *
+ * <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 international menus
+ * @param end the upper bound of the range of international menus (not inclusive)
+ * @return the range of international menus
+ * @throws SystemException if a system exception occurred
+ */
+ public List<InternationalMenu> findAll(int start, int end)
+ throws SystemException {
+ return findAll(start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the international menus.
+ *
+ * <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 international menus
+ * @param end the upper bound of the range of international menus (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of international menus
+ * @throws SystemException if a system exception occurred
+ */
+ public List<InternationalMenu> 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<InternationalMenu> list = (List<InternationalMenu>)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_INTERNATIONALMENU);
+
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+
+ sql = query.toString();
+ }
+ else {
+ sql = _SQL_SELECT_INTERNATIONALMENU;
+ }
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ if (orderByComparator == null) {
+ list = (List<InternationalMenu>)QueryUtil.list(q,
+ getDialect(), start, end, false);
+
+ Collections.sort(list);
+ }
+ else {
+ list = (List<InternationalMenu>)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 international menus where entityMenuId = ? from the database.
+ *
+ * @param entityMenuId the entity menu ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByentityMenuId(long entityMenuId)
+ throws SystemException {
+ for (InternationalMenu internationalMenu : findByentityMenuId(
+ entityMenuId)) {
+ remove(internationalMenu);
+ }
+ }
+
+ /**
+ * Removes all the international menus where entityMenuId = ? and locale = ? from the database.
+ *
+ * @param entityMenuId the entity menu ID
+ * @param locale the locale
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByentityMenuId_locale(long entityMenuId, String locale)
+ throws SystemException {
+ for (InternationalMenu internationalMenu : findByentityMenuId_locale(
+ entityMenuId, locale)) {
+ remove(internationalMenu);
+ }
+ }
+
+ /**
+ * Removes all the international menus from the database.
+ *
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeAll() throws SystemException {
+ for (InternationalMenu internationalMenu : findAll()) {
+ remove(internationalMenu);
+ }
+ }
+
+ /**
+ * Returns the number of international menus where entityMenuId = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @return the number of matching international menus
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByentityMenuId(long entityMenuId) throws SystemException {
+ Object[] finderArgs = new Object[] { entityMenuId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ENTITYMENUID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(2);
+
+ query.append(_SQL_COUNT_INTERNATIONALMENU_WHERE);
+
+ query.append(_FINDER_COLUMN_ENTITYMENUID_ENTITYMENUID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(entityMenuId);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ENTITYMENUID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of international menus where entityMenuId = ? and locale = ?.
+ *
+ * @param entityMenuId the entity menu ID
+ * @param locale the locale
+ * @return the number of matching international menus
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByentityMenuId_locale(long entityMenuId, String locale)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { entityMenuId, locale };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ENTITYMENUID_LOCALE,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_INTERNATIONALMENU_WHERE);
+
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_ENTITYMENUID_2);
+
+ if (locale == null) {
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_1);
+ }
+ else {
+ if (locale.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_2);
+ }
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(entityMenuId);
+
+ if (locale != null) {
+ qPos.add(locale);
+ }
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ENTITYMENUID_LOCALE,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of international menus.
+ *
+ * @return the number of international menus
+ * @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_INTERNATIONALMENU);
+
+ 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 international menu persistence.
+ */
+ public void afterPropertiesSet() {
+ String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
+ com.liferay.util.service.ServiceProps.get(
+ "value.object.listener.com.pentila.entSavoie.gestionMenus.model.InternationalMenu")));
+
+ if (listenerClassNames.length > 0) {
+ try {
+ List<ModelListener<InternationalMenu>> listenersList = new ArrayList<ModelListener<InternationalMenu>>();
+
+ for (String listenerClassName : listenerClassNames) {
+ listenersList.add((ModelListener<InternationalMenu>)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(InternationalMenuImpl.class.getName());
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @BeanReference(type = EntityMenuPersistence.class)
+ protected EntityMenuPersistence entityMenuPersistence;
+ @BeanReference(type = InternationalMenuPersistence.class)
+ protected InternationalMenuPersistence internationalMenuPersistence;
+ @BeanReference(type = LinkEtabPersistence.class)
+ protected LinkEtabPersistence linkEtabPersistence;
+ @BeanReference(type = MenuIconMappingPersistence.class)
+ protected MenuIconMappingPersistence menuIconMappingPersistence;
+ @BeanReference(type = PronoteLinkPersistence.class)
+ protected PronoteLinkPersistence pronoteLinkPersistence;
+ @BeanReference(type = ResourcePersistence.class)
+ protected ResourcePersistence resourcePersistence;
+ @BeanReference(type = UserPersistence.class)
+ protected UserPersistence userPersistence;
+ private static final String _SQL_SELECT_INTERNATIONALMENU = "SELECT internationalMenu FROM InternationalMenu internationalMenu";
+ private static final String _SQL_SELECT_INTERNATIONALMENU_WHERE = "SELECT internationalMenu FROM InternationalMenu internationalMenu WHERE ";
+ private static final String _SQL_COUNT_INTERNATIONALMENU = "SELECT COUNT(internationalMenu) FROM InternationalMenu internationalMenu";
+ private static final String _SQL_COUNT_INTERNATIONALMENU_WHERE = "SELECT COUNT(internationalMenu) FROM InternationalMenu internationalMenu WHERE ";
+ private static final String _FINDER_COLUMN_ENTITYMENUID_ENTITYMENUID_2 = "internationalMenu.entityMenuId = ?";
+ private static final String _FINDER_COLUMN_ENTITYMENUID_LOCALE_ENTITYMENUID_2 =
+ "internationalMenu.entityMenuId = ? AND ";
+ private static final String _FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_1 = "internationalMenu.locale IS NULL";
+ private static final String _FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_2 = "internationalMenu.locale = ?";
+ private static final String _FINDER_COLUMN_ENTITYMENUID_LOCALE_LOCALE_3 = "(internationalMenu.locale IS NULL OR internationalMenu.locale = ?)";
+ private static final String _ORDER_BY_ENTITY_ALIAS = "internationalMenu.";
+ private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No InternationalMenu exists with the primary key ";
+ private static final String _NO_SUCH_ENTITY_WITH_KEY = "No InternationalMenu 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(InternationalMenuPersistenceImpl.class);
+ private static InternationalMenu _nullInternationalMenu = new InternationalMenuImpl() {
+ @Override
+ public Object clone() {
+ return this;
+ }
+
+ @Override
+ public CacheModel<InternationalMenu> toCacheModel() {
+ return _nullInternationalMenuCacheModel;
+ }
+ };
+
+ private static CacheModel<InternationalMenu> _nullInternationalMenuCacheModel =
+ new CacheModel<InternationalMenu>() {
+ public InternationalMenu toEntityModel() {
+ return _nullInternationalMenu;
+ }
+ };
+}
\ No newline at end of file