コード例 #1
0
  @Override
  protected Ticket removeImpl(Ticket ticket) throws SystemException {
    ticket = toUnwrappedModel(ticket);

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.delete(session, ticket);
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);
    }

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

    TicketModelImpl ticketModelImpl = (TicketModelImpl) ticket;

    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticketModelImpl.getKey()});

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

    return ticket;
  }
コード例 #2
0
  @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;
  }
コード例 #3
0
  @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);

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

    if (!isNew && (!Validator.equals(ticket.getKey(), ticketModelImpl.getOriginalKey()))) {
      FinderCacheUtil.removeResult(
          FINDER_PATH_FETCH_BY_KEY, new Object[] {ticketModelImpl.getOriginalKey()});
    }

    if (isNew || (!Validator.equals(ticket.getKey(), ticketModelImpl.getOriginalKey()))) {
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_KEY, new Object[] {ticket.getKey()}, ticket);
    }

    return ticket;
  }