Example usage for com.liferay.portal.kernel.dao.orm EntityCacheUtil removeResult

List of usage examples for com.liferay.portal.kernel.dao.orm EntityCacheUtil removeResult

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.dao.orm EntityCacheUtil removeResult.

Prototype

public static void removeResult(boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey) 

Source Link

Usage

From source file:at.bibbox.reactjsservice.service.persistence.ToolInformationPersistenceImpl.java

License:Open Source License

/**
 * Clears the cache for the tool information.
 *
 * <p>/*from   ww  w .  j  av  a  2s .c om*/
 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
 * </p>
 */
@Override
public void clearCache(ToolInformation toolInformation) {
    EntityCacheUtil.removeResult(ToolInformationModelImpl.ENTITY_CACHE_ENABLED, ToolInformationImpl.class,
            toolInformation.getPrimaryKey());

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
}

From source file:at.bibbox.reactjsservice.service.persistence.ToolInformationPersistenceImpl.java

License:Open Source License

@Override
public void clearCache(List<ToolInformation> toolInformations) {
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

    for (ToolInformation toolInformation : toolInformations) {
        EntityCacheUtil.removeResult(ToolInformationModelImpl.ENTITY_CACHE_ENABLED, ToolInformationImpl.class,
                toolInformation.getPrimaryKey());
    }/*from   w  w w  .  j  a  v  a2s  . c o m*/
}

From source file:at.bibbox.reactjsservice.service.persistence.ToolInformationPersistenceImpl.java

License:Open Source License

/**
 * Returns the tool information with the primary key or returns <code>null</code> if it could not be found.
 *
 * @param primaryKey the primary key of the tool information
 * @return the tool information, or <code>null</code> if a tool information with the primary key could not be found
 * @throws SystemException if a system exception occurred
 *///from w  w  w  . j  a  v a 2s  .c  o m
@Override
public ToolInformation fetchByPrimaryKey(Serializable primaryKey) throws SystemException {
    ToolInformation toolInformation = (ToolInformation) EntityCacheUtil
            .getResult(ToolInformationModelImpl.ENTITY_CACHE_ENABLED, ToolInformationImpl.class, primaryKey);

    if (toolInformation == _nullToolInformation) {
        return null;
    }

    if (toolInformation == null) {
        Session session = null;

        try {
            session = openSession();

            toolInformation = (ToolInformation) session.get(ToolInformationImpl.class, primaryKey);

            if (toolInformation != null) {
                cacheResult(toolInformation);
            } else {
                EntityCacheUtil.putResult(ToolInformationModelImpl.ENTITY_CACHE_ENABLED,
                        ToolInformationImpl.class, primaryKey, _nullToolInformation);
            }
        } catch (Exception e) {
            EntityCacheUtil.removeResult(ToolInformationModelImpl.ENTITY_CACHE_ENABLED,
                    ToolInformationImpl.class, primaryKey);

            throw processException(e);
        } finally {
            closeSession(session);
        }
    }

    return toolInformation;
}

From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.ConfigurationPersistenceImpl.java

License:Open Source License

/**
 * Clears the cache for the configuration.
 *
 * <p>//from   w  w w  .  ja  v  a2s. c  o m
 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
 * </p>
 */
@Override
public void clearCache(Configuration configuration) {
    EntityCacheUtil.removeResult(ConfigurationModelImpl.ENTITY_CACHE_ENABLED, ConfigurationImpl.class,
            configuration.getPrimaryKey());

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

    clearUniqueFindersCache(configuration);
}

From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.ConfigurationPersistenceImpl.java

License:Open Source License

@Override
public void clearCache(List<Configuration> configurations) {
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

    for (Configuration configuration : configurations) {
        EntityCacheUtil.removeResult(ConfigurationModelImpl.ENTITY_CACHE_ENABLED, ConfigurationImpl.class,
                configuration.getPrimaryKey());

        clearUniqueFindersCache(configuration);
    }//w ww . j  a  v a  2s. c  o  m
}

From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.ConfigurationPersistenceImpl.java

License:Open Source License

/**
 * Returns the configuration with the primary key or returns <code>null</code> if it could not be found.
 *
 * @param primaryKey the primary key of the configuration
 * @return the configuration, or <code>null</code> if a configuration with the primary key could not be found
 * @throws SystemException if a system exception occurred
 *///from w  w w.j av  a2s .  c  o m
