protected void cacheUniqueFindersCache(TipsOfTheDayUsers tipsOfTheDayUsers) {
    if (tipsOfTheDayUsers.isNew()) {
      Object[] args =
          new Object[] {
            tipsOfTheDayUsers.getCompanyId(),
            tipsOfTheDayUsers.getGroupId(),
            tipsOfTheDayUsers.getUserId()
          };

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_G_U, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_G_U, args, tipsOfTheDayUsers);
    } else {
      TipsOfTheDayUsersModelImpl tipsOfTheDayUsersModelImpl =
          (TipsOfTheDayUsersModelImpl) tipsOfTheDayUsers;

      if ((tipsOfTheDayUsersModelImpl.getColumnBitmask()
              & FINDER_PATH_FETCH_BY_C_G_U.getColumnBitmask())
          != 0) {
        Object[] args =
            new Object[] {
              tipsOfTheDayUsers.getCompanyId(),
              tipsOfTheDayUsers.getGroupId(),
              tipsOfTheDayUsers.getUserId()
            };

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_G_U, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_G_U, args, tipsOfTheDayUsers);
      }
    }
  }
  @Override
  public Quota updateImpl(org.lsug.quota.model.Quota quota, boolean merge) throws SystemException {
    quota = toUnwrappedModel(quota);

    boolean isNew = quota.isNew();

    QuotaModelImpl quotaModelImpl = (QuotaModelImpl) quota;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, quota, merge);

      quota.setNew(false);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !QuotaModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }

    EntityCacheUtil.putResult(
        QuotaModelImpl.ENTITY_CACHE_ENABLED, QuotaImpl.class, quota.getPrimaryKey(), quota);

    if (isNew) {
      FinderCacheUtil.putResult(
          FINDER_PATH_FETCH_BY_CLASSNAMEIDCLASSPK,
          new Object[] {Long.valueOf(quota.getClassNameId()), Long.valueOf(quota.getClassPK())},
          quota);
    } else {
      if ((quotaModelImpl.getColumnBitmask()
              & FINDER_PATH_FETCH_BY_CLASSNAMEIDCLASSPK.getColumnBitmask())
          != 0) {
        Object[] args =
            new Object[] {
              Long.valueOf(quotaModelImpl.getOriginalClassNameId()),
              Long.valueOf(quotaModelImpl.getOriginalClassPK())
            };

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEIDCLASSPK, args);

        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CLASSNAMEIDCLASSPK, args);

        FinderCacheUtil.putResult(
            FINDER_PATH_FETCH_BY_CLASSNAMEIDCLASSPK,
            new Object[] {Long.valueOf(quota.getClassNameId()), Long.valueOf(quota.getClassPK())},
            quota);
      }
    }

    return quota;
  }
  /**
   * Caches the shard in the entity cache if it is enabled.
   *
   * @param shard the shard
   */
  @Override
  public void cacheResult(Shard shard) {
    EntityCacheUtil.putResult(
        ShardModelImpl.ENTITY_CACHE_ENABLED, ShardImpl.class, shard.getPrimaryKey(), shard);

    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME, new Object[] {shard.getName()}, shard);

    FinderCacheUtil.putResult(
        FINDER_PATH_FETCH_BY_C_C, new Object[] {shard.getClassNameId(), shard.getClassPK()}, shard);

    shard.resetOriginalValues();
  }
  @Override
  public ClassName updateImpl(com.liferay.portal.model.ClassName className, boolean merge)
      throws SystemException {
    className = toUnwrappedModel(className);

    boolean isNew = className.isNew();

    ClassNameModelImpl classNameModelImpl = (ClassNameModelImpl) className;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, className, merge);

      className.setNew(false);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !ClassNameModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }

    EntityCacheUtil.putResult(
        ClassNameModelImpl.ENTITY_CACHE_ENABLED,
        ClassNameImpl.class,
        className.getPrimaryKey(),
        className);

    if (isNew) {
      FinderCacheUtil.putResult(
          FINDER_PATH_FETCH_BY_VALUE, new Object[] {className.getValue()}, className);
    } else {
      if ((classNameModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_VALUE.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {classNameModelImpl.getOriginalValue()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_VALUE, args);
        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VALUE, args);

        FinderCacheUtil.putResult(
            FINDER_PATH_FETCH_BY_VALUE, new Object[] {className.getValue()}, className);
      }
    }

    return className;
  }
  protected void cacheUniqueFindersCache(Shard shard) {
    if (shard.isNew()) {
      Object[] args = new Object[] {shard.getName()};

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_NAME, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME, args, shard);

      args = new Object[] {shard.getClassNameId(), shard.getClassPK()};

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C, args, shard);
    } else {
      ShardModelImpl shardModelImpl = (ShardModelImpl) shard;

      if ((shardModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_NAME.getColumnBitmask()) != 0) {
        Object[] args = new Object[] {shard.getName()};

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_NAME, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME, args, shard);
      }

      if ((shardModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
        Object[] args = new Object[] {shard.getClassNameId(), shard.getClassPK()};

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C, args, shard);
      }
    }
  }
  /**
   * Returns the number of social equity histories.
   *
   * @return the number of social equity histories
   * @throws SystemException if a system exception occurred
   */
  public int countAll() throws SystemException {
    Object[] finderArgs = new Object[0];

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, finderArgs, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(_SQL_COUNT_SOCIALEQUITYHISTORY);

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
  /**
   * Returns the number of projects entries.
   *
   * @return the number of projects entries
   * @throws SystemException if a system exception occurred
   */
  @Override
  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_PROJECTSENTRY);

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
  public int countAll() throws SystemException {
    Object[] finderArgs = new Object[0];

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, finderArgs, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        Query q =
            session.createQuery(
                "SELECT COUNT(*) FROM com.ext.portlet.debaterevision.model.DebateItemReference");

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
  /**
   * Returns the number of class names.
   *
   * @return the number of class names
   * @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_CLASSNAME);

        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();
  }
  public int countAll() throws SystemException {
    Object[] finderArgs = new Object[0];

    Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, finderArgs, this);

    if (count == null) {
      Session session = null;

      try {
        session = openSession();

        Query q =
            session.createQuery(
                "SELECT COUNT(*) FROM larion.progate.cds.model.ViewListTitleCompetencies");

        count = (Long) q.uniqueResult();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (count == null) {
          count = Long.valueOf(0);
        }

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs, count);

        closeSession(session);
      }
    }

    return count.intValue();
  }
  @Override
  public Ticket updateImpl(com.liferay.portal.model.Ticket ticket, boolean merge)
      throws SystemException {
    ticket = toUnwrappedModel(ticket);

    boolean isNew = ticket.isNew();

    TicketModelImpl ticketModelImpl = (TicketModelImpl) ticket;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, ticket, merge);

      ticket.setNew(false);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !TicketModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }

    EntityCacheUtil.putResult(
        TicketModelImpl.ENTITY_CACHE_ENABLED, TicketImpl.class, ticket.getPrimaryKey(), ticket);

    if (isNew) {
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticket.getKey()}, ticket);
    } else {
      if ((ticketModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_KEY.getColumnBitmask()) != 0) {
        Object[] args = new Object[] {ticketModelImpl.getOriginalKey()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_KEY, args);
        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_KEY, args);

        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticket.getKey()}, ticket);
      }
    }

    return ticket;
  }
  /**
   * Returns an ordered range of all the layout sets where groupId = ?.
   *
   * <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.
   *
   * @param groupId the group ID
   * @param start the lower bound of the range of layout sets
   * @param end the upper bound of the range of layout sets (not inclusive)
   * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
   * @return the ordered range of matching layout sets
   * @throws SystemException if a system exception occurred
   */
  public List<LayoutSet> findByGroupId(
      long groupId, int start, int end, OrderByComparator orderByComparator)
      throws SystemException {
    Object[] finderArgs =
        new Object[] {
          groupId, String.valueOf(start), String.valueOf(end), String.valueOf(orderByComparator)
        };

    List<LayoutSet> list =
        (List<LayoutSet>) FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID, finderArgs, this);

    if (list == null) {
      StringBundler query = null;

      if (orderByComparator != null) {
        query = new StringBundler(3 + (orderByComparator.getOrderByFields().length * 3));
      } else {
        query = new StringBundler(2);
      }

      query.append(_SQL_SELECT_LAYOUTSET_WHERE);

      query.append(_FINDER_COLUMN_GROUPID_GROUPID_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(groupId);

        list = (List<LayoutSet>) QueryUtil.list(q, getDialect(), start, end);
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_GROUPID, finderArgs);
        } else {
          cacheResult(list);

          FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID, finderArgs, list);
        }

        closeSession(session);
      }
    }

    return list;
  }
  /**
   * Caches the ticket in the entity cache if it is enabled.
   *
   * @param ticket the ticket
   */
  public void cacheResult(Ticket ticket) {
    EntityCacheUtil.putResult(
        TicketModelImpl.ENTITY_CACHE_ENABLED, TicketImpl.class, ticket.getPrimaryKey(), ticket);

    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticket.getKey()}, ticket);

    ticket.resetOriginalValues();
  }
  protected void cacheUniqueFindersCache(Entry entry) {
    if (entry.isNew()) {
      Object[] args = new Object[] {entry.getUserId(), entry.getEmailAddress()};

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_EA, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_EA, args, entry);
    } else {
      EntryModelImpl entryModelImpl = (EntryModelImpl) entry;

      if ((entryModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_U_EA.getColumnBitmask()) != 0) {
        Object[] args = new Object[] {entry.getUserId(), entry.getEmailAddress()};

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_EA, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U_EA, args, entry);
      }
    }
  }
  /**
   * Returns the number of entries where userId = &#63; and emailAddress = &#63;.
   *
   * @param userId the user ID
   * @param emailAddress the email address
   * @return the number of matching entries
   * @throws SystemException if a system exception occurred
   */
  @Override
  public int countByU_EA(long userId, String emailAddress) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_U_EA;

    Object[] finderArgs = new Object[] {userId, emailAddress};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(3);

      query.append(_SQL_COUNT_ENTRY_WHERE);

      query.append(_FINDER_COLUMN_U_EA_USERID_2);

      boolean bindEmailAddress = false;

      if (emailAddress == null) {
        query.append(_FINDER_COLUMN_U_EA_EMAILADDRESS_1);
      } else if (emailAddress.equals(StringPool.BLANK)) {
        query.append(_FINDER_COLUMN_U_EA_EMAILADDRESS_3);
      } else {
        bindEmailAddress = true;

        query.append(_FINDER_COLUMN_U_EA_EMAILADDRESS_2);
      }

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(userId);

        if (bindEmailAddress) {
          qPos.add(emailAddress);
        }

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }
  /**
   * Returns an ordered range of all the social equity histories.
   *
   * <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.
   *
   * @param start the lower bound of the range of social equity histories
   * @param end the upper bound of the range of social equity histories (not inclusive)
   * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
   * @return the ordered range of social equity histories
   * @throws SystemException if a system exception occurred
   */
  public List<SocialEquityHistory> findAll(int start, int end, OrderByComparator orderByComparator)
      throws SystemException {
    Object[] finderArgs =
        new Object[] {
          String.valueOf(start), String.valueOf(end), String.valueOf(orderByComparator)
        };

    List<SocialEquityHistory> list =
        (List<SocialEquityHistory>)
            FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL, 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_SOCIALEQUITYHISTORY);

        appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator);

        sql = query.toString();
      } else {
        sql = _SQL_SELECT_SOCIALEQUITYHISTORY;
      }

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        if (orderByComparator == null) {
          list = (List<SocialEquityHistory>) QueryUtil.list(q, getDialect(), start, end, false);

          Collections.sort(list);
        } else {
          list = (List<SocialEquityHistory>) QueryUtil.list(q, getDialect(), start, end);
        }
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL, finderArgs);
        } else {
          cacheResult(list);

          FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
        }

        closeSession(session);
      }
    }

    return list;
  }
  public List<ViewListTitleCompetencies> findByTitleId(
      int titleId, int start, int end, OrderByComparator obc) throws SystemException {
    Object[] finderArgs =
        new Object[] {
          new Integer(titleId), String.valueOf(start), String.valueOf(end), String.valueOf(obc)
        };

    List<ViewListTitleCompetencies> list =
        (List<ViewListTitleCompetencies>)
            FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_TITLEID, finderArgs, this);

    if (list == null) {
      Session session = null;

      try {
        session = openSession();

        StringBuilder query = new StringBuilder();

        query.append("FROM larion.progate.cds.model.ViewListTitleCompetencies WHERE ");

        query.append("title_id = ?");

        query.append(" ");

        if (obc != null) {
          query.append("ORDER BY ");
          query.append(obc.getOrderBy());
        } else {
          query.append("ORDER BY ");

          query.append("competency_number_order ASC");
        }

        Query q = session.createQuery(query.toString());

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(titleId);

        list = (List<ViewListTitleCompetencies>) QueryUtil.list(q, getDialect(), start, end);
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          list = new ArrayList<ViewListTitleCompetencies>();
        }

        cacheResult(list);

        FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_TITLEID, finderArgs, list);

        closeSession(session);
      }
    }

    return list;
  }
  protected void cacheUniqueFindersCache(ListType listType) {
    if (listType.isNew()) {
      Object[] args = new Object[] {listType.getName(), listType.getType()};

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T, args, listType);
    } else {
      ListTypeModelImpl listTypeModelImpl = (ListTypeModelImpl) listType;

      if ((listTypeModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_N_T.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {listType.getName(), listType.getType()};

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_N_T, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_N_T, args, listType);
      }
    }
  }
  /**
   * Caches the d l sync in the entity cache if it is enabled.
   *
   * @param dlSync the d l sync
   */
  public void cacheResult(DLSync dlSync) {
    EntityCacheUtil.putResult(
        DLSyncModelImpl.ENTITY_CACHE_ENABLED, DLSyncImpl.class, dlSync.getPrimaryKey(), dlSync);

    FinderCacheUtil.putResult(
        FINDER_PATH_FETCH_BY_FILEID, new Object[] {dlSync.getFileId()}, dlSync);

    dlSync.resetOriginalValues();
  }
  protected void cacheUniqueFindersCache(SVNRepository svnRepository) {
    if (svnRepository.isNew()) {
      Object[] args = new Object[] {svnRepository.getUrl()};

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_URL, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_URL, args, svnRepository);
    } else {
      SVNRepositoryModelImpl svnRepositoryModelImpl = (SVNRepositoryModelImpl) svnRepository;

      if ((svnRepositoryModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_URL.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {svnRepository.getUrl()};

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_URL, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_URL, args, svnRepository);
      }
    }
  }
  protected void cacheUniqueFindersCache(DLSyncEvent dlSyncEvent) {
    if (dlSyncEvent.isNew()) {
      Object[] args = new Object[] {dlSyncEvent.getTypePK()};

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TYPEPK, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_TYPEPK, args, dlSyncEvent);
    } else {
      DLSyncEventModelImpl dlSyncEventModelImpl = (DLSyncEventModelImpl) dlSyncEvent;

      if ((dlSyncEventModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_TYPEPK.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {dlSyncEvent.getTypePK()};

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TYPEPK, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_TYPEPK, args, dlSyncEvent);
      }
    }
  }
  protected void cacheUniqueFindersCache(DLSync dlSync) {
    if (dlSync.isNew()) {
      Object[] args = new Object[] {dlSync.getFileId()};

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FILEID, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FILEID, args, dlSync);
    } else {
      DLSyncModelImpl dlSyncModelImpl = (DLSyncModelImpl) dlSync;

      if ((dlSyncModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_FILEID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {dlSync.getFileId()};

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FILEID, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FILEID, args, dlSync);
      }
    }
  }
  @Override
  public ExpandoRow updateImpl(
      com.liferay.portlet.expando.model.ExpandoRow expandoRow, boolean merge)
      throws SystemException {
    expandoRow = toUnwrappedModel(expandoRow);

    boolean isNew = expandoRow.isNew();

    ExpandoRowModelImpl expandoRowModelImpl = (ExpandoRowModelImpl) expandoRow;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, expandoRow, merge);

      expandoRow.setNew(false);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    EntityCacheUtil.putResult(
        ExpandoRowModelImpl.ENTITY_CACHE_ENABLED,
        ExpandoRowImpl.class,
        expandoRow.getPrimaryKey(),
        expandoRow);

    if (!isNew
        && ((expandoRow.getTableId() != expandoRowModelImpl.getOriginalTableId())
            || (expandoRow.getClassPK() != expandoRowModelImpl.getOriginalClassPK()))) {
      FinderCacheUtil.removeResult(
          FINDER_PATH_FETCH_BY_T_C,
          new Object[] {
            Long.valueOf(expandoRowModelImpl.getOriginalTableId()),
            Long.valueOf(expandoRowModelImpl.getOriginalClassPK())
          });
    }

    if (isNew
        || ((expandoRow.getTableId() != expandoRowModelImpl.getOriginalTableId())
            || (expandoRow.getClassPK() != expandoRowModelImpl.getOriginalClassPK()))) {
      FinderCacheUtil.putResult(
          FINDER_PATH_FETCH_BY_T_C,
          new Object[] {
            Long.valueOf(expandoRow.getTableId()), Long.valueOf(expandoRow.getClassPK())
          },
          expandoRow);
    }

    return expandoRow;
  }
