Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2020-08-10 15:52:17 +0000
committerRyan T. Baldwin2020-08-10 15:52:17 +0000
commit4318c778a95435eb44bfd63cceedd5c67a02ef68 (patch)
treea093274df0d7b7e679f2bd3bd3eaafc02ad9bf8b /plugins/org.eclipse.osee.framework.core.model
parent0d0ceb2f875db0728d5981a0173dedfcbf32476e (diff)
downloadorg.eclipse.osee-4318c778a95435eb44bfd63cceedd5c67a02ef68.tar.gz
org.eclipse.osee-4318c778a95435eb44bfd63cceedd5c67a02ef68.tar.xz
org.eclipse.osee-4318c778a95435eb44bfd63cceedd5c67a02ef68.zip
feature[TW15833]: Convert ChangeType to OseeEnum
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.model')
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItem.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java8
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeType.java64
3 files changed, 59 insertions, 17 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItem.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItem.java
index 4aead0ebb9a..1014f374fab 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItem.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItem.java
@@ -29,7 +29,7 @@ import org.eclipse.osee.framework.jdk.core.util.Conditions;
public class ChangeItem implements Comparable<ChangeItem> {
private ChangeIgnoreType ignoreType = ChangeIgnoreType.SENTINEL;
- private ChangeType changeType = ChangeType.UNKNOWN_CHANGE;
+ private ChangeType changeType = ChangeType.Unknown;
private ArtifactId artId = ArtifactId.SENTINEL;
private Id itemId = Id.valueOf(Id.SENTINEL);
private Id itemTypeId = Id.valueOf(Id.SENTINEL);
@@ -173,7 +173,7 @@ public class ChangeItem implements Comparable<ChangeItem> {
@Override
public String toString() {
String artIdBStr = "";
- if (getChangeType() == ChangeType.RELATION_CHANGE) {
+ if (getChangeType().isRelationChange()) {
artIdBStr = " artBId: " + getArtIdB();
}
return String.format(
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java
index 7ee996cf1bb..a76fc1c5026 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java
@@ -44,7 +44,7 @@ public final class ChangeItemUtil {
public static ChangeItem newArtifactChange(ArtifactId artId, ArtifactTypeId artTypeId, GammaId currentSourceGammaId, ModificationType currentSourceModType, ApplicabilityToken appToken) {
ChangeItem item = new ChangeItem();
- item.setChangeType(ChangeType.ARTIFACT_CHANGE);
+ item.setChangeType(ChangeType.Artifact);
item.setItemId(artId);
item.setItemTypeId(artTypeId);
@@ -61,7 +61,7 @@ public final class ChangeItemUtil {
public static ChangeItem newAttributeChange(AttributeId attrId, AttributeTypeId attrTypeId, ArtifactId artId, GammaId currentSourceGammaId, ModificationType currentSourceModType, String value, ApplicabilityToken appToken) {
ChangeItem item = new ChangeItem();
- item.setChangeType(ChangeType.ATTRIBUTE_CHANGE);
+ item.setChangeType(ChangeType.Attribute);
item.setItemId(attrId);
item.setItemTypeId(attrTypeId);
@@ -79,7 +79,7 @@ public final class ChangeItemUtil {
public static ChangeItem newRelationChange(RelationId relLinkId, RelationTypeToken relTypeId, GammaId currentSourceGammaId, ModificationType currentSourceModType, ArtifactId aArtId, ArtifactId bArtId, String rationale, ApplicabilityToken appToken) {
ChangeItem item = new ChangeItem();
- item.setChangeType(ChangeType.RELATION_CHANGE);
+ item.setChangeType(ChangeType.Relation);
item.setItemId(relLinkId);
item.setItemTypeId(relTypeId);
@@ -98,7 +98,7 @@ public final class ChangeItemUtil {
public static ChangeItem newTupleChange(TupleTypeId tupleTypeId, GammaId gammaId, ApplicabilityToken appToken, ModificationType currentSourceModType, Long... e) {
ChangeItem item = new ChangeItem();
- item.setChangeType(ChangeType.TUPLE_CHANGE);
+ item.setChangeType(ChangeType.Tuple);
item.setItemId(gammaId);
item.setItemTypeId(tupleTypeId);
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeType.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeType.java
index e1c5c622b42..d6c407f5605 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeType.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeType.java
@@ -13,29 +13,71 @@
package org.eclipse.osee.framework.core.model.change;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.eclipse.osee.framework.core.enums.OseeEnum;
+
/**
* @author Roberto E. Escobar
+ * @author Donald G. Dunne
*/
-public enum ChangeType {
- ARTIFACT_CHANGE,
- ATTRIBUTE_CHANGE,
- RELATION_CHANGE,
- TUPLE_CHANGE,
- UNKNOWN_CHANGE;
+public class ChangeType extends OseeEnum {
+
+ private static final Long ENUM_ID = 2834799904L;
+
+ public static ChangeType Artifact = new ChangeType(111L, "ArtifactChange");
+ public static ChangeType Attribute = new ChangeType(222L, "AttributeChange");
+ public static ChangeType Relation = new ChangeType(333L, "RelationChange");
+ public static ChangeType Tuple = new ChangeType(444L, "TupleChange");
+ public static ChangeType Unknown = new ChangeType(555L, "UnknownChange");
+
+ public ChangeType() {
+ super(ENUM_ID, -1L, "");
+ }
+
+ public ChangeType(String name) {
+ super(ENUM_ID, name);
+ }
+
+ public ChangeType(long id, String name) {
+ super(ENUM_ID, id, name);
+ }
+ @JsonIgnore
public boolean isArtifactChange() {
- return this == ARTIFACT_CHANGE;
+ return this.equals(Artifact);
}
+ @JsonIgnore
public boolean isAttributeChange() {
- return this == ATTRIBUTE_CHANGE;
+ return this.equals(Attribute);
}
+ @JsonIgnore
public boolean isRelationChange() {
- return this == RELATION_CHANGE;
+ return this.equals(Relation);
}
+ @JsonIgnore
public boolean isTupleChange() {
- return this == TUPLE_CHANGE;
+ return this.equals(Tuple);
+ }
+
+ @Override
+ public Long getTypeId() {
+ return ENUM_ID;
+ }
+
+ @JsonIgnore
+ @Override
+ public OseeEnum getDefault() {
+ return Unknown;
+ }
+
+ public boolean isNotRelationChange() {
+ return !isRelationChange();
+ }
+
+ public boolean isNotAttributeChange() {
+ return !isAttributeChange();
}
-} \ No newline at end of file
+}

Back to the top