Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2014-04-11 17:58:30 -0400
committerDonald Dunne2014-04-16 17:45:03 -0400
commitedfd64ae3bb3dafc6e150e577aae02be784fabd8 (patch)
tree9000d0cdd965c283117b6d1a1c4f08ff03d87f45
parent6d5618a83c4f3b3d17624d70e38554c40a39022b (diff)
downloadorg.eclipse.osee-edfd64ae3bb3dafc6e150e577aae02be784fabd8.tar.gz
org.eclipse.osee-edfd64ae3bb3dafc6e150e577aae02be784fabd8.tar.xz
org.eclipse.osee-edfd64ae3bb3dafc6e150e577aae02be784fabd8.zip
feature[ats_ATS19845]: Remove TokenFactory.createBranch-guid-name
-rw-r--r--plugins/org.eclipse.osee.ats.presenter.test/src/org/eclipse/osee/ats/presenter/internal/AtsSearchPresenterTest.java5
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/build/report/BuildTraceReport.java2
-rw-r--r--plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/ViewId.java4
-rw-r--r--plugins/org.eclipse.osee.display.presenter.test/src/org/eclipse/osee/display/presenter/internal/SearchPresenterTest.java6
-rw-r--r--plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchPresenterImpl.java36
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/IdentityLocator.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java23
9 files changed, 31 insertions, 54 deletions
diff --git a/plugins/org.eclipse.osee.ats.presenter.test/src/org/eclipse/osee/ats/presenter/internal/AtsSearchPresenterTest.java b/plugins/org.eclipse.osee.ats.presenter.test/src/org/eclipse/osee/ats/presenter/internal/AtsSearchPresenterTest.java
index e4d4f27240..4bf61b45ae 100644
--- a/plugins/org.eclipse.osee.ats.presenter.test/src/org/eclipse/osee/ats/presenter/internal/AtsSearchPresenterTest.java
+++ b/plugins/org.eclipse.osee.ats.presenter.test/src/org/eclipse/osee/ats/presenter/internal/AtsSearchPresenterTest.java
@@ -13,7 +13,6 @@ package org.eclipse.osee.ats.presenter.internal;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Assert;
import org.eclipse.osee.ats.ui.api.data.AtsSearchParameters;
import org.eclipse.osee.ats.ui.api.view.AtsSearchHeaderComponent;
import org.eclipse.osee.display.api.data.ViewId;
@@ -26,10 +25,12 @@ import org.eclipse.osee.display.presenter.mocks.MockSearchNavigator;
import org.eclipse.osee.display.presenter.mocks.MockSearchResultsListComponent;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.UrlQuery;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeReadable;
import org.eclipse.osee.orcs.search.Match;
+import org.junit.Assert;
import org.junit.Test;
/**
@@ -87,7 +88,7 @@ public class AtsSearchPresenterTest {
Assert.assertEquals(3, headerComp.getPrograms().size());
String programGuid = GUID.create();
- String buildGuid = GUID.create();
+ String buildGuid = String.valueOf(Lib.generateUuid());
String url =
"/" + new UrlQuery().put("program", programGuid).put("build", buildGuid).put("nameOnly", "true").put("search",
"phrase").put("verbose", "false").toString();
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/build/report/BuildTraceReport.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/build/report/BuildTraceReport.java
index 429a4b8cc7..f8696dd5eb 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/build/report/BuildTraceReport.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/build/report/BuildTraceReport.java
@@ -168,7 +168,7 @@ public class BuildTraceReport {
buildArt.getAttributes(AtsAttributeTypes.BaselineBranchUuid);
Conditions.checkNotNull(branchUuids, "branchUuids");
String baselineBranchUuid = branchUuids.getExactlyOne().getValue();
- IOseeBranch branch = TokenFactory.createBranch(baselineBranchUuid, "TraceReport Branch");
+ IOseeBranch branch = TokenFactory.createBranch(Long.valueOf(baselineBranchUuid), "TraceReport Branch");
return branch;
}
diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/ViewId.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/ViewId.java
index e65bf35c4e..a3282b8d87 100644
--- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/ViewId.java
+++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/ViewId.java
@@ -21,8 +21,8 @@ public class ViewId extends NamedIdentity<String> {
Map<String, String> attributes = new HashMap<String, String>();
- public ViewId(String guid, String name) {
- super(guid, name);
+ public ViewId(String uuid, String name) {
+ super(uuid, name);
}
public void setAttribute(String key, String value) {
diff --git a/plugins/org.eclipse.osee.display.presenter.test/src/org/eclipse/osee/display/presenter/internal/SearchPresenterTest.java b/plugins/org.eclipse.osee.display.presenter.test/src/org/eclipse/osee/display/presenter/internal/SearchPresenterTest.java
index 951c7e3d05..57139e7aca 100644
--- a/plugins/org.eclipse.osee.display.presenter.test/src/org/eclipse/osee/display/presenter/internal/SearchPresenterTest.java
+++ b/plugins/org.eclipse.osee.display.presenter.test/src/org/eclipse/osee/display/presenter/internal/SearchPresenterTest.java
@@ -46,6 +46,7 @@ import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.UrlQuery;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeReadable;
@@ -208,7 +209,7 @@ public class SearchPresenterTest {
provider.addArtifact(testArt);
- ViewId branch = new ViewId(GUID.create(), "branchName");
+ ViewId branch = new ViewId(String.valueOf(Lib.generateUuid()), "branchName");
ViewArtifact artifact = new ViewArtifact(artGuid, "artName", "artType", null, branch);
ViewId relation = new ViewId(Long.toString(relGuid), relName);
presenter.selectRelationType(artifact, relation, relComp);
@@ -247,7 +248,8 @@ public class SearchPresenterTest {
relComp = new MockRelationComponent();
ViewArtifact artifact =
- new ViewArtifact(GUID.create(), "name", "type", null, new ViewId(GUID.create(), "branchName"));
+ new ViewArtifact(GUID.create(), "name", "type", null, new ViewId(String.valueOf(Lib.generateUuid()),
+ "branchName"));
presenter.selectRelationType(artifact, null, relComp);
Assert.assertNotNull(relComp.getErrorMessage());
diff --git a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchPresenterImpl.java b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchPresenterImpl.java
index 333162c506..6fe26509d4 100644
--- a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchPresenterImpl.java
+++ b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchPresenterImpl.java
@@ -91,7 +91,7 @@ public class SearchPresenterImpl<T extends SearchHeaderComponent, K extends View
try {
searchHandler.setSearchValues(searchResultsComp, params.isVerbose());
- artifactProvider.getSearchResults(TokenFactory.createBranch(params.getBranchId(), ""), params.isNameOnly(),
+ artifactProvider.getSearchResults(TokenFactory.createBranch(params.getBranchUuid(), ""), params.isNameOnly(),
params.getSearchPhrase(), searchHandler);
} catch (Exception ex) {
setErrorMessage(searchResultsComp, "Error loading search results", ex);
@@ -158,7 +158,7 @@ public class SearchPresenterImpl<T extends SearchHeaderComponent, K extends View
return;
}
- String branch = params.getBranchId();
+ long branch = params.getBranchUuid();
String art = params.getArtifactId();
ArtifactReadable displayArt = null;
try {
@@ -228,7 +228,7 @@ public class SearchPresenterImpl<T extends SearchHeaderComponent, K extends View
String relGuid = relation.getGuid();
IRelationType type = TokenFactory.createRelationType(Long.parseLong(relGuid), relation.getName());
- IOseeBranch branch = TokenFactory.createBranch(artifact.getBranch().getGuid(), "");
+ IOseeBranch branch = TokenFactory.createBranch(Long.valueOf(artifact.getBranch().getGuid()), "");
ArtifactReadable sourceArt;
ResultSet<ArtifactReadable> relatedSideA;
ResultSet<ArtifactReadable> relatedSideB;
@@ -305,7 +305,11 @@ public class SearchPresenterImpl<T extends SearchHeaderComponent, K extends View
private ArtifactParameters decodeArtifactUrl(String url) throws UnsupportedEncodingException {
UrlQuery query = new UrlQuery();
query.parse(url);
- String branch = query.getParameter("branch");
+ String branchId = query.getParameter("branch");
+ long branch = 0;
+ if (Strings.isValid(branchId)) {
+ branch = Long.valueOf(branchId);
+ }
String artifact = query.getParameter("artifact");
return new ArtifactParameters(branch, artifact);
}
@@ -313,7 +317,7 @@ public class SearchPresenterImpl<T extends SearchHeaderComponent, K extends View
private SearchParameters decodeSearchUrl(String url) throws UnsupportedEncodingException {
UrlQuery query = new UrlQuery();
query.parse(url);
- String branch = query.getParameter("branch");
+ long branch = Long.valueOf(query.getParameter("branch"));
String vValue = query.getParameter("verbose");
boolean verbose = vValue == null ? false : vValue.equalsIgnoreCase("true");
String nValue = query.getParameter("nameOnly");
@@ -411,16 +415,16 @@ public class SearchPresenterImpl<T extends SearchHeaderComponent, K extends View
}
private class ArtifactParameters {
- private final String branchId;
+ private final long branchUuid;
private final String artifactId;
- public ArtifactParameters(String branchId, String artifactId) {
- this.branchId = branchId;
+ public ArtifactParameters(long branchUuid, String artifactId) {
+ this.branchUuid = branchUuid;
this.artifactId = artifactId;
}
- public String getBranchId() {
- return branchId;
+ public long getBranchUuid() {
+ return branchUuid;
}
public String getArtifactId() {
@@ -428,18 +432,18 @@ public class SearchPresenterImpl<T extends SearchHeaderComponent, K extends View
}
public boolean isValid() {
- return Strings.isValid(branchId) && Strings.isValid(artifactId);
+ return branchUuid > 0 && Strings.isValid(artifactId);
}
}
private class SearchParameters {
- private final String branchId;
+ private final long branchId;
private final boolean nameOnly, verbose;
private final String searchPhrase;
- public SearchParameters(String branchId, boolean nameOnly, String searchPhrase, boolean verbose) {
- this.branchId = branchId;
+ public SearchParameters(long branchUuid, boolean nameOnly, String searchPhrase, boolean verbose) {
+ this.branchId = branchUuid;
this.nameOnly = nameOnly;
this.searchPhrase = searchPhrase;
this.verbose = verbose;
@@ -449,7 +453,7 @@ public class SearchPresenterImpl<T extends SearchHeaderComponent, K extends View
return verbose;
}
- public String getBranchId() {
+ public long getBranchUuid() {
return branchId;
}
@@ -462,7 +466,7 @@ public class SearchPresenterImpl<T extends SearchHeaderComponent, K extends View
}
public boolean isValid() {
- return Strings.isValid(branchId);
+ return branchId > 0;
}
}
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
index 5b5079cb62..30acdfe008 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
@@ -410,7 +410,7 @@ public class OrcsStorageImpl implements Storage {
if (matcher.find()) {
String match = matcher.group();
String[] split = match.split(":");
- toReturn = TokenFactory.createBranch(split[1], baselineBranch.getName());
+ toReturn = TokenFactory.createBranch(Long.valueOf(split[1]), baselineBranch.getName());
}
regex = Pattern.compile(baselineBranch.getGuid() + "\\s*:\\s*.*");
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 106ea545a4..9571cf3823 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
@@ -59,10 +59,6 @@ public final class TokenFactory {
return createBranch(Lib.generateUuid(), name);
}
- public static IOseeBranch createBranch(String guid, String name) {
- return createBranch(Lib.generateUuid(), name);
- }
-
public static IOseeBranch createBranch(Long uuid, String name) {
return new BranchToken(uuid, name);
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/IdentityLocator.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/IdentityLocator.java
index 5cc403ed72..e95629911b 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/IdentityLocator.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/IdentityLocator.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
/**
@@ -20,6 +19,4 @@ public interface IdentityLocator {
Long parseToLocalId(String value) throws OseeCoreException;
- IOseeBranch getBranch(long branchId) throws OseeCoreException;
-
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java
index e81196c16a..99970a2bf1 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java
@@ -10,13 +10,10 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.util;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
import org.eclipse.osee.framework.core.util.HexUtil;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IOseeSequence;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.orcs.db.internal.IdentityManager;
@@ -26,9 +23,6 @@ import org.eclipse.osee.orcs.db.internal.IdentityManager;
*/
public class IdentityManagerImpl implements IdentityManager {
- private static final String SELECT_BRANCH_TOKEN_BY_ID =
- "select branch_guid, branch_name from osee_branch where branch_id = ?";
-
private final IOseeDatabaseService dbService;
public IdentityManagerImpl(IOseeDatabaseService dbService) {
@@ -79,21 +73,4 @@ public class IdentityManagerImpl implements IdentityManager {
getSequence().clear();
}
- @Override
- public IOseeBranch getBranch(long branchId) throws OseeCoreException {
- IOseeBranch toReturn = null;
- IOseeStatement stmt = dbService.getStatement();
- try {
- stmt.runPreparedQuery(SELECT_BRANCH_TOKEN_BY_ID, branchId);
- while (stmt.next()) {
- String guid = stmt.getString("branch_guid");
- String name = stmt.getString("branch_name");
- toReturn = TokenFactory.createBranch(guid, name);
- }
- } finally {
- stmt.close();
- }
- return toReturn;
- }
-
}

Back to the top