/**
   * Generates workflow step to remove volumes from ExportMask.
   *
   * @param workflow
   * @param previousStep
   * @param exportGroup
   * @param exportMask
   * @param completer
   * @return
   */
  public String generateWorkflowStepToToRemoveVolumesFromExportMask(
      Workflow workflow,
      String previousStep,
      ExportGroup exportGroup,
      ExportMask exportMask,
      List<URI> volumesToRemove,
      ExportTaskCompleter completer) {
    URI exportGroupURI = exportGroup.getId();

    String stepId = workflow.createStepId();
    ExportTaskCompleter exportTaskCompleter;
    if (completer != null) {
      exportTaskCompleter = completer;
      exportTaskCompleter.setOpId(stepId);
    } else {
      exportTaskCompleter =
          new ExportMaskRemoveVolumeCompleter(
              exportGroupURI, exportMask.getId(), volumesToRemove, stepId);
    }

    Workflow.Method removeVolumesFromExportMaskExecuteMethod =
        new Workflow.Method(
            "doExportGroupToCleanVolumesInExportMask",
            exportGroupURI,
            exportMask.getId(),
            volumesToRemove,
            exportTaskCompleter);

    stepId =
        workflow.createStep(
            EXPORT_MASK_CLEANUP_TASK,
            String.format(
                "ExportMask to removeVolumes %s (%s)",
                exportMask.getMaskName(), exportMask.getId().toString()),
            previousStep,
            NullColumnValueGetter.getNullURI(),
            "storage-system",
            MaskingWorkflowEntryPoints.class,
            removeVolumesFromExportMaskExecuteMethod,
            null,
            stepId);

    return stepId;
  }
  /**
   * Generates workflow step to Mark ExportMask inActive.
   *
   * @param workflow
   * @param previousStep
   * @param exportGroup
   * @param exportMask
   * @param completer
   * @return
   */
  public String generateWorkflowStepToMarkExportMaskInActive(
      Workflow workflow,
      String previousStep,
      ExportGroup exportGroup,
      ExportMask exportMask,
      ExportTaskCompleter completer) {
    URI exportGroupURI = exportGroup.getId();

    String stepId = workflow.createStepId();
    ExportTaskCompleter exportTaskCompleter;
    if (completer != null) {
      exportTaskCompleter = completer;
      exportTaskCompleter.setOpId(stepId);
    } else {
      exportTaskCompleter =
          new ExportMaskDeleteCompleter(exportGroupURI, exportMask.getId(), stepId);
    }

    Workflow.Method markExportMaskInActiveExecuteMethod =
        new Workflow.Method(
            "doExportGroupToCleanExportMask",
            exportGroupURI,
            exportMask.getId(),
            exportTaskCompleter);

    stepId =
        workflow.createStep(
            EXPORT_MASK_CLEANUP_TASK,
            String.format(
                "Marking exportmasks to inactive %s (%s)",
                exportMask.getMaskName(), exportMask.getId().toString()),
            previousStep,
            NullColumnValueGetter.getNullURI(),
            "storage-system",
            MaskingWorkflowEntryPoints.class,
            markExportMaskInActiveExecuteMethod,
            null,
            stepId);

    return stepId;
  }
  @Override
  protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded)
      throws DeviceControllerException {
    try {

      _log.info(
          String.format(
              "Done ExportMaskDelete - Id: %s, OpId: %s, status: %s",
              getId().toString(), getOpId(), status.name()));
    } catch (Exception e) {
      _log.error(
          String.format(
              "Failed updating status for ExportMaskDelete - Id: %s, OpId: %s",
              getId().toString(), getOpId()),
          e);
    } finally {
      super.complete(dbClient, status, coded);
    }
  }