summaryrefslogtreecommitdiffstats
blob: f1f9ac5f61ba29f75bb33824b21bb7071a71f3c0 (plain)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*******************************************************************************
 * Copyright (c) 2010 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.branch.management.change;

import org.eclipse.osee.framework.core.enums.ConflictStatus;
import org.eclipse.osee.framework.core.enums.ConflictType;
import org.eclipse.osee.framework.core.enums.StorageState;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.IOseeStorable;
import org.eclipse.osee.framework.core.model.MergeBranch;

public final class Conflict implements IOseeStorable {
   private final MergeBranch mergeBranch;
   private final ConflictStatus conflictStatus;
   private final int itemId;
   private final Long sourceGammaId;
   private final Long destinationGammaId;
   private final ConflictType conflictType;

   private StorageState storageState;
   private boolean isDirty;

   public Conflict(StorageState storageState, int itemId, ConflictType conflictType, MergeBranch mergeBranch, ConflictStatus conflictStatus, long sourceGammaId, long destinationGammaId) {
      this.mergeBranch = mergeBranch;
      this.storageState = storageState;
      this.conflictStatus = conflictStatus;
      this.itemId = itemId;
      this.conflictType = conflictType;
      this.sourceGammaId = sourceGammaId;
      this.destinationGammaId = destinationGammaId;
      this.isDirty = false;
   }

   public ConflictType getType() {
      return conflictType;
   }

   public Long getSourceGammaId() {
      return sourceGammaId;
   }

   public Long getDestinationGammaId() {
      return destinationGammaId;
   }

   @Override
   public int getId() {
      return itemId;
   }

   public MergeBranch getMergeBranch() {
      return mergeBranch;
   }

   public ConflictStatus getStatus() {
      return conflictStatus;
   }

   @Override
   public StorageState getStorageState() {
      return storageState;
   }

   @Override
   public boolean isIdValid() {
      return IOseeStorable.UNPERSISTED_VALUE != getId();
   }

   @Override
   public void setId(int uniqueId) throws OseeCoreException {
      throw new UnsupportedOperationException();
   }

   @Override
   public void clearDirty() {
      this.isDirty = false;
      this.storageState = StorageState.LOADED;
   }

   @Override
   public boolean isDirty() {
      return isDirty;
   }
}