Example #1
0
  @Override
  public PasswordTracker updateImpl(com.liferay.portal.model.PasswordTracker passwordTracker)
      throws SystemException {
    passwordTracker = toUnwrappedModel(passwordTracker);

    boolean isNew = passwordTracker.isNew();

    PasswordTrackerModelImpl passwordTrackerModelImpl = (PasswordTrackerModelImpl) passwordTracker;

    Session session = null;

    try {
      session = openSession();

      if (passwordTracker.isNew()) {
        session.save(passwordTracker);

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !PasswordTrackerModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((passwordTrackerModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {passwordTrackerModelImpl.getOriginalUserId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);

        args = new Object[] {passwordTrackerModelImpl.getUserId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);
      }
    }

    EntityCacheUtil.putResult(
        PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
        PasswordTrackerImpl.class,
        passwordTracker.getPrimaryKey(),
        passwordTracker);

    passwordTracker.resetOriginalValues();

    return passwordTracker;
  }
  @Override
  public void resetOriginalValues() {
    PasswordTrackerModelImpl passwordTrackerModelImpl = this;

    passwordTrackerModelImpl._originalUserId = passwordTrackerModelImpl._userId;

    passwordTrackerModelImpl._setOriginalUserId = false;

    passwordTrackerModelImpl._columnBitmask = 0;
  }