Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2016-02-05 14:15:23 +0000
committerRyan D. Brooks2016-02-05 14:15:23 +0000
commit60965980be809aaafb0a2a7dedc5c596cc3b918b (patch)
treefb560f1738c9546e27e555d42268ddb087f20868 /plugins/org.eclipse.osee.framework.core
parent6d6d7de7ff2d14bc2898c8722cc03a3339479ca9 (diff)
downloadorg.eclipse.osee-60965980be809aaafb0a2a7dedc5c596cc3b918b.tar.gz
org.eclipse.osee-60965980be809aaafb0a2a7dedc5c596cc3b918b.tar.xz
org.eclipse.osee-60965980be809aaafb0a2a7dedc5c596cc3b918b.zip
refactor: Create BranchId using Long
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core')
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchId.java34
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeBranch.java17
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java37
3 files changed, 65 insertions, 23 deletions
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
new file mode 100644
index 00000000000..a5007d841ac
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchId.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.core.data;
+
+import org.eclipse.osee.framework.jdk.core.type.Id;
+import org.eclipse.osee.framework.jdk.core.type.Identity;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public interface BranchId extends Identity<Long>, HasUuid, Id {
+
+ @Override
+ default Long getUuid() {
+ return getId();
+ }
+
+ @Override
+ default Long getGuid() {
+ return getId();
+ };
+
+ default Long getBranchId() {
+ return getId();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeBranch.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeBranch.java
index 7c377a49de8..90c41eaf701 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeBranch.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeBranch.java
@@ -10,13 +10,22 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.data;
-import org.eclipse.osee.framework.jdk.core.type.Identifiable;
+import org.eclipse.osee.framework.jdk.core.type.Named;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
/**
* @author Ryan D. Brooks
*/
-public interface IOseeBranch extends Identifiable<Long>, HasUuid {
+public interface IOseeBranch extends BranchId, Named {
- @Override
- Long getUuid();
+
+ static final int SHORT_NAME_LIMIT = 35;
+
+ default String getShortName() {
+ return getShortName(SHORT_NAME_LIMIT);
+ }
+
+ default String getShortName(int length) {
+ return Strings.truncate(getName(), length);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java
index a1c703f8f4a..5fbd8479239 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java
@@ -14,6 +14,7 @@ import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.jdk.core.type.BaseIdentity;
import org.eclipse.osee.framework.jdk.core.type.FullyNamedIdentity;
+import org.eclipse.osee.framework.jdk.core.type.NamedId;
import org.eclipse.osee.framework.jdk.core.type.NamedIdentity;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Lib;
@@ -79,7 +80,7 @@ public final class TokenFactory {
return new SorterIdToken(guid, name);
}
- private final static class SorterIdToken extends NamedIdentity<String>implements IRelationSorterId {
+ private final static class SorterIdToken extends NamedIdentity<String> implements IRelationSorterId {
public SorterIdToken(String guid, String name) {
super(guid, name);
@@ -91,9 +92,14 @@ public final class TokenFactory {
}
}
- private final static class ArtifactTypeToken extends NamedIdentity<Long>implements IArtifactType {
- public ArtifactTypeToken(Long guid, String name) {
- super(guid, name);
+ private final static class ArtifactTypeToken extends NamedId implements IArtifactType {
+ public ArtifactTypeToken(Long id, String name) {
+ super(id, name);
+ }
+
+ @Override
+ public Long getGuid() {
+ return getId();
}
}
@@ -101,26 +107,19 @@ public final class TokenFactory {
return new TransactionToken(txId);
}
- private static final class TransactionToken extends BaseIdentity<Integer>implements ITransaction {
+ private static final class TransactionToken extends BaseIdentity<Integer> implements ITransaction {
public TransactionToken(Integer txId) {
super(txId);
}
}
- private static final class BranchToken extends NamedIdentity<Long>implements IOseeBranch {
-
+ private static final class BranchToken extends NamedId implements IOseeBranch {
public BranchToken(Long branchId, String name) {
super(branchId, name);
}
-
- @Override
- public Long getUuid() {
- return getGuid();
- }
-
}
- private final static class AttributeTypeToken extends FullyNamedIdentity<Long>implements IAttributeType {
+ private final static class AttributeTypeToken extends FullyNamedIdentity<Long> implements IAttributeType {
public AttributeTypeToken(Long guid, String name) {
super(guid, name);
}
@@ -130,13 +129,13 @@ public final class TokenFactory {
}
}
- private final static class RelationTypeToken extends FullyNamedIdentity<Long>implements IRelationType {
+ private final static class RelationTypeToken extends FullyNamedIdentity<Long> implements IRelationType {
public RelationTypeToken(Long guid, String name) {
super(guid, name);
}
}
- private static class ArtifactToken extends NamedIdentity<String>implements IArtifactToken {
+ private static class ArtifactToken extends NamedIdentity<String> implements IArtifactToken {
private final IArtifactType artifactType;
private final long uuid;
@@ -157,7 +156,7 @@ public final class TokenFactory {
}
}
- private static class UserToken extends NamedIdentity<String>implements IUserToken {
+ private static class UserToken extends NamedIdentity<String> implements IUserToken {
private final String userId;
private final boolean active;
@@ -219,7 +218,7 @@ public final class TokenFactory {
}
- private final static class AccessContextIdToken extends NamedIdentity<String>implements IAccessContextId {
+ private final static class AccessContextIdToken extends NamedIdentity<String> implements IAccessContextId {
public AccessContextIdToken(String guid, String name) {
super(guid, name);
}
@@ -230,7 +229,7 @@ public final class TokenFactory {
}
}
- private final static class RelationTypeSideToken extends FullyNamedIdentity<Long>implements IRelationTypeSide {
+ private final static class RelationTypeSideToken extends FullyNamedIdentity<Long> implements IRelationTypeSide {
private final RelationSide relationSide;
private RelationTypeSideToken opposite;

Back to the top