public ItemType add(String name, long companyId, long groupId) throws SystemException { long itemTypeId = CounterLocalServiceUtil.increment(ItemType.class.getName()); ItemType itemType = itemTypePersistence.create(itemTypeId); itemType.setItemTypeName(name); itemType.setCompanyId(companyId); itemType.setGroupId(groupId); itemTypePersistence.update(itemType); return itemType; }
/** * Increment approved item count * * @param itemTypeId * @throws SystemException */ public void incrementApprovedCount(long itemTypeId) throws SystemException { ItemType itemType = itemTypePersistence.fetchByPrimaryKey(itemTypeId); int newCount = itemType.getApprovedCount() + 1; itemType.setApprovedCount(newCount); itemTypePersistence.update(itemType); }
/** Decrement overall item type count */ public void decrementCounter(long itemTypeId) throws SystemException { ItemType itemType = itemTypePersistence.fetchByPrimaryKey(itemTypeId); int newCount = itemType.getItemCount() - 1; itemType.setItemCount(newCount); itemTypePersistence.update(itemType); }