Search in sources :

Example 1 with ArtistModelImpl

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

the class ArtistPersistenceImpl method updateImpl.

@Override
public Artist updateImpl(org.liferay.jukebox.model.Artist artist) throws SystemException {
    artist = toUnwrappedModel(artist);
    boolean isNew = artist.isNew();
    ArtistModelImpl artistModelImpl = (ArtistModelImpl) artist;
    if (Validator.isNull(artist.getUuid())) {
        String uuid = PortalUUIDUtil.generate();
        artist.setUuid(uuid);
    }
    Session session = null;
    try {
        session = openSession();
        if (artist.isNew()) {
            session.save(artist);
            artist.setNew(false);
        } else {
            session.merge(artist);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    if (isNew || !ArtistModelImpl.COLUMN_BITMASK_ENABLED) {
        FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    } else {
        if ((artistModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { artistModelImpl.getOriginalUuid() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args);
            args = new Object[] { artistModelImpl.getUuid() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args);
        }
        if ((artistModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { artistModelImpl.getOriginalUuid(), artistModelImpl.getOriginalCompanyId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args);
            args = new Object[] { artistModelImpl.getUuid(), artistModelImpl.getCompanyId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args);
        }
        if ((artistModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { artistModelImpl.getOriginalGroupId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args);
            args = new Object[] { artistModelImpl.getGroupId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args);
        }
        if ((artistModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { artistModelImpl.getOriginalUserId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);
            args = new Object[] { artistModelImpl.getUserId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID, args);
        }
        if ((artistModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { artistModelImpl.getOriginalCompanyId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID, args);
            args = new Object[] { artistModelImpl.getCompanyId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID, args);
        }
        if ((artistModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { artistModelImpl.getOriginalUserId(), artistModelImpl.getOriginalGroupId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_G, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G, args);
            args = new Object[] { artistModelImpl.getUserId(), artistModelImpl.getGroupId() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_U_G, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_U_G, args);
        }
        if ((artistModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S.getColumnBitmask()) != 0) {
            Object[] args = new Object[] { artistModelImpl.getOriginalGroupId(), artistModelImpl.getOriginalStatus() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S, args);
            args = new Object[] { artistModelImpl.getGroupId(), artistModelImpl.getStatus() };
            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
            FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S, args);
        }
    }
    EntityCacheUtil.putResult(ArtistModelImpl.ENTITY_CACHE_ENABLED, ArtistImpl.class, artist.getPrimaryKey(), artist);
    clearUniqueFindersCache(artist);
    cacheUniqueFindersCache(artist);
    return artist;
}
Also used : ArtistModelImpl(org.liferay.jukebox.model.impl.ArtistModelImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArtistException(org.liferay.jukebox.NoSuchArtistException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 2 with ArtistModelImpl

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

the class ArtistPersistenceImpl method cacheUniqueFindersCache.

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

Example 3 with ArtistModelImpl

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

the class ArtistPersistenceImpl method clearUniqueFindersCache.

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

Aggregations

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