diff options
author | Ryan D. Brooks | 2016-02-05 14:15:23 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2016-02-05 14:15:23 +0000 |
commit | 60965980be809aaafb0a2a7dedc5c596cc3b918b (patch) | |
tree | fb560f1738c9546e27e555d42268ddb087f20868 | |
parent | 6d6d7de7ff2d14bc2898c8722cc03a3339479ca9 (diff) | |
download | org.eclipse.osee-60965980be809aaafb0a2a7dedc5c596cc3b918b.tar.gz org.eclipse.osee-60965980be809aaafb0a2a7dedc5c596cc3b918b.tar.xz org.eclipse.osee-60965980be809aaafb0a2a7dedc5c596cc3b918b.zip |
refactor: Create BranchId using Long
Change-Id: I94135edc20c821cd90897f299675cbc5a9a822f2
21 files changed, 214 insertions, 155 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java index bf31ce849c8..f06bbd318a3 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java @@ -28,14 +28,11 @@ import org.eclipse.osee.framework.core.model.internal.fields.AssociatedArtifactF import org.eclipse.osee.framework.core.model.internal.fields.CollectionField; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; -import org.eclipse.osee.framework.jdk.core.util.Strings; /** * @author Roberto E. Escobar */ -public class Branch extends AbstractOseeType<Long>implements WriteableBranch, IAdaptable { - - private static final int SHORT_NAME_LIMIT = 35; +public class Branch extends AbstractOseeType<Long> implements WriteableBranch, IAdaptable { private final Collection<Branch> childBranches = new HashSet<>(); @@ -86,19 +83,6 @@ public class Branch extends AbstractOseeType<Long>implements WriteableBranch, IA } @Override - public String getShortName() { - return getShortName(this); - } - - public String getShortName(int length) { - return Strings.truncate(getName(), length); - } - - public static String getShortName(IOseeBranch branch) { - return Strings.truncate(branch.getName(), SHORT_NAME_LIMIT); - } - - @Override public BranchType getBranchType() { return getFieldValueLogException(null, BranchField.BRANCH_TYPE_FIELD_KEY); } @@ -196,11 +180,6 @@ public class Branch extends AbstractOseeType<Long>implements WriteableBranch, IA return getBranchState() == BranchState.PURGE_IN_PROGRESS; } - @Override - public String toString() { - return getName(); - } - public Collection<Branch> getChildren() throws OseeCoreException { return getFieldValue(BranchField.BRANCH_CHILDREN); } @@ -291,13 +270,17 @@ public class Branch extends AbstractOseeType<Long>implements WriteableBranch, IA return String.format("[%s][%s]", getGuid(), getName()); } - @Override - public Long getUuid() { - return getGuid(); - } - public String toStringWithDetails() { return "Branch [name=" + getShortName() + ", type=" + getBranchType() + ", state=" + getBranchState() + ", archived=" + getArchiveState() + ", assocArtId=" + getAssociatedArtifactId() + ", uuid=" + getUuid() + "]"; } + @Override + public String toString() { + return getName(); + } + + @Override + public Long getId() { + return getGuid(); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchReadable.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchReadable.java index 093617c1763..3eef8f22f73 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchReadable.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchReadable.java @@ -48,7 +48,4 @@ public interface BranchReadable extends IOseeBranch { Collection<? extends BranchReadable> getAncestors() throws OseeCoreException; boolean isAncestorOf(IOseeBranch branch) throws OseeCoreException; - - String getShortName(); - -} +}
\ No newline at end of file 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; diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/BaseId.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/BaseId.java new file mode 100644 index 00000000000..c07412b014f --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/BaseId.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * 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.jdk.core.type; + +/** + * @author Ryan D. Brooks + */ +public class BaseId implements Id { + private final Long id; + + public BaseId(Long id) { + this.id = id; + } + + @Override + public int hashCode() { + return id.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof Id) { + return ((Id) obj).getId().equals(id); + } + return false; + } + + @Override + public String toString() { + return String.valueOf(id); + } + + @Override + public Long getId() { + return id; + } +}
\ No newline at end of file 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 new file mode 100644 index 00000000000..5d42abc3b77 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/Id.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.jdk.core.type; + +/** + * @author Ryan D. Brooks + */ +public interface Id { + + Long getId(); + + default boolean matches(BaseId... identities) { + for (BaseId identity : identities) { + if (equals(identity)) { + return true; + } + } + return false; + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/NamedId.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/NamedId.java new file mode 100644 index 00000000000..5eec5394b21 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/NamedId.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * 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.jdk.core.type; + +/** + * @author Ryan D. Brooks + */ +public class NamedId extends BaseId implements Named { + private String name; + + public NamedId(Long id, String name) { + super(id); + this.name = name; + } + + @Override + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return getName(); + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/BaseToHeadHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/BaseToHeadHandler.java index e62d68c1c6e..c1a1b9a63b6 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/BaseToHeadHandler.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/BaseToHeadHandler.java @@ -39,7 +39,7 @@ public final class BaseToHeadHandler implements IChangeReportUiHandler { public String getName(TransactionDelta txDelta) { String branchName; try { - branchName = txDelta.getEndTx().getFullBranch().getShortName(BRANCH_NAME_LEN); + branchName = txDelta.getEndTx().getBranch().getShortName(BRANCH_NAME_LEN); } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex.toString(), ex); branchName = "Unknown"; diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstOtherHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstOtherHandler.java index 403fb2bf63f..0c3376518a1 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstOtherHandler.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstOtherHandler.java @@ -38,7 +38,7 @@ public final class CurrentsAgainstOtherHandler implements IChangeReportUiHandler public String getName(TransactionDelta txDelta) { String branchName; try { - branchName = txDelta.getStartTx().getFullBranch().getShortName(BRANCH_NAME_LEN); + branchName = txDelta.getStartTx().getBranch().getShortName(BRANCH_NAME_LEN); } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex.toString(), ex); branchName = "Unknown"; diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstParentHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstParentHandler.java index 7c60479dfdf..3603bb350f6 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstParentHandler.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstParentHandler.java @@ -38,7 +38,7 @@ public final class CurrentsAgainstParentHandler implements IChangeReportUiHandle public String getName(TransactionDelta txDelta) { String branchName; try { - branchName = txDelta.getStartTx().getFullBranch().getShortName(BRANCH_NAME_LEN); + branchName = txDelta.getStartTx().getBranch().getShortName(BRANCH_NAME_LEN); } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex.toString(), ex); branchName = "Unknown"; diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/SpecificTxsHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/SpecificTxsHandler.java index 8ed189baa34..b7a4f42d705 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/SpecificTxsHandler.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/SpecificTxsHandler.java @@ -39,7 +39,7 @@ public final class SpecificTxsHandler implements IChangeReportUiHandler { public String getName(TransactionDelta txDelta) { String branchName; try { - branchName = txDelta.getEndTx().getFullBranch().getShortName(BRANCH_NAME_LEN); + branchName = txDelta.getEndTx().getBranch().getShortName(BRANCH_NAME_LEN); } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex.toString(), ex); branchName = "Unknown"; diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java index 77ed918819b..58db8d011d5 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java @@ -19,7 +19,6 @@ import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.TxChange; -import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.type.AttributeType; import org.eclipse.osee.framework.jdk.core.type.HashCollection; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; @@ -95,7 +94,7 @@ public class RepeatEnumerationAttributeValues extends DatabaseHealthOperation { ArtifactQuery.getArtifactListFromIds(artifactGuids, branch, EXCLUDE_DELETED); // bulk load for speed SkynetTransaction transaction = TransactionManager.createTransaction(branch, - "Delete Repeat Attribute Values for" + Branch.getShortName(branch)); + "Delete Repeat Attribute Values for" + branch.getShortName()); for (AttrData attrData : attributeData) { Artifact artifact = ArtifactQuery.getArtifactFromId(attrData.getArtifactGuid(), branch); AttributeType attributeType = AttributeTypeManager.getTypeByGuid(attrData.getAttributeTypeId()); diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java index 5ab3ce8e2f7..fca2926e439 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java @@ -23,7 +23,6 @@ import org.eclipse.core.resources.IFolder; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.osee.framework.core.data.IOseeBranch; -import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.TransactionDelta; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; @@ -199,7 +198,7 @@ public final class RenderingUtil { public static String toFileName(IOseeBranch branch) throws OseeCoreException { // replace invalid filename characters \/:"*?<>| and . and ' with _ - String shortName = Strings.saferReplace(Branch.getShortName(branch), "[\\.\\/:\"*?<>|'\\\\]+", "_"); + String shortName = Strings.saferReplace(branch.getShortName(), "[\\.\\/:\"*?<>|'\\\\]+", "_"); return encode(shortName); } diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchData.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchData.java index 1cef12ea671..cacd8d713a0 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchData.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchData.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.osee.orcs.core.ds; -import org.eclipse.osee.framework.core.data.HasLocalId; +import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.BranchArchivedState; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; @@ -18,15 +18,7 @@ import org.eclipse.osee.framework.core.enums.BranchType; /** * @author Roberto E. Escobar */ -public interface BranchData extends HasLocalId<Long> { - - void setUuid(Long uuid); - - Long getUuid(); - - String getName(); - - void setName(String name); +public interface BranchData extends IOseeBranch { int getAssociatedArtifactId(); diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/BranchDataImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/BranchDataImpl.java index 9096ef084ec..5680fabf72d 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/BranchDataImpl.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/BranchDataImpl.java @@ -13,7 +13,7 @@ package org.eclipse.osee.orcs.db.internal.loader.data; import org.eclipse.osee.framework.core.enums.BranchArchivedState; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; -import org.eclipse.osee.framework.jdk.core.type.Identity; +import org.eclipse.osee.framework.jdk.core.type.NamedId; import org.eclipse.osee.orcs.core.ds.BranchData; import org.eclipse.osee.orcs.data.BranchReadable; import org.eclipse.osee.orcs.db.internal.sql.RelationalConstants; @@ -21,10 +21,7 @@ import org.eclipse.osee.orcs.db.internal.sql.RelationalConstants; /** * @author Roberto E. Escobar */ -public class BranchDataImpl extends OrcsObjectImpl<Long>implements BranchData, BranchReadable { - - private Long uuid = RelationalConstants.DEFAULT_UUID; - private String name = ""; +public class BranchDataImpl extends NamedId implements BranchData, BranchReadable { private int associatedArtifactId = RelationalConstants.ART_ID_SENTINEL; private int baseTransaction = RelationalConstants.TRANSACTION_SENTINEL; private int sourceTransaction = RelationalConstants.TRANSACTION_SENTINEL; @@ -34,23 +31,8 @@ public class BranchDataImpl extends OrcsObjectImpl<Long>implements BranchData, B private BranchType branchType = BranchType.WORKING; private boolean inheritAccessControl = false; - public BranchDataImpl() { - super(); - } - - @Override - public Long getGuid() { - return getUuid(); - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; + public BranchDataImpl(Long branchId, String name) { + super(branchId, name); } @Override @@ -129,33 +111,8 @@ public class BranchDataImpl extends OrcsObjectImpl<Long>implements BranchData, B } @Override - public int hashCode() { - return getGuid().hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof Identity) { - Identity<?> id = (Identity<?>) obj; - return id.getGuid().equals(this.getGuid()); - } - return false; - - } - - @Override public String toString() { - return "BranchData [uuid=" + uuid + ", " + super.toString() + "]"; - } - - @Override - public Long getUuid() { - return uuid; - } - - @Override - public void setUuid(Long uuid) { - this.uuid = uuid; + return "BranchData [uuid=" + getId() + ", " + super.toString() + "]"; } @Override @@ -167,5 +124,4 @@ public class BranchDataImpl extends OrcsObjectImpl<Long>implements BranchData, B public void setInheritAccessControl(boolean inheritAccessControl) { this.inheritAccessControl = inheritAccessControl; } - -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java index 5d614baf3e8..08b6084e3e4 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java @@ -180,14 +180,12 @@ public class OrcsObjectFactoryImpl implements OrcsObjectFactory { @Override public BranchData createBranchData(Long branchUuid, BranchType branchType, String name, Long parentBranch, int baseTransaction, int sourceTransaction, BranchArchivedState archiveState, BranchState branchState, int associatedArtifactId, boolean inheritAccessControl) { - BranchData data = new BranchDataImpl(); + BranchData data = new BranchDataImpl(branchUuid, name); data.setArchiveState(archiveState); data.setAssociatedArtifactId(associatedArtifactId); data.setBaseTransaction(baseTransaction); data.setBranchState(branchState); data.setBranchType(branchType); - data.setUuid(branchUuid); - data.setName(name); data.setParentBranch(parentBranch); data.setSourceTransaction(sourceTransaction); data.setInheritAccessControl(inheritAccessControl); @@ -196,7 +194,7 @@ public class OrcsObjectFactoryImpl implements OrcsObjectFactory { @Override public BranchData createCopy(BranchData source) { - return createBranchData(source.getLocalId(), source.getBranchType(), source.getName(), source.getParentBranch(), + return createBranchData(source.getId(), source.getBranchType(), source.getName(), source.getParentBranch(), source.getBaseTransaction(), source.getSourceTransaction(), source.getArchiveState(), source.getBranchState(), source.getAssociatedArtifactId(), source.isInheritAccessControl()); } diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java index ec096b28355..6df320a3ee2 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java @@ -116,7 +116,7 @@ public class HtmlWriter { Map<String, Object> data = new LinkedHashMap<>(); data.put("Name", branch.getName()); data.put("Uuid", branch.getUuid()); - data.put("Local Id", branch.getLocalId()); + data.put("Local Id", branch.getId()); data.put("State", branch.getBranchState()); data.put("Type", branch.getBranchType()); data.put("Archived", branch.getArchiveState()); diff --git a/plugins/org.eclipse.osee.orcs.test/OrcsIntegrationTestSuite.launch b/plugins/org.eclipse.osee.orcs.test/OrcsIntegrationTestSuite.launch index 09119b5b4b3..94cc0635b45 100644 --- a/plugins/org.eclipse.osee.orcs.test/OrcsIntegrationTestSuite.launch +++ b/plugins/org.eclipse.osee.orcs.test/OrcsIntegrationTestSuite.launch @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig"> <setAttribute key="additional_plugins"> -<setEntry value="org.eclipse.equinox.ds:1.4.200.v20131126-2331:default:true"/> -<setEntry value="org.eclipse.osee.orcs.db.mock:0.22.0.qualifier:default:true"/> +<setEntry value="org.eclipse.equinox.ds:1.4.300.v20150423-1356:default:true"/> +<setEntry value="org.eclipse.osee.orcs.db.mock:0.24.0.qualifier:default:true"/> <setEntry value="org.hsqldb:2.2.9.qualifier:default:false"/> <setEntry value="org.mockito:1.9.0.qualifier:default:false"/> </setAttribute> diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/BranchReadable.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/BranchReadable.java index 33fc65b6caf..2d5498451c2 100644 --- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/BranchReadable.java +++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/BranchReadable.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.osee.orcs.data; -import org.eclipse.osee.framework.core.data.HasLocalId; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.BranchArchivedState; import org.eclipse.osee.framework.core.enums.BranchState; @@ -19,7 +18,7 @@ import org.eclipse.osee.framework.core.enums.BranchType; /** * @author Roberto E. Escobar */ -public interface BranchReadable extends HasLocalId<Long>, IOseeBranch { +public interface BranchReadable extends IOseeBranch { BranchArchivedState getArchiveState(); diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java index 1367f38678c..c352fda29b7 100644 --- a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java +++ b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java @@ -18,13 +18,13 @@ import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.SoftwareRe import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.AccessContextId; import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.Active; import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON; +import static org.eclipse.osee.framework.core.enums.DemoBranches.SAW_Bld_1; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.io.StringWriter; import java.util.Collection; import java.util.Properties; import javax.ws.rs.core.MediaType; -import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.enums.QueryOption; import org.eclipse.osee.framework.core.enums.SystemUser; @@ -43,24 +43,6 @@ public class OseeClientQueryTest { private static final String GUID1 = SystemUser.Anonymous.getGuid(); private static final String GUID2 = SystemUser.OseeSystem.getGuid(); - private static final IOseeBranch SAW_1 = new IOseeBranch() { - - @Override - public Long getGuid() { - return 3L; - } - - @Override - public String getName() { - return "SAW_Bld_1"; - } - - @Override - public Long getUuid() { - return 3L; - } - }; - private static OseeClient createClient; @BeforeClass @@ -138,14 +120,14 @@ public class OseeClientQueryTest { public void searchForArtifactType() throws OseeCoreException { final int EXPECTED_RESULTS = 7; SearchResult results = - createClient.createQueryBuilder(SAW_1).andTypeEquals(Folder).getSearchResult(RequestType.IDS); + createClient.createQueryBuilder(SAW_Bld_1).andTypeEquals(Folder).getSearchResult(RequestType.IDS); assertEquals(EXPECTED_RESULTS, results.getTotal()); } @Test public void searchForArtifactTypes() throws OseeCoreException { final int EXPECTED_RESULTS = 24; - SearchResult results = createClient.createQueryBuilder(SAW_1).andTypeEquals(GeneralData, GeneralDocument, + SearchResult results = createClient.createQueryBuilder(SAW_Bld_1).andTypeEquals(GeneralData, GeneralDocument, SoftwareRequirement).getSearchResult(RequestType.IDS); assertEquals(EXPECTED_RESULTS, results.getTotal()); } @@ -153,9 +135,8 @@ public class OseeClientQueryTest { @Test public void searchForArtifactTypesIncludeTypeInheritance() throws OseeCoreException { final int EXPECTED_RESULTS = 150; - SearchResult results = - createClient.createQueryBuilder(SAW_1).andIsOfType(GeneralData, GeneralDocument, Requirement).getSearchResult( - RequestType.IDS); + SearchResult results = createClient.createQueryBuilder(SAW_Bld_1).andIsOfType(GeneralData, GeneralDocument, + Requirement).getSearchResult(RequestType.IDS); assertEquals(EXPECTED_RESULTS, results.getTotal()); } |