@Override
public Configuration fetchByPrimaryKey(Serializable primaryKey) throws SystemException {
    Configuration configuration = (Configuration) EntityCacheUtil
            .getResult(ConfigurationModelImpl.ENTITY_CACHE_ENABLED, ConfigurationImpl.class, primaryKey);

    if (configuration == _nullConfiguration) {
        return null;
    }

    if (configuration == null) {
        Session session = null;

        try {
            session = openSession();

            configuration = (Configuration) session.get(ConfigurationImpl.class, primaryKey);

            if (configuration != null) {
                cacheResult(configuration);
            } else {
                EntityCacheUtil.putResult(ConfigurationModelImpl.ENTITY_CACHE_ENABLED, ConfigurationImpl.class,
                        primaryKey, _nullConfiguration);
            }
        } catch (Exception e) {
            EntityCacheUtil.removeResult(ConfigurationModelImpl.ENTITY_CACHE_ENABLED, ConfigurationImpl.class,
                    primaryKey);

            throw processException(e);
        } finally {
            closeSession(session);
        }
    }

    return configuration;
}

From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.FahrzeugPersistenceImpl.java

License:Open Source License

/**
 * Clears the cache for the fahrzeug.//from w w w  .j a va 2s  .c o  m
 *
 * <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.
 * </p>
 */
@Override
public void clearCache(Fahrzeug fahrzeug) {
    EntityCacheUtil.removeResult(FahrzeugModelImpl.ENTITY_CACHE_ENABLED, FahrzeugImpl.class,
            fahrzeug.getPrimaryKey());

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
}

From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.FahrzeugPersistenceImpl.java

License:Open Source License

@Override
public void clearCache(List<Fahrzeug> fahrzeugs) {
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

    for (Fahrzeug fahrzeug : fahrzeugs) {
        EntityCacheUtil.removeResult(FahrzeugModelImpl.ENTITY_CACHE_ENABLED, FahrzeugImpl.class,
                fahrzeug.getPrimaryKey());
    }/*from w  ww. ja  v  a  2s.c  om*/
}

From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.FahrzeugPersistenceImpl.java

License:Open Source License

/**
 * Returns the fahrzeug with the primary key or returns <code>null</code> if it could not be found.
 *
 * @param primaryKey the primary key of the fahrzeug
 * @return the fahrzeug, or <code>null</code> if a fahrzeug with the primary key could not be found
 * @throws SystemException if a system exception occurred
 *//*from   w w  w .  ja v a 2s. c  o m*/
@Override
public Fahrzeug fetchByPrimaryKey(Serializable primaryKey) throws SystemException {
    Fahrzeug fahrzeug = (Fahrzeug) EntityCacheUtil.getResult(FahrzeugModelImpl.ENTITY_CACHE_ENABLED,
            FahrzeugImpl.class, primaryKey);

    if (fahrzeug == _nullFahrzeug) {
        return null;
    }

    if (fahrzeug == null) {
        Session session = null;

        try {
            session = openSession();

            fahrzeug = (Fahrzeug) session.get(FahrzeugImpl.class, primaryKey);

            if (fahrzeug != null) {
                cacheResult(fahrzeug);
            } else {
                EntityCacheUtil.putResult(FahrzeugModelImpl.ENTITY_CACHE_ENABLED, FahrzeugImpl.class,
                        primaryKey, _nullFahrzeug);
            }
        } catch (Exception e) {
            EntityCacheUtil.removeResult(FahrzeugModelImpl.ENTITY_CACHE_ENABLED, FahrzeugImpl.class,
                    primaryKey);

            throw processException(e);
        } finally {
            closeSession(session);
        }
    }

    return fahrzeug;
}

From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.ObjectDataPersistenceImpl.java

License:Open Source License

/**
 * Clears the cache for the object data.
 *
 * <p>//from  www  . j  av a2 s  .c  om
 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
 * </p>
 */
@Override
public void clearCache(ObjectData objectData) {
    EntityCacheUtil.removeResult(ObjectDataModelImpl.ENTITY_CACHE_ENABLED, ObjectDataImpl.class,
            objectData.getPrimaryKey());

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

    clearUniqueFindersCache(objectData);
}