@Override protected JIRAChangeItem removeImpl(JIRAChangeItem jiraChangeItem) throws SystemException { jiraChangeItem = toUnwrappedModel(jiraChangeItem); Session session = null; try { session = openSession(); BatchSessionUtil.delete(session, jiraChangeItem); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST); FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL, FINDER_ARGS_EMPTY); EntityCacheUtil.removeResult( JIRAChangeItemModelImpl.ENTITY_CACHE_ENABLED, JIRAChangeItemImpl.class, jiraChangeItem.getPrimaryKey()); return jiraChangeItem; }
@Override public JIRAChangeItem updateImpl( com.liferay.socialcoding.model.JIRAChangeItem jiraChangeItem, boolean merge) throws SystemException { jiraChangeItem = toUnwrappedModel(jiraChangeItem); Session session = null; try { session = openSession(); BatchSessionUtil.update(session, jiraChangeItem, merge); jiraChangeItem.setNew(false); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST); EntityCacheUtil.putResult( JIRAChangeItemModelImpl.ENTITY_CACHE_ENABLED, JIRAChangeItemImpl.class, jiraChangeItem.getPrimaryKey(), jiraChangeItem); return jiraChangeItem; }
@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; }
/** * Clears the cache for the j i r a change item. * * <p>The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link * com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method. */ @Override public void clearCache(JIRAChangeItem jiraChangeItem) { EntityCacheUtil.removeResult( JIRAChangeItemModelImpl.ENTITY_CACHE_ENABLED, JIRAChangeItemImpl.class, jiraChangeItem.getPrimaryKey()); FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL, FINDER_ARGS_EMPTY); }
/** * 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(); }
/** * Clears the cache for the j i r a change item. * * <p>The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link * com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method. */ @Override public void clearCache(JIRAChangeItem jiraChangeItem) { EntityCacheUtil.removeResult( JIRAChangeItemModelImpl.ENTITY_CACHE_ENABLED, JIRAChangeItemImpl.class, jiraChangeItem.getPrimaryKey()); FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); }
/** * 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 */ public void cacheResult(List<JIRAChangeItem> jiraChangeItems) { for (JIRAChangeItem jiraChangeItem : jiraChangeItems) { if (EntityCacheUtil.getResult( JIRAChangeItemModelImpl.ENTITY_CACHE_ENABLED, JIRAChangeItemImpl.class, jiraChangeItem.getPrimaryKey()) == null) { cacheResult(jiraChangeItem); } } }
protected JIRAChangeItem toUnwrappedModel(JIRAChangeItem jiraChangeItem) { if (jiraChangeItem instanceof JIRAChangeItemImpl) { return jiraChangeItem; } JIRAChangeItemImpl jiraChangeItemImpl = new JIRAChangeItemImpl(); jiraChangeItemImpl.setNew(jiraChangeItem.isNew()); jiraChangeItemImpl.setPrimaryKey(jiraChangeItem.getPrimaryKey()); jiraChangeItemImpl.setJiraChangeItemId(jiraChangeItem.getJiraChangeItemId()); jiraChangeItemImpl.setJiraChangeGroupId(jiraChangeItem.getJiraChangeGroupId()); jiraChangeItemImpl.setField(jiraChangeItem.getField()); jiraChangeItemImpl.setOldValue(jiraChangeItem.getOldValue()); jiraChangeItemImpl.setOldString(jiraChangeItem.getOldString()); jiraChangeItemImpl.setNewValue(jiraChangeItem.getNewValue()); jiraChangeItemImpl.setNewString(jiraChangeItem.getNewString()); return jiraChangeItemImpl; }