public void intercept(IEntityForm aForm, Object aEntity, InterceptorContext aContext) { PrescriptListForm form = (PrescriptListForm) aForm; PrescriptList prescriptList = (PrescriptList) aEntity; prescriptList.setCreateUsername(aContext.getSessionContext().getCallerPrincipal().toString()); java.sql.Date cur = new java.sql.Date(new java.util.Date().getTime()); prescriptList.setCreateDate(cur); prescriptList.setEditDate(cur); ModePrescriptionForm modeForm = form.getModeForm(); // Сохранение режима if (aContext .getSessionContext() .isCallerInRole("/Policy/Mis/Prescription/ModePrescription/Create") && modeForm != null && modeForm.getModePrescription() != null && !modeForm.equals(Long.valueOf(0)) && modeForm.getPlanStartDate() != null && !modeForm.getPlanStartDate().equals("")) { modeForm.setPrescriptionList(prescriptList.getId()); try { EjbInjection.getInstance().getLocalService(IParentEntityFormService.class).create(modeForm); } catch (Exception e) { } } DietPrescriptionForm dietForm = form.getDietForm(); // Сохранение диеты if (aContext .getSessionContext() .isCallerInRole("/Policy/Mis/Prescription/DietPrescription/Create") && dietForm != null && dietForm.getDiet() != null && !dietForm.getDiet().equals(Long.valueOf(0)) && dietForm.getPlanStartDate() != null && !dietForm.getPlanStartDate().equals("")) { dietForm.setPrescriptionList(prescriptList.getId()); try { EjbInjection.getInstance().getLocalService(IParentEntityFormService.class).create(dietForm); } catch (Exception e) { } } // Сохранение назначение лекарственных средств }