@@ -80,6 +80,10 @@ public Result<DataFlow> getById(String dataFlowId) {
8080 return store .findById (dataFlowId );
8181 }
8282
83+ public Result <Void > save (DataFlow dataFlow ) {
84+ return store .save (dataFlow );
85+ }
86+
8387 public Result <DataFlowStatusResponseMessage > status (String dataFlowId ) {
8488 return store .findById (dataFlowId )
8589 .map (f -> new DataFlowStatusResponseMessage (f .getId (), f .getState ().name ()));
@@ -113,7 +117,7 @@ public Result<DataFlowResponseMessage> prepare(DataFlowPrepareMessage message) {
113117 response = new DataFlowResponseMessage (id , null , initialDataFlow .getState ().name (), null );
114118 }
115119
116- return store . save (dataFlow ).map (it -> response );
120+ return save (dataFlow ).map (it -> response );
117121 });
118122 }
119123
@@ -144,7 +148,7 @@ public Result<DataFlowResponseMessage> start(DataFlowStartMessage message) {
144148 } else {
145149 response = new DataFlowResponseMessage (id , null , dataFlow .getState ().name (), null );
146150 }
147- return store . save (dataFlow ).map (it -> response );
151+ return save (dataFlow ).map (it -> response );
148152 });
149153 }
150154
@@ -191,7 +195,7 @@ public Result<Void> notifyCompleted(String dataFlowId) {
191195 var successful = response .statusCode () >= 200 && response .statusCode () < 300 ;
192196 if (successful ) {
193197 dataFlow .transitionToCompleted ();
194- return store . save (dataFlow );
198+ return save (dataFlow );
195199 }
196200
197201 return Result .failure (new DataFlowNotifyCompletedFailed (response ));
@@ -220,7 +224,7 @@ public Result<Void> notifyErrored(String dataFlowId, Throwable throwable) {
220224 var successful = response .statusCode () >= 200 && response .statusCode () < 300 ;
221225 if (successful ) {
222226 dataFlow .transitionToTerminated (throwable .getMessage ());
223- return store . save (dataFlow );
227+ return save (dataFlow );
224228 }
225229
226230 return Result .failure (new DataFlowNotifyErroredFailed (response ));
@@ -236,7 +240,7 @@ public Result<Void> started(String flowId, DataFlowStartedNotificationMessage st
236240 .compose (onStarted ::action )
237241 .compose (dataFlow -> {
238242 dataFlow .transitionToStarted ();
239- return store . save (dataFlow );
243+ return save (dataFlow );
240244 });
241245 }
242246
@@ -250,7 +254,7 @@ public Result<Void> completed(String flowId) {
250254 return store .findById (flowId ).compose (onCompleted ::action )
251255 .compose (dataFlow -> {
252256 dataFlow .transitionToCompleted ();
253- return store . save (dataFlow );
257+ return save (dataFlow );
254258 });
255259 }
256260
0 commit comments