コード例 #1
0
  @Override
  public JIRAChangeItem updateImpl(com.liferay.socialcoding.model.JIRAChangeItem jiraChangeItem)
      throws SystemException {
    jiraChangeItem = toUnwrappedModel(jiraChangeItem);

    boolean isNew = jiraChangeItem.isNew();

    JIRAChangeItemModelImpl jiraChangeItemModelImpl = (JIRAChangeItemModelImpl) jiraChangeItem;

    Session session = null;

    try {
      session = openSession();

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

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

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

    if (isNew || !JIRAChangeItemModelImpl.COLUMN_BITMASK_ENABLED) {
      FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
      if ((jiraChangeItemModelImpl.getColumnBitmask()
              & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_JIRACHANGEGROUPID.getColumnBitmask())
          != 0) {
        Object[] args = new Object[] {jiraChangeItemModelImpl.getOriginalJiraChangeGroupId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_JIRACHANGEGROUPID, args);
        FinderCacheUtil.removeResult(
            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_JIRACHANGEGROUPID, args);

        args = new Object[] {jiraChangeItemModelImpl.getJiraChangeGroupId()};

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_JIRACHANGEGROUPID, args);
        FinderCacheUtil.removeResult(
            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_JIRACHANGEGROUPID, args);
      }
    }

    EntityCacheUtil.putResult(
        JIRAChangeItemModelImpl.ENTITY_CACHE_ENABLED,
        JIRAChangeItemImpl.class,
        jiraChangeItem.getPrimaryKey(),
        jiraChangeItem,
        false);

    jiraChangeItem.resetOriginalValues();

    return jiraChangeItem;
  }
コード例 #2
0
  /**
   * Caches the j i r a change item in the entity cache if it is enabled.
   *
   * @param jiraChangeItem the j i r a change item
   */
  public void cacheResult(JIRAChangeItem jiraChangeItem) {
    EntityCacheUtil.putResult(
        JIRAChangeItemModelImpl.ENTITY_CACHE_ENABLED,
        JIRAChangeItemImpl.class,
        jiraChangeItem.getPrimaryKey(),
        jiraChangeItem);

    jiraChangeItem.resetOriginalValues();
  }
コード例 #3
0
 /**
  * Caches the j i r a change items in the entity cache if it is enabled.
  *
  * @param jiraChangeItems the j i r a change items
  */
 @Override
 public void cacheResult(List<JIRAChangeItem> jiraChangeItems) {
   for (JIRAChangeItem jiraChangeItem : jiraChangeItems) {
     if (EntityCacheUtil.getResult(
             JIRAChangeItemModelImpl.ENTITY_CACHE_ENABLED,
             JIRAChangeItemImpl.class,
             jiraChangeItem.getPrimaryKey())
         == null) {
       cacheResult(jiraChangeItem);
     } else {
       jiraChangeItem.resetOriginalValues();
     }
   }
 }