View Javadoc
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  
13  package org.eclipse.jgit.transport;
14  
15  import java.util.Collection;
16  import java.util.Collections;
17  import java.util.Map;
18  
19  /**
20   * Result of push operation to the remote repository. Holding information of
21   * {@link org.eclipse.jgit.transport.OperationResult} and remote refs updates
22   * status.
23   *
24   * @see Transport#push(org.eclipse.jgit.lib.ProgressMonitor, Collection)
25   */
26  public class PushResult extends OperationResult {
27  	private Map<String, RemoteRefUpdate> remoteUpdates = Collections.emptyMap();
28  
29  	/**
30  	 * Get status of remote refs updates. Together with
31  	 * {@link #getAdvertisedRefs()} it provides full description/status of each
32  	 * ref update.
33  	 * <p>
34  	 * Returned collection is not sorted in any order.
35  	 * </p>
36  	 *
37  	 * @return collection of remote refs updates
38  	 */
39  	public Collection<RemoteRefUpdate> getRemoteUpdates() {
40  		return Collections.unmodifiableCollection(remoteUpdates.values());
41  	}
42  
43  	/**
44  	 * Get status of specific remote ref update by remote ref name. Together
45  	 * with {@link #getAdvertisedRef(String)} it provide full description/status
46  	 * of this ref update.
47  	 *
48  	 * @param refName
49  	 *            remote ref name
50  	 * @return status of remote ref update
51  	 */
52  	public RemoteRefUpdate getRemoteUpdate(String refName) {
53  		return remoteUpdates.get(refName);
54  	}
55  
56  	void setRemoteUpdates(
57  			final Map<String, RemoteRefUpdate> remoteUpdates) {
58  		this.remoteUpdates = remoteUpdates;
59  	}
60  }