Skip to main content
summaryrefslogtreecommitdiffstats
blob: b203298348879f83bf36bae458cff40453087f41 (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
/*
 * Created on Mar 31, 2010
 *
 * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
 */
package org.eclipse.osee.framework.messaging.event.res.event;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.osee.framework.core.enums.ModificationType;

/**
 * This class maps attribute modification types to event guids.<br>
 * <br>
 * TODO Should probably replace Modification Type or integrate guids in, but can't do cause ModificationType is
 * serializeable and can't change till 0.9.5
 * 
 * @author Donald G. Dunne
 */
public class AttributeEventModificationType {

   private final ModificationType modificationType;
   private final String guid;
   private static Map<ModificationType, AttributeEventModificationType> modTypeToEventType =
         new HashMap<ModificationType, AttributeEventModificationType>(15);
   private static Map<String, AttributeEventModificationType> guidToEventType =
         new HashMap<String, AttributeEventModificationType>(15);
   public static AttributeEventModificationType Modified =
         new AttributeEventModificationType(ModificationType.MODIFIED, "AYsmVz6VujxZxW3ByjgA");
   public static AttributeEventModificationType Artifact_Deleted =
         new AttributeEventModificationType(ModificationType.ARTIFACT_DELETED, "AYsmWPvkJyoo4ynjAbgA");
   public static AttributeEventModificationType Deleted =
         new AttributeEventModificationType(ModificationType.DELETED, "AYsmWPxw7mAFrGVGf2AA");
   public static AttributeEventModificationType Introduced =
         new AttributeEventModificationType(ModificationType.INTRODUCED, "AYsmWPzUPCGfOdH5w3wA");
   public static AttributeEventModificationType Merged =
         new AttributeEventModificationType(ModificationType.MERGED, "AYsmWP0Gb1y5V6G9tRwA");
   public static AttributeEventModificationType New =
         new AttributeEventModificationType(ModificationType.NEW, "AYsmWP05uX1Dl6q2pIwA");
   public static AttributeEventModificationType Undeleted =
         new AttributeEventModificationType(ModificationType.UNDELETED, "AYsmWP1q1B2bK1kj0ugA");

   public AttributeEventModificationType(ModificationType modificationType, String guid) {
      this.modificationType = modificationType;
      this.guid = guid;
      modTypeToEventType.put(this.modificationType, this);
      guidToEventType.put(guid, this);
   }

   public static Collection<AttributeEventModificationType> getTypes() {
      return modTypeToEventType.values();
   }

   public static AttributeEventModificationType getType(ModificationType modificationType) {
      return modTypeToEventType.get(modificationType);
   }

   public static AttributeEventModificationType getType(String guid) {
      return guidToEventType.get(guid);
   }

   public ModificationType getModificationType() {
      return modificationType;
   }

   public String getGuid() {
      return guid;
   }
}

Back to the top