PushResult.java

  1. /*
  2.  * Copyright (C) 2009, Google Inc.
  3.  * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
  4.  * Copyright (C) 2009, Robin Rosenberg <robin.rosenberg@dewire.com> and others
  5.  *
  6.  * This program and the accompanying materials are made available under the
  7.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  8.  * https://www.eclipse.org/org/documents/edl-v10.php.
  9.  *
  10.  * SPDX-License-Identifier: BSD-3-Clause
  11.  */

  12. package org.eclipse.jgit.transport;

  13. import java.util.Collection;
  14. import java.util.Collections;
  15. import java.util.Map;

  16. /**
  17.  * Result of push operation to the remote repository. Holding information of
  18.  * {@link org.eclipse.jgit.transport.OperationResult} and remote refs updates
  19.  * status.
  20.  *
  21.  * @see Transport#push(org.eclipse.jgit.lib.ProgressMonitor, Collection)
  22.  */
  23. public class PushResult extends OperationResult {
  24.     private Map<String, RemoteRefUpdate> remoteUpdates = Collections.emptyMap();

  25.     /**
  26.      * Get status of remote refs updates. Together with
  27.      * {@link #getAdvertisedRefs()} it provides full description/status of each
  28.      * ref update.
  29.      * <p>
  30.      * Returned collection is not sorted in any order.
  31.      * </p>
  32.      *
  33.      * @return collection of remote refs updates
  34.      */
  35.     public Collection<RemoteRefUpdate> getRemoteUpdates() {
  36.         return Collections.unmodifiableCollection(remoteUpdates.values());
  37.     }

  38.     /**
  39.      * Get status of specific remote ref update by remote ref name. Together
  40.      * with {@link #getAdvertisedRef(String)} it provide full description/status
  41.      * of this ref update.
  42.      *
  43.      * @param refName
  44.      *            remote ref name
  45.      * @return status of remote ref update
  46.      */
  47.     public RemoteRefUpdate getRemoteUpdate(String refName) {
  48.         return remoteUpdates.get(refName);
  49.     }

  50.     void setRemoteUpdates(
  51.             final Map<String, RemoteRefUpdate> remoteUpdates) {
  52.         this.remoteUpdates = remoteUpdates;
  53.     }
  54. }