Search in sources :

Example 1 with AlbumModelImpl

use of org.liferay.jukebox.model.impl.AlbumModelImpl in project liferay-ide by liferay.

the class AlbumPersistenceImpl method updateImpl.

@Override
public Album updateImpl(org.liferay.jukebox.model.Album album) throws SystemException {
    album = toUnwrappedModel(album);
    boolean isNew = album.isNew();
    AlbumModelImpl albumModelImpl = (AlbumModelImpl) album;
    if (Validator.isNull(album.getUuid())) {
        String uuid = PortalUUIDUtil.generate();
        album.setUuid(uuid);
    }
    Session session = null;
    try {
        session = openSession();
        if (album.isNew()) {
            session.save(album);
            album.setNew(false);
        } else {
            session.merge(album);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    if (isNew || !AlbumModelImpl.COLUMN_BITMASK_ENABLED) {
        FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
        if ((albumModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { albumModelImpl.getOriginalUuid() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args);
            args = new Object[] { albumModelImpl.getUuid() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args);
        }
        if ((albumModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { albumModelImpl.getOriginalUuid(), albumModelImpl.getOriginalCompanyId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args);
            args = new Object[] { albumModelImpl.getUuid(), albumModelImpl.getCompanyId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args);
        }
        if ((albumModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { albumModelImpl.getOriginalGroupId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args);
            args = new Object[] { albumModelImpl.getGroupId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args);
        }
        if ((albumModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { albumModelImpl.getOriginalUserId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);
            args = new Object[] { albumModelImpl.getUserId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);
        }
        if ((albumModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { albumModelImpl.getOriginalCompanyId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID, args);
            args = new Object[] { albumModelImpl.getCompanyId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID, args);
        }
        if ((albumModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ARTISTID.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { albumModelImpl.getOriginalArtistId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ARTISTID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ARTISTID, args);
            args = new Object[] { albumModelImpl.getArtistId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ARTISTID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ARTISTID, args);
        }
        if ((albumModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { albumModelImpl.getOriginalGroupId(), albumModelImpl.getOriginalUserId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U, args);
            args = new Object[] { albumModelImpl.getGroupId(), albumModelImpl.getUserId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U, args);
        }
        if ((albumModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { albumModelImpl.getOriginalGroupId(), albumModelImpl.getOriginalStatus() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S, args);
            args = new Object[] { albumModelImpl.getGroupId(), albumModelImpl.getStatus() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S, args);
        }
        if ((albumModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_A_S.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { albumModelImpl.getOriginalGroupId(), albumModelImpl.getOriginalArtistId(), albumModelImpl.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[] { albumModelImpl.getGroupId(), albumModelImpl.getArtistId(), albumModelImpl.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(AlbumModelImpl.ENTITY_CACHE_ENABLED, AlbumImpl.class, album.getPrimaryKey(), album);
    clearUniqueFindersCache(album);
    cacheUniqueFindersCache(album);
    return album;
}
Also used : AlbumModelImpl(org.liferay.jukebox.model.impl.AlbumModelImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchAlbumException(org.liferay.jukebox.NoSuchAlbumException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 2 with AlbumModelImpl

use of org.liferay.jukebox.model.impl.AlbumModelImpl in project liferay-ide by liferay.

the class AlbumPersistenceImpl method clearUniqueFindersCache.

protected void clearUniqueFindersCache(Album album) {
    AlbumModelImpl albumModelImpl = (AlbumModelImpl) album;
    Object[] args = new Object[] { album.getUuid(), album.getGroupId() };
    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
    if ((albumModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
        args = new Object[] { albumModelImpl.getOriginalUuid(), albumModelImpl.getOriginalGroupId() };
        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
    }
}
Also used : AlbumModelImpl(org.liferay.jukebox.model.impl.AlbumModelImpl)

Example 3 with AlbumModelImpl

use of org.liferay.jukebox.model.impl.AlbumModelImpl in project liferay-ide by liferay.

the class AlbumPersistenceImpl method cacheUniqueFindersCache.

protected void cacheUniqueFindersCache(Album album) {
    if (album.isNew()) {
        Object[] args = new Object[] { album.getUuid(), album.getGroupId() };
        FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G, args, Long.valueOf(1));
        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G, args, album);
    } else {
        AlbumModelImpl albumModelImpl = (AlbumModelImpl) album;
        if ((albumModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { album.getUuid(), album.getGroupId() };
            FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G, args, Long.valueOf(1));
            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G, args, album);
        }
    }
}
Also used : AlbumModelImpl(org.liferay.jukebox.model.impl.AlbumModelImpl)

Aggregations

AlbumModelImpl (org.liferay.jukebox.model.impl.AlbumModelImpl)3 Session (com.liferay.portal.kernel.dao.orm.Session)1 SystemException (com.liferay.portal.kernel.exception.SystemException)1 NoSuchAlbumException (org.liferay.jukebox.NoSuchAlbumException)1