use of org.liferay.jukebox.model.impl.SongModelImpl in project liferay-ide by liferay.
the class SongPersistenceImpl method updateImpl.
@Override
public Song updateImpl(org.liferay.jukebox.model.Song song) throws SystemException {
song = toUnwrappedModel(song);
boolean isNew = song.isNew();
SongModelImpl songModelImpl = (SongModelImpl) song;
if (Validator.isNull(song.getUuid())) {
String uuid = PortalUUIDUtil.generate();
song.setUuid(uuid);
}
Session session = null;
try {
session = openSession();
if (song.isNew()) {
session.save(song);
song.setNew(false);
} else {
session.merge(song);
}
} catch (Exception e) {
throw processException(e);
} finally {
closeSession(session);
}
FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
if (isNew || !SongModelImpl.COLUMN_BITMASK_ENABLED) {
FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
} else {
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
Object[] args = new Object[] { songModelImpl.getOriginalUuid() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args);
args = new Object[] { songModelImpl.getUuid() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args);
}
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C.getColumnBitmask()) != 0) {
Object[] args = new Object[] { songModelImpl.getOriginalUuid(), songModelImpl.getOriginalCompanyId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args);
args = new Object[] { songModelImpl.getUuid(), songModelImpl.getCompanyId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args);
}
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
Object[] args = new Object[] { songModelImpl.getOriginalGroupId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args);
args = new Object[] { songModelImpl.getGroupId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args);
}
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
Object[] args = new Object[] { songModelImpl.getOriginalUserId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);
args = new Object[] { songModelImpl.getUserId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);
}
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
Object[] args = new Object[] { songModelImpl.getOriginalCompanyId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID, args);
args = new Object[] { songModelImpl.getCompanyId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID, args);
}
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ARTISTID.getColumnBitmask()) != 0) {
Object[] args = new Object[] { songModelImpl.getOriginalArtistId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ARTISTID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ARTISTID, args);
args = new Object[] { songModelImpl.getArtistId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ARTISTID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ARTISTID, args);
}
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ALBUMID.getColumnBitmask()) != 0) {
Object[] args = new Object[] { songModelImpl.getOriginalAlbumId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ALBUMID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ALBUMID, args);
args = new Object[] { songModelImpl.getAlbumId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ALBUMID, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ALBUMID, args);
}
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S.getColumnBitmask()) != 0) {
Object[] args = new Object[] { songModelImpl.getOriginalGroupId(), songModelImpl.getOriginalStatus() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S, args);
args = new Object[] { songModelImpl.getGroupId(), songModelImpl.getStatus() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S, args);
}
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A.getColumnBitmask()) != 0) {
Object[] args = new Object[] { songModelImpl.getOriginalGroupId(), songModelImpl.getOriginalAlbumId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A, args);
args = new Object[] { songModelImpl.getGroupId(), songModelImpl.getAlbumId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A, args);
}
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A_S.getColumnBitmask()) != 0) {
Object[] args = new Object[] { songModelImpl.getOriginalGroupId(), songModelImpl.getOriginalAlbumId(), songModelImpl.getOriginalStatus() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A_S, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A_S, args);
args = new Object[] { songModelImpl.getGroupId(), songModelImpl.getAlbumId(), songModelImpl.getStatus() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A_S, args);
FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A_S, args);
}
}
EntityCacheUtil.putResult(SongModelImpl.ENTITY_CACHE_ENABLED, SongImpl.class, song.getPrimaryKey(), song);
clearUniqueFindersCache(song);
cacheUniqueFindersCache(song);
return song;
}
use of org.liferay.jukebox.model.impl.SongModelImpl in project liferay-ide by liferay.
the class SongPersistenceImpl method cacheUniqueFindersCache.
protected void cacheUniqueFindersCache(Song song) {
if (song.isNew()) {
Object[] args = new Object[] { song.getUuid(), song.getGroupId() };
FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G, args, Long.valueOf(1));
FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G, args, song);
args = new Object[] { song.getGroupId(), song.getArtistId(), song.getAlbumId(), song.getName() };
FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A_A_N, args, Long.valueOf(1));
FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_A_N, args, song);
} else {
SongModelImpl songModelImpl = (SongModelImpl) song;
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
Object[] args = new Object[] { song.getUuid(), song.getGroupId() };
FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G, args, Long.valueOf(1));
FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G, args, song);
}
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_G_A_A_N.getColumnBitmask()) != 0) {
Object[] args = new Object[] { song.getGroupId(), song.getArtistId(), song.getAlbumId(), song.getName() };
FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A_A_N, args, Long.valueOf(1));
FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_A_N, args, song);
}
}
}
use of org.liferay.jukebox.model.impl.SongModelImpl in project liferay-ide by liferay.
the class SongPersistenceImpl method clearUniqueFindersCache.
protected void clearUniqueFindersCache(Song song) {
SongModelImpl songModelImpl = (SongModelImpl) song;
Object[] args = new Object[] { song.getUuid(), song.getGroupId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
args = new Object[] { songModelImpl.getOriginalUuid(), songModelImpl.getOriginalGroupId() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
}
args = new Object[] { song.getGroupId(), song.getArtistId(), song.getAlbumId(), song.getName() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A_A_N, args);
FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_A_A_N, args);
if ((songModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_G_A_A_N.getColumnBitmask()) != 0) {
args = new Object[] { songModelImpl.getOriginalGroupId(), songModelImpl.getOriginalArtistId(), songModelImpl.getOriginalAlbumId(), songModelImpl.getOriginalName() };
FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_A_A_N, args);
FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_A_A_N, args);
}
}
Aggregations