@Override
  public void resetOriginalValues() {
    PortalPreferencesModelImpl portalPreferencesModelImpl = this;

    portalPreferencesModelImpl._originalOwnerId = portalPreferencesModelImpl._ownerId;

    portalPreferencesModelImpl._setOriginalOwnerId = false;

    portalPreferencesModelImpl._originalOwnerType = portalPreferencesModelImpl._ownerType;

    portalPreferencesModelImpl._setOriginalOwnerType = false;

    portalPreferencesModelImpl._columnBitmask = 0;
  }
  @Override
  public PortalPreferences updateImpl(com.liferay.portal.model.PortalPreferences portalPreferences)
      throws SystemException {
    portalPreferences = toUnwrappedModel(portalPreferences);

    boolean isNew = portalPreferences.isNew();

    PortalPreferencesModelImpl portalPreferencesModelImpl =
        (PortalPreferencesModelImpl) portalPreferences;

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

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

    EntityCacheUtil.putResult(
        PortalPreferencesModelImpl.ENTITY_CACHE_ENABLED,
        PortalPreferencesImpl.class,
        portalPreferences.getPrimaryKey(),
        portalPreferences);

    if (isNew) {
      FinderCacheUtil.putResult(
          FINDER_PATH_FETCH_BY_O_O,
          new Object[] {
            Long.valueOf(portalPreferences.getOwnerId()),
            Integer.valueOf(portalPreferences.getOwnerType())
          },
          portalPreferences);
    } else {
      if ((portalPreferencesModelImpl.getColumnBitmask()
              & FINDER_PATH_FETCH_BY_O_O.getColumnBitmask())
          != 0) {
        Object[] args =
            new Object[] {
              Long.valueOf(portalPreferencesModelImpl.getOriginalOwnerId()),
              Integer.valueOf(portalPreferencesModelImpl.getOriginalOwnerType())
            };

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_O_O, args);

        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_O_O, args);

        FinderCacheUtil.putResult(
            FINDER_PATH_FETCH_BY_O_O,
            new Object[] {
              Long.valueOf(portalPreferences.getOwnerId()),
              Integer.valueOf(portalPreferences.getOwnerType())
            },
            portalPreferences);
      }
    }

    return portalPreferences;
  }