/** * Removes the specified product from the database. * * @param product * @throws com.liferay.portal.kernel.exception.PortalException * @throws com.liferay.portal.kernel.exception.SystemException */ public void deleteServiceTime(LPServiceTimer timer) throws PortalException, SystemException { resourceLocalService.deleteResource( timer.getBillId(), LPServiceTimer.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, timer.getPrimaryKey()); lpServiceTimerPersistence.remove(timer); }
public LPServiceTimer addServiceTimer(LPServiceTimer newTime, long userId) throws SystemException, PortalException { LPServiceTimer timer = lpServiceTimerPersistence.create( counterLocalService.increment(LPServiceTimer.class.getName())); timer.setBillId(newTime.getBillId()); timer.setClientId(newTime.getClientId()); timer.setMatterId(newTime.getMatterId()); timer.setStartTime(newTime.getStartTime()); timer.setStopTime(newTime.getStopTime()); Date startTime = newTime.getStartTime(); Date stopTime = newTime.getStopTime(); timer.setHourSpent(startTime.getTime() - stopTime.getTime()); timer.setCreateDate(new Date()); resourceLocalService.addResources( newTime.getBillId(), newTime.getClientId(), userId, LPServiceTimer.class.getName(), timer.getPrimaryKey(), false, true, true); return lpServiceTimerPersistence.update(timer, false); }