Class RelocationHandler

java.lang.Object
com.cloudbees.hudson.plugins.folder.relocate.RelocationHandler
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
StandardHandler

public abstract class RelocationHandler extends Object implements ExtensionPoint
Provides some kind of specialized handling for a move. Handlers are chained in extension registration order, so that some can decorate other handlers. It is also possible for a handler to send a placeholder response and schedule a move for later (keeping the rest of the handlers ready).
  • Constructor Details

    • RelocationHandler

      public RelocationHandler()
  • Method Details

    • applicability

      @NonNull public abstract RelocationHandler.HandlingMode applicability(@NonNull Item item)
      Checks quickly whether this handler might be able to move a given item.
      Parameters:
      item - an item which the user wishes to move
      Returns:
      how this handler might handle the given item
    • handle

      @CheckForNull public abstract org.kohsuke.stapler.HttpResponse handle(@NonNull Item item, @NonNull ItemGroup<?> destination, @NonNull AtomicReference<Item> newItem, @NonNull List<? extends RelocationHandler> chain) throws IOException, InterruptedException
      Possibly handles redirecting an item.
      Parameters:
      item - an item which the user wishes to move
      destination - the location the user wishes to move it to
      newItem - if moving succeeds, set this to the new item (typically same object as item)
      chain - zero or more remaining handlers which could be delegated to (may call this method on the first and pass in the rest of the chain)
      Returns:
      Failure if the move is known to not be able to proceed, or a custom response such as a redirect, or a delegated response from the first handler in the chain, or null if no HTTP response is warranted or possible
      Throws:
      IOException - if the move was attempted but failed
      InterruptedException - if the move was attempted but was interrupted
    • validDestinations

      @NonNull public abstract List<? extends ItemGroup<?>> validDestinations(@NonNull Item item)
      Gathers a list of possible destinations to which an item may be moved. The union of all destinations from various handlers is used.
      Parameters:
      item - an item which the user wishes to move
      Returns:
      potential destinations (may be empty if this handler does not need to add new kinds of destinations)