Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2017-08-24 13:32:17 -0400
committerRyan Brooks2017-08-29 15:55:41 -0400
commit1066b7ee8e3c6d4377c1d7f3c510f0239afd88f8 (patch)
treee4216caa14b6d1e23ee4bd3ae7a7af29d7098f33
parent765b760bc3ee776ba9c1cff87791bb689007a71f (diff)
downloadorg.eclipse.osee-1066b7ee8e3c6d4377c1d7f3c510f0239afd88f8.tar.gz
org.eclipse.osee-1066b7ee8e3c6d4377c1d7f3c510f0239afd88f8.tar.xz
org.eclipse.osee-1066b7ee8e3c6d4377c1d7f3c510f0239afd88f8.zip
refactor: Gracefully handel null in Id
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationCacheTest.java4
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationFilterUtilTest.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/type/TransactionRecordTest.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItem.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeId.java8
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ApplicabilityId.java7
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java10
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactTypeId.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeId.java11
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeId.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java10
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchId.java8
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/GammaId.java8
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationId.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationTypeId.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionId.java10
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple2Type.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple3Type.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple4Type.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TupleFamilyId.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TupleTypeId.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserId.java4
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/Id.java31
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParserTest.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImplTest.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AddSyntheticArtifactChangeData.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsValidationHelperAdapterTest.java2
30 files changed, 106 insertions, 80 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationCacheTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationCacheTest.java
index 48b788f8cc5..631f76d3ec3 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationCacheTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationCacheTest.java
@@ -49,8 +49,8 @@ public class RelationCacheTest {
@Rule
public OseeLogMonitorRule monitorRule = new OseeLogMonitorRule();
- private final BranchId branch1 = BranchId.valueOf(100);
- private final BranchId branch2 = BranchId.valueOf(200);
+ private final BranchId branch1 = BranchId.valueOf(100L);
+ private final BranchId branch2 = BranchId.valueOf(200L);
private final Artifact artifact1 = new Artifact(branch1);
private final Artifact artifact2 = new Artifact(branch2);
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationFilterUtilTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationFilterUtilTest.java
index df6b5719cf4..1dd248cdffb 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationFilterUtilTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationFilterUtilTest.java
@@ -42,7 +42,7 @@ public class RelationFilterUtilTest {
@Rule
public OseeLogMonitorRule monitorRule = new OseeLogMonitorRule();
- private final BranchId branch1 = BranchId.valueOf(100);
+ private final BranchId branch1 = BranchId.valueOf(100L);
private final RelationType relationType = TestUtil.createRelationType(5);
private final ArtifactId id55 = ArtifactId.valueOf(55);
private final ArtifactId id66 = ArtifactId.valueOf(66);
diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java
index 9fd4ad34b5b..e760b545616 100644
--- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java
@@ -16,8 +16,8 @@ import org.eclipse.osee.framework.core.data.IAccessContextId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.data.UserId;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.DemoUsers;
import org.eclipse.osee.framework.core.enums.PermissionEnum;
import org.eclipse.osee.framework.core.enums.RelationSorter;
import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity;
@@ -78,8 +78,8 @@ public final class MockDataFactory {
value++;
}
IOseeBranch branch = IOseeBranch.create(branchUuid, "fake test branch");
- return new TransactionRecord(value * 47L, branch, "comment_" + value, new Date(), UserId.valueOf(value * 37),
- value * 42, type);
+ return new TransactionRecord(value * 47L, branch, "comment_" + value, new Date(), DemoUsers.Joe_Smith, value * 42,
+ type);
}
public static OseeEnumEntry createEnumEntry(int index) {
diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/type/TransactionRecordTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/type/TransactionRecordTest.java
index c65ef49f94c..6ed1489c07c 100644
--- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/type/TransactionRecordTest.java
+++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/type/TransactionRecordTest.java
@@ -16,6 +16,7 @@ import java.util.Date;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.data.UserId;
+import org.eclipse.osee.framework.core.enums.DemoUsers;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.mocks.MockDataFactory;
@@ -157,10 +158,9 @@ public class TransactionRecordTest {
BranchId branch = BranchId.valueOf(index * 9L);
String comment = GUID.create();
Date time = new Date();
- UserId authorArtId = UserId.valueOf(index * 47);
int commitArtId = index * 37;
TransactionDetailsType txType = TransactionDetailsType.toEnum(index % TransactionDetailsType.values().length);
- data.add(new Object[] {transactionNumber, branch, comment, time, authorArtId, commitArtId, txType});
+ data.add(new Object[] {transactionNumber, branch, comment, time, DemoUsers.Joe_Smith, commitArtId, txType});
}
return data;
}
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 e4456eadf00..2bd55dd734e 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
@@ -34,7 +34,7 @@ public class ChangeItem implements Comparable<ChangeItem> {
private boolean synthetic = false;
private boolean isApplicabilityCopy = false;
- private ArtifactId artIdB = ArtifactId.valueOf(-1L);
+ private ArtifactId artIdB = ArtifactId.SENTINEL;
public ChangeItem() {
super();
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeId.java
index bf597a8707d..3242e379410 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeId.java
@@ -19,6 +19,10 @@ import org.eclipse.osee.framework.jdk.core.type.Id;
public interface ActivityTypeId extends Id {
ActivityTypeId SENTINEL = valueOf(Id.SENTINEL);
+ public static ActivityTypeId valueOf(String id) {
+ return Id.valueOf(id, ActivityTypeId::valueOf);
+ }
+
public static ActivityTypeId valueOf(Long id) {
final class ActivityTypeIdImpl extends BaseId implements ActivityTypeId {
public ActivityTypeIdImpl(Long id) {
@@ -27,8 +31,4 @@ public interface ActivityTypeId extends Id {
}
return new ActivityTypeIdImpl(id);
}
-
- public static ActivityTypeId valueOf(String id) {
- return valueOf(Long.valueOf(id));
- }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ApplicabilityId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ApplicabilityId.java
index d0c4ca6a62e..de2216ef61f 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ApplicabilityId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ApplicabilityId.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.data;
-import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.eclipse.osee.framework.jdk.core.type.BaseId;
import org.eclipse.osee.framework.jdk.core.type.Id;
@@ -28,11 +27,10 @@ public interface ApplicabilityId extends Id {
}
public static ApplicabilityId valueOf(String id) {
- return valueOf(Long.valueOf(id));
+ return Id.valueOf(id, ApplicabilityId::valueOf);
}
- @JsonCreator
- public static ApplicabilityId valueOf(long id) {
+ public static ApplicabilityId valueOf(Long id) {
final class ApplicabilityToken extends BaseId implements ApplicabilityId {
public ApplicabilityToken(Long txId) {
super(txId);
@@ -40,5 +38,4 @@ public interface ApplicabilityId extends Id {
}
return new ApplicabilityToken(id);
}
-
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
index acc646f0aaa..657aaacf3e2 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
@@ -22,21 +22,25 @@ import org.eclipse.osee.framework.jdk.core.type.Identity;
@JsonSerialize(using = IdSerializer.class)
public interface ArtifactId extends Identity<String>, Id {
- public static final ArtifactId SENTINEL = ArtifactId.valueOf(Id.SENTINEL);
+ public static final ArtifactId SENTINEL = valueOf(Id.SENTINEL);
default Long getUuid() {
return getId();
}
public static ArtifactId valueOf(String id) {
- return valueOf(Long.valueOf(id));
+ return Id.valueOf(id, ArtifactId::valueOf);
}
public static ArtifactId valueOf(Id id) {
return valueOf(id.getId());
}
- public static ArtifactId valueOf(long id) {
+ public static ArtifactId valueOf(int id) {
+ return valueOf(Long.valueOf(id));
+ }
+
+ public static ArtifactId valueOf(Long id) {
final class ArtifactIdImpl extends BaseId implements ArtifactId, Comparable<ArtifactId> {
public ArtifactIdImpl(Long artId) {
super(artId);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactTypeId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactTypeId.java
index 6cbeb183cb7..842e0acb2eb 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactTypeId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactTypeId.java
@@ -23,13 +23,13 @@ public interface ArtifactTypeId extends Id {
ArtifactTypeId SENTINEL = valueOf(Id.SENTINEL);
public static ArtifactTypeId valueOf(String id) {
- return valueOf(Long.valueOf(id));
+ return Id.valueOf(id, ArtifactTypeId::valueOf);
}
public static ArtifactTypeId valueOf(Long id) {
final class ArtifactTypeIdImpl extends BaseId implements ArtifactTypeId {
- public ArtifactTypeIdImpl(Long txId) {
- super(txId);
+ public ArtifactTypeIdImpl(Long id) {
+ super(id);
}
}
return new ArtifactTypeIdImpl(id);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeId.java
index 2e3518ce07a..f8d5e460ec6 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeId.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.data;
-import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.eclipse.osee.framework.jdk.core.type.BaseId;
import org.eclipse.osee.framework.jdk.core.type.Id;
@@ -24,6 +23,9 @@ public interface AttributeId extends HasLocalId<Integer>, Id {
AttributeId SENTINEL = valueOf(Id.SENTINEL);
public static AttributeId valueOf(String id) {
+ if (id == null) {
+ return valueOf((Long) null);
+ }
return valueOf(Long.valueOf(id));
}
@@ -34,8 +36,11 @@ public interface AttributeId extends HasLocalId<Integer>, Id {
return getId().intValue();
}
- @JsonCreator
- public static AttributeId valueOf(long id) {
+ public static AttributeId valueOf(int id) {
+ return valueOf(Long.valueOf(id));
+ }
+
+ public static AttributeId valueOf(Long id) {
final class AttributeIdImpl extends BaseId implements AttributeId {
public AttributeIdImpl(Long txId) {
super(txId);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeId.java
index 9afeb329e50..c8b01548a99 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeId.java
@@ -23,7 +23,7 @@ public interface AttributeTypeId extends Id {
AttributeTypeId SENTINEL = valueOf(Id.SENTINEL);
public static AttributeTypeId valueOf(String id) {
- return valueOf(Long.valueOf(id));
+ return Id.valueOf(id, AttributeTypeId::valueOf);
}
public static AttributeTypeId valueOf(Long id) {
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java
index 9279f48ddf0..c9823284de1 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.data;
-import org.codehaus.jackson.annotate.JsonCreator;
import org.eclipse.osee.framework.jdk.core.type.FullyNamed;
import org.eclipse.osee.framework.jdk.core.type.HasDescription;
import org.eclipse.osee.framework.jdk.core.type.Id;
@@ -27,12 +26,15 @@ public interface AttributeTypeToken extends AttributeTypeId, FullyNamed, HasDesc
return valueOf(Long.valueOf(id), Named.SENTINEL);
}
- public static AttributeTypeToken valueOf(long id, String name) {
+ public static AttributeTypeToken valueOf(int id, String name) {
+ return valueOf(Long.valueOf(id), name, "");
+ }
+
+ public static AttributeTypeToken valueOf(Long id, String name) {
return valueOf(id, name, "");
}
- @JsonCreator
- public static AttributeTypeToken valueOf(long id, String name, String description) {
+ public static AttributeTypeToken valueOf(Long id, String name, String description) {
final class AttributeTypeImpl extends NamedIdBase implements AttributeTypeToken {
private final String description;
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchId.java
index ecd1ac1374d..b2ddf7cb962 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchId.java
@@ -36,12 +36,12 @@ public interface BranchId extends Identity<Long>, Id {
};
public static BranchId valueOf(String id) {
- return valueOf(Long.valueOf(id));
+ return Id.valueOf(id, BranchId::valueOf);
}
- public static BranchId create(long id, ArtifactId view) {
+ public static BranchId create(Long id, ArtifactId view) {
final class BranchIdImpl extends BaseId implements BranchId {
- private ArtifactId viewId;
+ private final ArtifactId viewId;
public BranchIdImpl(Long id, ArtifactId view) {
super(id);
@@ -65,7 +65,7 @@ public interface BranchId extends Identity<Long>, Id {
return new BranchIdImpl(id, view);
}
- public static BranchId valueOf(long id) {
+ public static BranchId valueOf(Long id) {
return create(id, ArtifactId.SENTINEL);
}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/GammaId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/GammaId.java
index de28996ed09..8b048b24381 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/GammaId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/GammaId.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.data;
-import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.eclipse.osee.framework.jdk.core.type.BaseId;
import org.eclipse.osee.framework.jdk.core.type.Id;
@@ -24,11 +23,14 @@ public interface GammaId extends Id {
GammaId SENTINEL = valueOf(Id.SENTINEL);
public static GammaId valueOf(String id) {
+ return Id.valueOf(id, GammaId::valueOf);
+ }
+
+ public static GammaId valueOf(int id) {
return valueOf(Long.valueOf(id));
}
- @JsonCreator
- public static GammaId valueOf(long id) {
+ public static GammaId valueOf(Long id) {
final class GammaIdImpl extends BaseId implements GammaId {
public GammaIdImpl(Long id) {
super(id);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationId.java
index 9491ee4383c..29ac8617c03 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationId.java
@@ -23,10 +23,14 @@ public interface RelationId extends Id {
RelationId SENTINEL = valueOf(Id.SENTINEL);
public static RelationId valueOf(String id) {
- return valueOf(Long.valueOf(id));
+ return Id.valueOf(id, RelationId::valueOf);
}
public static RelationId valueOf(long id) {
+ return valueOf(Long.valueOf(id));
+ }
+
+ public static RelationId valueOf(Long id) {
final class RelationIdImpl extends BaseId implements RelationId {
public RelationIdImpl(Long txId) {
super(txId);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationTypeId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationTypeId.java
index 046e8a39a04..e2581a25293 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationTypeId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/RelationTypeId.java
@@ -23,10 +23,14 @@ public interface RelationTypeId extends Id {
RelationTypeId SENTINEL = valueOf(Id.SENTINEL);
public static RelationTypeId valueOf(String id) {
+ return Id.valueOf(id, RelationTypeId::valueOf);
+ }
+
+ public static RelationTypeId valueOf(int id) {
return valueOf(Long.valueOf(id));
}
- public static RelationTypeId valueOf(long id) {
+ public static RelationTypeId valueOf(Long id) {
final class RelationTypeIdImpl extends BaseId implements RelationTypeId {
public RelationTypeIdImpl(Long txId) {
super(txId);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionId.java
index 8ee699a16ef..25cf2028afd 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionId.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.data;
-import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.eclipse.osee.framework.jdk.core.type.BaseId;
import org.eclipse.osee.framework.jdk.core.type.Id;
@@ -24,15 +23,18 @@ public interface TransactionId extends Id {
TransactionId SENTINEL = valueOf(Id.SENTINEL);
default boolean isOlderThan(TransactionId other) {
- return getId() < other.getId();
+ return isLessThan(other);
}
public static TransactionId valueOf(String id) {
+ return Id.valueOf(id, TransactionId::valueOf);
+ }
+
+ public static TransactionId valueOf(int id) {
return valueOf(Long.valueOf(id));
}
- @JsonCreator
- public static TransactionId valueOf(long id) {
+ public static TransactionId valueOf(Long id) {
final class TransactionToken extends BaseId implements TransactionId {
public TransactionToken(Long txId) {
super(txId);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple2Type.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple2Type.java
index ff2beff02dd..4d09f738474 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple2Type.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple2Type.java
@@ -17,7 +17,7 @@ import static org.eclipse.osee.framework.core.enums.CoreTupleFamilyTypes.Default
*/
public interface Tuple2Type<E1, E2> extends TupleTypeId {
- public static <E1, E2> Tuple2Type<E1, E2> valueOf(TupleFamilyId family, long tupleTypeId) {
+ public static <E1, E2> Tuple2Type<E1, E2> valueOf(TupleFamilyId family, Long tupleTypeId) {
final class Tuple2TypeImpl extends TupleTypeImpl implements Tuple2Type<E1, E2> {
public Tuple2TypeImpl(TupleFamilyId family, Long tupleTypeId) {
super(family, tupleTypeId);
@@ -35,7 +35,7 @@ public interface Tuple2Type<E1, E2> extends TupleTypeId {
return new Tuple2TypeImpl(family, tupleTypeId);
}
- public static <E1, E2> Tuple2Type<E1, E2> valueOf(long tupleType) {
+ public static <E1, E2> Tuple2Type<E1, E2> valueOf(Long tupleType) {
return valueOf(DefaultFamily, tupleType);
}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple3Type.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple3Type.java
index 8db308af1d6..72a243de714 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple3Type.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple3Type.java
@@ -11,14 +11,13 @@
package org.eclipse.osee.framework.core.data;
import static org.eclipse.osee.framework.core.enums.CoreTupleFamilyTypes.DefaultFamily;
-import org.codehaus.jackson.annotate.JsonCreator;
/**
* @author Ryan D. Brooks
*/
public interface Tuple3Type<E1, E2, E3> extends TupleTypeId {
- public static <E1, E2, E3> Tuple3Type<E1, E2, E3> valueOf(TupleFamilyId family, long tupleTypeId) {
+ public static <E1, E2, E3> Tuple3Type<E1, E2, E3> valueOf(TupleFamilyId family, Long tupleTypeId) {
final class Tuple3TypeImpl extends TupleTypeImpl implements Tuple3Type<E1, E2, E3> {
public Tuple3TypeImpl(TupleFamilyId family, Long tupleTypeId) {
super(family, tupleTypeId);
@@ -31,8 +30,7 @@ public interface Tuple3Type<E1, E2, E3> extends TupleTypeId {
return new Tuple3TypeImpl(family, tupleTypeId);
}
- @JsonCreator
- public static <E1, E2, E3> Tuple3Type<E1, E2, E3> valueOf(long tupleTypeId) {
+ public static <E1, E2, E3> Tuple3Type<E1, E2, E3> valueOf(Long tupleTypeId) {
return valueOf(DefaultFamily, tupleTypeId);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple4Type.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple4Type.java
index 23f2f5f8a50..6693e8a6e59 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple4Type.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Tuple4Type.java
@@ -11,14 +11,13 @@
package org.eclipse.osee.framework.core.data;
import static org.eclipse.osee.framework.core.enums.CoreTupleFamilyTypes.DefaultFamily;
-import org.codehaus.jackson.annotate.JsonCreator;
/**
* @author Ryan D. Brooks
*/
public interface Tuple4Type<E1, E2, E3, E4> extends TupleTypeId {
- public static <E1, E2, E3, E4> Tuple4Type<E1, E2, E3, E4> valueOf(TupleFamilyId family, long tupleTypeId) {
+ public static <E1, E2, E3, E4> Tuple4Type<E1, E2, E3, E4> valueOf(TupleFamilyId family, Long tupleTypeId) {
final class Tuple4TypeImpl extends TupleTypeImpl implements Tuple4Type<E1, E2, E3, E4> {
public Tuple4TypeImpl(TupleFamilyId family, Long tupleTypeId) {
super(family, tupleTypeId);
@@ -31,8 +30,7 @@ public interface Tuple4Type<E1, E2, E3, E4> extends TupleTypeId {
return new Tuple4TypeImpl(family, tupleTypeId);
}
- @JsonCreator
- public static <E1, E2, E3, E4> Tuple4Type<E1, E2, E3, E4> valueOf(long tupleTypeId) {
+ public static <E1, E2, E3, E4> Tuple4Type<E1, E2, E3, E4> valueOf(Long tupleTypeId) {
return valueOf(DefaultFamily, tupleTypeId);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TupleFamilyId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TupleFamilyId.java
index 829161dd210..3850dfb83f7 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TupleFamilyId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TupleFamilyId.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.data;
-import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.eclipse.osee.framework.jdk.core.type.BaseId;
import org.eclipse.osee.framework.jdk.core.type.Id;
@@ -22,8 +21,7 @@ import org.eclipse.osee.framework.jdk.core.type.IdSerializer;
@JsonSerialize(using = IdSerializer.class)
public interface TupleFamilyId extends Id {
- @JsonCreator
- public static TupleFamilyId valueOf(long tupleFamilyTypeId) {
+ public static TupleFamilyId valueOf(Long tupleFamilyTypeId) {
final class TupleFailyTypeImpl extends BaseId implements TupleFamilyId {
public TupleFailyTypeImpl(Long tupleFamilyTypeId) {
super(tupleFamilyTypeId);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TupleTypeId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TupleTypeId.java
index 18ed3a72019..4525ee415d1 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TupleTypeId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TupleTypeId.java
@@ -20,7 +20,7 @@ import org.eclipse.osee.framework.jdk.core.type.IdSerializer;
@JsonSerialize(using = IdSerializer.class)
public interface TupleTypeId extends Id {
- public static TupleTypeId valueOf(long tupleTypeId) {
- return new TupleTypeImpl(tupleTypeId);
+ public static TupleTypeId valueOf(Long id) {
+ return new TupleTypeImpl(id);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserId.java
index 77d0db57955..98b87366d55 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserId.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.data;
-import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.jdk.core.type.BaseId;
@@ -31,8 +30,7 @@ public interface UserId extends ArtifactId {
return valueOf(Long.valueOf(id));
}
- @JsonCreator
- public static UserId valueOf(long id) {
+ public static UserId valueOf(Long id) {
final class UserIdImpl extends BaseId implements UserId {
public UserIdImpl(Long id) {
super(id);
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.jdk.core/META-INF/MANIFEST.MF
index ea6e4d9ca6a..8528ec545c7 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.jdk.core/META-INF/MANIFEST.MF
@@ -33,5 +33,6 @@ Import-Package: org.apache.commons.codec.binary,
org.codehaus.jackson.annotate,
org.codehaus.jackson.map,
org.codehaus.jackson.map.annotate,
- org.codehaus.jackson.map.ser.std
+ org.codehaus.jackson.map.ser.std,
+ org.eclipse.jdt.annotation
Require-Bundle: org.codehaus.jackson.mapper;bundle-version="1.9.13"
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/Id.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/Id.java
index 1ba73286d67..9ee2f515d1b 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/Id.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/Id.java
@@ -11,7 +11,7 @@
package org.eclipse.osee.framework.jdk.core.type;
-import org.codehaus.jackson.annotate.JsonCreator;
+import java.util.function.Function;
import org.codehaus.jackson.annotate.JsonIgnore;
/**
@@ -20,24 +20,34 @@ import org.codehaus.jackson.annotate.JsonIgnore;
public interface Id {
public static final Long SENTINEL = -1L;
+ public static <R> R valueOf(String id, Function<Long, R> function) {
+ if (id == null || id.equals("")) {
+ return function.apply(null);
+ }
+ return function.apply(Long.valueOf(id));
+ }
+
public static Id valueOf(String id) {
- return valueOf(Long.valueOf(id));
+ return valueOf(id, BaseId::new);
+ }
+
+ public static Id valueOf(int id) {
+ return new BaseId(Long.valueOf(id));
}
- @JsonCreator
- public static Id valueOf(long id) {
+ public static Id valueOf(Long id) {
return new BaseId(id);
}
Long getId();
default String getIdString() {
- return getId().toString();
+ return String.valueOf(getId());
}
- default boolean matches(Id... identities) {
- for (Id identity : identities) {
- if (equals(identity)) {
+ default boolean matches(Id... ids) {
+ for (Id id : ids) {
+ if (equals(id)) {
return true;
}
}
@@ -48,7 +58,7 @@ public interface Id {
return getId().equals(id);
}
- default boolean notEqual(long id) {
+ default boolean notEqual(Long id) {
return !equals(id);
}
@@ -58,7 +68,8 @@ public interface Id {
@JsonIgnore
default boolean isValid() {
- return getId().longValue() > 0;
+ Long id = getId();
+ return id != null && id.longValue() > 0;
}
@JsonIgnore
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParserTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParserTest.java
index 0a83a194456..f1c7ee00e33 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParserTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParserTest.java
@@ -12,6 +12,7 @@
package org.eclipse.osee.framework.skynet.core.linking;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.junit.Assert;
@@ -24,8 +25,8 @@ public class OseeLinkParserTest {
public void testNewSchoolLink() throws Exception {
OseeLinkParser parser = new OseeLinkParser();
String guid = GUID.create();
- BranchId branch = BranchId.valueOf(12);
- parser.parse(String.format("http://127.0.0.1:8081/Define?guid=%s&branchUuid=%s", guid, branch));
+ BranchId branch = CoreBranches.COMMON;
+ parser.parse(String.format("http://127.0.0.1:8081/Define?guid=%s&branchUuid=%s", guid, branch.getIdString()));
Assert.assertEquals(guid, parser.getGuid());
Assert.assertEquals(branch, parser.getId());
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java
index 7bf33883f7f..791032ccac0 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java
@@ -177,7 +177,7 @@ public class ChangeDataLoader extends AbstractOperation {
try {
ArtifactId artId = item.getArtId();
ArtifactDelta artifactDelta = null;
- if (!artId.equals(ArtifactId.valueOf(-1L))) {
+ if (artId.isValid()) {
Artifact startTxArtifact;
Artifact endTxArtifact;
if (txDelta.areOnTheSameBranch()) {
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImplTest.java
index 60e0dc7c410..75396475c30 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImplTest.java
@@ -24,6 +24,7 @@ import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.RelationTypeId;
import org.eclipse.osee.framework.core.data.RelationalConstants;
import org.eclipse.osee.framework.core.data.TransactionId;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -54,7 +55,7 @@ import org.mockito.MockitoAnnotations;
* @author Roberto E. Escobar
*/
public class DataFactoryImplTest {
- private static final BranchId BRANCH = BranchId.valueOf(11);
+ private static final BranchId BRANCH = CoreBranches.SYSTEM_ROOT;
private static final TransactionId tx333 = TransactionId.valueOf(333);
private static final TransactionId tx444 = TransactionId.valueOf(444);
private static final GammaId gamma222 = GammaId.valueOf(222);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AddSyntheticArtifactChangeData.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AddSyntheticArtifactChangeData.java
index 3c11a6a9d86..97ec7c6fd73 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AddSyntheticArtifactChangeData.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/AddSyntheticArtifactChangeData.java
@@ -64,7 +64,7 @@ public class AddSyntheticArtifactChangeData {
artifactChange = syntheticArtifactChanges.get(artIdToCheck);
if (artifactChange == null) {
artifactChange = ChangeItemUtil.newArtifactChange(artIdToCheck, ArtifactTypeId.SENTINEL,
- GammaId.valueOf(-1), null, null);
+ GammaId.SENTINEL, null, null);
syntheticArtifactChanges.put(artIdToCheck, artifactChange);
artifactChange.setSynthetic(true);
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsValidationHelperAdapterTest.java b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsValidationHelperAdapterTest.java
index 1caefc7f400..12d3efbf3f0 100644
--- a/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsValidationHelperAdapterTest.java
+++ b/plugins/org.eclipse.osee.orcs.rest.test/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsValidationHelperAdapterTest.java
@@ -57,7 +57,7 @@ public class OrcsValidationHelperAdapterTest {
public void testIsBranchExists() {
Assert.assertTrue(helper.isBranchExists(COMMON));
- Assert.assertFalse(helper.isBranchExists(BranchId.valueOf(34598)));
+ Assert.assertFalse(helper.isBranchExists(BranchId.valueOf(34598L)));
}
@Test

Back to the top