--- /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.gestionVieScolaire.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.gestionVieScolaire.NoSuchUserMappingException;
+import com.pentila.entSavoie.gestionVieScolaire.model.UserMapping;
+import com.pentila.entSavoie.gestionVieScolaire.model.impl.UserMappingImpl;
+import com.pentila.entSavoie.gestionVieScolaire.model.impl.UserMappingModelImpl;
+
+import java.io.Serializable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * The persistence implementation for the user mapping service.
+ *
+ * <p>
+ * Caching information and settings can be found in <code>portal.properties</code>
+ * </p>
+ *
+ * @author Cédric Lecarpentier
+ * @see UserMappingPersistence
+ * @see UserMappingUtil
+ * @generated
+ */
+public class UserMappingPersistenceImpl extends BasePersistenceImpl<UserMapping>
+ implements UserMappingPersistence {
+ /*
+ * NOTE FOR DEVELOPERS:
+ *
+ * Never modify or reference this class directly. Always use {@link UserMappingUtil} to access the user mapping persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
+ */
+ public static final String FINDER_CLASS_NAME_ENTITY = UserMappingImpl.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_NATIONALNUMBER =
+ new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByNationalNumber",
+ new String[] {
+ String.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_NATIONALNUMBER =
+ new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByNationalNumber",
+ new String[] { String.class.getName(), Long.class.getName() },
+ UserMappingModelImpl.NATIONALNUMBER_COLUMN_BITMASK |
+ UserMappingModelImpl.ETABID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_NATIONALNUMBER = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByNationalNumber",
+ new String[] { String.class.getName(), Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_PRONOTEID =
+ new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByPronoteId",
+ new String[] {
+ String.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_PRONOTEID =
+ new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByPronoteId",
+ new String[] { String.class.getName(), Long.class.getName() },
+ UserMappingModelImpl.PRONOTEID_COLUMN_BITMASK |
+ UserMappingModelImpl.ETABID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_PRONOTEID = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByPronoteId",
+ new String[] { String.class.getName(), Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_STSID = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByStsId",
+ new String[] {
+ String.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_STSID = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByStsId",
+ new String[] { String.class.getName(), Long.class.getName() },
+ UserMappingModelImpl.STSID_COLUMN_BITMASK |
+ UserMappingModelImpl.ETABID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_STSID = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByStsId",
+ new String[] { String.class.getName(), Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERETABID =
+ new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUserEtabId",
+ new String[] {
+ String.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_USERETABID =
+ new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserEtabId",
+ new String[] { String.class.getName(), Long.class.getName() },
+ UserMappingModelImpl.USERETABID_COLUMN_BITMASK |
+ UserMappingModelImpl.ETABID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_USERETABID = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserEtabId",
+ new String[] { String.class.getName(), Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_SCONETID = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBySconetId",
+ new String[] {
+ String.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_SCONETID =
+ new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBySconetId",
+ new String[] { String.class.getName(), Long.class.getName() },
+ UserMappingModelImpl.SCONETID_COLUMN_BITMASK |
+ UserMappingModelImpl.ETABID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_SCONETID = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countBySconetId",
+ new String[] { String.class.getName(), Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_CASID = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCasId",
+ new String[] {
+ String.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_CASID = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCasId",
+ new String[] { String.class.getName(), Long.class.getName() },
+ UserMappingModelImpl.CASID_COLUMN_BITMASK |
+ UserMappingModelImpl.ETABID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_CASID = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCasId",
+ new String[] { String.class.getName(), Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_PARTNERID =
+ new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByPartnerId",
+ new String[] {
+ String.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_PARTNERID =
+ new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByPartnerId",
+ new String[] { String.class.getName(), Long.class.getName() },
+ UserMappingModelImpl.PARTNERID_COLUMN_BITMASK |
+ UserMappingModelImpl.ETABID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_PARTNERID = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByPartnerId",
+ new String[] { String.class.getName(), Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, UserMappingImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
+
+ /**
+ * Caches the user mapping in the entity cache if it is enabled.
+ *
+ * @param userMapping the user mapping
+ */
+ public void cacheResult(UserMapping userMapping) {
+ EntityCacheUtil.putResult(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingImpl.class, userMapping.getPrimaryKey(), userMapping);
+
+ userMapping.resetOriginalValues();
+ }
+
+ /**
+ * Caches the user mappings in the entity cache if it is enabled.
+ *
+ * @param userMappings the user mappings
+ */
+ public void cacheResult(List<UserMapping> userMappings) {
+ for (UserMapping userMapping : userMappings) {
+ if (EntityCacheUtil.getResult(
+ UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingImpl.class, userMapping.getPrimaryKey()) == null) {
+ cacheResult(userMapping);
+ }
+ else {
+ userMapping.resetOriginalValues();
+ }
+ }
+ }
+
+ /**
+ * Clears the cache for all user mappings.
+ *
+ * <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(UserMappingImpl.class.getName());
+ }
+
+ EntityCacheUtil.clearCache(UserMappingImpl.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 user mapping.
+ *
+ * <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(UserMapping userMapping) {
+ EntityCacheUtil.removeResult(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingImpl.class, userMapping.getPrimaryKey());
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @Override
+ public void clearCache(List<UserMapping> userMappings) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+
+ for (UserMapping userMapping : userMappings) {
+ EntityCacheUtil.removeResult(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingImpl.class, userMapping.getPrimaryKey());
+ }
+ }
+
+ /**
+ * Creates a new user mapping with the primary key. Does not add the user mapping to the database.
+ *
+ * @param userMappingPK the primary key for the new user mapping
+ * @return the new user mapping
+ */
+ public UserMapping create(UserMappingPK userMappingPK) {
+ UserMapping userMapping = new UserMappingImpl();
+
+ userMapping.setNew(true);
+ userMapping.setPrimaryKey(userMappingPK);
+
+ return userMapping;
+ }
+
+ /**
+ * Removes the user mapping with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param userMappingPK the primary key of the user mapping
+ * @return the user mapping that was removed
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping remove(UserMappingPK userMappingPK)
+ throws NoSuchUserMappingException, SystemException {
+ return remove((Serializable)userMappingPK);
+ }
+
+ /**
+ * Removes the user mapping with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param primaryKey the primary key of the user mapping
+ * @return the user mapping that was removed
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public UserMapping remove(Serializable primaryKey)
+ throws NoSuchUserMappingException, SystemException {
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserMapping userMapping = (UserMapping)session.get(UserMappingImpl.class,
+ primaryKey);
+
+ if (userMapping == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
+ }
+
+ throw new NoSuchUserMappingException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ primaryKey);
+ }
+
+ return remove(userMapping);
+ }
+ catch (NoSuchUserMappingException nsee) {
+ throw nsee;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ @Override
+ protected UserMapping removeImpl(UserMapping userMapping)
+ throws SystemException {
+ userMapping = toUnwrappedModel(userMapping);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.delete(session, userMapping);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ clearCache(userMapping);
+
+ return userMapping;
+ }
+
+ @Override
+ public UserMapping updateImpl(
+ com.pentila.entSavoie.gestionVieScolaire.model.UserMapping userMapping,
+ boolean merge) throws SystemException {
+ userMapping = toUnwrappedModel(userMapping);
+
+ boolean isNew = userMapping.isNew();
+
+ UserMappingModelImpl userMappingModelImpl = (UserMappingModelImpl)userMapping;
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.update(session, userMapping, merge);
+
+ userMapping.setNew(false);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+
+ if (isNew || !UserMappingModelImpl.COLUMN_BITMASK_ENABLED) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ else {
+ if ((userMappingModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_NATIONALNUMBER.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ userMappingModelImpl.getOriginalNationalNumber(),
+ Long.valueOf(userMappingModelImpl.getOriginalEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_NATIONALNUMBER,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_NATIONALNUMBER,
+ args);
+
+ args = new Object[] {
+ userMappingModelImpl.getNationalNumber(),
+ Long.valueOf(userMappingModelImpl.getEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_NATIONALNUMBER,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_NATIONALNUMBER,
+ args);
+ }
+
+ if ((userMappingModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRONOTEID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ userMappingModelImpl.getOriginalPronoteId(),
+ Long.valueOf(userMappingModelImpl.getOriginalEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PRONOTEID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRONOTEID,
+ args);
+
+ args = new Object[] {
+ userMappingModelImpl.getPronoteId(),
+ Long.valueOf(userMappingModelImpl.getEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PRONOTEID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRONOTEID,
+ args);
+ }
+
+ if ((userMappingModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STSID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ userMappingModelImpl.getOriginalStsId(),
+ Long.valueOf(userMappingModelImpl.getOriginalEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_STSID, args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STSID,
+ args);
+
+ args = new Object[] {
+ userMappingModelImpl.getStsId(),
+ Long.valueOf(userMappingModelImpl.getEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_STSID, args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STSID,
+ args);
+ }
+
+ if ((userMappingModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERETABID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ userMappingModelImpl.getOriginalUserEtabId(),
+ Long.valueOf(userMappingModelImpl.getOriginalEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERETABID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERETABID,
+ args);
+
+ args = new Object[] {
+ userMappingModelImpl.getUserEtabId(),
+ Long.valueOf(userMappingModelImpl.getEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERETABID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERETABID,
+ args);
+ }
+
+ if ((userMappingModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SCONETID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ userMappingModelImpl.getOriginalSconetId(),
+ Long.valueOf(userMappingModelImpl.getOriginalEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SCONETID, args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SCONETID,
+ args);
+
+ args = new Object[] {
+ userMappingModelImpl.getSconetId(),
+ Long.valueOf(userMappingModelImpl.getEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SCONETID, args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SCONETID,
+ args);
+ }
+
+ if ((userMappingModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CASID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ userMappingModelImpl.getOriginalCasId(),
+ Long.valueOf(userMappingModelImpl.getOriginalEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CASID, args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CASID,
+ args);
+
+ args = new Object[] {
+ userMappingModelImpl.getCasId(),
+ Long.valueOf(userMappingModelImpl.getEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CASID, args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CASID,
+ args);
+ }
+
+ if ((userMappingModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PARTNERID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ userMappingModelImpl.getOriginalPartnerId(),
+ Long.valueOf(userMappingModelImpl.getOriginalEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PARTNERID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PARTNERID,
+ args);
+
+ args = new Object[] {
+ userMappingModelImpl.getPartnerId(),
+ Long.valueOf(userMappingModelImpl.getEtabId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PARTNERID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PARTNERID,
+ args);
+ }
+ }
+
+ EntityCacheUtil.putResult(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingImpl.class, userMapping.getPrimaryKey(), userMapping);
+
+ return userMapping;
+ }
+
+ protected UserMapping toUnwrappedModel(UserMapping userMapping) {
+ if (userMapping instanceof UserMappingImpl) {
+ return userMapping;
+ }
+
+ UserMappingImpl userMappingImpl = new UserMappingImpl();
+
+ userMappingImpl.setNew(userMapping.isNew());
+ userMappingImpl.setPrimaryKey(userMapping.getPrimaryKey());
+
+ userMappingImpl.setUserId(userMapping.getUserId());
+ userMappingImpl.setEtabId(userMapping.getEtabId());
+ userMappingImpl.setNationalNumber(userMapping.getNationalNumber());
+ userMappingImpl.setPronoteId(userMapping.getPronoteId());
+ userMappingImpl.setUserEtabId(userMapping.getUserEtabId());
+ userMappingImpl.setSconetId(userMapping.getSconetId());
+ userMappingImpl.setStsId(userMapping.getStsId());
+ userMappingImpl.setCasId(userMapping.getCasId());
+ userMappingImpl.setPartnerId(userMapping.getPartnerId());
+
+ return userMappingImpl;
+ }
+
+ /**
+ * Returns the user mapping 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 user mapping
+ * @return the user mapping
+ * @throws com.liferay.portal.NoSuchModelException if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public UserMapping findByPrimaryKey(Serializable primaryKey)
+ throws NoSuchModelException, SystemException {
+ return findByPrimaryKey((UserMappingPK)primaryKey);
+ }
+
+ /**
+ * Returns the user mapping with the primary key or throws a {@link com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException} if it could not be found.
+ *
+ * @param userMappingPK the primary key of the user mapping
+ * @return the user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByPrimaryKey(UserMappingPK userMappingPK)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByPrimaryKey(userMappingPK);
+
+ if (userMapping == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + userMappingPK);
+ }
+
+ throw new NoSuchUserMappingException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ userMappingPK);
+ }
+
+ return userMapping;
+ }
+
+ /**
+ * Returns the user mapping with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param primaryKey the primary key of the user mapping
+ * @return the user mapping, or <code>null</code> if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public UserMapping fetchByPrimaryKey(Serializable primaryKey)
+ throws SystemException {
+ return fetchByPrimaryKey((UserMappingPK)primaryKey);
+ }
+
+ /**
+ * Returns the user mapping with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param userMappingPK the primary key of the user mapping
+ * @return the user mapping, or <code>null</code> if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByPrimaryKey(UserMappingPK userMappingPK)
+ throws SystemException {
+ UserMapping userMapping = (UserMapping)EntityCacheUtil.getResult(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingImpl.class, userMappingPK);
+
+ if (userMapping == _nullUserMapping) {
+ return null;
+ }
+
+ if (userMapping == null) {
+ Session session = null;
+
+ boolean hasException = false;
+
+ try {
+ session = openSession();
+
+ userMapping = (UserMapping)session.get(UserMappingImpl.class,
+ userMappingPK);
+ }
+ catch (Exception e) {
+ hasException = true;
+
+ throw processException(e);
+ }
+ finally {
+ if (userMapping != null) {
+ cacheResult(userMapping);
+ }
+ else if (!hasException) {
+ EntityCacheUtil.putResult(UserMappingModelImpl.ENTITY_CACHE_ENABLED,
+ UserMappingImpl.class, userMappingPK, _nullUserMapping);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return userMapping;
+ }
+
+ /**
+ * Returns all the user mappings where nationalNumber = ? and etabId = ?.
+ *
+ * @param nationalNumber the national number
+ * @param etabId the etab ID
+ * @return the matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByNationalNumber(String nationalNumber,
+ long etabId) throws SystemException {
+ return findByNationalNumber(nationalNumber, etabId, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the user mappings where nationalNumber = ? 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 nationalNumber the national number
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @return the range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByNationalNumber(String nationalNumber,
+ long etabId, int start, int end) throws SystemException {
+ return findByNationalNumber(nationalNumber, etabId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user mappings where nationalNumber = ? 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 nationalNumber the national number
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByNationalNumber(String nationalNumber,
+ 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_NATIONALNUMBER;
+ finderArgs = new Object[] { nationalNumber, etabId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_NATIONALNUMBER;
+ finderArgs = new Object[] {
+ nationalNumber, etabId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<UserMapping> list = (List<UserMapping>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (UserMapping userMapping : list) {
+ if (!Validator.equals(nationalNumber,
+ userMapping.getNationalNumber()) ||
+ (etabId != userMapping.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_USERMAPPING_WHERE);
+
+ if (nationalNumber == null) {
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_1);
+ }
+ else {
+ if (nationalNumber.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_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);
+
+ if (nationalNumber != null) {
+ qPos.add(nationalNumber);
+ }
+
+ qPos.add(etabId);
+
+ list = (List<UserMapping>)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 user mapping in the ordered set where nationalNumber = ? and etabId = ?.
+ *
+ * @param nationalNumber the national number
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByNationalNumber_First(String nationalNumber,
+ long etabId, OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByNationalNumber_First(nationalNumber,
+ etabId, orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("nationalNumber=");
+ msg.append(nationalNumber);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the first user mapping in the ordered set where nationalNumber = ? and etabId = ?.
+ *
+ * @param nationalNumber the national number
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByNationalNumber_First(String nationalNumber,
+ long etabId, OrderByComparator orderByComparator)
+ throws SystemException {
+ List<UserMapping> list = findByNationalNumber(nationalNumber, etabId,
+ 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where nationalNumber = ? and etabId = ?.
+ *
+ * @param nationalNumber the national number
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByNationalNumber_Last(String nationalNumber,
+ long etabId, OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByNationalNumber_Last(nationalNumber,
+ etabId, orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("nationalNumber=");
+ msg.append(nationalNumber);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where nationalNumber = ? and etabId = ?.
+ *
+ * @param nationalNumber the national number
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByNationalNumber_Last(String nationalNumber,
+ long etabId, OrderByComparator orderByComparator)
+ throws SystemException {
+ int count = countByNationalNumber(nationalNumber, etabId);
+
+ List<UserMapping> list = findByNationalNumber(nationalNumber, etabId,
+ count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user mappings before and after the current user mapping in the ordered set where nationalNumber = ? and etabId = ?.
+ *
+ * @param userMappingPK the primary key of the current user mapping
+ * @param nationalNumber the national number
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping[] findByNationalNumber_PrevAndNext(
+ UserMappingPK userMappingPK, String nationalNumber, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = findByPrimaryKey(userMappingPK);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserMapping[] array = new UserMappingImpl[3];
+
+ array[0] = getByNationalNumber_PrevAndNext(session, userMapping,
+ nationalNumber, etabId, orderByComparator, true);
+
+ array[1] = userMapping;
+
+ array[2] = getByNationalNumber_PrevAndNext(session, userMapping,
+ nationalNumber, etabId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected UserMapping getByNationalNumber_PrevAndNext(Session session,
+ UserMapping userMapping, String nationalNumber, 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_USERMAPPING_WHERE);
+
+ if (nationalNumber == null) {
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_1);
+ }
+ else {
+ if (nationalNumber.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_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);
+
+ if (nationalNumber != null) {
+ qPos.add(nationalNumber);
+ }
+
+ qPos.add(etabId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(userMapping);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<UserMapping> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the user mappings where pronoteId = ? and etabId = ?.
+ *
+ * @param pronoteId the pronote ID
+ * @param etabId the etab ID
+ * @return the matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByPronoteId(String pronoteId, long etabId)
+ throws SystemException {
+ return findByPronoteId(pronoteId, etabId, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the user mappings where pronoteId = ? 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 pronoteId the pronote ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @return the range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByPronoteId(String pronoteId, long etabId,
+ int start, int end) throws SystemException {
+ return findByPronoteId(pronoteId, etabId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user mappings where pronoteId = ? 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 pronoteId the pronote ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByPronoteId(String pronoteId, 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_PRONOTEID;
+ finderArgs = new Object[] { pronoteId, etabId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PRONOTEID;
+ finderArgs = new Object[] {
+ pronoteId, etabId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<UserMapping> list = (List<UserMapping>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (UserMapping userMapping : list) {
+ if (!Validator.equals(pronoteId, userMapping.getPronoteId()) ||
+ (etabId != userMapping.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_USERMAPPING_WHERE);
+
+ if (pronoteId == null) {
+ query.append(_FINDER_COLUMN_PRONOTEID_PRONOTEID_1);
+ }
+ else {
+ if (pronoteId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_PRONOTEID_PRONOTEID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_PRONOTEID_PRONOTEID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_PRONOTEID_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);
+
+ if (pronoteId != null) {
+ qPos.add(pronoteId);
+ }
+
+ qPos.add(etabId);
+
+ list = (List<UserMapping>)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 user mapping in the ordered set where pronoteId = ? and etabId = ?.
+ *
+ * @param pronoteId the pronote ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByPronoteId_First(String pronoteId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByPronoteId_First(pronoteId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("pronoteId=");
+ msg.append(pronoteId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the first user mapping in the ordered set where pronoteId = ? and etabId = ?.
+ *
+ * @param pronoteId the pronote ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByPronoteId_First(String pronoteId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<UserMapping> list = findByPronoteId(pronoteId, etabId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where pronoteId = ? and etabId = ?.
+ *
+ * @param pronoteId the pronote ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByPronoteId_Last(String pronoteId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByPronoteId_Last(pronoteId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("pronoteId=");
+ msg.append(pronoteId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where pronoteId = ? and etabId = ?.
+ *
+ * @param pronoteId the pronote ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByPronoteId_Last(String pronoteId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByPronoteId(pronoteId, etabId);
+
+ List<UserMapping> list = findByPronoteId(pronoteId, etabId, count - 1,
+ count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user mappings before and after the current user mapping in the ordered set where pronoteId = ? and etabId = ?.
+ *
+ * @param userMappingPK the primary key of the current user mapping
+ * @param pronoteId the pronote ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping[] findByPronoteId_PrevAndNext(
+ UserMappingPK userMappingPK, String pronoteId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = findByPrimaryKey(userMappingPK);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserMapping[] array = new UserMappingImpl[3];
+
+ array[0] = getByPronoteId_PrevAndNext(session, userMapping,
+ pronoteId, etabId, orderByComparator, true);
+
+ array[1] = userMapping;
+
+ array[2] = getByPronoteId_PrevAndNext(session, userMapping,
+ pronoteId, etabId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected UserMapping getByPronoteId_PrevAndNext(Session session,
+ UserMapping userMapping, String pronoteId, 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_USERMAPPING_WHERE);
+
+ if (pronoteId == null) {
+ query.append(_FINDER_COLUMN_PRONOTEID_PRONOTEID_1);
+ }
+ else {
+ if (pronoteId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_PRONOTEID_PRONOTEID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_PRONOTEID_PRONOTEID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_PRONOTEID_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);
+
+ if (pronoteId != null) {
+ qPos.add(pronoteId);
+ }
+
+ qPos.add(etabId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(userMapping);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<UserMapping> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the user mappings where stsId = ? and etabId = ?.
+ *
+ * @param stsId the sts ID
+ * @param etabId the etab ID
+ * @return the matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByStsId(String stsId, long etabId)
+ throws SystemException {
+ return findByStsId(stsId, etabId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
+ null);
+ }
+
+ /**
+ * Returns a range of all the user mappings where stsId = ? 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 stsId the sts ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @return the range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByStsId(String stsId, long etabId, int start,
+ int end) throws SystemException {
+ return findByStsId(stsId, etabId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user mappings where stsId = ? 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 stsId the sts ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByStsId(String stsId, 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_STSID;
+ finderArgs = new Object[] { stsId, etabId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_STSID;
+ finderArgs = new Object[] {
+ stsId, etabId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<UserMapping> list = (List<UserMapping>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (UserMapping userMapping : list) {
+ if (!Validator.equals(stsId, userMapping.getStsId()) ||
+ (etabId != userMapping.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_USERMAPPING_WHERE);
+
+ if (stsId == null) {
+ query.append(_FINDER_COLUMN_STSID_STSID_1);
+ }
+ else {
+ if (stsId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_STSID_STSID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_STSID_STSID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_STSID_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);
+
+ if (stsId != null) {
+ qPos.add(stsId);
+ }
+
+ qPos.add(etabId);
+
+ list = (List<UserMapping>)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 user mapping in the ordered set where stsId = ? and etabId = ?.
+ *
+ * @param stsId the sts ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByStsId_First(String stsId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByStsId_First(stsId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("stsId=");
+ msg.append(stsId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the first user mapping in the ordered set where stsId = ? and etabId = ?.
+ *
+ * @param stsId the sts ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByStsId_First(String stsId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<UserMapping> list = findByStsId(stsId, etabId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where stsId = ? and etabId = ?.
+ *
+ * @param stsId the sts ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByStsId_Last(String stsId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByStsId_Last(stsId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("stsId=");
+ msg.append(stsId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where stsId = ? and etabId = ?.
+ *
+ * @param stsId the sts ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByStsId_Last(String stsId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByStsId(stsId, etabId);
+
+ List<UserMapping> list = findByStsId(stsId, etabId, count - 1, count,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user mappings before and after the current user mapping in the ordered set where stsId = ? and etabId = ?.
+ *
+ * @param userMappingPK the primary key of the current user mapping
+ * @param stsId the sts ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping[] findByStsId_PrevAndNext(UserMappingPK userMappingPK,
+ String stsId, long etabId, OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = findByPrimaryKey(userMappingPK);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserMapping[] array = new UserMappingImpl[3];
+
+ array[0] = getByStsId_PrevAndNext(session, userMapping, stsId,
+ etabId, orderByComparator, true);
+
+ array[1] = userMapping;
+
+ array[2] = getByStsId_PrevAndNext(session, userMapping, stsId,
+ etabId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected UserMapping getByStsId_PrevAndNext(Session session,
+ UserMapping userMapping, String stsId, 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_USERMAPPING_WHERE);
+
+ if (stsId == null) {
+ query.append(_FINDER_COLUMN_STSID_STSID_1);
+ }
+ else {
+ if (stsId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_STSID_STSID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_STSID_STSID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_STSID_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);
+
+ if (stsId != null) {
+ qPos.add(stsId);
+ }
+
+ qPos.add(etabId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(userMapping);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<UserMapping> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the user mappings where userEtabId = ? and etabId = ?.
+ *
+ * @param userEtabId the user etab ID
+ * @param etabId the etab ID
+ * @return the matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByUserEtabId(String userEtabId, long etabId)
+ throws SystemException {
+ return findByUserEtabId(userEtabId, etabId, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the user mappings where userEtabId = ? 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 userEtabId the user etab ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @return the range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByUserEtabId(String userEtabId, long etabId,
+ int start, int end) throws SystemException {
+ return findByUserEtabId(userEtabId, etabId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user mappings where userEtabId = ? 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 userEtabId the user etab ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByUserEtabId(String userEtabId, 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_USERETABID;
+ finderArgs = new Object[] { userEtabId, etabId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERETABID;
+ finderArgs = new Object[] {
+ userEtabId, etabId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<UserMapping> list = (List<UserMapping>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (UserMapping userMapping : list) {
+ if (!Validator.equals(userEtabId, userMapping.getUserEtabId()) ||
+ (etabId != userMapping.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_USERMAPPING_WHERE);
+
+ if (userEtabId == null) {
+ query.append(_FINDER_COLUMN_USERETABID_USERETABID_1);
+ }
+ else {
+ if (userEtabId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_USERETABID_USERETABID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_USERETABID_USERETABID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_USERETABID_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);
+
+ if (userEtabId != null) {
+ qPos.add(userEtabId);
+ }
+
+ qPos.add(etabId);
+
+ list = (List<UserMapping>)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 user mapping in the ordered set where userEtabId = ? and etabId = ?.
+ *
+ * @param userEtabId the user etab ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByUserEtabId_First(String userEtabId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByUserEtabId_First(userEtabId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("userEtabId=");
+ msg.append(userEtabId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the first user mapping in the ordered set where userEtabId = ? and etabId = ?.
+ *
+ * @param userEtabId the user etab ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByUserEtabId_First(String userEtabId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<UserMapping> list = findByUserEtabId(userEtabId, etabId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where userEtabId = ? and etabId = ?.
+ *
+ * @param userEtabId the user etab ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByUserEtabId_Last(String userEtabId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByUserEtabId_Last(userEtabId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("userEtabId=");
+ msg.append(userEtabId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where userEtabId = ? and etabId = ?.
+ *
+ * @param userEtabId the user etab ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByUserEtabId_Last(String userEtabId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByUserEtabId(userEtabId, etabId);
+
+ List<UserMapping> list = findByUserEtabId(userEtabId, etabId,
+ count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user mappings before and after the current user mapping in the ordered set where userEtabId = ? and etabId = ?.
+ *
+ * @param userMappingPK the primary key of the current user mapping
+ * @param userEtabId the user etab ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping[] findByUserEtabId_PrevAndNext(
+ UserMappingPK userMappingPK, String userEtabId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = findByPrimaryKey(userMappingPK);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserMapping[] array = new UserMappingImpl[3];
+
+ array[0] = getByUserEtabId_PrevAndNext(session, userMapping,
+ userEtabId, etabId, orderByComparator, true);
+
+ array[1] = userMapping;
+
+ array[2] = getByUserEtabId_PrevAndNext(session, userMapping,
+ userEtabId, etabId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected UserMapping getByUserEtabId_PrevAndNext(Session session,
+ UserMapping userMapping, String userEtabId, 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_USERMAPPING_WHERE);
+
+ if (userEtabId == null) {
+ query.append(_FINDER_COLUMN_USERETABID_USERETABID_1);
+ }
+ else {
+ if (userEtabId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_USERETABID_USERETABID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_USERETABID_USERETABID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_USERETABID_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);
+
+ if (userEtabId != null) {
+ qPos.add(userEtabId);
+ }
+
+ qPos.add(etabId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(userMapping);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<UserMapping> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the user mappings where sconetId = ? and etabId = ?.
+ *
+ * @param sconetId the sconet ID
+ * @param etabId the etab ID
+ * @return the matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findBySconetId(String sconetId, long etabId)
+ throws SystemException {
+ return findBySconetId(sconetId, etabId, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the user mappings where sconetId = ? 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 sconetId the sconet ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @return the range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findBySconetId(String sconetId, long etabId,
+ int start, int end) throws SystemException {
+ return findBySconetId(sconetId, etabId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user mappings where sconetId = ? 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 sconetId the sconet ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findBySconetId(String sconetId, 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_SCONETID;
+ finderArgs = new Object[] { sconetId, etabId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SCONETID;
+ finderArgs = new Object[] {
+ sconetId, etabId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<UserMapping> list = (List<UserMapping>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (UserMapping userMapping : list) {
+ if (!Validator.equals(sconetId, userMapping.getSconetId()) ||
+ (etabId != userMapping.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_USERMAPPING_WHERE);
+
+ if (sconetId == null) {
+ query.append(_FINDER_COLUMN_SCONETID_SCONETID_1);
+ }
+ else {
+ if (sconetId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_SCONETID_SCONETID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_SCONETID_SCONETID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_SCONETID_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);
+
+ if (sconetId != null) {
+ qPos.add(sconetId);
+ }
+
+ qPos.add(etabId);
+
+ list = (List<UserMapping>)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 user mapping in the ordered set where sconetId = ? and etabId = ?.
+ *
+ * @param sconetId the sconet ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findBySconetId_First(String sconetId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchBySconetId_First(sconetId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("sconetId=");
+ msg.append(sconetId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the first user mapping in the ordered set where sconetId = ? and etabId = ?.
+ *
+ * @param sconetId the sconet ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchBySconetId_First(String sconetId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<UserMapping> list = findBySconetId(sconetId, etabId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where sconetId = ? and etabId = ?.
+ *
+ * @param sconetId the sconet ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findBySconetId_Last(String sconetId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchBySconetId_Last(sconetId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("sconetId=");
+ msg.append(sconetId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where sconetId = ? and etabId = ?.
+ *
+ * @param sconetId the sconet ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchBySconetId_Last(String sconetId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countBySconetId(sconetId, etabId);
+
+ List<UserMapping> list = findBySconetId(sconetId, etabId, count - 1,
+ count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user mappings before and after the current user mapping in the ordered set where sconetId = ? and etabId = ?.
+ *
+ * @param userMappingPK the primary key of the current user mapping
+ * @param sconetId the sconet ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping[] findBySconetId_PrevAndNext(
+ UserMappingPK userMappingPK, String sconetId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = findByPrimaryKey(userMappingPK);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserMapping[] array = new UserMappingImpl[3];
+
+ array[0] = getBySconetId_PrevAndNext(session, userMapping,
+ sconetId, etabId, orderByComparator, true);
+
+ array[1] = userMapping;
+
+ array[2] = getBySconetId_PrevAndNext(session, userMapping,
+ sconetId, etabId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected UserMapping getBySconetId_PrevAndNext(Session session,
+ UserMapping userMapping, String sconetId, 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_USERMAPPING_WHERE);
+
+ if (sconetId == null) {
+ query.append(_FINDER_COLUMN_SCONETID_SCONETID_1);
+ }
+ else {
+ if (sconetId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_SCONETID_SCONETID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_SCONETID_SCONETID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_SCONETID_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);
+
+ if (sconetId != null) {
+ qPos.add(sconetId);
+ }
+
+ qPos.add(etabId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(userMapping);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<UserMapping> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the user mappings where casId = ? and etabId = ?.
+ *
+ * @param casId the cas ID
+ * @param etabId the etab ID
+ * @return the matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByCasId(String casId, long etabId)
+ throws SystemException {
+ return findByCasId(casId, etabId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
+ null);
+ }
+
+ /**
+ * Returns a range of all the user mappings where casId = ? 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 casId the cas ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @return the range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByCasId(String casId, long etabId, int start,
+ int end) throws SystemException {
+ return findByCasId(casId, etabId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user mappings where casId = ? 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 casId the cas ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByCasId(String casId, 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_CASID;
+ finderArgs = new Object[] { casId, etabId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CASID;
+ finderArgs = new Object[] {
+ casId, etabId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<UserMapping> list = (List<UserMapping>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (UserMapping userMapping : list) {
+ if (!Validator.equals(casId, userMapping.getCasId()) ||
+ (etabId != userMapping.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_USERMAPPING_WHERE);
+
+ if (casId == null) {
+ query.append(_FINDER_COLUMN_CASID_CASID_1);
+ }
+ else {
+ if (casId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_CASID_CASID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_CASID_CASID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_CASID_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);
+
+ if (casId != null) {
+ qPos.add(casId);
+ }
+
+ qPos.add(etabId);
+
+ list = (List<UserMapping>)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 user mapping in the ordered set where casId = ? and etabId = ?.
+ *
+ * @param casId the cas ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByCasId_First(String casId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByCasId_First(casId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("casId=");
+ msg.append(casId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the first user mapping in the ordered set where casId = ? and etabId = ?.
+ *
+ * @param casId the cas ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByCasId_First(String casId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<UserMapping> list = findByCasId(casId, etabId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where casId = ? and etabId = ?.
+ *
+ * @param casId the cas ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByCasId_Last(String casId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByCasId_Last(casId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("casId=");
+ msg.append(casId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where casId = ? and etabId = ?.
+ *
+ * @param casId the cas ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByCasId_Last(String casId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByCasId(casId, etabId);
+
+ List<UserMapping> list = findByCasId(casId, etabId, count - 1, count,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user mappings before and after the current user mapping in the ordered set where casId = ? and etabId = ?.
+ *
+ * @param userMappingPK the primary key of the current user mapping
+ * @param casId the cas ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping[] findByCasId_PrevAndNext(UserMappingPK userMappingPK,
+ String casId, long etabId, OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = findByPrimaryKey(userMappingPK);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserMapping[] array = new UserMappingImpl[3];
+
+ array[0] = getByCasId_PrevAndNext(session, userMapping, casId,
+ etabId, orderByComparator, true);
+
+ array[1] = userMapping;
+
+ array[2] = getByCasId_PrevAndNext(session, userMapping, casId,
+ etabId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected UserMapping getByCasId_PrevAndNext(Session session,
+ UserMapping userMapping, String casId, 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_USERMAPPING_WHERE);
+
+ if (casId == null) {
+ query.append(_FINDER_COLUMN_CASID_CASID_1);
+ }
+ else {
+ if (casId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_CASID_CASID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_CASID_CASID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_CASID_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);
+
+ if (casId != null) {
+ qPos.add(casId);
+ }
+
+ qPos.add(etabId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(userMapping);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<UserMapping> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the user mappings where partnerId = ? and etabId = ?.
+ *
+ * @param partnerId the partner ID
+ * @param etabId the etab ID
+ * @return the matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByPartnerId(String partnerId, long etabId)
+ throws SystemException {
+ return findByPartnerId(partnerId, etabId, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the user mappings where partnerId = ? 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 partnerId the partner ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @return the range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByPartnerId(String partnerId, long etabId,
+ int start, int end) throws SystemException {
+ return findByPartnerId(partnerId, etabId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user mappings where partnerId = ? 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 partnerId the partner ID
+ * @param etabId the etab ID
+ * @param start the lower bound of the range of user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findByPartnerId(String partnerId, 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_PARTNERID;
+ finderArgs = new Object[] { partnerId, etabId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PARTNERID;
+ finderArgs = new Object[] {
+ partnerId, etabId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<UserMapping> list = (List<UserMapping>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (UserMapping userMapping : list) {
+ if (!Validator.equals(partnerId, userMapping.getPartnerId()) ||
+ (etabId != userMapping.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_USERMAPPING_WHERE);
+
+ if (partnerId == null) {
+ query.append(_FINDER_COLUMN_PARTNERID_PARTNERID_1);
+ }
+ else {
+ if (partnerId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_PARTNERID_PARTNERID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_PARTNERID_PARTNERID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_PARTNERID_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);
+
+ if (partnerId != null) {
+ qPos.add(partnerId);
+ }
+
+ qPos.add(etabId);
+
+ list = (List<UserMapping>)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 user mapping in the ordered set where partnerId = ? and etabId = ?.
+ *
+ * @param partnerId the partner ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByPartnerId_First(String partnerId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByPartnerId_First(partnerId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("partnerId=");
+ msg.append(partnerId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the first user mapping in the ordered set where partnerId = ? and etabId = ?.
+ *
+ * @param partnerId the partner ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByPartnerId_First(String partnerId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<UserMapping> list = findByPartnerId(partnerId, etabId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where partnerId = ? and etabId = ?.
+ *
+ * @param partnerId the partner ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping findByPartnerId_Last(String partnerId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = fetchByPartnerId_Last(partnerId, etabId,
+ orderByComparator);
+
+ if (userMapping != null) {
+ return userMapping;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("partnerId=");
+ msg.append(partnerId);
+
+ msg.append(", etabId=");
+ msg.append(etabId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserMappingException(msg.toString());
+ }
+
+ /**
+ * Returns the last user mapping in the ordered set where partnerId = ? and etabId = ?.
+ *
+ * @param partnerId the partner ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user mapping, or <code>null</code> if a matching user mapping could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping fetchByPartnerId_Last(String partnerId, long etabId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByPartnerId(partnerId, etabId);
+
+ List<UserMapping> list = findByPartnerId(partnerId, etabId, count - 1,
+ count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user mappings before and after the current user mapping in the ordered set where partnerId = ? and etabId = ?.
+ *
+ * @param userMappingPK the primary key of the current user mapping
+ * @param partnerId the partner ID
+ * @param etabId the etab ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next user mapping
+ * @throws com.pentila.entSavoie.gestionVieScolaire.NoSuchUserMappingException if a user mapping with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserMapping[] findByPartnerId_PrevAndNext(
+ UserMappingPK userMappingPK, String partnerId, long etabId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserMappingException, SystemException {
+ UserMapping userMapping = findByPrimaryKey(userMappingPK);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserMapping[] array = new UserMappingImpl[3];
+
+ array[0] = getByPartnerId_PrevAndNext(session, userMapping,
+ partnerId, etabId, orderByComparator, true);
+
+ array[1] = userMapping;
+
+ array[2] = getByPartnerId_PrevAndNext(session, userMapping,
+ partnerId, etabId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected UserMapping getByPartnerId_PrevAndNext(Session session,
+ UserMapping userMapping, String partnerId, 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_USERMAPPING_WHERE);
+
+ if (partnerId == null) {
+ query.append(_FINDER_COLUMN_PARTNERID_PARTNERID_1);
+ }
+ else {
+ if (partnerId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_PARTNERID_PARTNERID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_PARTNERID_PARTNERID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_PARTNERID_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);
+
+ if (partnerId != null) {
+ qPos.add(partnerId);
+ }
+
+ qPos.add(etabId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(userMapping);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<UserMapping> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the user mappings.
+ *
+ * @return the user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findAll() throws SystemException {
+ return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the user mappings.
+ *
+ * <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 user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @return the range of user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> findAll(int start, int end)
+ throws SystemException {
+ return findAll(start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user mappings.
+ *
+ * <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 user mappings
+ * @param end the upper bound of the range of user mappings (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserMapping> 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<UserMapping> list = (List<UserMapping>)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_USERMAPPING);
+
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+
+ sql = query.toString();
+ }
+ else {
+ sql = _SQL_SELECT_USERMAPPING;
+ }
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ if (orderByComparator == null) {
+ list = (List<UserMapping>)QueryUtil.list(q, getDialect(),
+ start, end, false);
+
+ Collections.sort(list);
+ }
+ else {
+ list = (List<UserMapping>)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 user mappings where nationalNumber = ? and etabId = ? from the database.
+ *
+ * @param nationalNumber the national number
+ * @param etabId the etab ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByNationalNumber(String nationalNumber, long etabId)
+ throws SystemException {
+ for (UserMapping userMapping : findByNationalNumber(nationalNumber,
+ etabId)) {
+ remove(userMapping);
+ }
+ }
+
+ /**
+ * Removes all the user mappings where pronoteId = ? and etabId = ? from the database.
+ *
+ * @param pronoteId the pronote ID
+ * @param etabId the etab ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByPronoteId(String pronoteId, long etabId)
+ throws SystemException {
+ for (UserMapping userMapping : findByPronoteId(pronoteId, etabId)) {
+ remove(userMapping);
+ }
+ }
+
+ /**
+ * Removes all the user mappings where stsId = ? and etabId = ? from the database.
+ *
+ * @param stsId the sts ID
+ * @param etabId the etab ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByStsId(String stsId, long etabId)
+ throws SystemException {
+ for (UserMapping userMapping : findByStsId(stsId, etabId)) {
+ remove(userMapping);
+ }
+ }
+
+ /**
+ * Removes all the user mappings where userEtabId = ? and etabId = ? from the database.
+ *
+ * @param userEtabId the user etab ID
+ * @param etabId the etab ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByUserEtabId(String userEtabId, long etabId)
+ throws SystemException {
+ for (UserMapping userMapping : findByUserEtabId(userEtabId, etabId)) {
+ remove(userMapping);
+ }
+ }
+
+ /**
+ * Removes all the user mappings where sconetId = ? and etabId = ? from the database.
+ *
+ * @param sconetId the sconet ID
+ * @param etabId the etab ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeBySconetId(String sconetId, long etabId)
+ throws SystemException {
+ for (UserMapping userMapping : findBySconetId(sconetId, etabId)) {
+ remove(userMapping);
+ }
+ }
+
+ /**
+ * Removes all the user mappings where casId = ? and etabId = ? from the database.
+ *
+ * @param casId the cas ID
+ * @param etabId the etab ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByCasId(String casId, long etabId)
+ throws SystemException {
+ for (UserMapping userMapping : findByCasId(casId, etabId)) {
+ remove(userMapping);
+ }
+ }
+
+ /**
+ * Removes all the user mappings where partnerId = ? and etabId = ? from the database.
+ *
+ * @param partnerId the partner ID
+ * @param etabId the etab ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByPartnerId(String partnerId, long etabId)
+ throws SystemException {
+ for (UserMapping userMapping : findByPartnerId(partnerId, etabId)) {
+ remove(userMapping);
+ }
+ }
+
+ /**
+ * Removes all the user mappings from the database.
+ *
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeAll() throws SystemException {
+ for (UserMapping userMapping : findAll()) {
+ remove(userMapping);
+ }
+ }
+
+ /**
+ * Returns the number of user mappings where nationalNumber = ? and etabId = ?.
+ *
+ * @param nationalNumber the national number
+ * @param etabId the etab ID
+ * @return the number of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByNationalNumber(String nationalNumber, long etabId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { nationalNumber, etabId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_NATIONALNUMBER,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_USERMAPPING_WHERE);
+
+ if (nationalNumber == null) {
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_1);
+ }
+ else {
+ if (nationalNumber.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_NATIONALNUMBER_ETABID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ if (nationalNumber != null) {
+ qPos.add(nationalNumber);
+ }
+
+ 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_NATIONALNUMBER,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user mappings where pronoteId = ? and etabId = ?.
+ *
+ * @param pronoteId the pronote ID
+ * @param etabId the etab ID
+ * @return the number of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByPronoteId(String pronoteId, long etabId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { pronoteId, etabId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PRONOTEID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_USERMAPPING_WHERE);
+
+ if (pronoteId == null) {
+ query.append(_FINDER_COLUMN_PRONOTEID_PRONOTEID_1);
+ }
+ else {
+ if (pronoteId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_PRONOTEID_PRONOTEID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_PRONOTEID_PRONOTEID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_PRONOTEID_ETABID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ if (pronoteId != null) {
+ qPos.add(pronoteId);
+ }
+
+ 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_PRONOTEID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user mappings where stsId = ? and etabId = ?.
+ *
+ * @param stsId the sts ID
+ * @param etabId the etab ID
+ * @return the number of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByStsId(String stsId, long etabId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { stsId, etabId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_STSID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_USERMAPPING_WHERE);
+
+ if (stsId == null) {
+ query.append(_FINDER_COLUMN_STSID_STSID_1);
+ }
+ else {
+ if (stsId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_STSID_STSID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_STSID_STSID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_STSID_ETABID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ if (stsId != null) {
+ qPos.add(stsId);
+ }
+
+ 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_STSID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user mappings where userEtabId = ? and etabId = ?.
+ *
+ * @param userEtabId the user etab ID
+ * @param etabId the etab ID
+ * @return the number of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByUserEtabId(String userEtabId, long etabId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { userEtabId, etabId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERETABID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_USERMAPPING_WHERE);
+
+ if (userEtabId == null) {
+ query.append(_FINDER_COLUMN_USERETABID_USERETABID_1);
+ }
+ else {
+ if (userEtabId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_USERETABID_USERETABID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_USERETABID_USERETABID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_USERETABID_ETABID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ if (userEtabId != null) {
+ qPos.add(userEtabId);
+ }
+
+ 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_USERETABID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user mappings where sconetId = ? and etabId = ?.
+ *
+ * @param sconetId the sconet ID
+ * @param etabId the etab ID
+ * @return the number of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public int countBySconetId(String sconetId, long etabId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { sconetId, etabId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SCONETID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_USERMAPPING_WHERE);
+
+ if (sconetId == null) {
+ query.append(_FINDER_COLUMN_SCONETID_SCONETID_1);
+ }
+ else {
+ if (sconetId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_SCONETID_SCONETID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_SCONETID_SCONETID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_SCONETID_ETABID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ if (sconetId != null) {
+ qPos.add(sconetId);
+ }
+
+ 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_SCONETID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user mappings where casId = ? and etabId = ?.
+ *
+ * @param casId the cas ID
+ * @param etabId the etab ID
+ * @return the number of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByCasId(String casId, long etabId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { casId, etabId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CASID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_USERMAPPING_WHERE);
+
+ if (casId == null) {
+ query.append(_FINDER_COLUMN_CASID_CASID_1);
+ }
+ else {
+ if (casId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_CASID_CASID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_CASID_CASID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_CASID_ETABID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ if (casId != null) {
+ qPos.add(casId);
+ }
+
+ 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_CASID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user mappings where partnerId = ? and etabId = ?.
+ *
+ * @param partnerId the partner ID
+ * @param etabId the etab ID
+ * @return the number of matching user mappings
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByPartnerId(String partnerId, long etabId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { partnerId, etabId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PARTNERID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_USERMAPPING_WHERE);
+
+ if (partnerId == null) {
+ query.append(_FINDER_COLUMN_PARTNERID_PARTNERID_1);
+ }
+ else {
+ if (partnerId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_PARTNERID_PARTNERID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_PARTNERID_PARTNERID_2);
+ }
+ }
+
+ query.append(_FINDER_COLUMN_PARTNERID_ETABID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ if (partnerId != null) {
+ qPos.add(partnerId);
+ }
+
+ 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_PARTNERID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user mappings.
+ *
+ * @return the number of user mappings
+ * @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_USERMAPPING);
+
+ 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 user mapping persistence.
+ */
+ public void afterPropertiesSet() {
+ String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
+ com.liferay.util.service.ServiceProps.get(
+ "value.object.listener.com.pentila.entSavoie.gestionVieScolaire.model.UserMapping")));
+
+ if (listenerClassNames.length > 0) {
+ try {
+ List<ModelListener<UserMapping>> listenersList = new ArrayList<ModelListener<UserMapping>>();
+
+ for (String listenerClassName : listenerClassNames) {
+ listenersList.add((ModelListener<UserMapping>)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(UserMappingImpl.class.getName());
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @BeanReference(type = AbsencePersistence.class)
+ protected AbsencePersistence absencePersistence;
+ @BeanReference(type = AbsencesBlogEntryMappingPersistence.class)
+ protected AbsencesBlogEntryMappingPersistence absencesBlogEntryMappingPersistence;
+ @BeanReference(type = SynchroConfigPersistence.class)
+ protected SynchroConfigPersistence synchroConfigPersistence;
+ @BeanReference(type = SynchroInstancePersistence.class)
+ protected SynchroInstancePersistence synchroInstancePersistence;
+ @BeanReference(type = UserMappingPersistence.class)
+ protected UserMappingPersistence userMappingPersistence;
+ @BeanReference(type = ResourcePersistence.class)
+ protected ResourcePersistence resourcePersistence;
+ @BeanReference(type = UserPersistence.class)
+ protected UserPersistence userPersistence;
+ private static final String _SQL_SELECT_USERMAPPING = "SELECT userMapping FROM UserMapping userMapping";
+ private static final String _SQL_SELECT_USERMAPPING_WHERE = "SELECT userMapping FROM UserMapping userMapping WHERE ";
+ private static final String _SQL_COUNT_USERMAPPING = "SELECT COUNT(userMapping) FROM UserMapping userMapping";
+ private static final String _SQL_COUNT_USERMAPPING_WHERE = "SELECT COUNT(userMapping) FROM UserMapping userMapping WHERE ";
+ private static final String _FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_1 = "userMapping.nationalNumber IS NULL AND ";
+ private static final String _FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_2 = "userMapping.nationalNumber = ? AND ";
+ private static final String _FINDER_COLUMN_NATIONALNUMBER_NATIONALNUMBER_3 = "(userMapping.nationalNumber IS NULL OR userMapping.nationalNumber = ?) AND ";
+ private static final String _FINDER_COLUMN_NATIONALNUMBER_ETABID_2 = "userMapping.id.etabId = ?";
+ private static final String _FINDER_COLUMN_PRONOTEID_PRONOTEID_1 = "userMapping.pronoteId IS NULL AND ";
+ private static final String _FINDER_COLUMN_PRONOTEID_PRONOTEID_2 = "userMapping.pronoteId = ? AND ";
+ private static final String _FINDER_COLUMN_PRONOTEID_PRONOTEID_3 = "(userMapping.pronoteId IS NULL OR userMapping.pronoteId = ?) AND ";
+ private static final String _FINDER_COLUMN_PRONOTEID_ETABID_2 = "userMapping.id.etabId = ?";
+ private static final String _FINDER_COLUMN_STSID_STSID_1 = "userMapping.stsId IS NULL AND ";
+ private static final String _FINDER_COLUMN_STSID_STSID_2 = "userMapping.stsId = ? AND ";
+ private static final String _FINDER_COLUMN_STSID_STSID_3 = "(userMapping.stsId IS NULL OR userMapping.stsId = ?) AND ";
+ private static final String _FINDER_COLUMN_STSID_ETABID_2 = "userMapping.id.etabId = ?";
+ private static final String _FINDER_COLUMN_USERETABID_USERETABID_1 = "userMapping.userEtabId IS NULL AND ";
+ private static final String _FINDER_COLUMN_USERETABID_USERETABID_2 = "userMapping.userEtabId = ? AND ";
+ private static final String _FINDER_COLUMN_USERETABID_USERETABID_3 = "(userMapping.userEtabId IS NULL OR userMapping.userEtabId = ?) AND ";
+ private static final String _FINDER_COLUMN_USERETABID_ETABID_2 = "userMapping.id.etabId = ?";
+ private static final String _FINDER_COLUMN_SCONETID_SCONETID_1 = "userMapping.sconetId IS NULL AND ";
+ private static final String _FINDER_COLUMN_SCONETID_SCONETID_2 = "userMapping.sconetId = ? AND ";
+ private static final String _FINDER_COLUMN_SCONETID_SCONETID_3 = "(userMapping.sconetId IS NULL OR userMapping.sconetId = ?) AND ";
+ private static final String _FINDER_COLUMN_SCONETID_ETABID_2 = "userMapping.id.etabId = ?";
+ private static final String _FINDER_COLUMN_CASID_CASID_1 = "userMapping.casId IS NULL AND ";
+ private static final String _FINDER_COLUMN_CASID_CASID_2 = "userMapping.casId = ? AND ";
+ private static final String _FINDER_COLUMN_CASID_CASID_3 = "(userMapping.casId IS NULL OR userMapping.casId = ?) AND ";
+ private static final String _FINDER_COLUMN_CASID_ETABID_2 = "userMapping.id.etabId = ?";
+ private static final String _FINDER_COLUMN_PARTNERID_PARTNERID_1 = "userMapping.partnerId IS NULL AND ";
+ private static final String _FINDER_COLUMN_PARTNERID_PARTNERID_2 = "userMapping.partnerId = ? AND ";
+ private static final String _FINDER_COLUMN_PARTNERID_PARTNERID_3 = "(userMapping.partnerId IS NULL OR userMapping.partnerId = ?) AND ";
+ private static final String _FINDER_COLUMN_PARTNERID_ETABID_2 = "userMapping.id.etabId = ?";
+ private static final String _ORDER_BY_ENTITY_ALIAS = "userMapping.";
+ private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserMapping exists with the primary key ";
+ private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserMapping 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(UserMappingPersistenceImpl.class);
+ private static UserMapping _nullUserMapping = new UserMappingImpl() {
+ @Override
+ public Object clone() {
+ return this;
+ }
+
+ @Override
+ public CacheModel<UserMapping> toCacheModel() {
+ return _nullUserMappingCacheModel;
+ }
+ };
+
+ private static CacheModel<UserMapping> _nullUserMappingCacheModel = new CacheModel<UserMapping>() {
+ public UserMapping toEntityModel() {
+ return _nullUserMapping;
+ }
+ };
+}
\ No newline at end of file