Example #24
0
  protected void cacheUniqueFindersCache(Release release) {
    if (release.isNew()) {
      Object[] args = new Object[] {release.getServletContextName()};

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SERVLETCONTEXTNAME, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SERVLETCONTEXTNAME, args, release);
    } else {
      ReleaseModelImpl releaseModelImpl = (ReleaseModelImpl) release;

      if ((releaseModelImpl.getColumnBitmask()
              & FINDER_PATH_FETCH_BY_SERVLETCONTEXTNAME.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {release.getServletContextName()};

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SERVLETCONTEXTNAME, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SERVLETCONTEXTNAME, args, release);
      }
    }
  }
  protected void cacheUniqueFindersCache(BrowserTracker browserTracker) {
    if (browserTracker.isNew()) {
      Object[] args = new Object[] {Long.valueOf(browserTracker.getUserId())};

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_USERID, args, browserTracker);
    } else {
      BrowserTrackerModelImpl browserTrackerModelImpl = (BrowserTrackerModelImpl) browserTracker;

      if ((browserTrackerModelImpl.getColumnBitmask()
              & FINDER_PATH_FETCH_BY_USERID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {Long.valueOf(browserTracker.getUserId())};

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_USERID, args, browserTracker);
      }
    }
  }
  public List<ViewListTitleCompetencies> findAll(int start, int end, OrderByComparator obc)
      throws SystemException {
    Object[] finderArgs =
        new Object[] {String.valueOf(start), String.valueOf(end), String.valueOf(obc)};

    List<ViewListTitleCompetencies> list =
        (List<ViewListTitleCompetencies>)
            FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL, finderArgs, this);

    if (list == null) {
      Session session = null;

      try {
        session = openSession();

        StringBuilder query = new StringBuilder();

        query.append("FROM larion.progate.cds.model.ViewListTitleCompetencies ");

        if (obc != null) {
          query.append("ORDER BY ");
          query.append(obc.getOrderBy());
        } else {
          query.append("ORDER BY ");

          query.append("competency_number_order ASC");
        }

        Query q = session.createQuery(query.toString());

        if (obc == null) {
          list =
              (List<ViewListTitleCompetencies>) QueryUtil.list(q, getDialect(), start, end, false);

          Collections.sort(list);
        } else {
          list = (List<ViewListTitleCompetencies>) QueryUtil.list(q, getDialect(), start, end);
        }
      } catch (Exception e) {
        throw processException(e);
      } finally {
        if (list == null) {
          list = new ArrayList<ViewListTitleCompetencies>();
        }

        cacheResult(list);

        FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);

        closeSession(session);
      }
    }

    return list;
  }
  public int countAll() throws SystemException {
    boolean finderClassNameCacheEnabled = PmlEdmLevelSendModelImpl.CACHE_ENABLED;
    String finderClassName = PmlEdmLevelSend.class.getName();
    String finderMethodName = "countAll";
    String[] finderParams = new String[] {};
    Object[] finderArgs = new Object[] {};

    Object result = null;

    if (finderClassNameCacheEnabled) {
      result =
          FinderCacheUtil.getResult(
              finderClassName, finderMethodName, finderParams, finderArgs, this);
    }

    if (result == null) {
      Session session = null;

      try {
        session = openSession();

        Query q =
            session.createQuery(
                "SELECT COUNT(*) FROM com.sgs.portlet.pmllevelsend.model.PmlEdmLevelSend");

        Long count = null;

        Iterator<Long> itr = q.list().iterator();

        if (itr.hasNext()) {
          count = itr.next();
        }

        if (count == null) {
          count = new Long(0);
        }

        FinderCacheUtil.putResult(
            finderClassNameCacheEnabled,
            finderClassName,
            finderMethodName,
            finderParams,
            finderArgs,
            count);

        return count.intValue();
      } catch (Exception e) {
        throw processException(e);
      } finally {
        closeSession(session);
      }
    } else {
      return ((Long) result).intValue();
    }
  }
  public List<SoPhongVanBanNoiBo> findBySoVanBanNoiBo(long soVanBanNoiBoId) throws SystemException {
    boolean finderClassNameCacheEnabled = SoPhongVanBanNoiBoModelImpl.CACHE_ENABLED;
    String finderClassName = SoPhongVanBanNoiBo.class.getName();
    String finderMethodName = "findBySoVanBanNoiBo";
    String[] finderParams = new String[] {Long.class.getName()};
    Object[] finderArgs = new Object[] {new Long(soVanBanNoiBoId)};

    Object result = null;

    if (finderClassNameCacheEnabled) {
      result =
          FinderCacheUtil.getResult(
              finderClassName, finderMethodName, finderParams, finderArgs, this);
    }

    if (result == null) {
      Session session = null;

      try {
        session = openSession();

        StringBuilder query = new StringBuilder();

        query.append("FROM com.sgs.portlet.sovanbannoibo.model.SoPhongVanBanNoiBo WHERE ");

        query.append("soVanBanNoiBoId = ?");

        query.append(" ");

        Query q = session.createQuery(query.toString());

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(soVanBanNoiBoId);

        List<SoPhongVanBanNoiBo> list = q.list();

        FinderCacheUtil.putResult(
            finderClassNameCacheEnabled,
            finderClassName,
            finderMethodName,
            finderParams,
            finderArgs,
            list);

        return list;
      } catch (Exception e) {
        throw processException(e);
      } finally {
        closeSession(session);
      }
    } else {
      return (List<SoPhongVanBanNoiBo>) result;
    }
  }
  @Override
  public LayoutSet updateImpl(com.liferay.portal.model.LayoutSet layoutSet, boolean merge)
      throws SystemException {
    layoutSet = toUnwrappedModel(layoutSet);

    boolean isNew = layoutSet.isNew();

    LayoutSetModelImpl layoutSetModelImpl = (LayoutSetModelImpl) layoutSet;

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, layoutSet, merge);

      layoutSet.setNew(false);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    EntityCacheUtil.putResult(
        LayoutSetModelImpl.ENTITY_CACHE_ENABLED,
        LayoutSetImpl.class,
        layoutSet.getPrimaryKey(),
        layoutSet);

    if (!isNew
        && ((layoutSet.getGroupId() != layoutSetModelImpl.getOriginalGroupId())
            || (layoutSet.getPrivateLayout() != layoutSetModelImpl.getOriginalPrivateLayout()))) {
      FinderCacheUtil.removeResult(
          FINDER_PATH_FETCH_BY_G_P,
          new Object[] {
            Long.valueOf(layoutSetModelImpl.getOriginalGroupId()),
            Boolean.valueOf(layoutSetModelImpl.getOriginalPrivateLayout())
          });
    }

    if (isNew
        || ((layoutSet.getGroupId() != layoutSetModelImpl.getOriginalGroupId())
            || (layoutSet.getPrivateLayout() != layoutSetModelImpl.getOriginalPrivateLayout()))) {
      FinderCacheUtil.putResult(
          FINDER_PATH_FETCH_BY_G_P,
          new Object[] {
            Long.valueOf(layoutSet.getGroupId()), Boolean.valueOf(layoutSet.getPrivateLayout())
          },
          layoutSet);
    }

    return layoutSet;
  }
  /**
   * Returns the number of bars where text = &#63;.
   *
   * @param text the text
   * @return the number of matching bars
   */
  @Override
  public int countByText(String text) {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_TEXT;

    Object[] finderArgs = new Object[] {text};

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
      StringBundler query = new StringBundler(2);

      query.append(_SQL_COUNT_BAR_WHERE);

      boolean bindText = false;

      if (text == null) {
        query.append(_FINDER_COLUMN_TEXT_TEXT_1);
      } else if (text.equals(StringPool.BLANK)) {
        query.append(_FINDER_COLUMN_TEXT_TEXT_3);
      } else {
        bindText = true;

        query.append(_FINDER_COLUMN_TEXT_TEXT_2);
      }

      String sql = query.toString();

      Session session = null;

      try {
        session = openSession();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        if (bindText) {
          qPos.add(text);
        }

        count = (Long) q.uniqueResult();

        FinderCacheUtil.putResult(finderPath, finderArgs, count);
      } catch (Exception e) {
        FinderCacheUtil.removeResult(finderPath, finderArgs);

        throw processException(e);
      } finally {
        closeSession(session);
      }
    }

    return count.intValue();
  }