--- /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.userProperties.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.userProperties.NoSuchUserRelationshipException;
+import com.pentila.entSavoie.userProperties.model.UserRelationship;
+import com.pentila.entSavoie.userProperties.model.impl.UserRelationshipImpl;
+import com.pentila.entSavoie.userProperties.model.impl.UserRelationshipModelImpl;
+
+import java.io.Serializable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * The persistence implementation for the user relationship service.
+ *
+ * <p>
+ * Caching information and settings can be found in <code>portal.properties</code>
+ * </p>
+ *
+ * @author Amblard Mathieu - Barma Igor
+ * @see UserRelationshipPersistence
+ * @see UserRelationshipUtil
+ * @generated
+ */
+public class UserRelationshipPersistenceImpl extends BasePersistenceImpl<UserRelationship>
+ implements UserRelationshipPersistence {
+ /*
+ * NOTE FOR DEVELOPERS:
+ *
+ * Never modify or reference this class directly. Always use {@link UserRelationshipUtil} to access the user relationship persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
+ */
+ public static final String FINDER_CLASS_NAME_ENTITY = UserRelationshipImpl.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_FROMUSERID_TOUSERID =
+ new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED,
+ UserRelationshipImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findByfromUserId_toUserId",
+ new String[] {
+ Long.class.getName(), Long.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FROMUSERID_TOUSERID =
+ new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED,
+ UserRelationshipImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findByfromUserId_toUserId",
+ new String[] { Long.class.getName(), Long.class.getName() },
+ UserRelationshipModelImpl.FROMUSERID_COLUMN_BITMASK |
+ UserRelationshipModelImpl.TOUSERID_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_FROMUSERID_TOUSERID = new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countByfromUserId_toUserId",
+ new String[] { Long.class.getName(), Long.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_FROMUSERID_RELATIONTYPE =
+ new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED,
+ UserRelationshipImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findByfromUserId_relationType",
+ new String[] {
+ Long.class.getName(), String.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FROMUSERID_RELATIONTYPE =
+ new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED,
+ UserRelationshipImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findByfromUserId_relationType",
+ new String[] { Long.class.getName(), String.class.getName() },
+ UserRelationshipModelImpl.FROMUSERID_COLUMN_BITMASK |
+ UserRelationshipModelImpl.RELATIONTYPE_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_FROMUSERID_RELATIONTYPE = new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countByfromUserId_relationType",
+ new String[] { Long.class.getName(), String.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_TOUSERID_RELATIONTYPE =
+ new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED,
+ UserRelationshipImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findBytoUserId_relationType",
+ new String[] {
+ Long.class.getName(), String.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOUSERID_RELATIONTYPE =
+ new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED,
+ UserRelationshipImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findBytoUserId_relationType",
+ new String[] { Long.class.getName(), String.class.getName() },
+ UserRelationshipModelImpl.TOUSERID_COLUMN_BITMASK |
+ UserRelationshipModelImpl.RELATIONTYPE_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_TOUSERID_RELATIONTYPE = new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countBytoUserId_relationType",
+ new String[] { Long.class.getName(), String.class.getName() });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_TOUSERSCONETID_RELATIONTYPE =
+ new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED,
+ UserRelationshipImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findBytoUserSconetId_relationType",
+ new String[] {
+ String.class.getName(), String.class.getName(),
+
+ "java.lang.Integer", "java.lang.Integer",
+ "com.liferay.portal.kernel.util.OrderByComparator"
+ });
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOUSERSCONETID_RELATIONTYPE =
+ new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED,
+ UserRelationshipImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "findBytoUserSconetId_relationType",
+ new String[] { String.class.getName(), String.class.getName() },
+ UserRelationshipModelImpl.TOUSERSCONETID_COLUMN_BITMASK |
+ UserRelationshipModelImpl.RELATIONTYPE_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_TOUSERSCONETID_RELATIONTYPE =
+ new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countBytoUserSconetId_relationType",
+ new String[] { String.class.getName(), String.class.getName() });
+ public static final FinderPath FINDER_PATH_FETCH_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE =
+ new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED,
+ UserRelationshipImpl.class, FINDER_CLASS_NAME_ENTITY,
+ "fetchByfromUserId_toUserSconetId_relationType",
+ new String[] {
+ Long.class.getName(), String.class.getName(),
+ String.class.getName()
+ },
+ UserRelationshipModelImpl.FROMUSERID_COLUMN_BITMASK |
+ UserRelationshipModelImpl.TOUSERSCONETID_COLUMN_BITMASK |
+ UserRelationshipModelImpl.RELATIONTYPE_COLUMN_BITMASK);
+ public static final FinderPath FINDER_PATH_COUNT_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE =
+ new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
+ "countByfromUserId_toUserSconetId_relationType",
+ new String[] {
+ Long.class.getName(), String.class.getName(),
+ String.class.getName()
+ });
+ public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED,
+ UserRelationshipImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
+ "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED,
+ UserRelationshipImpl.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
+ public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipModelImpl.FINDER_CACHE_ENABLED, Long.class,
+ FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
+
+ /**
+ * Caches the user relationship in the entity cache if it is enabled.
+ *
+ * @param userRelationship the user relationship
+ */
+ public void cacheResult(UserRelationship userRelationship) {
+ EntityCacheUtil.putResult(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipImpl.class, userRelationship.getPrimaryKey(),
+ userRelationship);
+
+ FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ new Object[] {
+ Long.valueOf(userRelationship.getFromUserId()),
+
+ userRelationship.getToUserSconetId(),
+
+ userRelationship.getRelationType()
+ }, userRelationship);
+
+ userRelationship.resetOriginalValues();
+ }
+
+ /**
+ * Caches the user relationships in the entity cache if it is enabled.
+ *
+ * @param userRelationships the user relationships
+ */
+ public void cacheResult(List<UserRelationship> userRelationships) {
+ for (UserRelationship userRelationship : userRelationships) {
+ if (EntityCacheUtil.getResult(
+ UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipImpl.class,
+ userRelationship.getPrimaryKey()) == null) {
+ cacheResult(userRelationship);
+ }
+ else {
+ userRelationship.resetOriginalValues();
+ }
+ }
+ }
+
+ /**
+ * Clears the cache for all user relationships.
+ *
+ * <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(UserRelationshipImpl.class.getName());
+ }
+
+ EntityCacheUtil.clearCache(UserRelationshipImpl.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 relationship.
+ *
+ * <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(UserRelationship userRelationship) {
+ EntityCacheUtil.removeResult(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipImpl.class, userRelationship.getPrimaryKey());
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+
+ clearUniqueFindersCache(userRelationship);
+ }
+
+ @Override
+ public void clearCache(List<UserRelationship> userRelationships) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+
+ for (UserRelationship userRelationship : userRelationships) {
+ EntityCacheUtil.removeResult(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipImpl.class, userRelationship.getPrimaryKey());
+
+ clearUniqueFindersCache(userRelationship);
+ }
+ }
+
+ protected void clearUniqueFindersCache(UserRelationship userRelationship) {
+ FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ new Object[] {
+ Long.valueOf(userRelationship.getFromUserId()),
+
+ userRelationship.getToUserSconetId(),
+
+ userRelationship.getRelationType()
+ });
+ }
+
+ /**
+ * Creates a new user relationship with the primary key. Does not add the user relationship to the database.
+ *
+ * @param userRelationshipId the primary key for the new user relationship
+ * @return the new user relationship
+ */
+ public UserRelationship create(long userRelationshipId) {
+ UserRelationship userRelationship = new UserRelationshipImpl();
+
+ userRelationship.setNew(true);
+ userRelationship.setPrimaryKey(userRelationshipId);
+
+ return userRelationship;
+ }
+
+ /**
+ * Removes the user relationship with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param userRelationshipId the primary key of the user relationship
+ * @return the user relationship that was removed
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a user relationship with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship remove(long userRelationshipId)
+ throws NoSuchUserRelationshipException, SystemException {
+ return remove(Long.valueOf(userRelationshipId));
+ }
+
+ /**
+ * Removes the user relationship with the primary key from the database. Also notifies the appropriate model listeners.
+ *
+ * @param primaryKey the primary key of the user relationship
+ * @return the user relationship that was removed
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a user relationship with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public UserRelationship remove(Serializable primaryKey)
+ throws NoSuchUserRelationshipException, SystemException {
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserRelationship userRelationship = (UserRelationship)session.get(UserRelationshipImpl.class,
+ primaryKey);
+
+ if (userRelationship == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
+ }
+
+ throw new NoSuchUserRelationshipException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ primaryKey);
+ }
+
+ return remove(userRelationship);
+ }
+ catch (NoSuchUserRelationshipException nsee) {
+ throw nsee;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ @Override
+ protected UserRelationship removeImpl(UserRelationship userRelationship)
+ throws SystemException {
+ userRelationship = toUnwrappedModel(userRelationship);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.delete(session, userRelationship);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ clearCache(userRelationship);
+
+ return userRelationship;
+ }
+
+ @Override
+ public UserRelationship updateImpl(
+ com.pentila.entSavoie.userProperties.model.UserRelationship userRelationship,
+ boolean merge) throws SystemException {
+ userRelationship = toUnwrappedModel(userRelationship);
+
+ boolean isNew = userRelationship.isNew();
+
+ UserRelationshipModelImpl userRelationshipModelImpl = (UserRelationshipModelImpl)userRelationship;
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ BatchSessionUtil.update(session, userRelationship, merge);
+
+ userRelationship.setNew(false);
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
+
+ if (isNew || !UserRelationshipModelImpl.COLUMN_BITMASK_ENABLED) {
+ FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ else {
+ if ((userRelationshipModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FROMUSERID_TOUSERID.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(userRelationshipModelImpl.getOriginalFromUserId()),
+ Long.valueOf(userRelationshipModelImpl.getOriginalToUserId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FROMUSERID_TOUSERID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FROMUSERID_TOUSERID,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(userRelationshipModelImpl.getFromUserId()),
+ Long.valueOf(userRelationshipModelImpl.getToUserId())
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FROMUSERID_TOUSERID,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FROMUSERID_TOUSERID,
+ args);
+ }
+
+ if ((userRelationshipModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FROMUSERID_RELATIONTYPE.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(userRelationshipModelImpl.getOriginalFromUserId()),
+
+ userRelationshipModelImpl.getOriginalRelationType()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FROMUSERID_RELATIONTYPE,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FROMUSERID_RELATIONTYPE,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(userRelationshipModelImpl.getFromUserId()),
+
+ userRelationshipModelImpl.getRelationType()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FROMUSERID_RELATIONTYPE,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FROMUSERID_RELATIONTYPE,
+ args);
+ }
+
+ if ((userRelationshipModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOUSERID_RELATIONTYPE.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(userRelationshipModelImpl.getOriginalToUserId()),
+
+ userRelationshipModelImpl.getOriginalRelationType()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TOUSERID_RELATIONTYPE,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOUSERID_RELATIONTYPE,
+ args);
+
+ args = new Object[] {
+ Long.valueOf(userRelationshipModelImpl.getToUserId()),
+
+ userRelationshipModelImpl.getRelationType()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TOUSERID_RELATIONTYPE,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOUSERID_RELATIONTYPE,
+ args);
+ }
+
+ if ((userRelationshipModelImpl.getColumnBitmask() &
+ FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOUSERSCONETID_RELATIONTYPE.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ userRelationshipModelImpl.getOriginalToUserSconetId(),
+
+ userRelationshipModelImpl.getOriginalRelationType()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TOUSERSCONETID_RELATIONTYPE,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOUSERSCONETID_RELATIONTYPE,
+ args);
+
+ args = new Object[] {
+ userRelationshipModelImpl.getToUserSconetId(),
+
+ userRelationshipModelImpl.getRelationType()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TOUSERSCONETID_RELATIONTYPE,
+ args);
+ FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TOUSERSCONETID_RELATIONTYPE,
+ args);
+ }
+ }
+
+ EntityCacheUtil.putResult(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipImpl.class, userRelationship.getPrimaryKey(),
+ userRelationship);
+
+ if (isNew) {
+ FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ new Object[] {
+ Long.valueOf(userRelationship.getFromUserId()),
+
+ userRelationship.getToUserSconetId(),
+
+ userRelationship.getRelationType()
+ }, userRelationship);
+ }
+ else {
+ if ((userRelationshipModelImpl.getColumnBitmask() &
+ FINDER_PATH_FETCH_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE.getColumnBitmask()) != 0) {
+ Object[] args = new Object[] {
+ Long.valueOf(userRelationshipModelImpl.getOriginalFromUserId()),
+
+ userRelationshipModelImpl.getOriginalToUserSconetId(),
+
+ userRelationshipModelImpl.getOriginalRelationType()
+ };
+
+ FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ args);
+
+ FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ args);
+
+ FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ new Object[] {
+ Long.valueOf(userRelationship.getFromUserId()),
+
+ userRelationship.getToUserSconetId(),
+
+ userRelationship.getRelationType()
+ }, userRelationship);
+ }
+ }
+
+ return userRelationship;
+ }
+
+ protected UserRelationship toUnwrappedModel(
+ UserRelationship userRelationship) {
+ if (userRelationship instanceof UserRelationshipImpl) {
+ return userRelationship;
+ }
+
+ UserRelationshipImpl userRelationshipImpl = new UserRelationshipImpl();
+
+ userRelationshipImpl.setNew(userRelationship.isNew());
+ userRelationshipImpl.setPrimaryKey(userRelationship.getPrimaryKey());
+
+ userRelationshipImpl.setUserRelationshipId(userRelationship.getUserRelationshipId());
+ userRelationshipImpl.setFromUserId(userRelationship.getFromUserId());
+ userRelationshipImpl.setToUserId(userRelationship.getToUserId());
+ userRelationshipImpl.setToUserSconetId(userRelationship.getToUserSconetId());
+ userRelationshipImpl.setRelationType(userRelationship.getRelationType());
+
+ return userRelationshipImpl;
+ }
+
+ /**
+ * Returns the user relationship 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 relationship
+ * @return the user relationship
+ * @throws com.liferay.portal.NoSuchModelException if a user relationship with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public UserRelationship findByPrimaryKey(Serializable primaryKey)
+ throws NoSuchModelException, SystemException {
+ return findByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the user relationship with the primary key or throws a {@link com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException} if it could not be found.
+ *
+ * @param userRelationshipId the primary key of the user relationship
+ * @return the user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a user relationship with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship findByPrimaryKey(long userRelationshipId)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = fetchByPrimaryKey(userRelationshipId);
+
+ if (userRelationship == null) {
+ if (_log.isWarnEnabled()) {
+ _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ userRelationshipId);
+ }
+
+ throw new NoSuchUserRelationshipException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
+ userRelationshipId);
+ }
+
+ return userRelationship;
+ }
+
+ /**
+ * Returns the user relationship with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param primaryKey the primary key of the user relationship
+ * @return the user relationship, or <code>null</code> if a user relationship with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ @Override
+ public UserRelationship fetchByPrimaryKey(Serializable primaryKey)
+ throws SystemException {
+ return fetchByPrimaryKey(((Long)primaryKey).longValue());
+ }
+
+ /**
+ * Returns the user relationship with the primary key or returns <code>null</code> if it could not be found.
+ *
+ * @param userRelationshipId the primary key of the user relationship
+ * @return the user relationship, or <code>null</code> if a user relationship with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship fetchByPrimaryKey(long userRelationshipId)
+ throws SystemException {
+ UserRelationship userRelationship = (UserRelationship)EntityCacheUtil.getResult(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipImpl.class, userRelationshipId);
+
+ if (userRelationship == _nullUserRelationship) {
+ return null;
+ }
+
+ if (userRelationship == null) {
+ Session session = null;
+
+ boolean hasException = false;
+
+ try {
+ session = openSession();
+
+ userRelationship = (UserRelationship)session.get(UserRelationshipImpl.class,
+ Long.valueOf(userRelationshipId));
+ }
+ catch (Exception e) {
+ hasException = true;
+
+ throw processException(e);
+ }
+ finally {
+ if (userRelationship != null) {
+ cacheResult(userRelationship);
+ }
+ else if (!hasException) {
+ EntityCacheUtil.putResult(UserRelationshipModelImpl.ENTITY_CACHE_ENABLED,
+ UserRelationshipImpl.class, userRelationshipId,
+ _nullUserRelationship);
+ }
+
+ closeSession(session);
+ }
+ }
+
+ return userRelationship;
+ }
+
+ /**
+ * Returns all the user relationships where fromUserId = ? and toUserId = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserId the to user ID
+ * @return the matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findByfromUserId_toUserId(long fromUserId,
+ long toUserId) throws SystemException {
+ return findByfromUserId_toUserId(fromUserId, toUserId,
+ QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the user relationships where fromUserId = ? and toUserId = ?.
+ *
+ * <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 fromUserId the from user ID
+ * @param toUserId the to user ID
+ * @param start the lower bound of the range of user relationships
+ * @param end the upper bound of the range of user relationships (not inclusive)
+ * @return the range of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findByfromUserId_toUserId(long fromUserId,
+ long toUserId, int start, int end) throws SystemException {
+ return findByfromUserId_toUserId(fromUserId, toUserId, start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user relationships where fromUserId = ? and toUserId = ?.
+ *
+ * <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 fromUserId the from user ID
+ * @param toUserId the to user ID
+ * @param start the lower bound of the range of user relationships
+ * @param end the upper bound of the range of user relationships (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findByfromUserId_toUserId(long fromUserId,
+ long toUserId, 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_FROMUSERID_TOUSERID;
+ finderArgs = new Object[] { fromUserId, toUserId };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_FROMUSERID_TOUSERID;
+ finderArgs = new Object[] {
+ fromUserId, toUserId,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<UserRelationship> list = (List<UserRelationship>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (UserRelationship userRelationship : list) {
+ if ((fromUserId != userRelationship.getFromUserId()) ||
+ (toUserId != userRelationship.getToUserId())) {
+ 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_USERRELATIONSHIP_WHERE);
+
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERID_FROMUSERID_2);
+
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERID_TOUSERID_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(fromUserId);
+
+ qPos.add(toUserId);
+
+ list = (List<UserRelationship>)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 relationship in the ordered set where fromUserId = ? and toUserId = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserId the to user ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship findByfromUserId_toUserId_First(long fromUserId,
+ long toUserId, OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = fetchByfromUserId_toUserId_First(fromUserId,
+ toUserId, orderByComparator);
+
+ if (userRelationship != null) {
+ return userRelationship;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("fromUserId=");
+ msg.append(fromUserId);
+
+ msg.append(", toUserId=");
+ msg.append(toUserId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserRelationshipException(msg.toString());
+ }
+
+ /**
+ * Returns the first user relationship in the ordered set where fromUserId = ? and toUserId = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserId the to user ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user relationship, or <code>null</code> if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship fetchByfromUserId_toUserId_First(long fromUserId,
+ long toUserId, OrderByComparator orderByComparator)
+ throws SystemException {
+ List<UserRelationship> list = findByfromUserId_toUserId(fromUserId,
+ toUserId, 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last user relationship in the ordered set where fromUserId = ? and toUserId = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserId the to user ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship findByfromUserId_toUserId_Last(long fromUserId,
+ long toUserId, OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = fetchByfromUserId_toUserId_Last(fromUserId,
+ toUserId, orderByComparator);
+
+ if (userRelationship != null) {
+ return userRelationship;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("fromUserId=");
+ msg.append(fromUserId);
+
+ msg.append(", toUserId=");
+ msg.append(toUserId);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserRelationshipException(msg.toString());
+ }
+
+ /**
+ * Returns the last user relationship in the ordered set where fromUserId = ? and toUserId = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserId the to user ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user relationship, or <code>null</code> if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship fetchByfromUserId_toUserId_Last(long fromUserId,
+ long toUserId, OrderByComparator orderByComparator)
+ throws SystemException {
+ int count = countByfromUserId_toUserId(fromUserId, toUserId);
+
+ List<UserRelationship> list = findByfromUserId_toUserId(fromUserId,
+ toUserId, count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user relationships before and after the current user relationship in the ordered set where fromUserId = ? and toUserId = ?.
+ *
+ * @param userRelationshipId the primary key of the current user relationship
+ * @param fromUserId the from user ID
+ * @param toUserId the to user ID
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a user relationship with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship[] findByfromUserId_toUserId_PrevAndNext(
+ long userRelationshipId, long fromUserId, long toUserId,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = findByPrimaryKey(userRelationshipId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserRelationship[] array = new UserRelationshipImpl[3];
+
+ array[0] = getByfromUserId_toUserId_PrevAndNext(session,
+ userRelationship, fromUserId, toUserId, orderByComparator,
+ true);
+
+ array[1] = userRelationship;
+
+ array[2] = getByfromUserId_toUserId_PrevAndNext(session,
+ userRelationship, fromUserId, toUserId, orderByComparator,
+ false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected UserRelationship getByfromUserId_toUserId_PrevAndNext(
+ Session session, UserRelationship userRelationship, long fromUserId,
+ long toUserId, 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_USERRELATIONSHIP_WHERE);
+
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERID_FROMUSERID_2);
+
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERID_TOUSERID_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(fromUserId);
+
+ qPos.add(toUserId);
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(userRelationship);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<UserRelationship> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the user relationships where fromUserId = ? and relationType = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param relationType the relation type
+ * @return the matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findByfromUserId_relationType(
+ long fromUserId, String relationType) throws SystemException {
+ return findByfromUserId_relationType(fromUserId, relationType,
+ QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the user relationships where fromUserId = ? and relationType = ?.
+ *
+ * <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 fromUserId the from user ID
+ * @param relationType the relation type
+ * @param start the lower bound of the range of user relationships
+ * @param end the upper bound of the range of user relationships (not inclusive)
+ * @return the range of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findByfromUserId_relationType(
+ long fromUserId, String relationType, int start, int end)
+ throws SystemException {
+ return findByfromUserId_relationType(fromUserId, relationType, start,
+ end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user relationships where fromUserId = ? and relationType = ?.
+ *
+ * <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 fromUserId the from user ID
+ * @param relationType the relation type
+ * @param start the lower bound of the range of user relationships
+ * @param end the upper bound of the range of user relationships (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findByfromUserId_relationType(
+ long fromUserId, String relationType, 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_FROMUSERID_RELATIONTYPE;
+ finderArgs = new Object[] { fromUserId, relationType };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_FROMUSERID_RELATIONTYPE;
+ finderArgs = new Object[] {
+ fromUserId, relationType,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<UserRelationship> list = (List<UserRelationship>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (UserRelationship userRelationship : list) {
+ if ((fromUserId != userRelationship.getFromUserId()) ||
+ !Validator.equals(relationType,
+ userRelationship.getRelationType())) {
+ 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_USERRELATIONSHIP_WHERE);
+
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_FROMUSERID_2);
+
+ if (relationType == null) {
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_1);
+ }
+ else {
+ if (relationType.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_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(fromUserId);
+
+ if (relationType != null) {
+ qPos.add(relationType);
+ }
+
+ list = (List<UserRelationship>)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 relationship in the ordered set where fromUserId = ? and relationType = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship findByfromUserId_relationType_First(
+ long fromUserId, String relationType,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = fetchByfromUserId_relationType_First(fromUserId,
+ relationType, orderByComparator);
+
+ if (userRelationship != null) {
+ return userRelationship;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("fromUserId=");
+ msg.append(fromUserId);
+
+ msg.append(", relationType=");
+ msg.append(relationType);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserRelationshipException(msg.toString());
+ }
+
+ /**
+ * Returns the first user relationship in the ordered set where fromUserId = ? and relationType = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user relationship, or <code>null</code> if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship fetchByfromUserId_relationType_First(
+ long fromUserId, String relationType,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<UserRelationship> list = findByfromUserId_relationType(fromUserId,
+ relationType, 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last user relationship in the ordered set where fromUserId = ? and relationType = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship findByfromUserId_relationType_Last(
+ long fromUserId, String relationType,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = fetchByfromUserId_relationType_Last(fromUserId,
+ relationType, orderByComparator);
+
+ if (userRelationship != null) {
+ return userRelationship;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("fromUserId=");
+ msg.append(fromUserId);
+
+ msg.append(", relationType=");
+ msg.append(relationType);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserRelationshipException(msg.toString());
+ }
+
+ /**
+ * Returns the last user relationship in the ordered set where fromUserId = ? and relationType = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user relationship, or <code>null</code> if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship fetchByfromUserId_relationType_Last(
+ long fromUserId, String relationType,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countByfromUserId_relationType(fromUserId, relationType);
+
+ List<UserRelationship> list = findByfromUserId_relationType(fromUserId,
+ relationType, count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user relationships before and after the current user relationship in the ordered set where fromUserId = ? and relationType = ?.
+ *
+ * @param userRelationshipId the primary key of the current user relationship
+ * @param fromUserId the from user ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a user relationship with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship[] findByfromUserId_relationType_PrevAndNext(
+ long userRelationshipId, long fromUserId, String relationType,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = findByPrimaryKey(userRelationshipId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserRelationship[] array = new UserRelationshipImpl[3];
+
+ array[0] = getByfromUserId_relationType_PrevAndNext(session,
+ userRelationship, fromUserId, relationType,
+ orderByComparator, true);
+
+ array[1] = userRelationship;
+
+ array[2] = getByfromUserId_relationType_PrevAndNext(session,
+ userRelationship, fromUserId, relationType,
+ orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected UserRelationship getByfromUserId_relationType_PrevAndNext(
+ Session session, UserRelationship userRelationship, long fromUserId,
+ String relationType, 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_USERRELATIONSHIP_WHERE);
+
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_FROMUSERID_2);
+
+ if (relationType == null) {
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_1);
+ }
+ else {
+ if (relationType.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_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(fromUserId);
+
+ if (relationType != null) {
+ qPos.add(relationType);
+ }
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(userRelationship);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<UserRelationship> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the user relationships where toUserId = ? and relationType = ?.
+ *
+ * @param toUserId the to user ID
+ * @param relationType the relation type
+ * @return the matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findBytoUserId_relationType(long toUserId,
+ String relationType) throws SystemException {
+ return findBytoUserId_relationType(toUserId, relationType,
+ QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the user relationships where toUserId = ? and relationType = ?.
+ *
+ * <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 toUserId the to user ID
+ * @param relationType the relation type
+ * @param start the lower bound of the range of user relationships
+ * @param end the upper bound of the range of user relationships (not inclusive)
+ * @return the range of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findBytoUserId_relationType(long toUserId,
+ String relationType, int start, int end) throws SystemException {
+ return findBytoUserId_relationType(toUserId, relationType, start, end,
+ null);
+ }
+
+ /**
+ * Returns an ordered range of all the user relationships where toUserId = ? and relationType = ?.
+ *
+ * <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 toUserId the to user ID
+ * @param relationType the relation type
+ * @param start the lower bound of the range of user relationships
+ * @param end the upper bound of the range of user relationships (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findBytoUserId_relationType(long toUserId,
+ String relationType, 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_TOUSERID_RELATIONTYPE;
+ finderArgs = new Object[] { toUserId, relationType };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TOUSERID_RELATIONTYPE;
+ finderArgs = new Object[] {
+ toUserId, relationType,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<UserRelationship> list = (List<UserRelationship>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (UserRelationship userRelationship : list) {
+ if ((toUserId != userRelationship.getToUserId()) ||
+ !Validator.equals(relationType,
+ userRelationship.getRelationType())) {
+ 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_USERRELATIONSHIP_WHERE);
+
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_TOUSERID_2);
+
+ if (relationType == null) {
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_1);
+ }
+ else {
+ if (relationType.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_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(toUserId);
+
+ if (relationType != null) {
+ qPos.add(relationType);
+ }
+
+ list = (List<UserRelationship>)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 relationship in the ordered set where toUserId = ? and relationType = ?.
+ *
+ * @param toUserId the to user ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship findBytoUserId_relationType_First(long toUserId,
+ String relationType, OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = fetchBytoUserId_relationType_First(toUserId,
+ relationType, orderByComparator);
+
+ if (userRelationship != null) {
+ return userRelationship;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("toUserId=");
+ msg.append(toUserId);
+
+ msg.append(", relationType=");
+ msg.append(relationType);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserRelationshipException(msg.toString());
+ }
+
+ /**
+ * Returns the first user relationship in the ordered set where toUserId = ? and relationType = ?.
+ *
+ * @param toUserId the to user ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user relationship, or <code>null</code> if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship fetchBytoUserId_relationType_First(long toUserId,
+ String relationType, OrderByComparator orderByComparator)
+ throws SystemException {
+ List<UserRelationship> list = findBytoUserId_relationType(toUserId,
+ relationType, 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last user relationship in the ordered set where toUserId = ? and relationType = ?.
+ *
+ * @param toUserId the to user ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship findBytoUserId_relationType_Last(long toUserId,
+ String relationType, OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = fetchBytoUserId_relationType_Last(toUserId,
+ relationType, orderByComparator);
+
+ if (userRelationship != null) {
+ return userRelationship;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("toUserId=");
+ msg.append(toUserId);
+
+ msg.append(", relationType=");
+ msg.append(relationType);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserRelationshipException(msg.toString());
+ }
+
+ /**
+ * Returns the last user relationship in the ordered set where toUserId = ? and relationType = ?.
+ *
+ * @param toUserId the to user ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user relationship, or <code>null</code> if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship fetchBytoUserId_relationType_Last(long toUserId,
+ String relationType, OrderByComparator orderByComparator)
+ throws SystemException {
+ int count = countBytoUserId_relationType(toUserId, relationType);
+
+ List<UserRelationship> list = findBytoUserId_relationType(toUserId,
+ relationType, count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user relationships before and after the current user relationship in the ordered set where toUserId = ? and relationType = ?.
+ *
+ * @param userRelationshipId the primary key of the current user relationship
+ * @param toUserId the to user ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a user relationship with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship[] findBytoUserId_relationType_PrevAndNext(
+ long userRelationshipId, long toUserId, String relationType,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = findByPrimaryKey(userRelationshipId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserRelationship[] array = new UserRelationshipImpl[3];
+
+ array[0] = getBytoUserId_relationType_PrevAndNext(session,
+ userRelationship, toUserId, relationType,
+ orderByComparator, true);
+
+ array[1] = userRelationship;
+
+ array[2] = getBytoUserId_relationType_PrevAndNext(session,
+ userRelationship, toUserId, relationType,
+ orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected UserRelationship getBytoUserId_relationType_PrevAndNext(
+ Session session, UserRelationship userRelationship, long toUserId,
+ String relationType, 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_USERRELATIONSHIP_WHERE);
+
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_TOUSERID_2);
+
+ if (relationType == null) {
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_1);
+ }
+ else {
+ if (relationType.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_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(toUserId);
+
+ if (relationType != null) {
+ qPos.add(relationType);
+ }
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(userRelationship);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<UserRelationship> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the user relationships where toUserSconetId = ? and relationType = ?.
+ *
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @return the matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findBytoUserSconetId_relationType(
+ String toUserSconetId, String relationType) throws SystemException {
+ return findBytoUserSconetId_relationType(toUserSconetId, relationType,
+ QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the user relationships where toUserSconetId = ? and relationType = ?.
+ *
+ * <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 toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @param start the lower bound of the range of user relationships
+ * @param end the upper bound of the range of user relationships (not inclusive)
+ * @return the range of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findBytoUserSconetId_relationType(
+ String toUserSconetId, String relationType, int start, int end)
+ throws SystemException {
+ return findBytoUserSconetId_relationType(toUserSconetId, relationType,
+ start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user relationships where toUserSconetId = ? and relationType = ?.
+ *
+ * <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 toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @param start the lower bound of the range of user relationships
+ * @param end the upper bound of the range of user relationships (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findBytoUserSconetId_relationType(
+ String toUserSconetId, String relationType, 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_TOUSERSCONETID_RELATIONTYPE;
+ finderArgs = new Object[] { toUserSconetId, relationType };
+ }
+ else {
+ finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TOUSERSCONETID_RELATIONTYPE;
+ finderArgs = new Object[] {
+ toUserSconetId, relationType,
+
+ start, end, orderByComparator
+ };
+ }
+
+ List<UserRelationship> list = (List<UserRelationship>)FinderCacheUtil.getResult(finderPath,
+ finderArgs, this);
+
+ if ((list != null) && !list.isEmpty()) {
+ for (UserRelationship userRelationship : list) {
+ if (!Validator.equals(toUserSconetId,
+ userRelationship.getToUserSconetId()) ||
+ !Validator.equals(relationType,
+ userRelationship.getRelationType())) {
+ 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_USERRELATIONSHIP_WHERE);
+
+ if (toUserSconetId == null) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_1);
+ }
+ else {
+ if (toUserSconetId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_2);
+ }
+ }
+
+ if (relationType == null) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_1);
+ }
+ else {
+ if (relationType.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_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 (toUserSconetId != null) {
+ qPos.add(toUserSconetId);
+ }
+
+ if (relationType != null) {
+ qPos.add(relationType);
+ }
+
+ list = (List<UserRelationship>)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 relationship in the ordered set where toUserSconetId = ? and relationType = ?.
+ *
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship findBytoUserSconetId_relationType_First(
+ String toUserSconetId, String relationType,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = fetchBytoUserSconetId_relationType_First(toUserSconetId,
+ relationType, orderByComparator);
+
+ if (userRelationship != null) {
+ return userRelationship;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("toUserSconetId=");
+ msg.append(toUserSconetId);
+
+ msg.append(", relationType=");
+ msg.append(relationType);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserRelationshipException(msg.toString());
+ }
+
+ /**
+ * Returns the first user relationship in the ordered set where toUserSconetId = ? and relationType = ?.
+ *
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the first matching user relationship, or <code>null</code> if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship fetchBytoUserSconetId_relationType_First(
+ String toUserSconetId, String relationType,
+ OrderByComparator orderByComparator) throws SystemException {
+ List<UserRelationship> list = findBytoUserSconetId_relationType(toUserSconetId,
+ relationType, 0, 1, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the last user relationship in the ordered set where toUserSconetId = ? and relationType = ?.
+ *
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship findBytoUserSconetId_relationType_Last(
+ String toUserSconetId, String relationType,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = fetchBytoUserSconetId_relationType_Last(toUserSconetId,
+ relationType, orderByComparator);
+
+ if (userRelationship != null) {
+ return userRelationship;
+ }
+
+ StringBundler msg = new StringBundler(6);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("toUserSconetId=");
+ msg.append(toUserSconetId);
+
+ msg.append(", relationType=");
+ msg.append(relationType);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ throw new NoSuchUserRelationshipException(msg.toString());
+ }
+
+ /**
+ * Returns the last user relationship in the ordered set where toUserSconetId = ? and relationType = ?.
+ *
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the last matching user relationship, or <code>null</code> if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship fetchBytoUserSconetId_relationType_Last(
+ String toUserSconetId, String relationType,
+ OrderByComparator orderByComparator) throws SystemException {
+ int count = countBytoUserSconetId_relationType(toUserSconetId,
+ relationType);
+
+ List<UserRelationship> list = findBytoUserSconetId_relationType(toUserSconetId,
+ relationType, count - 1, count, orderByComparator);
+
+ if (!list.isEmpty()) {
+ return list.get(0);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the user relationships before and after the current user relationship in the ordered set where toUserSconetId = ? and relationType = ?.
+ *
+ * @param userRelationshipId the primary key of the current user relationship
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
+ * @return the previous, current, and next user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a user relationship with the primary key could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship[] findBytoUserSconetId_relationType_PrevAndNext(
+ long userRelationshipId, String toUserSconetId, String relationType,
+ OrderByComparator orderByComparator)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = findByPrimaryKey(userRelationshipId);
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ UserRelationship[] array = new UserRelationshipImpl[3];
+
+ array[0] = getBytoUserSconetId_relationType_PrevAndNext(session,
+ userRelationship, toUserSconetId, relationType,
+ orderByComparator, true);
+
+ array[1] = userRelationship;
+
+ array[2] = getBytoUserSconetId_relationType_PrevAndNext(session,
+ userRelationship, toUserSconetId, relationType,
+ orderByComparator, false);
+
+ return array;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ closeSession(session);
+ }
+ }
+
+ protected UserRelationship getBytoUserSconetId_relationType_PrevAndNext(
+ Session session, UserRelationship userRelationship,
+ String toUserSconetId, String relationType,
+ 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_USERRELATIONSHIP_WHERE);
+
+ if (toUserSconetId == null) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_1);
+ }
+ else {
+ if (toUserSconetId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_2);
+ }
+ }
+
+ if (relationType == null) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_1);
+ }
+ else {
+ if (relationType.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_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 (toUserSconetId != null) {
+ qPos.add(toUserSconetId);
+ }
+
+ if (relationType != null) {
+ qPos.add(relationType);
+ }
+
+ if (orderByComparator != null) {
+ Object[] values = orderByComparator.getOrderByConditionValues(userRelationship);
+
+ for (Object value : values) {
+ qPos.add(value);
+ }
+ }
+
+ List<UserRelationship> list = q.list();
+
+ if (list.size() == 2) {
+ return list.get(1);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the user relationship where fromUserId = ? and toUserSconetId = ? and relationType = ? or throws a {@link com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException} if it could not be found.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @return the matching user relationship
+ * @throws com.pentila.entSavoie.userProperties.NoSuchUserRelationshipException if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship findByfromUserId_toUserSconetId_relationType(
+ long fromUserId, String toUserSconetId, String relationType)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = fetchByfromUserId_toUserSconetId_relationType(fromUserId,
+ toUserSconetId, relationType);
+
+ if (userRelationship == null) {
+ StringBundler msg = new StringBundler(8);
+
+ msg.append(_NO_SUCH_ENTITY_WITH_KEY);
+
+ msg.append("fromUserId=");
+ msg.append(fromUserId);
+
+ msg.append(", toUserSconetId=");
+ msg.append(toUserSconetId);
+
+ msg.append(", relationType=");
+ msg.append(relationType);
+
+ msg.append(StringPool.CLOSE_CURLY_BRACE);
+
+ if (_log.isWarnEnabled()) {
+ _log.warn(msg.toString());
+ }
+
+ throw new NoSuchUserRelationshipException(msg.toString());
+ }
+
+ return userRelationship;
+ }
+
+ /**
+ * Returns the user relationship where fromUserId = ? and toUserSconetId = ? and relationType = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @return the matching user relationship, or <code>null</code> if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship fetchByfromUserId_toUserSconetId_relationType(
+ long fromUserId, String toUserSconetId, String relationType)
+ throws SystemException {
+ return fetchByfromUserId_toUserSconetId_relationType(fromUserId,
+ toUserSconetId, relationType, true);
+ }
+
+ /**
+ * Returns the user relationship where fromUserId = ? and toUserSconetId = ? and relationType = ? or returns <code>null</code> if it could not be found, optionally using the finder cache.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @param retrieveFromCache whether to use the finder cache
+ * @return the matching user relationship, or <code>null</code> if a matching user relationship could not be found
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship fetchByfromUserId_toUserSconetId_relationType(
+ long fromUserId, String toUserSconetId, String relationType,
+ boolean retrieveFromCache) throws SystemException {
+ Object[] finderArgs = new Object[] {
+ fromUserId, toUserSconetId, relationType
+ };
+
+ Object result = null;
+
+ if (retrieveFromCache) {
+ result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ finderArgs, this);
+ }
+
+ if (result instanceof UserRelationship) {
+ UserRelationship userRelationship = (UserRelationship)result;
+
+ if ((fromUserId != userRelationship.getFromUserId()) ||
+ !Validator.equals(toUserSconetId,
+ userRelationship.getToUserSconetId()) ||
+ !Validator.equals(relationType,
+ userRelationship.getRelationType())) {
+ result = null;
+ }
+ }
+
+ if (result == null) {
+ StringBundler query = new StringBundler(4);
+
+ query.append(_SQL_SELECT_USERRELATIONSHIP_WHERE);
+
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_FROMUSERID_2);
+
+ if (toUserSconetId == null) {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_1);
+ }
+ else {
+ if (toUserSconetId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_2);
+ }
+ }
+
+ if (relationType == null) {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_1);
+ }
+ else {
+ if (relationType.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_2);
+ }
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(fromUserId);
+
+ if (toUserSconetId != null) {
+ qPos.add(toUserSconetId);
+ }
+
+ if (relationType != null) {
+ qPos.add(relationType);
+ }
+
+ List<UserRelationship> list = q.list();
+
+ result = list;
+
+ UserRelationship userRelationship = null;
+
+ if (list.isEmpty()) {
+ FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ finderArgs, list);
+ }
+ else {
+ userRelationship = list.get(0);
+
+ cacheResult(userRelationship);
+
+ if ((userRelationship.getFromUserId() != fromUserId) ||
+ (userRelationship.getToUserSconetId() == null) ||
+ !userRelationship.getToUserSconetId()
+ .equals(toUserSconetId) ||
+ (userRelationship.getRelationType() == null) ||
+ !userRelationship.getRelationType()
+ .equals(relationType)) {
+ FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ finderArgs, userRelationship);
+ }
+ }
+
+ return userRelationship;
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (result == null) {
+ FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ finderArgs);
+ }
+
+ closeSession(session);
+ }
+ }
+ else {
+ if (result instanceof List<?>) {
+ return null;
+ }
+ else {
+ return (UserRelationship)result;
+ }
+ }
+ }
+
+ /**
+ * Returns all the user relationships.
+ *
+ * @return the user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findAll() throws SystemException {
+ return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
+ }
+
+ /**
+ * Returns a range of all the user relationships.
+ *
+ * <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 relationships
+ * @param end the upper bound of the range of user relationships (not inclusive)
+ * @return the range of user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> findAll(int start, int end)
+ throws SystemException {
+ return findAll(start, end, null);
+ }
+
+ /**
+ * Returns an ordered range of all the user relationships.
+ *
+ * <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 relationships
+ * @param end the upper bound of the range of user relationships (not inclusive)
+ * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
+ * @return the ordered range of user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public List<UserRelationship> 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<UserRelationship> list = (List<UserRelationship>)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_USERRELATIONSHIP);
+
+ appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
+ orderByComparator);
+
+ sql = query.toString();
+ }
+ else {
+ sql = _SQL_SELECT_USERRELATIONSHIP;
+ }
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ if (orderByComparator == null) {
+ list = (List<UserRelationship>)QueryUtil.list(q,
+ getDialect(), start, end, false);
+
+ Collections.sort(list);
+ }
+ else {
+ list = (List<UserRelationship>)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 relationships where fromUserId = ? and toUserId = ? from the database.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserId the to user ID
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByfromUserId_toUserId(long fromUserId, long toUserId)
+ throws SystemException {
+ for (UserRelationship userRelationship : findByfromUserId_toUserId(
+ fromUserId, toUserId)) {
+ remove(userRelationship);
+ }
+ }
+
+ /**
+ * Removes all the user relationships where fromUserId = ? and relationType = ? from the database.
+ *
+ * @param fromUserId the from user ID
+ * @param relationType the relation type
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeByfromUserId_relationType(long fromUserId,
+ String relationType) throws SystemException {
+ for (UserRelationship userRelationship : findByfromUserId_relationType(
+ fromUserId, relationType)) {
+ remove(userRelationship);
+ }
+ }
+
+ /**
+ * Removes all the user relationships where toUserId = ? and relationType = ? from the database.
+ *
+ * @param toUserId the to user ID
+ * @param relationType the relation type
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeBytoUserId_relationType(long toUserId, String relationType)
+ throws SystemException {
+ for (UserRelationship userRelationship : findBytoUserId_relationType(
+ toUserId, relationType)) {
+ remove(userRelationship);
+ }
+ }
+
+ /**
+ * Removes all the user relationships where toUserSconetId = ? and relationType = ? from the database.
+ *
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeBytoUserSconetId_relationType(String toUserSconetId,
+ String relationType) throws SystemException {
+ for (UserRelationship userRelationship : findBytoUserSconetId_relationType(
+ toUserSconetId, relationType)) {
+ remove(userRelationship);
+ }
+ }
+
+ /**
+ * Removes the user relationship where fromUserId = ? and toUserSconetId = ? and relationType = ? from the database.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @return the user relationship that was removed
+ * @throws SystemException if a system exception occurred
+ */
+ public UserRelationship removeByfromUserId_toUserSconetId_relationType(
+ long fromUserId, String toUserSconetId, String relationType)
+ throws NoSuchUserRelationshipException, SystemException {
+ UserRelationship userRelationship = findByfromUserId_toUserSconetId_relationType(fromUserId,
+ toUserSconetId, relationType);
+
+ return remove(userRelationship);
+ }
+
+ /**
+ * Removes all the user relationships from the database.
+ *
+ * @throws SystemException if a system exception occurred
+ */
+ public void removeAll() throws SystemException {
+ for (UserRelationship userRelationship : findAll()) {
+ remove(userRelationship);
+ }
+ }
+
+ /**
+ * Returns the number of user relationships where fromUserId = ? and toUserId = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserId the to user ID
+ * @return the number of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByfromUserId_toUserId(long fromUserId, long toUserId)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { fromUserId, toUserId };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FROMUSERID_TOUSERID,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_USERRELATIONSHIP_WHERE);
+
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERID_FROMUSERID_2);
+
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERID_TOUSERID_2);
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(fromUserId);
+
+ qPos.add(toUserId);
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FROMUSERID_TOUSERID,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user relationships where fromUserId = ? and relationType = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param relationType the relation type
+ * @return the number of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByfromUserId_relationType(long fromUserId,
+ String relationType) throws SystemException {
+ Object[] finderArgs = new Object[] { fromUserId, relationType };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FROMUSERID_RELATIONTYPE,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_USERRELATIONSHIP_WHERE);
+
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_FROMUSERID_2);
+
+ if (relationType == null) {
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_1);
+ }
+ else {
+ if (relationType.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_2);
+ }
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(fromUserId);
+
+ if (relationType != null) {
+ qPos.add(relationType);
+ }
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FROMUSERID_RELATIONTYPE,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user relationships where toUserId = ? and relationType = ?.
+ *
+ * @param toUserId the to user ID
+ * @param relationType the relation type
+ * @return the number of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public int countBytoUserId_relationType(long toUserId, String relationType)
+ throws SystemException {
+ Object[] finderArgs = new Object[] { toUserId, relationType };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TOUSERID_RELATIONTYPE,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_USERRELATIONSHIP_WHERE);
+
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_TOUSERID_2);
+
+ if (relationType == null) {
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_1);
+ }
+ else {
+ if (relationType.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_2);
+ }
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(toUserId);
+
+ if (relationType != null) {
+ qPos.add(relationType);
+ }
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TOUSERID_RELATIONTYPE,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user relationships where toUserSconetId = ? and relationType = ?.
+ *
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @return the number of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public int countBytoUserSconetId_relationType(String toUserSconetId,
+ String relationType) throws SystemException {
+ Object[] finderArgs = new Object[] { toUserSconetId, relationType };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TOUSERSCONETID_RELATIONTYPE,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(3);
+
+ query.append(_SQL_COUNT_USERRELATIONSHIP_WHERE);
+
+ if (toUserSconetId == null) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_1);
+ }
+ else {
+ if (toUserSconetId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_2);
+ }
+ }
+
+ if (relationType == null) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_1);
+ }
+ else {
+ if (relationType.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_2);
+ }
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ if (toUserSconetId != null) {
+ qPos.add(toUserSconetId);
+ }
+
+ if (relationType != null) {
+ qPos.add(relationType);
+ }
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TOUSERSCONETID_RELATIONTYPE,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user relationships where fromUserId = ? and toUserSconetId = ? and relationType = ?.
+ *
+ * @param fromUserId the from user ID
+ * @param toUserSconetId the to user sconet ID
+ * @param relationType the relation type
+ * @return the number of matching user relationships
+ * @throws SystemException if a system exception occurred
+ */
+ public int countByfromUserId_toUserSconetId_relationType(long fromUserId,
+ String toUserSconetId, String relationType) throws SystemException {
+ Object[] finderArgs = new Object[] {
+ fromUserId, toUserSconetId, relationType
+ };
+
+ Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ finderArgs, this);
+
+ if (count == null) {
+ StringBundler query = new StringBundler(4);
+
+ query.append(_SQL_COUNT_USERRELATIONSHIP_WHERE);
+
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_FROMUSERID_2);
+
+ if (toUserSconetId == null) {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_1);
+ }
+ else {
+ if (toUserSconetId.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_2);
+ }
+ }
+
+ if (relationType == null) {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_1);
+ }
+ else {
+ if (relationType.equals(StringPool.BLANK)) {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_3);
+ }
+ else {
+ query.append(_FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_2);
+ }
+ }
+
+ String sql = query.toString();
+
+ Session session = null;
+
+ try {
+ session = openSession();
+
+ Query q = session.createQuery(sql);
+
+ QueryPos qPos = QueryPos.getInstance(q);
+
+ qPos.add(fromUserId);
+
+ if (toUserSconetId != null) {
+ qPos.add(toUserSconetId);
+ }
+
+ if (relationType != null) {
+ qPos.add(relationType);
+ }
+
+ count = (Long)q.uniqueResult();
+ }
+ catch (Exception e) {
+ throw processException(e);
+ }
+ finally {
+ if (count == null) {
+ count = Long.valueOf(0);
+ }
+
+ FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FROMUSERID_TOUSERSCONETID_RELATIONTYPE,
+ finderArgs, count);
+
+ closeSession(session);
+ }
+ }
+
+ return count.intValue();
+ }
+
+ /**
+ * Returns the number of user relationships.
+ *
+ * @return the number of user relationships
+ * @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_USERRELATIONSHIP);
+
+ 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 relationship persistence.
+ */
+ public void afterPropertiesSet() {
+ String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
+ com.liferay.util.service.ServiceProps.get(
+ "value.object.listener.com.pentila.entSavoie.userProperties.model.UserRelationship")));
+
+ if (listenerClassNames.length > 0) {
+ try {
+ List<ModelListener<UserRelationship>> listenersList = new ArrayList<ModelListener<UserRelationship>>();
+
+ for (String listenerClassName : listenerClassNames) {
+ listenersList.add((ModelListener<UserRelationship>)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(UserRelationshipImpl.class.getName());
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
+ FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
+ }
+
+ @BeanReference(type = DashboardConfigPersistence.class)
+ protected DashboardConfigPersistence dashboardConfigPersistence;
+ @BeanReference(type = DashboardDefaultConfigPersistence.class)
+ protected DashboardDefaultConfigPersistence dashboardDefaultConfigPersistence;
+ @BeanReference(type = InternalOauthPersistence.class)
+ protected InternalOauthPersistence internalOauthPersistence;
+ @BeanReference(type = NotifyConfigPersistence.class)
+ protected NotifyConfigPersistence notifyConfigPersistence;
+ @BeanReference(type = UserContactPersistence.class)
+ protected UserContactPersistence userContactPersistence;
+ @BeanReference(type = UserInternalSSOPersistence.class)
+ protected UserInternalSSOPersistence userInternalSSOPersistence;
+ @BeanReference(type = UserMailSynchronisationPersistence.class)
+ protected UserMailSynchronisationPersistence userMailSynchronisationPersistence;
+ @BeanReference(type = UserMatchingPersistence.class)
+ protected UserMatchingPersistence userMatchingPersistence;
+ @BeanReference(type = UserMobileNotificationPersistence.class)
+ protected UserMobileNotificationPersistence userMobileNotificationPersistence;
+ @BeanReference(type = UserPropertiesPersistence.class)
+ protected UserPropertiesPersistence userPropertiesPersistence;
+ @BeanReference(type = UserRelationshipPersistence.class)
+ protected UserRelationshipPersistence userRelationshipPersistence;
+ @BeanReference(type = ResourcePersistence.class)
+ protected ResourcePersistence resourcePersistence;
+ @BeanReference(type = UserPersistence.class)
+ protected UserPersistence userPersistence;
+ private static final String _SQL_SELECT_USERRELATIONSHIP = "SELECT userRelationship FROM UserRelationship userRelationship";
+ private static final String _SQL_SELECT_USERRELATIONSHIP_WHERE = "SELECT userRelationship FROM UserRelationship userRelationship WHERE ";
+ private static final String _SQL_COUNT_USERRELATIONSHIP = "SELECT COUNT(userRelationship) FROM UserRelationship userRelationship";
+ private static final String _SQL_COUNT_USERRELATIONSHIP_WHERE = "SELECT COUNT(userRelationship) FROM UserRelationship userRelationship WHERE ";
+ private static final String _FINDER_COLUMN_FROMUSERID_TOUSERID_FROMUSERID_2 = "userRelationship.fromUserId = ? AND ";
+ private static final String _FINDER_COLUMN_FROMUSERID_TOUSERID_TOUSERID_2 = "userRelationship.toUserId = ?";
+ private static final String _FINDER_COLUMN_FROMUSERID_RELATIONTYPE_FROMUSERID_2 =
+ "userRelationship.fromUserId = ? AND ";
+ private static final String _FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_1 =
+ "userRelationship.relationType IS NULL";
+ private static final String _FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_2 =
+ "userRelationship.relationType = ?";
+ private static final String _FINDER_COLUMN_FROMUSERID_RELATIONTYPE_RELATIONTYPE_3 =
+ "(userRelationship.relationType IS NULL OR userRelationship.relationType = ?)";
+ private static final String _FINDER_COLUMN_TOUSERID_RELATIONTYPE_TOUSERID_2 = "userRelationship.toUserId = ? AND ";
+ private static final String _FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_1 =
+ "userRelationship.relationType IS NULL";
+ private static final String _FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_2 =
+ "userRelationship.relationType = ?";
+ private static final String _FINDER_COLUMN_TOUSERID_RELATIONTYPE_RELATIONTYPE_3 =
+ "(userRelationship.relationType IS NULL OR userRelationship.relationType = ?)";
+ private static final String _FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_1 =
+ "userRelationship.toUserSconetId IS NULL AND ";
+ private static final String _FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_2 =
+ "userRelationship.toUserSconetId = ? AND ";
+ private static final String _FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_3 =
+ "(userRelationship.toUserSconetId IS NULL OR userRelationship.toUserSconetId = ?) AND ";
+ private static final String _FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_1 =
+ "userRelationship.relationType IS NULL";
+ private static final String _FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_2 =
+ "userRelationship.relationType = ?";
+ private static final String _FINDER_COLUMN_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_3 =
+ "(userRelationship.relationType IS NULL OR userRelationship.relationType = ?)";
+ private static final String _FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_FROMUSERID_2 =
+ "userRelationship.fromUserId = ? AND ";
+ private static final String _FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_1 =
+ "userRelationship.toUserSconetId IS NULL AND ";
+ private static final String _FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_2 =
+ "userRelationship.toUserSconetId = ? AND ";
+ private static final String _FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_TOUSERSCONETID_3 =
+ "(userRelationship.toUserSconetId IS NULL OR userRelationship.toUserSconetId = ?) AND ";
+ private static final String _FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_1 =
+ "userRelationship.relationType IS NULL";
+ private static final String _FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_2 =
+ "userRelationship.relationType = ?";
+ private static final String _FINDER_COLUMN_FROMUSERID_TOUSERSCONETID_RELATIONTYPE_RELATIONTYPE_3 =
+ "(userRelationship.relationType IS NULL OR userRelationship.relationType = ?)";
+ private static final String _ORDER_BY_ENTITY_ALIAS = "userRelationship.";
+ private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No UserRelationship exists with the primary key ";
+ private static final String _NO_SUCH_ENTITY_WITH_KEY = "No UserRelationship 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(UserRelationshipPersistenceImpl.class);
+ private static UserRelationship _nullUserRelationship = new UserRelationshipImpl() {
+ @Override
+ public Object clone() {
+ return this;
+ }
+
+ @Override
+ public CacheModel<UserRelationship> toCacheModel() {
+ return _nullUserRelationshipCacheModel;
+ }
+ };
+
+ private static CacheModel<UserRelationship> _nullUserRelationshipCacheModel = new CacheModel<UserRelationship>() {
+ public UserRelationship toEntityModel() {
+ return _nullUserRelationship;
+ }
+ };
+}
\ No newline at end of file