public void customizeNotification(CustomerInquiry customerInquiry, String amount, String unit) { int span = Integer.valueOf(amount); if (unit.equalsIgnoreCase("days")) { span = Integer.valueOf(amount) * 24; } CustomerInquiry ci = getCustomerInquiry( customerInquiry.getCustomer().getName(), customerInquiry.getInquiry().getType(), customerInquiry.getSubject(), customerInquiry.getResponse()); ci.setNotificationSpan(span); entityManager.persist(ci); entityManager.flush(); }