@Override public ShoppingItemField updateImpl( com.liferay.portlet.shopping.model.ShoppingItemField shoppingItemField) throws SystemException { shoppingItemField = toUnwrappedModel(shoppingItemField); boolean isNew = shoppingItemField.isNew(); ShoppingItemFieldModelImpl shoppingItemFieldModelImpl = (ShoppingItemFieldModelImpl) shoppingItemField; Session session = null; try { session = openSession(); if (shoppingItemField.isNew()) { session.save(shoppingItemField); shoppingItemField.setNew(false); } else { session.merge(shoppingItemField); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); if (isNew || !ShoppingItemFieldModelImpl.COLUMN_BITMASK_ENABLED) { FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } else { if ((shoppingItemFieldModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID.getColumnBitmask()) != 0) { Object[] args = new Object[] {Long.valueOf(shoppingItemFieldModelImpl.getOriginalItemId())}; FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ITEMID, args); FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID, args); args = new Object[] {Long.valueOf(shoppingItemFieldModelImpl.getItemId())}; FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_ITEMID, args); FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_ITEMID, args); } } EntityCacheUtil.putResult( ShoppingItemFieldModelImpl.ENTITY_CACHE_ENABLED, ShoppingItemFieldImpl.class, shoppingItemField.getPrimaryKey(), shoppingItemField); return shoppingItemField; }
protected ShoppingItemField toUnwrappedModel(ShoppingItemField shoppingItemField) { if (shoppingItemField instanceof ShoppingItemFieldImpl) { return shoppingItemField; } ShoppingItemFieldImpl shoppingItemFieldImpl = new ShoppingItemFieldImpl(); shoppingItemFieldImpl.setNew(shoppingItemField.isNew()); shoppingItemFieldImpl.setPrimaryKey(shoppingItemField.getPrimaryKey()); shoppingItemFieldImpl.setItemFieldId(shoppingItemField.getItemFieldId()); shoppingItemFieldImpl.setItemId(shoppingItemField.getItemId()); shoppingItemFieldImpl.setName(shoppingItemField.getName()); shoppingItemFieldImpl.setValues(shoppingItemField.getValues()); shoppingItemFieldImpl.setDescription(shoppingItemField.getDescription()); return shoppingItemFieldImpl; }