@@ -50,48 +50,56 @@ public EpiPulseExportController() {
5050
5151 public void create (Runnable callback ) {
5252
53- EpipulseEditForm createForm = new EpipulseEditForm (true );
54- createForm .setValue (EpipulseExportDto .build (UserProvider .getCurrent ().getUserReference ()));
55- final CommitDiscardWrapperComponent <EpipulseEditForm > editView = new CommitDiscardWrapperComponent <EpipulseEditForm >(
56- createForm ,
57- UiUtil .permitted (UserRight .EPIPULSE_EXPORT_CREATE ),
58- createForm .getFieldGroup ());
59-
60- editView .addCommitListener (() -> {
61- if (!createForm .getFieldGroup ().isModified ()) {
62- EpipulseExportDto dto = createForm .getValue ();
63- dto .setStatus (EpipulseExportStatus .PENDING );
64- dto .setStatusChangeDate (new Date ());
65-
66- EpipulseExportDto savedEpipulseExport = FacadeProvider .getEpipulseExportFacade ().saveEpipulseExport (dto );
67-
68- Notification notification ;
69- if (savedEpipulseExport != null ) {
70- notification = new Notification (
71- I18nProperties .getString (Strings .messageEpipulseExportCreatedCaption ),
72- I18nProperties .getString (Strings .messageEpipulseExportCreatedDescription ),
73- Notification .Type .TRAY_NOTIFICATION ,
74- true );
75- notification .setDelayMsec (-1 );
76- } else {
77- notification = new Notification (
78- "" ,
79- I18nProperties .getString (Strings .messageEpipulseExportCreatedError ),
80- Notification .Type .ERROR_MESSAGE ,
81- true );
82- notification .setDelayMsec (-1 );
83- }
84-
85- notification .show (Page .getCurrent ());
53+ boolean configured = FacadeProvider .getEpipulseExportFacade ().configured ();
54+ if (configured ) {
55+ EpipulseEditForm createForm = new EpipulseEditForm (true );
56+ createForm .setValue (EpipulseExportDto .build (UserProvider .getCurrent ().getUserReference ()));
57+ final CommitDiscardWrapperComponent <EpipulseEditForm > editView = new CommitDiscardWrapperComponent <EpipulseEditForm >(
58+ createForm ,
59+ UiUtil .permitted (UserRight .EPIPULSE_EXPORT_CREATE ),
60+ createForm .getFieldGroup ());
61+
62+ editView .addCommitListener (() -> {
63+ if (!createForm .getFieldGroup ().isModified ()) {
64+ EpipulseExportDto dto = createForm .getValue ();
65+ dto .setStatus (EpipulseExportStatus .PENDING );
66+ dto .setStatusChangeDate (new Date ());
67+
68+ EpipulseExportDto savedEpipulseExport = FacadeProvider .getEpipulseExportFacade ().saveEpipulseExport (dto );
69+
70+ Notification notification ;
71+ if (savedEpipulseExport != null ) {
72+ notification = new Notification (
73+ I18nProperties .getString (Strings .messageEpipulseExportCreatedCaption ),
74+ I18nProperties .getString (Strings .messageEpipulseExportCreatedDescription ),
75+ Notification .Type .TRAY_NOTIFICATION ,
76+ true );
77+ notification .setDelayMsec (-1 );
78+ } else {
79+ notification = new Notification (
80+ "" ,
81+ I18nProperties .getString (Strings .messageEpipulseExportCreatedError ),
82+ Notification .Type .ERROR_MESSAGE ,
83+ true );
84+ notification .setDelayMsec (-1 );
85+ }
86+
87+ notification .show (Page .getCurrent ());
88+
89+ if (callback != null ) {
90+ callback .run ();
91+ }
8692
87- if (callback != null ) {
88- callback .run ();
8993 }
94+ });
9095
91- }
92- });
93-
94- VaadinUiUtil .showModalPopupWindow (editView , I18nProperties .getString (Strings .headingCreateNewEpipulseExport ));
96+ VaadinUiUtil .showModalPopupWindow (editView , I18nProperties .getString (Strings .headingCreateNewEpipulseExport ));
97+ } else {
98+ Notification notification =
99+ new Notification ("" , I18nProperties .getString (Strings .messageEpipulseInvalidConfigError ), Notification .Type .ERROR_MESSAGE , true );
100+ notification .setDelayMsec (-1 );
101+ notification .show (Page .getCurrent ());
102+ }
95103 }
96104
97105 public void view (EpipulseExportIndexDto exportIndexDto , Runnable callback ) {
0 commit comments