code: @Override
      public void beforeStep(StepExecution stepExecution) {
          super.beforeStep(stepExecution);
          try {
              RestoreStatus newStatus = RestoreStatus.TRANSFERRING_TO_DURACLOUD;
              restoreManager.transitionRestoreStatus(restorationId, newStatus, "");
              Space space = this.contentStore.getSpace(destinationSpaceId, null, 1, null);
              if (!CollectionUtils.isEmpty(space.getContentIds())) {
                  stepExecution.addFailureException(new RuntimeException("destination space "
                                                                         + destinationSpaceId +
                                                                         " must be empty to receive restored content"));
              }
          } catch (NotFoundException ex) {
              try {
                  this.contentStore.createSpace(destinationSpaceId);
              } catch (ContentStoreException e) {
                  addError(ex.getMessage());
                  stepExecution.addFailureException(e);
              }
          } catch (Exception ex) {
              addError(ex.getMessage());
              stepExecution.addFailureException(ex);
          }
      }
docs: /*
  (non-Javadoc)
  
  @see org.springframework.batch.core.StepExecutionListener#beforeStep(org.
  springframework.batch.core.StepExecution)