Esempio n. 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;
  }
Esempio n. 2
0
  /**
   * Creates a new password tracker with the primary key. Does not add the password tracker to the
   * database.
   *
   * @param passwordTrackerId the primary key for the new password tracker
   * @return the new password tracker
   */
  @Override
  public PasswordTracker create(long passwordTrackerId) {
    PasswordTracker passwordTracker = new PasswordTrackerImpl();

    passwordTracker.setNew(true);
    passwordTracker.setPrimaryKey(passwordTrackerId);

    return passwordTracker;
  }