/** * Creates a new announcements flag with the primary key. Does not add the announcements flag to * the database. * * @param flagId the primary key for the new announcements flag * @return the new announcements flag */ public AnnouncementsFlag create(long flagId) { AnnouncementsFlag announcementsFlag = new AnnouncementsFlagImpl(); announcementsFlag.setNew(true); announcementsFlag.setPrimaryKey(flagId); return announcementsFlag; }
@Override public AnnouncementsFlag updateImpl( com.liferay.portlet.announcements.model.AnnouncementsFlag announcementsFlag, boolean merge) throws SystemException { announcementsFlag = toUnwrappedModel(announcementsFlag); boolean isNew = announcementsFlag.isNew(); AnnouncementsFlagModelImpl announcementsFlagModelImpl = (AnnouncementsFlagModelImpl) announcementsFlag; Session session = null; try { session = openSession(); BatchSessionUtil.update(session, announcementsFlag, merge); announcementsFlag.setNew(false); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); if (isNew || !AnnouncementsFlagModelImpl.COLUMN_BITMASK_ENABLED) { FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } else { if ((announcementsFlagModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTRYID.getColumnBitmask()) != 0) { Object[] args = new Object[] {Long.valueOf(announcementsFlagModelImpl.getOriginalEntryId())}; FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ENTRYID, args); FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTRYID, args); args = new Object[] {Long.valueOf(announcementsFlagModelImpl.getEntryId())}; FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ENTRYID, args); FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ENTRYID, args); } } EntityCacheUtil.putResult( AnnouncementsFlagModelImpl.ENTITY_CACHE_ENABLED, AnnouncementsFlagImpl.class, announcementsFlag.getPrimaryKey(), announcementsFlag); if (isNew) { FinderCacheUtil.putResult( FINDER_PATH_FETCH_BY_U_E_V, new Object[] { Long.valueOf(announcementsFlag.getUserId()), Long.valueOf(announcementsFlag.getEntryId()), Integer.valueOf(announcementsFlag.getValue()) }, announcementsFlag); } else { if ((announcementsFlagModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_U_E_V.getColumnBitmask()) != 0) { Object[] args = new Object[] { Long.valueOf(announcementsFlagModelImpl.getOriginalUserId()), Long.valueOf(announcementsFlagModelImpl.getOriginalEntryId()), Integer.valueOf(announcementsFlagModelImpl.getOriginalValue()) }; FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_E_V, args); FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U_E_V, args); FinderCacheUtil.putResult( FINDER_PATH_FETCH_BY_U_E_V, new Object[] { Long.valueOf(announcementsFlag.getUserId()), Long.valueOf(announcementsFlag.getEntryId()), Integer.valueOf(announcementsFlag.getValue()) }, announcementsFlag); } } return announcementsFlag; }