@Override public Quota updateImpl(org.lsug.quota.model.Quota quota, boolean merge) throws SystemException { quota = toUnwrappedModel(quota); boolean isNew = quota.isNew(); QuotaModelImpl quotaModelImpl = (QuotaModelImpl) quota; Session session = null; try { session = openSession(); BatchSessionUtil.update(session, quota, merge); quota.setNew(false); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); if (isNew || !QuotaModelImpl.COLUMN_BITMASK_ENABLED) { FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } EntityCacheUtil.putResult( QuotaModelImpl.ENTITY_CACHE_ENABLED, QuotaImpl.class, quota.getPrimaryKey(), quota); if (isNew) { FinderCacheUtil.putResult( FINDER_PATH_FETCH_BY_CLASSNAMEIDCLASSPK, new Object[] {Long.valueOf(quota.getClassNameId()), Long.valueOf(quota.getClassPK())}, quota); } else { if ((quotaModelImpl.getColumnBitmask() & FINDER_PATH_FETCH_BY_CLASSNAMEIDCLASSPK.getColumnBitmask()) != 0) { Object[] args = new Object[] { Long.valueOf(quotaModelImpl.getOriginalClassNameId()), Long.valueOf(quotaModelImpl.getOriginalClassPK()) }; FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEIDCLASSPK, args); FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CLASSNAMEIDCLASSPK, args); FinderCacheUtil.putResult( FINDER_PATH_FETCH_BY_CLASSNAMEIDCLASSPK, new Object[] {Long.valueOf(quota.getClassNameId()), Long.valueOf(quota.getClassPK())}, quota); } } return quota; }
protected Quota toUnwrappedModel(Quota quota) { if (quota instanceof QuotaImpl) { return quota; } QuotaImpl quotaImpl = new QuotaImpl(); quotaImpl.setNew(quota.isNew()); quotaImpl.setPrimaryKey(quota.getPrimaryKey()); quotaImpl.setQuotaId(quota.getQuotaId()); quotaImpl.setClassNameId(quota.getClassNameId()); quotaImpl.setClassPK(quota.getClassPK()); quotaImpl.setQuotaAssigned(quota.getQuotaAssigned()); quotaImpl.setQuotaUsed(quota.getQuotaUsed()); quotaImpl.setQuotaStatus(quota.getQuotaStatus()); quotaImpl.setQuotaAlert(quota.getQuotaAlert()); return quotaImpl; }