예제 #1
0
  @Override
  public Release updateImpl(com.liferay.portal.model.Release release) throws SystemException {
    release = toUnwrappedModel(release);

    boolean isNew = release.isNew();

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

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

    EntityCacheUtil.putResult(
        ReleaseModelImpl.ENTITY_CACHE_ENABLED, ReleaseImpl.class, release.getPrimaryKey(), release);

    clearUniqueFindersCache(release);
    cacheUniqueFindersCache(release);

    return release;
  }
예제 #2
0
  protected void cacheUniqueFindersCache(Release release) {
    if (release.isNew()) {
      Object[] args = new Object[] {release.getServletContextName()};

      FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SERVLETCONTEXTNAME, args, Long.valueOf(1));
      FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SERVLETCONTEXTNAME, args, release);
    } else {
      ReleaseModelImpl releaseModelImpl = (ReleaseModelImpl) release;

      if ((releaseModelImpl.getColumnBitmask()
              & FINDER_PATH_FETCH_BY_SERVLETCONTEXTNAME.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {release.getServletContextName()};

        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SERVLETCONTEXTNAME, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SERVLETCONTEXTNAME, args, release);
      }
    }
  }
예제 #3
0
  protected Release toUnwrappedModel(Release release) {
    if (release instanceof ReleaseImpl) {
      return release;
    }

    ReleaseImpl releaseImpl = new ReleaseImpl();

    releaseImpl.setNew(release.isNew());
    releaseImpl.setPrimaryKey(release.getPrimaryKey());

    releaseImpl.setReleaseId(release.getReleaseId());
    releaseImpl.setCreateDate(release.getCreateDate());
    releaseImpl.setModifiedDate(release.getModifiedDate());
    releaseImpl.setServletContextName(release.getServletContextName());
    releaseImpl.setBuildNumber(release.getBuildNumber());
    releaseImpl.setBuildDate(release.getBuildDate());
    releaseImpl.setVerified(release.isVerified());
    releaseImpl.setState(release.getState());
    releaseImpl.setTestString(release.getTestString());

    return releaseImpl;
  }