Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2017-02-01 22:08:52 +0000
committerDavid W. Miller2017-02-01 22:08:52 +0000
commitcd7a2bb74c0e68336c9361e0d33870317b6cef3d (patch)
treeae3bb7b73abc0d7ade0ca46870695e13690ba146
parent565eb28bbd54f7fba7d927e323f44fd06ba35ee9 (diff)
downloadorg.eclipse.osee-cd7a2bb74c0e68336c9361e0d33870317b6cef3d.tar.gz
org.eclipse.osee-cd7a2bb74c0e68336c9361e0d33870317b6cef3d.tar.xz
org.eclipse.osee-cd7a2bb74c0e68336c9361e0d33870317b6cef3d.zip
refactor: Updates to use BranchId
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtil.java8
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtilTest.java2
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsBranchService.java9
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/access/AtsBranchAccessManager.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchCommitOperation.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchManager.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java10
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonArtifactExplorer.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonFavorites.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonLock.java6
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchEnablement.java17
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java1
12 files changed, 31 insertions, 32 deletions
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtil.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtil.java
index f43bc8fc956..add6ff2593b 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtil.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtil.java
@@ -452,7 +452,7 @@ public class AtsTestUtil {
IAtsChangeSet changes =
AtsClientService.get().createChangeSet(AtsTestUtil.class.getSimpleName() + " - cleanup deleteTeamWf");
- if (teamWfToDelete.getWorkingBranch() != null) {
+ if (teamWfToDelete.getWorkingBranch().isValid()) {
Result result = AtsBranchUtil.deleteWorkingBranch(teamWfToDelete, true);
if (result.isFalse()) {
throw new OseeStateException("Error deleting working branch [%s]", result.getText());
@@ -483,7 +483,7 @@ public class AtsTestUtil {
if (teamWf != null) {
BranchId workingBranch = teamWf.getWorkingBranch();
- if (workingBranch != null) {
+ if (workingBranch.isValid()) {
BranchManager.deleteBranchAndPend(workingBranch);
}
}
@@ -575,8 +575,8 @@ public class AtsTestUtil {
public static void cleanupSimpleTest(Collection<String> titles) throws Exception {
List<Artifact> artifacts = new ArrayList<>();
for (String title : titles) {
- artifacts.addAll(ArtifactQuery.getArtifactListFromName(title, AtsClientService.get().getAtsBranch(), EXCLUDE_DELETED,
- QueryOption.CONTAINS_MATCH_OPTIONS));
+ artifacts.addAll(ArtifactQuery.getArtifactListFromName(title, AtsClientService.get().getAtsBranch(),
+ EXCLUDE_DELETED, QueryOption.CONTAINS_MATCH_OPTIONS));
}
Operations.executeWorkAndCheckStatus(new PurgeArtifacts(artifacts));
TestUtil.sleep(4000);
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtilTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtilTest.java
index 0466f9b2cb6..1cee73b1d3d 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtilTest.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtilTest.java
@@ -68,7 +68,7 @@ public class AtsTestUtilTest extends AtsTestUtil {
Assert.assertTrue(result.getText(), result.isTrue());
Thread.sleep(2000);
BranchId branch = AtsTestUtil.getTeamWf().getWorkingBranch();
- Assert.assertNotNull(branch);
+ Assert.assertTrue(branch.isValid());
AtsTestUtil.cleanup();
Assert.assertTrue(BranchManager.getState(branch).isDeleted());
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsBranchService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsBranchService.java
index 20958d148cc..40b164ebc24 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsBranchService.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsBranchService.java
@@ -96,9 +96,10 @@ public abstract class AbstractAtsBranchService implements IAtsBranchService {
teamWf.getAtsId()) > 1000) {
IOseeBranch branch = IOseeBranch.SENTINEL;
try {
- branch = getWorkingBranchExcludeStates(teamWf, BranchState.REBASELINED, BranchState.DELETED,
- BranchState.PURGED, BranchState.COMMIT_IN_PROGRESS, BranchState.CREATION_IN_PROGRESS,
- BranchState.DELETE_IN_PROGRESS, BranchState.PURGE_IN_PROGRESS);
+ IOseeBranch workingBranch = getWorkingBranchExcludeStates(teamWf, BranchState.REBASELINED,
+ BranchState.DELETED, BranchState.PURGED, BranchState.COMMIT_IN_PROGRESS,
+ BranchState.CREATION_IN_PROGRESS, BranchState.DELETE_IN_PROGRESS, BranchState.PURGE_IN_PROGRESS);
+ branch = workingBranch == null ? IOseeBranch.SENTINEL : workingBranch;
} catch (ItemDoesNotExist ex) {
// do nothing
}
@@ -316,7 +317,7 @@ public abstract class AbstractAtsBranchService implements IAtsBranchService {
@Override
public boolean isWorkingBranchInWork(IAtsTeamWorkflow teamWf) throws OseeCoreException {
BranchId branch = getWorkingBranch(teamWf);
- return (branch != null) && branch.isValid() && !getBranchState(branch).isCommitted();
+ return branch.isValid() && !getBranchState(branch).isCommitted();
}
@Override
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/access/AtsBranchAccessManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/access/AtsBranchAccessManager.java
index 2946db5bbb1..70ad058cdf5 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/access/AtsBranchAccessManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/access/AtsBranchAccessManager.java
@@ -239,7 +239,7 @@ public class AtsBranchAccessManager implements IArtifactEventListener, EventHand
try {
if (ArtifactTypeManager.getType(guidArt).inheritsFrom(AtsArtifactTypes.TeamWorkflow)) {
TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) ArtifactCache.getActive(guidArt);
- if (teamArt != null && teamArt.getWorkingBranch() != null) {
+ if (teamArt != null && teamArt.getWorkingBranch().isValid()) {
branchUuidToContextIdCache.remove(teamArt.getWorkingBranch().getGuid());
}
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchCommitOperation.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchCommitOperation.java
index d883f704664..c373fd84878 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchCommitOperation.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchCommitOperation.java
@@ -61,7 +61,7 @@ public class AtsBranchCommitOperation extends AbstractOperation {
BranchId workflowWorkingBranch = teamArt.getWorkingBranch();
try {
AtsClientService.get().getBranchService().getBranchesInCommit().add(workflowWorkingBranch);
- if (workflowWorkingBranch == null) {
+ if (workflowWorkingBranch.isInvalid()) {
throw new OseeStateException("Commit Branch Failed: Can not locate branch for workflow [%s]",
teamArt.getAtsId());
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchManager.java
index c181e845140..5e0bbb1e773 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchManager.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchManager.java
@@ -70,7 +70,7 @@ public final class AtsBranchManager {
BranchId workingBranch = teamArt.getWorkingBranch();
List<BranchId> destinationBranches = new ArrayList<>();
- if (workingBranch != null) {
+ if (workingBranch.isValid()) {
List<MergeBranch> mergeBranches = BranchManager.getMergeBranches(workingBranch);
BranchId selectedBranch = null;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
index f4e9f778b12..0e1429d407d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranch.java
@@ -27,8 +27,8 @@ import org.eclipse.osee.ats.util.AtsBranchManager;
import org.eclipse.osee.framework.access.AccessControlData;
import org.eclipse.osee.framework.access.AccessControlManager;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLevel;
@@ -263,7 +263,7 @@ public class XWorkingBranch extends GenericXWidget implements IArtifactWidget, I
OseeLog.log(Activator.class, Level.SEVERE, ex);
}
// just show normal icon if no branch yet
- if (branch == null) {
+ if (branch.isInvalid()) {
noBranch = true;
} else {
someAccessControlSet = !AccessControlManager.getAccessControlList(branch).isEmpty();
@@ -283,7 +283,7 @@ public class XWorkingBranch extends GenericXWidget implements IArtifactWidget, I
return;
}
BranchId branch = teamArt.getWorkingBranch();
- if (branch == null) {
+ if (branch.isInvalid()) {
AWorkbench.popup("Working branch doesn't exist");
return;
}
@@ -302,7 +302,7 @@ public class XWorkingBranch extends GenericXWidget implements IArtifactWidget, I
private void toggleWorkingBranchLock() {
try {
BranchId branch = teamArt.getWorkingBranch();
- if (branch == null) {
+ if (branch.isInvalid()) {
AWorkbench.popup("Working branch doesn't exist");
return;
}
@@ -351,7 +351,7 @@ public class XWorkingBranch extends GenericXWidget implements IArtifactWidget, I
public void refreshLabel() {
if (labelWidget != null && Widgets.isAccessible(labelWidget) && !getLabel().equals("")) {
try {
- Branch workBranch = enablement.getWorkingBranch();
+ IOseeBranch workBranch = enablement.getWorkingBranch();
String labelStr =
getLabel() + ": " + enablement.getStatus().getDisplayName() + (workBranch != null ? " - " + workBranch.getShortName() : "");
labelWidget.setText(labelStr);
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonArtifactExplorer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonArtifactExplorer.java
index 2435293f5d0..6bc6c09e00c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonArtifactExplorer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonArtifactExplorer.java
@@ -47,7 +47,7 @@ public class XWorkingBranchButtonArtifactExplorer extends XWorkingBranchButtonAb
@Override
protected void refreshEnablement(Button button) {
- button.setEnabled(!disableAll && getWorkingBranch() != null && getStatus().isChangesPermitted());
+ button.setEnabled(!disableAll && getWorkingBranch().isValid() && getStatus().isChangesPermitted());
}
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonFavorites.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonFavorites.java
index eab044ea698..f3c7cb323b9 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonFavorites.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonFavorites.java
@@ -63,7 +63,7 @@ public class XWorkingBranchButtonFavorites extends XWorkingBranchButtonAbstract
return;
}
BranchId branch = getTeamArt().getWorkingBranch();
- if (branch == null) {
+ if (branch.isInvalid()) {
AWorkbench.popup("Working branch doesn't exist");
return;
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonLock.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonLock.java
index ab8592a4201..c564952f0b7 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonLock.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchButtonLock.java
@@ -74,7 +74,7 @@ public class XWorkingBranchButtonLock extends XWorkingBranchButtonAbstract imple
OseeLog.log(Activator.class, Level.SEVERE, ex);
}
// just show normal icon if no branch yet
- if (branch == null) {
+ if (branch.isInvalid()) {
noBranch = true;
} else {
someAccessControlSet = !AccessControlManager.getAccessControlList(branch).isEmpty();
@@ -88,7 +88,7 @@ public class XWorkingBranchButtonLock extends XWorkingBranchButtonAbstract imple
private void toggleWorkingBranchLock(Button button) {
try {
BranchId branch = getTeamArt().getWorkingBranch();
- if (branch == null) {
+ if (branch.isInvalid()) {
AWorkbench.popup("Working branch doesn't exist");
return;
}
@@ -130,7 +130,7 @@ public class XWorkingBranchButtonLock extends XWorkingBranchButtonAbstract imple
@Override
public void handleEvent(org.osgi.service.event.Event event) {
BranchId branch = getTeamArt().getWorkingBranch();
- if (branch != null) {
+ if (branch.isValid()) {
AccessTopicEventPayload accessEvent = EventUtil.getTopicJson(event, AccessTopicEventPayload.class);
if (branch.equals(accessEvent.getBranch())) {
refreshWorkingBranchWidget();
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchEnablement.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchEnablement.java
index b6003d3607f..1ae1c1b5311 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchEnablement.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/XWorkingBranchEnablement.java
@@ -16,7 +16,7 @@ import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.internal.AtsClientService;
import org.eclipse.osee.ats.util.widgets.XWorkingBranch.BranchStatus;
-import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.jdk.core.type.LazyObject;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Lib;
@@ -105,7 +105,7 @@ public class XWorkingBranchEnablement {
return getEnablementData().getBranchStatus();
}
- public Branch getWorkingBranch() throws OseeCoreException {
+ public IOseeBranch getWorkingBranch() throws OseeCoreException {
return getEnablementData().getWorkingBranch();
}
@@ -140,8 +140,7 @@ public class XWorkingBranchEnablement {
public BranchEnablementData call() throws Exception {
BranchEnablementData enablementData = new BranchEnablementData(teamArt);
if (teamArt != null) {
- Branch workingBranch =
- (Branch) AtsClientService.get().getBranchService().getWorkingBranch(teamArt, true);
+ IOseeBranch workingBranch = AtsClientService.get().getBranchService().getWorkingBranch(teamArt, true);
enablementData.setWorkingBranch(workingBranch);
enablementData.setWorkingBranchInWork(
@@ -160,7 +159,7 @@ public class XWorkingBranchEnablement {
private static final class BranchEnablementData {
private final TeamWorkFlowArtifact teamArt;
- private Branch workingBranch;
+ private IOseeBranch workingBranch;
private boolean workingBranchInWork;
private boolean committedBranchExists;
@@ -178,7 +177,7 @@ public class XWorkingBranchEnablement {
this.committedBranchExists = committedBranchExists;
}
- public void setWorkingBranch(Branch workingBranch) {
+ public void setWorkingBranch(IOseeBranch workingBranch) {
this.workingBranch = workingBranch;
}
@@ -187,12 +186,12 @@ public class XWorkingBranchEnablement {
}
public boolean isWorkingBranchCreationInProgress() {
- return teamArt.isWorkingBranchCreationInProgress() || (workingBranch != null && BranchManager.getState(
+ return teamArt.isWorkingBranchCreationInProgress() || (workingBranch.isValid() && BranchManager.getState(
workingBranch).isCreationInProgress());
}
public boolean isWorkingBranchCommitInProgress() {
- return teamArt.isWorkingBranchCommitInProgress() || workingBranch != null && BranchManager.getState(
+ return teamArt.isWorkingBranchCommitInProgress() || workingBranch.isValid() && BranchManager.getState(
workingBranch).isCommitInProgress();
}
@@ -208,7 +207,7 @@ public class XWorkingBranchEnablement {
return disableAll;
}
- public Branch getWorkingBranch() {
+ public IOseeBranch getWorkingBranch() {
return workingBranch;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
index cd956a7cfe0..a5f763e129d 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java
@@ -187,7 +187,6 @@ public final class BranchManager {
branch = loadBranchToCache(branchId);
}
}
-
return branch;
}

Back to the top