--- /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.cdt.service.persistence;
+
+import com.liferay.portal.NoSuchModelException;
+import com.liferay.portal.kernel.bean.BeanReference;
+import com.liferay.portal.kernel.cache.CacheRegistryUtil;
+import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
+import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
+import com.liferay.portal.kernel.dao.orm.FinderPath;
+import com.liferay.portal.kernel.dao.orm.Query;
+import com.liferay.portal.kernel.dao.orm.QueryPos;
+import com.liferay.portal.kernel.dao.orm.QueryUtil;
+import com.liferay.portal.kernel.dao.orm.Session;
+import com.liferay.portal.kernel.exception.SystemException;
+import com.liferay.portal.kernel.log.Log;
+import com.liferay.portal.kernel.log.LogFactoryUtil;
+import com.liferay.portal.kernel.portlet.PortletClassLoaderUtil;
+import com.liferay.portal.kernel.util.GetterUtil;
+import com.liferay.portal.kernel.util.InstanceFactory;
+import com.liferay.portal.kernel.util.OrderByComparator;
+import com.liferay.portal.kernel.util.PropsKeys;
+import com.liferay.portal.kernel.util.PropsUtil;
+import com.liferay.portal.kernel.util.StringBundler;
+import com.liferay.portal.kernel.util.StringPool;
+import com.liferay.portal.kernel.util.StringUtil;
+import com.liferay.portal.model.CacheModel;
+import com.liferay.portal.model.ModelListener;
+import com.liferay.portal.service.persistence.BatchSessionUtil;
+import com.liferay.portal.service.persistence.ResourcePersistence;
+import com.liferay.portal.service.persistence.UserPersistence;
+import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
+
+import com.pentila.entSavoie.cdt.NoSuchHomeworkException;
+import com.pentila.entSavoie.cdt.model.Homework;
+import com.pentila.entSavoie.cdt.model.impl.HomeworkImpl;
+import com.pentila.entSavoie.cdt.model.impl.HomeworkModelImpl;
+
+import java.io.Serializable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * The persistence implementation for the homework service.
+ *
+ * <p>
+ * Caching information and settings can be found in <code>portal.properties</code>
+ * </p>
+ *
+ * @author Cedric Lecarpentier
+ * @see HomeworkPersistence
+ * @see HomeworkUtil
+ * @generated
+ */
+public class HomeworkPersistenceImpl extends BasePersistenceImpl<Homework>
+ implements HomeworkPersistence {
+ /*
+ * NOTE FOR DEVELOPERS:
+ *
+ * Never modify or reference this class directly. Always use {@link HomeworkUtil} to access the homework persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
+ */
+ public static final String FINDER_CLASS_NAME_ENTITY = HomeworkImpl.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_TARGETSESSIONID =
+ new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, HomeworkImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBytargetSessionId",
+ new String[] {
+ Long.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TARGETSESSIONID =
+ new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, HomeworkImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBytargetSessionId",
+ new String[] { Long.class.getName() },
+ HomeworkModelImpl.TARGETSESSIONID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_TARGETSESSIONID = new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countBytargetSessionId", new String[] { Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_SOURCESESSIONID =
+ new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, HomeworkImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBysourceSessionId",
+ new String[] {
+ Long.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SOURCESESSIONID =
+ new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, HomeworkImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBysourceSessionId",
+ new String[] { Long.class.getName() },
+ HomeworkModelImpl.SOURCESESSIONID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_SOURCESESSIONID = new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countBysourceSessionId", new String[] { Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_TARGETWEEKID =
+ new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, HomeworkImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBytargetWeekId",
+ new String[] {
+ Integer.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TARGETWEEKID =
+ new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, HomeworkImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findBytargetWeekId",
+ new String[] { Integer.class.getName() },
+ HomeworkModelImpl.TARGETWEEKID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_TARGETWEEKID = new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countBytargetWeekId",
+ new String[] { Integer.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, HomeworkImpl.class,
+ FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, HomeworkImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
+
+ /**
+ * Caches the homework in the entity cache if it is enabled.
+ *
+ * @param homework the homework
+ */
+ public void cacheResult(Homework homework) {
+ EntityCacheUtil.putResult(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkImpl.class, homework.getPrimaryKey(), homework);
+
+ homework.resetOriginalValues();
+ }
+
+ /**
+ * Caches the homeworks in the entity cache if it is enabled.
+ *
+ * @param homeworks the homeworks
+ */
+ public void cacheResult(List<Homework> homeworks) {
+ for (Homework homework : homeworks) {
+ if (EntityCacheUtil.getResult(
+ HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkImpl.class, homework.getPrimaryKey()) == null) {
+ cacheResult(homework);
+ }
+ else {
+ homework.resetOriginalValues();
+ }
+ }
+ }
+
+ /**
+ * Clears the cache for all homeworks.
+ *
+ * <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(HomeworkImpl.class.getName());
+ }
+
+ EntityCacheUtil.clearCache(HomeworkImpl.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 homework.
+ *
+ * <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(Homework homework) {
+ EntityCacheUtil.removeResult(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkImpl.class, homework.getPrimaryKey());
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @Override
+ public void clearCache(List<Homework> homeworks) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+
+ for (Homework homework : homeworks) {
+ EntityCacheUtil.removeResult(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkImpl.class, homework.getPrimaryKey());
+ }
+ }
+
+ /**
+ * Creates a new homework with the primary key. Does not add the homework to the database.
+ *
+ * @param homeworkId the primary key for the new homework
+ * @return the new homework
+ */
+ public Homework create(long homeworkId) {
+ Homework homework = new HomeworkImpl();
+
+ homework.setNew(true);
+ homework.setPrimaryKey(homeworkId);
+
+ return homework;
+ }
+
+ /**
+ * Removes the homework with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param homeworkId the primary key of the homework
+ * @return the homework that was removed
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a homework with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework remove(long homeworkId)
+ throws NoSuchHomeworkException, SystemException {
+ return remove(Long.valueOf(homeworkId));
+ }
+
+ /**
+ * Removes the homework with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param primaryKey the primary key of the homework
+ * @return the homework that was removed
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a homework with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public Homework remove(Serializable primaryKey)
+ throws NoSuchHomeworkException, SystemException {
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Homework homework = (Homework)session.get(HomeworkImpl.class,
+ primaryKey);
+
+ if (homework == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
+ }
+
+ throw new NoSuchHomeworkException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ primaryKey);
+ }
+
+ return remove(homework);
+ }
+ catch (NoSuchHomeworkException nsee) {
+ throw nsee;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ @Override
+ protected Homework removeImpl(Homework homework) throws SystemException {
+ homework = toUnwrappedModel(homework);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.delete(session, homework);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ clearCache(homework);
+
+ return homework;
+ }
+
+ @Override
+ public Homework updateImpl(
+ com.pentila.entSavoie.cdt.model.Homework homework, boolean merge)
+ throws SystemException {
+ homework = toUnwrappedModel(homework);
+
+ boolean isNew = homework.isNew();
+
+ HomeworkModelImpl homeworkModelImpl = (HomeworkModelImpl)homework;
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.update(session, homework, merge);
+
+ homework.setNew(false);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+
+ if (isNew || !HomeworkModelImpl.COLUMN_BITMASK_ENABLED) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ else {
+ if ((homeworkModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TARGETSESSIONID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(homeworkModelImpl.getOriginalTargetSessionId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TARGETSESSIONID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TARGETSESSIONID,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(homeworkModelImpl.getTargetSessionId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TARGETSESSIONID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TARGETSESSIONID,
+ args);
+ }
+
+ if ((homeworkModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SOURCESESSIONID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(homeworkModelImpl.getOriginalSourceSessionId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SOURCESESSIONID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SOURCESESSIONID,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(homeworkModelImpl.getSourceSessionId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SOURCESESSIONID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SOURCESESSIONID,
+ args);
+ }
+
+ if ((homeworkModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TARGETWEEKID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Integer.valueOf(homeworkModelImpl.getOriginalTargetWeekId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TARGETWEEKID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TARGETWEEKID,
+ args);
+
+ args = new Object[] {
+ Integer.valueOf(homeworkModelImpl.getTargetWeekId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TARGETWEEKID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TARGETWEEKID,
+ args);
+ }
+ }
+
+ EntityCacheUtil.putResult(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkImpl.class, homework.getPrimaryKey(), homework);
+
+ return homework;
+ }
+
+ protected Homework toUnwrappedModel(Homework homework) {
+ if (homework instanceof HomeworkImpl) {
+ return homework;
+ }
+
+ HomeworkImpl homeworkImpl = new HomeworkImpl();
+
+ homeworkImpl.setNew(homework.isNew());
+ homeworkImpl.setPrimaryKey(homework.getPrimaryKey());
+
+ homeworkImpl.setHomeworkId(homework.getHomeworkId());
+ homeworkImpl.setType(homework.getType());
+ homeworkImpl.setSourceSessionId(homework.getSourceSessionId());
+ homeworkImpl.setTargetSessionId(homework.getTargetSessionId());
+ homeworkImpl.setTargetWeekId(homework.getTargetWeekId());
+ homeworkImpl.setTargetDate(homework.getTargetDate());
+ homeworkImpl.setGroupId(homework.getGroupId());
+ homeworkImpl.setTeacherId(homework.getTeacherId());
+ homeworkImpl.setDescription(homework.getDescription());
+ homeworkImpl.setEstimatedTime(homework.getEstimatedTime());
+ homeworkImpl.setFromDate(homework.getFromDate());
+ homeworkImpl.setHasAttachFile(homework.isHasAttachFile());
+ homeworkImpl.setIsToBeSent(homework.isIsToBeSent());
+ homeworkImpl.setIsCustomStudentList(homework.isIsCustomStudentList());
+
+ return homeworkImpl;
+ }
+
+ /**
+ * Returns the homework 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 homework
+ * @return the homework
+ * @throws com.liferay.portal.NoSuchModelException if a homework with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public Homework findByPrimaryKey(Serializable primaryKey)
+ throws NoSuchModelException, SystemException {
+ return findByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the homework with the primary key or throws a {@link com.pentila.entSavoie.cdt.NoSuchHomeworkException} if it could not be found.
+ *
+ * @param homeworkId the primary key of the homework
+ * @return the homework
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a homework with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework findByPrimaryKey(long homeworkId)
+ throws NoSuchHomeworkException, SystemException {
+ Homework homework = fetchByPrimaryKey(homeworkId);
+
+ if (homework == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + homeworkId);
+ }
+
+ throw new NoSuchHomeworkException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ homeworkId);
+ }
+
+ return homework;
+ }
+
+ /**
+ * Returns the homework with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param primaryKey the primary key of the homework
+ * @return the homework, or <code>null</code> if a homework with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public Homework fetchByPrimaryKey(Serializable primaryKey)
+ throws SystemException {
+ return fetchByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the homework with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param homeworkId the primary key of the homework
+ * @return the homework, or <code>null</code> if a homework with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework fetchByPrimaryKey(long homeworkId)
+ throws SystemException {
+ Homework homework = (Homework)EntityCacheUtil.getResult(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkImpl.class, homeworkId);
+
+ if (homework == _nullHomework) {
+ return null;
+ }
+
+ if (homework == null) {
+ Session session = null;
+
+ boolean hasException = false;
+
+ try {
+ session = openSession();
+
+ homework = (Homework)session.get(HomeworkImpl.class,
+ Long.valueOf(homeworkId));
+ }
+ catch (Exception e) {
+ hasException = true;
+
+ throw processException(e);
+ }
+ finally {
+ if (homework != null) {
+ cacheResult(homework);
+ }
+ else if (!hasException) {
+ EntityCacheUtil.putResult(HomeworkModelImpl.ENTITY_CACHE_ENABLED,
+ HomeworkImpl.class, homeworkId, _nullHomework);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return homework;
+ }
+
+ /**
+ * Returns all the homeworks where targetSessionId = ?.
+ *
+ * @param targetSessionId the target session ID
+ * @return the matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> findBytargetSessionId(long targetSessionId)
+ throws SystemException {
+ return findBytargetSessionId(targetSessionId, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the homeworks where targetSessionId = ?.
+ *
+ * <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 targetSessionId the target session ID
+ * @param start the lower bound of the range of homeworks
+ * @param end the upper bound of the range of homeworks (not inclusive)
+ * @return the range of matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> findBytargetSessionId(long targetSessionId,
+ int start, int end) throws SystemException {
+ return findBytargetSessionId(targetSessionId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the homeworks where targetSessionId = ?.
+ *
+ * <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 targetSessionId the target session ID
+ * @param start the lower bound of the range of homeworks
+ * @param end the upper bound of the range of homeworks (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> findBytargetSessionId(long targetSessionId,
+ 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_TARGETSESSIONID;
+ finderArgs = new Object[] { targetSessionId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TARGETSESSIONID;
+ finderArgs = new Object[] {
+ targetSessionId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Homework> list = (List<Homework>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Homework homework : list) {
+ if ((targetSessionId != homework.getTargetSessionId())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(3 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(2);
+ }
+
+ query.append(_SQL_SELECT_HOMEWORK_WHERE);
+
+ query.append(_FINDER_COLUMN_TARGETSESSIONID_TARGETSESSIONID_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(targetSessionId);
+
+ list = (List<Homework>)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 homework in the ordered set where targetSessionId = ?.
+ *
+ * @param targetSessionId the target session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching homework
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework findBytargetSessionId_First(long targetSessionId,
+ OrderByComparator orderByComparator)
+ throws NoSuchHomeworkException, SystemException {
+ Homework homework = fetchBytargetSessionId_First(targetSessionId,
+ orderByComparator);
+
+ if (homework != null) {
+ return homework;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("targetSessionId=");
+ msg.append(targetSessionId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchHomeworkException(msg.toString());
+ }
+
+ /**
+ * Returns the first homework in the ordered set where targetSessionId = ?.
+ *
+ * @param targetSessionId the target session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching homework, or <code>null</code> if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework fetchBytargetSessionId_First(long targetSessionId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<Homework> list = findBytargetSessionId(targetSessionId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last homework in the ordered set where targetSessionId = ?.
+ *
+ * @param targetSessionId the target session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching homework
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework findBytargetSessionId_Last(long targetSessionId,
+ OrderByComparator orderByComparator)
+ throws NoSuchHomeworkException, SystemException {
+ Homework homework = fetchBytargetSessionId_Last(targetSessionId,
+ orderByComparator);
+
+ if (homework != null) {
+ return homework;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("targetSessionId=");
+ msg.append(targetSessionId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchHomeworkException(msg.toString());
+ }
+
+ /**
+ * Returns the last homework in the ordered set where targetSessionId = ?.
+ *
+ * @param targetSessionId the target session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching homework, or <code>null</code> if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework fetchBytargetSessionId_Last(long targetSessionId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countBytargetSessionId(targetSessionId);
+
+ List<Homework> list = findBytargetSessionId(targetSessionId, count - 1,
+ count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the homeworks before and after the current homework in the ordered set where targetSessionId = ?.
+ *
+ * @param homeworkId the primary key of the current homework
+ * @param targetSessionId the target session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next homework
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a homework with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework[] findBytargetSessionId_PrevAndNext(long homeworkId,
+ long targetSessionId, OrderByComparator orderByComparator)
+ throws NoSuchHomeworkException, SystemException {
+ Homework homework = findByPrimaryKey(homeworkId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Homework[] array = new HomeworkImpl[3];
+
+ array[0] = getBytargetSessionId_PrevAndNext(session, homework,
+ targetSessionId, orderByComparator, true);
+
+ array[1] = homework;
+
+ array[2] = getBytargetSessionId_PrevAndNext(session, homework,
+ targetSessionId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Homework getBytargetSessionId_PrevAndNext(Session session,
+ Homework homework, long targetSessionId,
+ 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_HOMEWORK_WHERE);
+
+ query.append(_FINDER_COLUMN_TARGETSESSIONID_TARGETSESSIONID_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(targetSessionId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(homework);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Homework> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the homeworks where sourceSessionId = ?.
+ *
+ * @param sourceSessionId the source session ID
+ * @return the matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> findBysourceSessionId(long sourceSessionId)
+ throws SystemException {
+ return findBysourceSessionId(sourceSessionId, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the homeworks where sourceSessionId = ?.
+ *
+ * <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 sourceSessionId the source session ID
+ * @param start the lower bound of the range of homeworks
+ * @param end the upper bound of the range of homeworks (not inclusive)
+ * @return the range of matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> findBysourceSessionId(long sourceSessionId,
+ int start, int end) throws SystemException {
+ return findBysourceSessionId(sourceSessionId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the homeworks where sourceSessionId = ?.
+ *
+ * <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 sourceSessionId the source session ID
+ * @param start the lower bound of the range of homeworks
+ * @param end the upper bound of the range of homeworks (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> findBysourceSessionId(long sourceSessionId,
+ 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_SOURCESESSIONID;
+ finderArgs = new Object[] { sourceSessionId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SOURCESESSIONID;
+ finderArgs = new Object[] {
+ sourceSessionId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Homework> list = (List<Homework>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Homework homework : list) {
+ if ((sourceSessionId != homework.getSourceSessionId())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(3 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(2);
+ }
+
+ query.append(_SQL_SELECT_HOMEWORK_WHERE);
+
+ query.append(_FINDER_COLUMN_SOURCESESSIONID_SOURCESESSIONID_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(sourceSessionId);
+
+ list = (List<Homework>)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 homework in the ordered set where sourceSessionId = ?.
+ *
+ * @param sourceSessionId the source session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching homework
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework findBysourceSessionId_First(long sourceSessionId,
+ OrderByComparator orderByComparator)
+ throws NoSuchHomeworkException, SystemException {
+ Homework homework = fetchBysourceSessionId_First(sourceSessionId,
+ orderByComparator);
+
+ if (homework != null) {
+ return homework;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("sourceSessionId=");
+ msg.append(sourceSessionId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchHomeworkException(msg.toString());
+ }
+
+ /**
+ * Returns the first homework in the ordered set where sourceSessionId = ?.
+ *
+ * @param sourceSessionId the source session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching homework, or <code>null</code> if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework fetchBysourceSessionId_First(long sourceSessionId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<Homework> list = findBysourceSessionId(sourceSessionId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last homework in the ordered set where sourceSessionId = ?.
+ *
+ * @param sourceSessionId the source session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching homework
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework findBysourceSessionId_Last(long sourceSessionId,
+ OrderByComparator orderByComparator)
+ throws NoSuchHomeworkException, SystemException {
+ Homework homework = fetchBysourceSessionId_Last(sourceSessionId,
+ orderByComparator);
+
+ if (homework != null) {
+ return homework;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("sourceSessionId=");
+ msg.append(sourceSessionId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchHomeworkException(msg.toString());
+ }
+
+ /**
+ * Returns the last homework in the ordered set where sourceSessionId = ?.
+ *
+ * @param sourceSessionId the source session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching homework, or <code>null</code> if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework fetchBysourceSessionId_Last(long sourceSessionId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countBysourceSessionId(sourceSessionId);
+
+ List<Homework> list = findBysourceSessionId(sourceSessionId, count - 1,
+ count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the homeworks before and after the current homework in the ordered set where sourceSessionId = ?.
+ *
+ * @param homeworkId the primary key of the current homework
+ * @param sourceSessionId the source session ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next homework
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a homework with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework[] findBysourceSessionId_PrevAndNext(long homeworkId,
+ long sourceSessionId, OrderByComparator orderByComparator)
+ throws NoSuchHomeworkException, SystemException {
+ Homework homework = findByPrimaryKey(homeworkId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Homework[] array = new HomeworkImpl[3];
+
+ array[0] = getBysourceSessionId_PrevAndNext(session, homework,
+ sourceSessionId, orderByComparator, true);
+
+ array[1] = homework;
+
+ array[2] = getBysourceSessionId_PrevAndNext(session, homework,
+ sourceSessionId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Homework getBysourceSessionId_PrevAndNext(Session session,
+ Homework homework, long sourceSessionId,
+ 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_HOMEWORK_WHERE);
+
+ query.append(_FINDER_COLUMN_SOURCESESSIONID_SOURCESESSIONID_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(sourceSessionId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(homework);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Homework> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the homeworks where targetWeekId = ?.
+ *
+ * @param targetWeekId the target week ID
+ * @return the matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> findBytargetWeekId(int targetWeekId)
+ throws SystemException {
+ return findBytargetWeekId(targetWeekId, QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the homeworks where targetWeekId = ?.
+ *
+ * <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 targetWeekId the target week ID
+ * @param start the lower bound of the range of homeworks
+ * @param end the upper bound of the range of homeworks (not inclusive)
+ * @return the range of matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> findBytargetWeekId(int targetWeekId, int start,
+ int end) throws SystemException {
+ return findBytargetWeekId(targetWeekId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the homeworks where targetWeekId = ?.
+ *
+ * <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 targetWeekId the target week ID
+ * @param start the lower bound of the range of homeworks
+ * @param end the upper bound of the range of homeworks (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> findBytargetWeekId(int targetWeekId, 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_TARGETWEEKID;
+ finderArgs = new Object[] { targetWeekId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TARGETWEEKID;
+ finderArgs = new Object[] {
+ targetWeekId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<Homework> list = (List<Homework>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (Homework homework : list) {
+ if ((targetWeekId != homework.getTargetWeekId())) {
+ list = null;
+
+ break;
+ }
+ }
+ }
+
+ if (list == null) {
+ StringBundler query = null;
+
+ if (orderByComparator != null) {
+ query = new StringBundler(3 +
+ (orderByComparator.getOrderByFields().length * 3));
+ }
+ else {
+ query = new StringBundler(2);
+ }
+
+ query.append(_SQL_SELECT_HOMEWORK_WHERE);
+
+ query.append(_FINDER_COLUMN_TARGETWEEKID_TARGETWEEKID_2);
+
+ if (orderByComparator != null) {
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(targetWeekId);
+
+ list = (List<Homework>)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 homework in the ordered set where targetWeekId = ?.
+ *
+ * @param targetWeekId the target week ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching homework
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework findBytargetWeekId_First(int targetWeekId,
+ OrderByComparator orderByComparator)
+ throws NoSuchHomeworkException, SystemException {
+ Homework homework = fetchBytargetWeekId_First(targetWeekId,
+ orderByComparator);
+
+ if (homework != null) {
+ return homework;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("targetWeekId=");
+ msg.append(targetWeekId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchHomeworkException(msg.toString());
+ }
+
+ /**
+ * Returns the first homework in the ordered set where targetWeekId = ?.
+ *
+ * @param targetWeekId the target week ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching homework, or <code>null</code> if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework fetchBytargetWeekId_First(int targetWeekId,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<Homework> list = findBytargetWeekId(targetWeekId, 0, 1,
+ orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last homework in the ordered set where targetWeekId = ?.
+ *
+ * @param targetWeekId the target week ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching homework
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework findBytargetWeekId_Last(int targetWeekId,
+ OrderByComparator orderByComparator)
+ throws NoSuchHomeworkException, SystemException {
+ Homework homework = fetchBytargetWeekId_Last(targetWeekId,
+ orderByComparator);
+
+ if (homework != null) {
+ return homework;
+ }
+
+ StringBundler msg = new StringBundler(4);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("targetWeekId=");
+ msg.append(targetWeekId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchHomeworkException(msg.toString());
+ }
+
+ /**
+ * Returns the last homework in the ordered set where targetWeekId = ?.
+ *
+ * @param targetWeekId the target week ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching homework, or <code>null</code> if a matching homework could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework fetchBytargetWeekId_Last(int targetWeekId,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countBytargetWeekId(targetWeekId);
+
+ List<Homework> list = findBytargetWeekId(targetWeekId, count - 1,
+ count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the homeworks before and after the current homework in the ordered set where targetWeekId = ?.
+ *
+ * @param homeworkId the primary key of the current homework
+ * @param targetWeekId the target week ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next homework
+ * @throws com.pentila.entSavoie.cdt.NoSuchHomeworkException if a homework with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public Homework[] findBytargetWeekId_PrevAndNext(long homeworkId,
+ int targetWeekId, OrderByComparator orderByComparator)
+ throws NoSuchHomeworkException, SystemException {
+ Homework homework = findByPrimaryKey(homeworkId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Homework[] array = new HomeworkImpl[3];
+
+ array[0] = getBytargetWeekId_PrevAndNext(session, homework,
+ targetWeekId, orderByComparator, true);
+
+ array[1] = homework;
+
+ array[2] = getBytargetWeekId_PrevAndNext(session, homework,
+ targetWeekId, orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected Homework getBytargetWeekId_PrevAndNext(Session session,
+ Homework homework, int targetWeekId,
+ 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_HOMEWORK_WHERE);
+
+ query.append(_FINDER_COLUMN_TARGETWEEKID_TARGETWEEKID_2);
+
+ if (orderByComparator != null) {
+ String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
+
+ if (orderByConditionFields.length > 0) {
+ query.append(WHERE_AND);
+ }
+
+ for (int i = 0; i < orderByConditionFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByConditionFields[i]);
+
+ if ((i + 1) < orderByConditionFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN_HAS_NEXT);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(WHERE_GREATER_THAN);
+ }
+ else {
+ query.append(WHERE_LESSER_THAN);
+ }
+ }
+ }
+
+ query.append(ORDER_BY_CLAUSE);
+
+ String[] orderByFields = orderByComparator.getOrderByFields();
+
+ for (int i = 0; i < orderByFields.length; i++) {
+ query.append(_ORDER_BY_ENTITY_ALIAS);
+ query.append(orderByFields[i]);
+
+ if ((i + 1) < orderByFields.length) {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC_HAS_NEXT);
+ }
+ else {
+ query.append(ORDER_BY_DESC_HAS_NEXT);
+ }
+ }
+ else {
+ if (orderByComparator.isAscending() ^ previous) {
+ query.append(ORDER_BY_ASC);
+ }
+ else {
+ query.append(ORDER_BY_DESC);
+ }
+ }
+ }
+ }
+
+ String sql = query.toString();
+
+ Query q = session.createQuery(sql);
+
+ q.setFirstResult(0);
+ q.setMaxResults(2);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(targetWeekId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(homework);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<Homework> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the homeworks.
+ *
+ * @return the homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> findAll() throws SystemException {
+ return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the homeworks.
+ *
+ * <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 homeworks
+ * @param end the upper bound of the range of homeworks (not inclusive)
+ * @return the range of homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> findAll(int start, int end) throws SystemException {
+ return findAll(start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the homeworks.
+ *
+ * <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 homeworks
+ * @param end the upper bound of the range of homeworks (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public List<Homework> 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<Homework> list = (List<Homework>)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_HOMEWORK);
+
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+
+ sql = query.toString();
+ }
+ else {
+ sql = _SQL_SELECT_HOMEWORK;
+ }
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ if (orderByComparator == null) {
+ list = (List<Homework>)QueryUtil.list(q, getDialect(),
+ start, end, false);
+
+ Collections.sort(list);
+ }
+ else {
+ list = (List<Homework>)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 homeworks where targetSessionId = ? from the database.
+ *
+ * @param targetSessionId the target session ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeBytargetSessionId(long targetSessionId)
+ throws SystemException {
+ for (Homework homework : findBytargetSessionId(targetSessionId)) {
+ remove(homework);
+ }
+ }
+
+ /**
+ * Removes all the homeworks where sourceSessionId = ? from the database.
+ *
+ * @param sourceSessionId the source session ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeBysourceSessionId(long sourceSessionId)
+ throws SystemException {
+ for (Homework homework : findBysourceSessionId(sourceSessionId)) {
+ remove(homework);
+ }
+ }
+
+ /**
+ * Removes all the homeworks where targetWeekId = ? from the database.
+ *
+ * @param targetWeekId the target week ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeBytargetWeekId(int targetWeekId)
+ throws SystemException {
+ for (Homework homework : findBytargetWeekId(targetWeekId)) {
+ remove(homework);
+ }
+ }
+
+ /**
+ * Removes all the homeworks from the database.
+ *
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeAll() throws SystemException {
+ for (Homework homework : findAll()) {
+ remove(homework);
+ }
+ }
+
+ /**
+ * Returns the number of homeworks where targetSessionId = ?.
+ *
+ * @param targetSessionId the target session ID
+ * @return the number of matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public int countBytargetSessionId(long targetSessionId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { targetSessionId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TARGETSESSIONID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(2);
+
+ query.append(_SQL_COUNT_HOMEWORK_WHERE);
+
+ query.append(_FINDER_COLUMN_TARGETSESSIONID_TARGETSESSIONID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(targetSessionId);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TARGETSESSIONID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of homeworks where sourceSessionId = ?.
+ *
+ * @param sourceSessionId the source session ID
+ * @return the number of matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public int countBysourceSessionId(long sourceSessionId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { sourceSessionId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SOURCESESSIONID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(2);
+
+ query.append(_SQL_COUNT_HOMEWORK_WHERE);
+
+ query.append(_FINDER_COLUMN_SOURCESESSIONID_SOURCESESSIONID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(sourceSessionId);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SOURCESESSIONID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of homeworks where targetWeekId = ?.
+ *
+ * @param targetWeekId the target week ID
+ * @return the number of matching homeworks
+ * @throws SystemException if a system exception occurred
+ */
+ public int countBytargetWeekId(int targetWeekId) throws SystemException {
+ Object[] finderArgs = new Object[] { targetWeekId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TARGETWEEKID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(2);
+
+ query.append(_SQL_COUNT_HOMEWORK_WHERE);
+
+ query.append(_FINDER_COLUMN_TARGETWEEKID_TARGETWEEKID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(targetWeekId);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TARGETWEEKID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of homeworks.
+ *
+ * @return the number of homeworks
+ * @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_HOMEWORK);
+
+ 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 homework persistence.
+ */
+ public void afterPropertiesSet() {
+ String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
+ com.liferay.util.service.ServiceProps.get(
+ "value.object.listener.com.pentila.entSavoie.cdt.model.Homework")));
+
+ if (listenerClassNames.length > 0) {
+ try {
+ List<ModelListener<Homework>> listenersList = new ArrayList<ModelListener<Homework>>();
+
+ for (String listenerClassName : listenerClassNames) {
+ listenersList.add((ModelListener<Homework>)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(HomeworkImpl.class.getName());
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @BeanReference(type = CDTSessionPersistence.class)
+ protected CDTSessionPersistence cdtSessionPersistence;
+ @BeanReference(type = ConfigurationPersistence.class)
+ protected ConfigurationPersistence configurationPersistence;
+ @BeanReference(type = DailySchedulePersistence.class)
+ protected DailySchedulePersistence dailySchedulePersistence;
+ @BeanReference(type = HomeworkPersistence.class)
+ protected HomeworkPersistence homeworkPersistence;
+ @BeanReference(type = HomeworkDonePersistence.class)
+ protected HomeworkDonePersistence homeworkDonePersistence;
+ @BeanReference(type = HomeworkDropboxFolderPersistence.class)
+ protected HomeworkDropboxFolderPersistence homeworkDropboxFolderPersistence;
+ @BeanReference(type = SchoolSubjectPersistence.class)
+ protected SchoolSubjectPersistence schoolSubjectPersistence;
+ @BeanReference(type = SessionStudentPersistence.class)
+ protected SessionStudentPersistence sessionStudentPersistence;
+ @BeanReference(type = SessionTeacherPersistence.class)
+ protected SessionTeacherPersistence sessionTeacherPersistence;
+ @BeanReference(type = StudentHomeworkPersistence.class)
+ protected StudentHomeworkPersistence studentHomeworkPersistence;
+ @BeanReference(type = SubjectPersistence.class)
+ protected SubjectPersistence subjectPersistence;
+ @BeanReference(type = TeacherGroupColorPersistence.class)
+ protected TeacherGroupColorPersistence teacherGroupColorPersistence;
+ @BeanReference(type = VisaPersistence.class)
+ protected VisaPersistence visaPersistence;
+ @BeanReference(type = WeeklySchedulePersistence.class)
+ protected WeeklySchedulePersistence weeklySchedulePersistence;
+ @BeanReference(type = ResourcePersistence.class)
+ protected ResourcePersistence resourcePersistence;
+ @BeanReference(type = UserPersistence.class)
+ protected UserPersistence userPersistence;
+ private static final String _SQL_SELECT_HOMEWORK = "SELECT homework FROM Homework homework";
+ private static final String _SQL_SELECT_HOMEWORK_WHERE = "SELECT homework FROM Homework homework WHERE ";
+ private static final String _SQL_COUNT_HOMEWORK = "SELECT COUNT(homework) FROM Homework homework";
+ private static final String _SQL_COUNT_HOMEWORK_WHERE = "SELECT COUNT(homework) FROM Homework homework WHERE ";
+ private static final String _FINDER_COLUMN_TARGETSESSIONID_TARGETSESSIONID_2 =
+ "homework.targetSessionId = ?";
+ private static final String _FINDER_COLUMN_SOURCESESSIONID_SOURCESESSIONID_2 =
+ "homework.sourceSessionId = ?";
+ private static final String _FINDER_COLUMN_TARGETWEEKID_TARGETWEEKID_2 = "homework.targetWeekId = ?";
+ private static final String _ORDER_BY_ENTITY_ALIAS = "homework.";
+ private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Homework exists with the primary key ";
+ private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Homework 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(HomeworkPersistenceImpl.class);
+ private static Homework _nullHomework = new HomeworkImpl() {
+ @Override
+ public Object clone() {
+ return this;
+ }
+
+ @Override
+ public CacheModel<Homework> toCacheModel() {
+ return _nullHomeworkCacheModel;
+ }
+ };
+
+ private static CacheModel<Homework> _nullHomeworkCacheModel = new CacheModel<Homework>() {
+ public Homework toEntityModel() {
+ return _nullHomework;
+ }
+ };
+}
\ No newline at end of file