api/src/main/java/edu/utexas/tacc/tapis/files/api/resources/TransfersApiResource.java
private Response validateSystems(TransferTaskRequest transferTaskRequest, AuthenticatedUser user)
  {
    var errMessages = new ArrayList<String>();
    // If no transferTask elements we are done
    if (transferTaskRequest.getElements().isEmpty()) return null;
    // Collect sets of src and dest systems
    var allSystems = new HashSet<String>();
    for (TransferTaskRequestElement txfrElement : transferTaskRequest.getElements())
    {
      String srcId = txfrElement.getSourceURI().getSystemId();
      String dstId = txfrElement.getDestinationURI().getSystemId();
      if (!StringUtils.isBlank(srcId)) allSystems.add(srcId);
      if (!StringUtils.isBlank(dstId)) allSystems.add(dstId);
    }

    // Collect and log a list of any errors
    for (String sysId : allSystems) { validateSystemForTxfr(sysId, user, errMessages); }
    // If we have any errors log a message and return BAD_REQUEST response.
    if (!errMessages.isEmpty()) {
      // Construct message reporting all errors
      String allErrors = getListOfErrors(user, transferTaskRequest.getTag(), errMessages);
      log.error(allErrors);
      return Response.status(Response.Status.BAD_REQUEST).entity(TapisRestUtils.createErrorResponse(allErrors, true)).build();
    }
    return null;
  }
/**
   * Check that all source and destination systems referenced in a TransferRequest exist and are enabled.
   *
   * @param transferTaskRequest - Request to check
   * @param user - AuthenticatedUser, contains user info needed to fetch systems
   * @return null if all OK, BAD_REQUEST response if there are any missing or disabled systems
   */
Check that all source and destination systems referenced in a TransferRequest exist and are enabled.
@param transferTaskRequest - Request to check
@param user - AuthenticatedUser, contains user info needed to fetch systems
@return null if all OK, BAD_REQUEST response if there are any missing or disabled systems
Check that all source and destination systems referenced in a TransferRequest exist and are enabled . @param transferTaskRequest - Request to check @param user - AuthenticatedUser contains user info needed to fetch systems @return null if all OK BAD_REQUEST response if there are any missing or disabled systems
private Response validateSystems(TransferTaskRequest transferTaskRequest, AuthenticatedUser user)
  {
    var errMessages = new ArrayList<String>();
    if (transferTaskRequest.getElements().isEmpty()) return null;
    var allSystems = new HashSet<String>();
    for (TransferTaskRequestElement txfrElement : transferTaskRequest.getElements())
    {
      String srcId = txfrElement.getSourceURI().getSystemId();
      String dstId = txfrElement.getDestinationURI().getSystemId();
      if (!StringUtils.isBlank(srcId)) allSystems.add(srcId);
      if (!StringUtils.isBlank(dstId)) allSystems.add(dstId);
    }
    for (String sysId : allSystems) { validateSystemForTxfr(sysId, user, errMessages); }
    if (!errMessages.isEmpty()) {
      String allErrors = getListOfErrors(user, transferTaskRequest.getTag(), errMessages);
      log.error(allErrors);
      return Response.status(Response.Status.BAD_REQUEST).entity(TapisRestUtils.createErrorResponse(allErrors, true)).build();
    }
    return null;
  }
private Response validateSystems ( TransferTaskRequest transferTaskRequest , AuthenticatedUser user ) { var errMessages = new ArrayList < String > ( ) ; if ( transferTaskRequest . getElements ( ) . isEmpty ( ) ) return null ; var allSystems = new HashSet < String > ( ) ; for ( TransferTaskRequestElement txfrElement : transferTaskRequest . getElements ( ) ) { String srcId = txfrElement . getSourceURI ( ) . getSystemId ( ) ; String dstId = txfrElement . getDestinationURI ( ) . getSystemId ( ) ; if ( ! StringUtils . isBlank ( srcId ) ) allSystems . add ( srcId ) ; if ( ! StringUtils . isBlank ( dstId ) ) allSystems . add ( dstId ) ; } for ( String sysId : allSystems ) { validateSystemForTxfr ( sysId , user , errMessages ) ; } if ( ! errMessages . isEmpty ( ) ) { String allErrors = getListOfErrors ( user , transferTaskRequest . getTag ( ) , errMessages ) ; log . error ( allErrors ) ; return Response . status ( Response . Status . BAD_REQUEST ) . entity ( TapisRestUtils . createErrorResponse ( allErrors , true ) ) . build ( ) ; } return null ; }
Check that all source and destination systems referenced in a TransferRequest exist and are enabled.
Check that all source and destination systems referenced in a TransferRequest exist and are enabled .
// If no transferTask elements we are done // Collect sets of src and dest systems // Collect and log a list of any errors // If we have any errors log a message and return BAD_REQUEST response. // Construct message reporting all errors