List of usage examples for com.liferay.portal.kernel.dao.orm EntityCacheUtil getResult
public static Serializable getResult(boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey)
From source file:at.bibbox.reactjsservice.service.persistence.ToolInformationPersistenceImpl.java
License:Open Source License
/** * Caches the tool informations in the entity cache if it is enabled. * * @param toolInformations the tool informations *//*from www. j av a2s.co m*/ @Override public void cacheResult(List<ToolInformation> toolInformations) { for (ToolInformation toolInformation : toolInformations) { if (EntityCacheUtil.getResult(ToolInformationModelImpl.ENTITY_CACHE_ENABLED, ToolInformationImpl.class, toolInformation.getPrimaryKey()) == null) { cacheResult(toolInformation); } else { toolInformation.resetOriginalValues(); } } }
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 va 2s. c om @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
/** * Caches the configurations in the entity cache if it is enabled. * * @param configurations the configurations *//*from w ww . j a va 2 s . c o m*/ @Override public void cacheResult(List<Configuration> configurations) { for (Configuration configuration : configurations) { if (EntityCacheUtil.getResult(ConfigurationModelImpl.ENTITY_CACHE_ENABLED, ConfigurationImpl.class, configuration.getPrimaryKey()) == null) { cacheResult(configuration); } else { configuration.resetOriginalValues(); } } }
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 */// w w w .j ava 2 s. c om @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
/** * Caches the fahrzeugs in the entity cache if it is enabled. * * @param fahrzeugs the fahrzeugs// www . j av a 2s .co m */ @Override public void cacheResult(List<Fahrzeug> fahrzeugs) { for (Fahrzeug fahrzeug : fahrzeugs) { if (EntityCacheUtil.getResult(FahrzeugModelImpl.ENTITY_CACHE_ENABLED, FahrzeugImpl.class, fahrzeug.getPrimaryKey()) == null) { cacheResult(fahrzeug); } else { fahrzeug.resetOriginalValues(); } } }
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 *//*w ww.j av a 2s . com*/ @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
/** * Caches the object datas in the entity cache if it is enabled. * * @param objectDatas the object datas//ww w.j a v a2s . co m */ @Override public void cacheResult(List<ObjectData> objectDatas) { for (ObjectData objectData : objectDatas) { if (EntityCacheUtil.getResult(ObjectDataModelImpl.ENTITY_CACHE_ENABLED, ObjectDataImpl.class, objectData.getPrimaryKey()) == null) { cacheResult(objectData); } else { objectData.resetOriginalValues(); } } }
From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.ObjectDataPersistenceImpl.java
License:Open Source License
/** * Returns the object data with the primary key or returns <code>null</code> if it could not be found. * * @param primaryKey the primary key of the object data * @return the object data, or <code>null</code> if a object data with the primary key could not be found * @throws SystemException if a system exception occurred *//* w ww .ja v a 2 s.com*/ @Override public ObjectData fetchByPrimaryKey(Serializable primaryKey) throws SystemException { ObjectData objectData = (ObjectData) EntityCacheUtil.getResult(ObjectDataModelImpl.ENTITY_CACHE_ENABLED, ObjectDataImpl.class, primaryKey); if (objectData == _nullObjectData) { return null; } if (objectData == null) { Session session = null; try { session = openSession(); objectData = (ObjectData) session.get(ObjectDataImpl.class, primaryKey); if (objectData != null) { cacheResult(objectData); } else { EntityCacheUtil.putResult(ObjectDataModelImpl.ENTITY_CACHE_ENABLED, ObjectDataImpl.class, primaryKey, _nullObjectData); } } catch (Exception e) { EntityCacheUtil.removeResult(ObjectDataModelImpl.ENTITY_CACHE_ENABLED, ObjectDataImpl.class, primaryKey); throw processException(e); } finally { closeSession(session); } } return objectData; }
From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.ObjectImagePersistenceImpl.java
License:Open Source License
/** * Caches the object images in the entity cache if it is enabled. * * @param objectImages the object images */// w w w. j a va 2s . c om @Override public void cacheResult(List<ObjectImage> objectImages) { for (ObjectImage objectImage : objectImages) { if (EntityCacheUtil.getResult(ObjectImageModelImpl.ENTITY_CACHE_ENABLED, ObjectImageImpl.class, objectImage.getPrimaryKey()) == null) { cacheResult(objectImage); } else { objectImage.resetOriginalValues(); } } }
From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.ObjectImagePersistenceImpl.java
License:Open Source License
/** * Returns the object image with the primary key or returns <code>null</code> if it could not be found. * * @param primaryKey the primary key of the object image * @return the object image, or <code>null</code> if a object image with the primary key could not be found * @throws SystemException if a system exception occurred *///from w w w. ja va 2 s .c o m @Override public ObjectImage fetchByPrimaryKey(Serializable primaryKey) throws SystemException { ObjectImage objectImage = (ObjectImage) EntityCacheUtil.getResult(ObjectImageModelImpl.ENTITY_CACHE_ENABLED, ObjectImageImpl.class, primaryKey); if (objectImage == _nullObjectImage) { return null; } if (objectImage == null) { Session session = null; try { session = openSession(); objectImage = (ObjectImage) session.get(ObjectImageImpl.class, primaryKey); if (objectImage != null) { cacheResult(objectImage); } else { EntityCacheUtil.putResult(ObjectImageModelImpl.ENTITY_CACHE_ENABLED, ObjectImageImpl.class, primaryKey, _nullObjectImage); } } catch (Exception e) { EntityCacheUtil.removeResult(ObjectImageModelImpl.ENTITY_CACHE_ENABLED, ObjectImageImpl.class, primaryKey); throw processException(e); } finally { closeSession(session); } } return objectImage; }