Exemple #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;
  }
Exemple #2
0
  protected PasswordTracker toUnwrappedModel(PasswordTracker passwordTracker) {
    if (passwordTracker instanceof PasswordTrackerImpl) {
      return passwordTracker;
    }

    PasswordTrackerImpl passwordTrackerImpl = new PasswordTrackerImpl();

    passwordTrackerImpl.setNew(passwordTracker.isNew());
    passwordTrackerImpl.setPrimaryKey(passwordTracker.getPrimaryKey());

    passwordTrackerImpl.setPasswordTrackerId(passwordTracker.getPasswordTrackerId());
    passwordTrackerImpl.setUserId(passwordTracker.getUserId());
    passwordTrackerImpl.setCreateDate(passwordTracker.getCreateDate());
    passwordTrackerImpl.setPassword(passwordTracker.getPassword());

    return passwordTrackerImpl;
  }