21 lines
848 B
Java
21 lines
848 B
Java
|
|
package com.cmvr.scanner;
|
||
|
|
|
||
|
|
import com.cmvr.test.flow.control.FlowDeviceLifecycleExtension;
|
||
|
|
import lombok.RequiredArgsConstructor;
|
||
|
|
import org.springframework.stereotype.Component;
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
/** A completed workflow must not release a scanner that is still acquiring. */
|
||
|
|
@Component
|
||
|
|
@RequiredArgsConstructor
|
||
|
|
public class ScannerCompletionExtension implements FlowDeviceLifecycleExtension {
|
||
|
|
private final ScannerStopExtension stop;
|
||
|
|
private final ScannerPauseExtension pauses;
|
||
|
|
@Override public void beforePause(String instId, List<String> robots) {}
|
||
|
|
@Override public void beforeResume(String instId, List<String> robots) {}
|
||
|
|
@Override public void beforeComplete(String instId, List<String> robots) {
|
||
|
|
robots.stream().filter(stop::handles).distinct().forEach(stop::stop);
|
||
|
|
pauses.afterStop(instId);
|
||
|
|
}
|
||
|
|
}
|