blob: 18e1220d57c02fa4b838869df6e79267c4e1aaf7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/*******************************************************************************
* Copyright (c) 2004, 2007 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.conflict;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.ConflictStatus;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.revision.ConflictManagerInternal;
/**
* @author Donald G. Dunne
*/
public class ConflictManagerExternal {
private static final IProgressMonitor monitor = new NullProgressMonitor();
private final Branch destinationBranch;
private final Branch sourceBranch;
private List<Conflict> originalConflicts;
public ConflictManagerExternal(IOseeBranch destinationBranch, IOseeBranch sourceBranch) throws OseeCoreException {
this.destinationBranch = BranchManager.getBranch(destinationBranch);
this.sourceBranch = BranchManager.getBranch(sourceBranch);
}
public List<Conflict> getOriginalConflicts() throws OseeCoreException {
if (originalConflicts == null) {
originalConflicts =
ConflictManagerInternal.getConflictsPerBranch(sourceBranch, destinationBranch,
sourceBranch.getBaseTransaction(), monitor);
}
return originalConflicts;
}
public boolean originalConflictsExist() throws OseeCoreException {
return !getOriginalConflicts().isEmpty();
}
public List<Conflict> getRemainingConflicts() throws OseeCoreException {
List<Conflict> remainingConflicts = new ArrayList<Conflict>();
for (Conflict conflict : getOriginalConflicts()) {
ConflictStatus status = conflict.getStatus();
if (!status.isResolved() && !status.isCommitted() && !status.isInformational()) {
remainingConflicts.add(conflict);
}
}
return remainingConflicts;
}
public boolean remainingConflictsExist() throws OseeCoreException {
return !getRemainingConflicts().isEmpty();
}
public Branch getDestinationBranch() {
return destinationBranch;
}
public Branch getSourceBranch() {
return sourceBranch;
}
}
|