/** * Creates a new shopping item field with the primary key. Does not add the shopping item field to * the database. * * @param itemFieldId the primary key for the new shopping item field * @return the new shopping item field */ public ShoppingItemField create(long itemFieldId) { ShoppingItemField shoppingItemField = new ShoppingItemFieldImpl(); shoppingItemField.setNew(true); shoppingItemField.setPrimaryKey(itemFieldId); return shoppingItemField; }
@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; }
public ShoppingItemField addShoppingItemField(ShoppingItemField model) throws SystemException { ShoppingItemField shoppingItemField = new ShoppingItemFieldImpl(); shoppingItemField.setNew(true); shoppingItemField.setItemFieldId(model.getItemFieldId()); shoppingItemField.setItemId(model.getItemId()); shoppingItemField.setName(model.getName()); shoppingItemField.setValues(model.getValues()); shoppingItemField.setDescription(model.getDescription()); return shoppingItemFieldPersistence.update(shoppingItemField); }