diff options
author | Ryan D. Brooks | 2016-12-05 19:47:04 +0000 |
---|---|---|
committer | donald.g.dunne | 2016-12-05 19:47:04 +0000 |
commit | 4988c33c818cd2fc078725e8561ff49d74090a5d (patch) | |
tree | 079abb54a246056a53475a022d11e8a0e79ff066 /plugins | |
parent | ea7b408e3b9ef18aef0130a393b96773c7815f18 (diff) | |
download | org.eclipse.osee-4988c33c818cd2fc078725e8561ff49d74090a5d.tar.gz org.eclipse.osee-4988c33c818cd2fc078725e8561ff49d74090a5d.tar.xz org.eclipse.osee-4988c33c818cd2fc078725e8561ff49d74090a5d.zip |
refactor: Use Id types in DefaultBasicGuidArtifact
Change-Id: I2c88ddc5b396fccf5b03367c640b15327853bbd3
Diffstat (limited to 'plugins')
22 files changed, 143 insertions, 194 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AtsTaskService.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AtsTaskService.java index 05a76c8ae2e..1b9fce2a5d3 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AtsTaskService.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/AtsTaskService.java @@ -35,7 +35,6 @@ import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact; import org.eclipse.osee.ats.core.client.util.AtsTaskCache; import org.eclipse.osee.ats.core.util.AtsUtilCore; import org.eclipse.osee.framework.core.enums.DeletionFlag; -import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact; import org.eclipse.osee.framework.core.model.event.DefaultBasicUuidRelation; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; @@ -91,8 +90,8 @@ public class AtsTaskService extends AbstractAtsTaskService { for (JaxAtsTask task : jaxTasks.getTasks()) { String guid = ArtifactQuery.getGuidFromUuid(task.getUuid(), AtsUtilCore.getAtsBranch()); - artifactEvent.getArtifacts().add(new EventBasicGuidArtifact(EventModType.Added, AtsUtilCore.getAtsBranch(), - AtsArtifactTypes.Task.getGuid(), guid)); + artifactEvent.getArtifacts().add( + new EventBasicGuidArtifact(EventModType.Added, AtsUtilCore.getAtsBranch(), AtsArtifactTypes.Task, guid)); artUuids.add(task.getUuid()); RelationLink relation = getRelation(teamWf, task); @@ -100,9 +99,9 @@ public class AtsTaskService extends AbstractAtsTaskService { if (relation != null) { Artifact taskArt = atsClient.getArtifact(task.getUuid()); - DefaultBasicUuidRelation guidRelation = - new DefaultBasicUuidRelation(AtsUtilCore.getAtsBranch(), AtsRelationTypes.TeamWfToTask_Task.getGuid(), - relation.getId(), relation.getGammaId(), getBasicGuidArtifact(teamWf), getBasicGuidArtifact(taskArt)); + DefaultBasicUuidRelation guidRelation = new DefaultBasicUuidRelation(AtsUtilCore.getAtsBranch(), + AtsRelationTypes.TeamWfToTask_Task.getGuid(), relation.getId(), relation.getGammaId(), + teamWf.getBasicGuidArtifact(), taskArt.getBasicGuidArtifact()); artifactEvent.getRelations().add(new EventBasicGuidRelation(RelationEventType.Added, newTaskData.getTeamWfUuid().intValue(), new Long(task.getUuid()).intValue(), guidRelation)); @@ -114,10 +113,6 @@ public class AtsTaskService extends AbstractAtsTaskService { } } - public static DefaultBasicGuidArtifact getBasicGuidArtifact(Artifact artifact) { - return new DefaultBasicGuidArtifact(artifact.getBranch(), artifact.getArtTypeGuid(), artifact.getGuid()); - } - private RelationLink getRelation(Artifact teamWf, JaxAtsTask task) { for (RelationLink relation : teamWf.getRelationsAll(DeletionFlag.EXCLUDE_DELETED)) { if (relation.getBArtifactId() == task.getUuid().intValue()) { diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactEventTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactEventTest.java index c853b6dd29c..8bbe3a802bd 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactEventTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactEventTest.java @@ -325,11 +325,11 @@ public class ArtifactEventTest { } Assert.assertEquals(newArt.getGuid(), guidArt.getGuid()); Assert.assertTrue(newArt.isOnSameBranch(guidArt)); - Assert.assertEquals(CoreArtifactTypes.HeadingMSWord.getGuid(), guidArt.getArtTypeGuid()); - Assert.assertEquals(CoreArtifactTypes.GeneralData.getGuid(), guidArt.getFromArtTypeGuid()); + Assert.assertEquals(CoreArtifactTypes.HeadingMSWord, guidArt.getArtifactType()); + Assert.assertEquals(CoreArtifactTypes.GeneralData, guidArt.getFromArtTypeGuid()); // Reload artifact; since artifact cache cleared, it should be loaded as new artifact type Artifact changedArt = ArtifactQuery.getArtifactFromId(newArt.getGuid(), newArt.getBranch()); - Assert.assertEquals(CoreArtifactTypes.HeadingMSWord.getGuid(), changedArt.getArtifactType().getGuid()); + Assert.assertEquals(CoreArtifactTypes.HeadingMSWord, changedArt.getArtifactType()); } protected boolean isRemoteTest() { diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactTest.java index 9a4fef15920..2192570d0b7 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactTest.java @@ -25,7 +25,6 @@ import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; @@ -106,19 +105,16 @@ public final class ArtifactTest { art.persist("test"); DefaultBasicGuidArtifact equalGuid = - new DefaultBasicGuidArtifact(SYSTEM_ROOT, CoreArtifactTypes.SoftwareDesign.getGuid(), art.getGuid()); + new DefaultBasicGuidArtifact(SYSTEM_ROOT, CoreArtifactTypes.SoftwareDesign, art); Assert.assertEquals(art.hashCode(), equalGuid.hashCode()); - DefaultBasicGuidArtifact equalGuidArtType = - new DefaultBasicGuidArtifact(SYSTEM_ROOT, GeneralData.getGuid(), art.getGuid()); + DefaultBasicGuidArtifact equalGuidArtType = new DefaultBasicGuidArtifact(SYSTEM_ROOT, GeneralData, art); Assert.assertEquals(art.hashCode(), equalGuidArtType.hashCode()); - DefaultBasicGuidArtifact equalGuidArtTypeBranchUuid = - new DefaultBasicGuidArtifact(COMMON, GeneralData.getGuid(), art.getGuid()); + DefaultBasicGuidArtifact equalGuidArtTypeBranchUuid = new DefaultBasicGuidArtifact(COMMON, GeneralData, art); Assert.assertEquals(art.hashCode(), equalGuidArtTypeBranchUuid.hashCode()); - DefaultBasicGuidArtifact equalArtTypeBranchUuidNotGuid = - new DefaultBasicGuidArtifact(COMMON, GeneralData.getGuid(), GUID.create()); + DefaultBasicGuidArtifact equalArtTypeBranchUuidNotGuid = new DefaultBasicGuidArtifact(COMMON, GeneralData); Assert.assertNotSame(art.hashCode(), equalArtTypeBranchUuidNotGuid.hashCode()); } @@ -128,19 +124,16 @@ public final class ArtifactTest { art.persist("test"); DefaultBasicGuidArtifact equalGuid = - new DefaultBasicGuidArtifact(SYSTEM_ROOT, CoreArtifactTypes.SoftwareDesign.getGuid(), art.getGuid()); + new DefaultBasicGuidArtifact(SYSTEM_ROOT, CoreArtifactTypes.SoftwareDesign, art); Assert.assertNotSame(art, equalGuid); - DefaultBasicGuidArtifact equalGuidArtType = - new DefaultBasicGuidArtifact(SYSTEM_ROOT, GeneralData.getGuid(), art.getGuid()); + DefaultBasicGuidArtifact equalGuidArtType = new DefaultBasicGuidArtifact(SYSTEM_ROOT, GeneralData, art); Assert.assertNotSame(art, equalGuidArtType); - DefaultBasicGuidArtifact equalGuidArtTypeBranchUuid = - new DefaultBasicGuidArtifact(COMMON, GeneralData.getGuid(), art.getGuid()); + DefaultBasicGuidArtifact equalGuidArtTypeBranchUuid = new DefaultBasicGuidArtifact(COMMON, GeneralData, art); Assert.assertEquals(art, equalGuidArtTypeBranchUuid); - DefaultBasicGuidArtifact equalArtTypeBranchUuidNotGuid = - new DefaultBasicGuidArtifact(COMMON, GeneralData.getGuid(), GUID.create()); + DefaultBasicGuidArtifact equalArtTypeBranchUuidNotGuid = new DefaultBasicGuidArtifact(COMMON, GeneralData); Assert.assertNotSame(art, equalArtTypeBranchUuidNotGuid); } diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidArtifact.java index eca5bb1dfc3..dac3f1181ac 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidArtifact.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/event/DefaultBasicGuidArtifact.java @@ -10,21 +10,32 @@ *******************************************************************************/ package org.eclipse.osee.framework.core.model.event; +import org.eclipse.osee.framework.core.data.ArtifactId; +import org.eclipse.osee.framework.core.data.ArtifactTypeId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.jdk.core.type.BaseIdentity; +import org.eclipse.osee.framework.jdk.core.util.GUID; /** * @author Donald G. Dunne */ public class DefaultBasicGuidArtifact extends BaseIdentity<String> implements IBasicGuidArtifact { private final BranchId branch; - private Long artTypeGuid; + private ArtifactTypeId artifactType; - public DefaultBasicGuidArtifact(BranchId branch, Long artTypeGuid, String artGuid) { + public DefaultBasicGuidArtifact(BranchId branch, ArtifactTypeId artifactType, String artGuid) { super(artGuid); this.branch = branch; - this.artTypeGuid = artTypeGuid; + this.artifactType = artifactType; + } + + public DefaultBasicGuidArtifact(BranchId branch, ArtifactTypeId artifactType) { + this(branch, artifactType, GUID.create()); + } + + public DefaultBasicGuidArtifact(BranchId branch, ArtifactTypeId artifactType, ArtifactId artifact) { + this(branch, artifactType, artifact.getGuid()); } @Override @@ -34,7 +45,11 @@ public class DefaultBasicGuidArtifact extends BaseIdentity<String> implements IB @Override public Long getArtTypeGuid() { - return artTypeGuid; + return artifactType.getId(); + } + + public ArtifactTypeId getArtifactType() { + return artifactType; } @Override @@ -59,10 +74,10 @@ public class DefaultBasicGuidArtifact extends BaseIdentity<String> implements IB if (!equals && obj instanceof IBasicGuidArtifact) { IBasicGuidArtifact other = (IBasicGuidArtifact) obj; - if (artTypeGuid == null || other.getArtTypeGuid() == null) { + if (artifactType == null || other.getArtTypeGuid() == null) { equals = false; } - equals = artTypeGuid.equals(other.getArtTypeGuid()); + equals = artifactType.equals(other.getArtTypeGuid()); equals &= isOnSameBranch(other); @@ -75,8 +90,8 @@ public class DefaultBasicGuidArtifact extends BaseIdentity<String> implements IB return equals; } - public void setArtTypeGuid(Long artTypeGuid) { - this.artTypeGuid = artTypeGuid; + public void setArtTypeGuid(ArtifactTypeId artifactType) { + this.artifactType = artifactType; } public boolean is(IArtifactType... artifactTypes) { diff --git a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBasicGuidArtifact1.java b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBasicGuidArtifact1.java index 8408b67129a..6611ca4890a 100644 --- a/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBasicGuidArtifact1.java +++ b/plugins/org.eclipse.osee.framework.messaging.event.res/src-gen/org/eclipse/osee/framework/messaging/event/res/msgs/RemoteBasicGuidArtifact1.java @@ -14,6 +14,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; +import org.eclipse.osee.framework.core.data.ArtifactTypeId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.messaging.event.res.RemoteEvent; @@ -111,6 +112,10 @@ public class RemoteBasicGuidArtifact1 extends RemoteEvent { return artTypeGuid; } + public ArtifactTypeId getArtifactType() { + return ArtifactTypeId.valueOf(artTypeGuid); + } + /** * Sets the value of the artTypeGuid property. */ @@ -165,6 +170,10 @@ public class RemoteBasicGuidArtifact1 extends RemoteEvent { return toArtTypeGuid; } + public ArtifactTypeId getToArtifactType() { + return ArtifactTypeId.valueOf(toArtTypeGuid); + } + /** * Sets the value of the toArtTypeGuid property. */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventBasicGuidArtifactTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventBasicGuidArtifactTest.java index 107285c70a0..80aa6d2d3b2 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventBasicGuidArtifactTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventBasicGuidArtifactTest.java @@ -10,12 +10,12 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.event; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.Artifact; import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON; import java.util.HashSet; import java.util.Set; import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact; import org.eclipse.osee.framework.core.model.event.IBasicGuidArtifact; -import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact; import org.eclipse.osee.framework.skynet.core.event.model.EventModType; import org.junit.Assert; @@ -28,30 +28,15 @@ public class EventBasicGuidArtifactTest { @Test public void testEqualsEventBasicGuidArtifact() { - EventBasicGuidArtifact eventArt1 = new EventBasicGuidArtifact(EventModType.Added, COMMON, 0x01L, GUID.create()); + EventBasicGuidArtifact eventArt1 = new EventBasicGuidArtifact(EventModType.Added, COMMON, Artifact); EventBasicGuidArtifact eventArt2 = - new EventBasicGuidArtifact(EventModType.Added, COMMON, eventArt1.getArtTypeGuid(), eventArt1.getGuid()); + new EventBasicGuidArtifact(EventModType.Added, COMMON, Artifact, eventArt1.getGuid()); Assert.assertEquals(eventArt1.hashCode(), eventArt2.hashCode()); Assert.assertEquals(eventArt1, eventArt2); - - eventArt2 = - new EventBasicGuidArtifact(EventModType.Deleted, COMMON, eventArt1.getArtTypeGuid(), eventArt1.getGuid()); - - Assert.assertNotSame(eventArt1, eventArt2); - - eventArt2 = - new EventBasicGuidArtifact(EventModType.Added, COMMON, eventArt1.getArtTypeGuid(), eventArt1.getGuid()); - - Assert.assertNotSame(eventArt1, eventArt2); - - eventArt2 = new EventBasicGuidArtifact(EventModType.Added, COMMON, 0x02L, eventArt1.getGuid()); - Assert.assertNotSame(eventArt1, eventArt2); - eventArt2 = new EventBasicGuidArtifact(EventModType.Added, COMMON, eventArt1.getArtTypeGuid(), GUID.create()); - - Assert.assertNotSame(eventArt1, eventArt2); + eventArt2 = new EventBasicGuidArtifact(EventModType.Added, COMMON, Artifact); Set<EventBasicGuidArtifact> toAdd = new HashSet<>(); toAdd.add(eventArt2); @@ -65,36 +50,18 @@ public class EventBasicGuidArtifactTest { eventArts.add(eventArt2); eventArts.addAll(toAdd); Assert.assertEquals(2, toAdd.size()); - } @Test public void testEqualsBasicGuidArtifact() { - EventBasicGuidArtifact eventArt1 = new EventBasicGuidArtifact(EventModType.Added, COMMON, 0x01L, GUID.create()); - DefaultBasicGuidArtifact eventArt2 = - new DefaultBasicGuidArtifact(eventArt1.getBranch(), eventArt1.getArtTypeGuid(), eventArt1.getGuid()); + EventBasicGuidArtifact eventArt1 = new EventBasicGuidArtifact(EventModType.Added, COMMON, Artifact); + DefaultBasicGuidArtifact eventArt2 = new DefaultBasicGuidArtifact(COMMON, Artifact, eventArt1.getGuid()); Assert.assertEquals(eventArt1.hashCode(), eventArt2.hashCode()); Assert.assertEquals(eventArt1, eventArt2); - - eventArt2 = new EventBasicGuidArtifact(EventModType.Deleted, eventArt1.getBranch(), eventArt1.getArtTypeGuid(), - eventArt1.getGuid()); - - Assert.assertNotSame(eventArt1, eventArt2); - - eventArt2 = - new EventBasicGuidArtifact(EventModType.Added, COMMON, eventArt1.getArtTypeGuid(), eventArt1.getGuid()); - Assert.assertNotSame(eventArt1, eventArt2); - eventArt2 = new EventBasicGuidArtifact(EventModType.Added, eventArt1.getBranch(), 0x02L, eventArt1.getGuid()); - - Assert.assertNotSame(eventArt1, eventArt2); - - eventArt2 = new EventBasicGuidArtifact(EventModType.Added, eventArt1.getBranch(), eventArt1.getArtTypeGuid(), - GUID.create()); - - Assert.assertNotSame(eventArt1, eventArt2); + eventArt2 = new EventBasicGuidArtifact(EventModType.Added, COMMON, Artifact); Set<IBasicGuidArtifact> toAdd = new HashSet<>(); toAdd.add(eventArt2); @@ -108,16 +75,14 @@ public class EventBasicGuidArtifactTest { eventArts.add(eventArt2); eventArts.addAll(toAdd); Assert.assertEquals(2, toAdd.size()); - } @Test public void testEventBasicGuidArtifactIs() { - EventBasicGuidArtifact eventArt1 = new EventBasicGuidArtifact(EventModType.Added, COMMON, 0x01L, GUID.create()); + EventBasicGuidArtifact eventArt1 = new EventBasicGuidArtifact(EventModType.Added, COMMON, Artifact); Assert.assertTrue(eventArt1.is(EventModType.Added)); Assert.assertTrue(eventArt1.is(EventModType.Added, EventModType.ChangeType)); Assert.assertFalse(eventArt1.is(EventModType.ChangeType)); Assert.assertFalse(eventArt1.is(EventModType.Deleted, EventModType.ChangeType)); } - -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventBasicGuidRelationTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventBasicGuidRelationTest.java index 6483a612514..462cc53eb4c 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventBasicGuidRelationTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventBasicGuidRelationTest.java @@ -10,12 +10,13 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.event; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.Artifact; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.GlobalPreferences; import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON; import java.util.HashSet; import java.util.Set; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact; -import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidRelation; import org.eclipse.osee.framework.skynet.core.relation.RelationEventType; import org.junit.Assert; @@ -28,9 +29,8 @@ public class EventBasicGuidRelationTest { @Test public void testEqualsEventBasicGuidRelation() { - DefaultBasicGuidArtifact eventArt1 = new DefaultBasicGuidArtifact(COMMON, 0x01L, GUID.create()); - DefaultBasicGuidArtifact eventArt2 = - new DefaultBasicGuidArtifact(eventArt1.getBranch(), eventArt1.getArtTypeGuid(), eventArt1.getGuid()); + DefaultBasicGuidArtifact eventArt1 = new DefaultBasicGuidArtifact(COMMON, Artifact); + DefaultBasicGuidArtifact eventArt2 = new DefaultBasicGuidArtifact(COMMON, Artifact, eventArt1.getGuid()); EventBasicGuidRelation eventRel1 = new EventBasicGuidRelation(RelationEventType.Added, eventArt1.getBranch(), 0x02L, 234, 333, 34, eventArt1, 33, eventArt2); @@ -94,9 +94,8 @@ public class EventBasicGuidRelationTest { @Test public void testEventBasicGuidRelationIs() { - DefaultBasicGuidArtifact eventArt1 = new DefaultBasicGuidArtifact(COMMON, 0x03L, GUID.create()); - DefaultBasicGuidArtifact eventArt2 = - new DefaultBasicGuidArtifact(eventArt1.getBranch(), eventArt1.getArtTypeGuid(), eventArt1.getGuid()); + DefaultBasicGuidArtifact eventArt1 = new DefaultBasicGuidArtifact(COMMON, GlobalPreferences); + DefaultBasicGuidArtifact eventArt2 = new DefaultBasicGuidArtifact(COMMON, GlobalPreferences, eventArt1.getGuid()); EventBasicGuidRelation eventRel1 = new EventBasicGuidRelation(RelationEventType.Added, eventArt1.getBranch(), 0x04L, 234, 333, 34, eventArt1, 33, eventArt2); diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventChangeTypeBasicGuidArtifactTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventChangeTypeBasicGuidArtifactTest.java index 46431cda7a7..99b47f7fda2 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventChangeTypeBasicGuidArtifactTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/EventChangeTypeBasicGuidArtifactTest.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.event; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.Artifact; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.Folder; import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON; import java.util.HashSet; import java.util.Set; @@ -27,32 +29,17 @@ public class EventChangeTypeBasicGuidArtifactTest { @Test public void testEquals() { EventChangeTypeBasicGuidArtifact eventArt1 = - new EventChangeTypeBasicGuidArtifact(COMMON, 1234L, 546L, GUID.create()); - EventChangeTypeBasicGuidArtifact eventArt2 = new EventChangeTypeBasicGuidArtifact(eventArt1.getBranch(), - eventArt1.getFromArtTypeGuid(), eventArt1.getArtTypeGuid(), eventArt1.getGuid()); + new EventChangeTypeBasicGuidArtifact(COMMON, Artifact, Folder, GUID.create()); + EventChangeTypeBasicGuidArtifact eventArt2 = + new EventChangeTypeBasicGuidArtifact(COMMON, Artifact, Folder, eventArt1.getGuid()); Assert.assertEquals(eventArt1.hashCode(), eventArt2.hashCode()); Assert.assertEquals(eventArt1, eventArt2); - - eventArt2 = new EventChangeTypeBasicGuidArtifact(eventArt1.getBranch(), eventArt1.getFromArtTypeGuid(), - eventArt1.getArtTypeGuid(), eventArt1.getGuid()); - Assert.assertNotSame(eventArt1, eventArt2); - eventArt2 = new EventChangeTypeBasicGuidArtifact(COMMON, eventArt1.getFromArtTypeGuid(), - eventArt1.getArtTypeGuid(), eventArt1.getGuid()); - Assert.assertNotSame(eventArt1, eventArt2); - eventArt2 = new EventChangeTypeBasicGuidArtifact(eventArt1.getBranch(), 111L, eventArt1.getArtTypeGuid(), - eventArt1.getGuid()); - - Assert.assertNotSame(eventArt1, eventArt2); - - eventArt2 = new EventChangeTypeBasicGuidArtifact(eventArt1.getBranch(), eventArt1.getFromArtTypeGuid(), - eventArt1.getArtTypeGuid(), GUID.create()); - - Assert.assertNotSame(eventArt1, eventArt2); + eventArt2 = new EventChangeTypeBasicGuidArtifact(COMMON, Artifact, Folder, GUID.create()); Set<EventBasicGuidArtifact> toAdd = new HashSet<>(); toAdd.add(eventArt2); @@ -66,6 +53,5 @@ public class EventChangeTypeBasicGuidArtifactTest { eventArts.add(eventArt2); eventArts.addAll(toAdd); Assert.assertEquals(2, toAdd.size()); - } -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilterTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilterTest.java index 7adf6f4ac4c..e345875886c 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilterTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilterTest.java @@ -15,7 +15,6 @@ import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.core.enums.CoreRelationTypes; import org.eclipse.osee.framework.core.model.event.IBasicGuidRelation; -import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.skynet.core.artifact.IArtifactTypeProvider; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidRelation; @@ -47,12 +46,12 @@ public class ArtifactTypeEventFilterTest { CoreArtifactTypes.Requirement); ArtifactTypeEventFilter typeFilter = new ArtifactTypeEventFilter(typeProvider, CoreArtifactTypes.Requirement); EventBasicGuidArtifact guidArt = - new EventBasicGuidArtifact(EventModType.Added, COMMON, CoreArtifactTypes.Requirement.getGuid(), GUID.create()); + new EventBasicGuidArtifact(EventModType.Added, COMMON, CoreArtifactTypes.Requirement); List<EventBasicGuidArtifact> guidArts = Arrays.asList(guidArt); Assert.assertTrue("Should match cause same artifact type", typeFilter.isMatchArtifacts(guidArts)); // inherited type - guidArt.setArtTypeGuid(CoreArtifactTypes.SoftwareRequirement.getGuid()); + guidArt.setArtTypeGuid(CoreArtifactTypes.SoftwareRequirement); when(typeProvider.getTypeByGuid(CoreArtifactTypes.SoftwareRequirement.getGuid())).thenReturn( CoreArtifactTypes.SoftwareRequirement); when(typeProvider.inheritsFrom(CoreArtifactTypes.SoftwareRequirement, CoreArtifactTypes.Requirement)).thenReturn( @@ -63,7 +62,7 @@ public class ArtifactTypeEventFilterTest { // not inherited type typeFilter = new ArtifactTypeEventFilter(typeProvider, CoreArtifactTypes.SoftwareRequirement); - guidArt.setArtTypeGuid(CoreArtifactTypes.Requirement.getGuid()); + guidArt.setArtTypeGuid(CoreArtifactTypes.Requirement); Assert.assertFalse("Should NOT match cause Requirement is NOT subclass of Software Requirement", typeFilter.isMatchArtifacts(guidArts)); @@ -76,9 +75,9 @@ public class ArtifactTypeEventFilterTest { when(typeProvider.getTypeByGuid(CoreArtifactTypes.Requirement.getGuid())).thenReturn( CoreArtifactTypes.Requirement); EventBasicGuidArtifact guidArtA = - new EventBasicGuidArtifact(EventModType.Added, COMMON, CoreArtifactTypes.Requirement.getGuid(), GUID.create()); - EventBasicGuidArtifact guidArtB = new EventBasicGuidArtifact(EventModType.Added, COMMON, - CoreArtifactTypes.SoftwareRequirement.getGuid(), GUID.create()); + new EventBasicGuidArtifact(EventModType.Added, COMMON, CoreArtifactTypes.Requirement); + EventBasicGuidArtifact guidArtB = + new EventBasicGuidArtifact(EventModType.Added, COMMON, CoreArtifactTypes.SoftwareRequirement); List<IBasicGuidRelation> relations = new ArrayList<>(); EventBasicGuidRelation relation = new EventBasicGuidRelation(RelationEventType.Added, BranchId.SENTINEL, @@ -89,8 +88,8 @@ public class ArtifactTypeEventFilterTest { Assert.assertTrue(typeFilter.isMatchRelationArtifacts(relations)); // no art in relation matches - guidArtA.setArtTypeGuid(CoreArtifactTypes.AccessControlModel.getGuid()); - guidArtB.setArtTypeGuid(CoreArtifactTypes.Folder.getGuid()); + guidArtA.setArtTypeGuid(CoreArtifactTypes.AccessControlModel); + guidArtB.setArtTypeGuid(CoreArtifactTypes.Folder); Assert.assertFalse(typeFilter.isMatchRelationArtifacts(relations)); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/filter/BranchUuidEventFilterTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/filter/BranchUuidEventFilterTest.java index 91566cf7e68..4bf139cb024 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/filter/BranchUuidEventFilterTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/filter/BranchUuidEventFilterTest.java @@ -10,16 +10,16 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.event.filter; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.Requirement; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.SoftwareRequirement; import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON; import static org.eclipse.osee.framework.core.enums.CoreBranches.SYSTEM_ROOT; import java.util.ArrayList; import java.util.List; import org.eclipse.osee.framework.core.data.BranchId; -import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreRelationTypes; import org.eclipse.osee.framework.core.model.event.IBasicGuidArtifact; import org.eclipse.osee.framework.core.model.event.IBasicGuidRelation; -import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidRelation; import org.eclipse.osee.framework.skynet.core.event.model.EventModType; @@ -45,18 +45,16 @@ public class BranchUuidEventFilterTest { public void testIsMatchArtifacts() { BranchUuidEventFilter branchFilter = new BranchUuidEventFilter(COMMON); - EventBasicGuidArtifact guidArtA = new EventBasicGuidArtifact(EventModType.Added, BranchId.create(), - CoreArtifactTypes.Requirement.getGuid(), GUID.create()); - EventBasicGuidArtifact guidArtB = new EventBasicGuidArtifact(EventModType.Added, BranchId.create(), - CoreArtifactTypes.SoftwareRequirement.getGuid(), GUID.create()); + EventBasicGuidArtifact guidArtA = new EventBasicGuidArtifact(EventModType.Added, BranchId.create(), Requirement); + EventBasicGuidArtifact guidArtB = + new EventBasicGuidArtifact(EventModType.Added, BranchId.create(), SoftwareRequirement); List<IBasicGuidArtifact> arts = new ArrayList<>(); arts.add(guidArtB); arts.add(guidArtA); Assert.assertFalse(branchFilter.isMatchArtifacts(arts)); - guidArtA = - new EventBasicGuidArtifact(EventModType.Added, COMMON, CoreArtifactTypes.Requirement.getGuid(), GUID.create()); + guidArtA = new EventBasicGuidArtifact(EventModType.Added, COMMON, Requirement); arts.clear(); arts.add(guidArtB); arts.add(guidArtA); @@ -68,10 +66,9 @@ public class BranchUuidEventFilterTest { public void testIsMatchRelationArtifacts() { BranchUuidEventFilter branchFilter = new BranchUuidEventFilter(COMMON); - EventBasicGuidArtifact guidArtA = new EventBasicGuidArtifact(EventModType.Added, BranchId.create(), - CoreArtifactTypes.Requirement.getGuid(), GUID.create()); - EventBasicGuidArtifact guidArtB = new EventBasicGuidArtifact(EventModType.Added, BranchId.create(), - CoreArtifactTypes.SoftwareRequirement.getGuid(), GUID.create()); + EventBasicGuidArtifact guidArtA = new EventBasicGuidArtifact(EventModType.Added, BranchId.create(), Requirement); + EventBasicGuidArtifact guidArtB = + new EventBasicGuidArtifact(EventModType.Added, BranchId.create(), SoftwareRequirement); List<IBasicGuidRelation> relations = new ArrayList<>(); EventBasicGuidRelation relation = new EventBasicGuidRelation(RelationEventType.Added, BranchId.SENTINEL, @@ -81,10 +78,8 @@ public class BranchUuidEventFilterTest { // neither in relation matches common branch Assert.assertFalse(branchFilter.isMatchRelationArtifacts(relations)); - guidArtA = - new EventBasicGuidArtifact(EventModType.Added, COMMON, CoreArtifactTypes.Requirement.getGuid(), GUID.create()); - guidArtB = new EventBasicGuidArtifact(EventModType.Added, COMMON, CoreArtifactTypes.SoftwareRequirement.getGuid(), - GUID.create()); + guidArtA = new EventBasicGuidArtifact(EventModType.Added, COMMON, Requirement); + guidArtB = new EventBasicGuidArtifact(EventModType.Added, COMMON, SoftwareRequirement); relations.clear(); relation = new EventBasicGuidRelation(RelationEventType.Added, COMMON, diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java index 9e34b1699ea..22627a656de 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java @@ -20,7 +20,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map.Entry; -import java.util.Random; import org.eclipse.osee.framework.core.data.RelationTypeToken; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreBranches; @@ -34,7 +33,6 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.Pair; import org.eclipse.osee.framework.jdk.core.util.Collections; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.skynet.core.types.IArtifact; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -44,7 +42,6 @@ import org.junit.Test; * @author Roberto E. Escobar */ public class RelationOrderDataTest { - private static final Random randomGenerator = new Random(); private Artifact artifact; private MockRelationOrderAccessor accessor; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java index 0d7fac35dd5..4e299930e26 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java @@ -1703,7 +1703,7 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A } public final DefaultBasicGuidArtifact getBasicGuidArtifact() { - return new DefaultBasicGuidArtifact(getBranch(), getArtifactType().getGuid(), getGuid()); + return new DefaultBasicGuidArtifact(getBranch(), getArtifactTypeId(), this); } @Override diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java index 2d723452a29..b54c1a1fc39 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java @@ -75,12 +75,10 @@ public class ArtifactTransactionData extends BaseTransactionData { // transactionEvent populated in SkynetTransaction after all attribute changes have been made break; case DELETED: - artifactEvent.getArtifacts().add( - new EventBasicGuidArtifact(EventModType.Deleted, artifact.getBasicGuidArtifact())); + artifactEvent.getArtifacts().add(new EventBasicGuidArtifact(EventModType.Deleted, artifact)); break; default: - artifactEvent.getArtifacts().add( - new EventBasicGuidArtifact(EventModType.Added, artifact.getBasicGuidArtifact())); + artifactEvent.getArtifacts().add(new EventBasicGuidArtifact(EventModType.Added, artifact)); break; } } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java index fd4e3d14a5c..92c5661ae20 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java @@ -144,8 +144,8 @@ public class ChangeArtifactType { deleteInvalidAttributes(artifact, newArtifactType); deleteInvalidRelations(artifact, newArtifactType); addTransaction(artifact, txMap); - artifactChanges.add(new EventChangeTypeBasicGuidArtifact(artifact.getBranch(), artifact.getArtTypeGuid(), - newArtifactType.getGuid(), artifact.getGuid())); + artifactChanges.add(new EventChangeTypeBasicGuidArtifact(artifact.getBranch(), + artifact.getArtifactTypeId(), newArtifactType, artifact.getGuid())); } } } finally { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java index 5d0d4790ceb..ce20c21880f 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkEventUtil.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.logging.Level; +import org.eclipse.osee.framework.core.data.ArtifactTypeId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact; import org.eclipse.osee.framework.core.model.event.DefaultBasicUuidRelationReorder; @@ -31,7 +32,6 @@ import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteNetworkSender1; import org.eclipse.osee.framework.messaging.event.res.msgs.RemotePersistEvent1; import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteTransactionChange1; import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteTransactionEvent1; -import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent; import org.eclipse.osee.framework.skynet.core.event.model.AttributeChange; import org.eclipse.osee.framework.skynet.core.event.model.BranchEvent; @@ -121,18 +121,17 @@ public final class FrameworkEventUtil { event.setTransaction(transEvent.getTransactionId()); for (EventBasicGuidArtifact guidArt : transEvent.getArtifacts()) { if (guidArt.getModType() == EventModType.Modified) { - event.getArtifacts().add(getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), - guidArt.getBasicGuidArtifact(), ((EventModifiedBasicGuidArtifact) guidArt).getAttributeChanges())); + event.getArtifacts().add(getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), guidArt, + ((EventModifiedBasicGuidArtifact) guidArt).getAttributeChanges())); } else if (guidArt.getModType() == EventModType.ChangeType) { EventChangeTypeBasicGuidArtifact changeGuidArt = (EventChangeTypeBasicGuidArtifact) guidArt; RemoteBasicGuidArtifact1 remGuidArt = - getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), guidArt.getBasicGuidArtifact(), null); - remGuidArt.setArtTypeGuid(changeGuidArt.getFromArtTypeGuid()); + getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), guidArt, null); + remGuidArt.setArtTypeGuid(changeGuidArt.getFromArtTypeGuid().getId()); remGuidArt.setToArtTypeGuid(changeGuidArt.getArtTypeGuid()); event.getArtifacts().add(remGuidArt); } else { - event.getArtifacts().add( - getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), guidArt.getBasicGuidArtifact(), null)); + event.getArtifacts().add(getRemoteBasicGuidArtifact(guidArt.getModType().getGuid(), guidArt, null)); } } for (EventBasicGuidRelation guidRel : transEvent.getRelations()) { @@ -244,13 +243,13 @@ public final class FrameworkEventUtil { } public static EventBasicGuidArtifact getEventBasicGuidArtifact(EventModType modType, RemoteBasicGuidArtifact1 remGuidArt) { - return new EventBasicGuidArtifact(modType, remGuidArt.getBranch(), remGuidArt.getArtTypeGuid(), + return new EventBasicGuidArtifact(modType, remGuidArt.getBranch(), remGuidArt.getArtifactType(), remGuidArt.getArtGuid()); } public static EventChangeTypeBasicGuidArtifact getEventChangeTypeBasicGuidArtifact(EventModType modType, RemoteBasicGuidArtifact1 remGuidArt) { - return new EventChangeTypeBasicGuidArtifact(remGuidArt.getBranch(), remGuidArt.getArtTypeGuid(), - remGuidArt.getToArtTypeGuid(), remGuidArt.getArtGuid()); + return new EventChangeTypeBasicGuidArtifact(remGuidArt.getBranch(), remGuidArt.getArtifactType(), + remGuidArt.getToArtifactType(), remGuidArt.getArtGuid()); } public static EventModifiedBasicGuidArtifact getEventModifiedBasicGuidArtifact(EventModType modType, RemoteBasicGuidArtifact1 remGuidArt) { @@ -258,16 +257,13 @@ public final class FrameworkEventUtil { for (RemoteAttributeChange1 remAttrChg : remGuidArt.getAttributes()) { attributeChanges.add(getAttributeChange(remAttrChg)); } - return new EventModifiedBasicGuidArtifact(remGuidArt.getBranch(), remGuidArt.getArtTypeGuid(), + return new EventModifiedBasicGuidArtifact(remGuidArt.getBranch(), remGuidArt.getArtifactType(), remGuidArt.getArtGuid(), attributeChanges); } public static DefaultBasicGuidArtifact getBasicGuidArtifact(RemoteBasicGuidArtifact1 remGuidArt) { - return new DefaultBasicGuidArtifact(remGuidArt.getBranch(), remGuidArt.getArtTypeGuid(), remGuidArt.getArtGuid()); - } - - public static DefaultBasicGuidArtifact getBasicGuidArtifact(Artifact artifact) { - return new DefaultBasicGuidArtifact(artifact.getBranch(), artifact.getArtTypeGuid(), artifact.getGuid()); + return new DefaultBasicGuidArtifact(remGuidArt.getBranch(), ArtifactTypeId.valueOf(remGuidArt.getArtTypeGuid()), + remGuidArt.getArtGuid()); } public static RemoteBasicGuidArtifact1 getRemoteBasicGuidArtifact(String modTypeGuid, DefaultBasicGuidArtifact guidArt, Collection<AttributeChange> attributeChanges) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventBasicGuidArtifact.java index 676cc3e14c2..f50668860a0 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventBasicGuidArtifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventBasicGuidArtifact.java @@ -13,11 +13,14 @@ package org.eclipse.osee.framework.skynet.core.event.model; import java.util.Collection; import java.util.HashSet; import java.util.Set; -import org.eclipse.osee.framework.core.data.BranchId; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; +import org.eclipse.osee.framework.core.data.ArtifactTypeId; +import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBasicGuidArtifact1; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; @@ -28,21 +31,26 @@ public class EventBasicGuidArtifact extends DefaultBasicGuidArtifact { private final EventModType eventModType; - public EventBasicGuidArtifact(EventModType eventModType, DefaultBasicGuidArtifact guidArt) { - this(eventModType, guidArt.getBranch(), guidArt.getArtTypeGuid(), guidArt.getGuid()); - } - public EventBasicGuidArtifact(EventModType eventModType, Artifact artifact) { - this(eventModType, artifact.getBranch(), artifact.getArtifactType().getGuid(), artifact.getGuid()); + this(eventModType, artifact.getBranch(), artifact.getArtifactType(), artifact); } public EventBasicGuidArtifact(EventModType eventModType, ArtifactToken basicGuidArtifact) { - this(eventModType, basicGuidArtifact.getBranch(), basicGuidArtifact.getArtifactType().getGuid(), - basicGuidArtifact.getGuid()); + this(eventModType, basicGuidArtifact.getBranch(), basicGuidArtifact.getArtifactType(), basicGuidArtifact); + } + + public EventBasicGuidArtifact(EventModType eventModType, BranchId branch, ArtifactTypeId artifactType, String guid) { + super(branch, artifactType, guid); + this.eventModType = eventModType; + } + + public EventBasicGuidArtifact(EventModType eventModType, BranchId branch, ArtifactTypeId artifactType) { + super(branch, artifactType, GUID.create()); + this.eventModType = eventModType; } - public EventBasicGuidArtifact(EventModType eventModType, BranchId branch, Long artTypeGuid, String guid) { - super(branch, artTypeGuid, guid); + public EventBasicGuidArtifact(EventModType eventModType, BranchId branch, ArtifactTypeId artifactType, ArtifactId artifact) { + super(branch, artifactType, artifact); this.eventModType = eventModType; } @@ -67,16 +75,12 @@ public class EventBasicGuidArtifact extends DefaultBasicGuidArtifact { } Set<EventBasicGuidArtifact> eventArts = new HashSet<>(); for (RemoteBasicGuidArtifact1 guidArt : basicGuidArtifacts) { - eventArts.add(new EventBasicGuidArtifact(eventModType, guidArt.getBranch(), guidArt.getArtTypeGuid(), + eventArts.add(new EventBasicGuidArtifact(eventModType, guidArt.getBranch(), guidArt.getArtifactType(), guidArt.getArtGuid())); } return eventArts; } - public DefaultBasicGuidArtifact getBasicGuidArtifact() { - return new DefaultBasicGuidArtifact(getBranch(), getArtTypeGuid(), getGuid()); - } - @Override public boolean equals(Object obj) { boolean equals = false; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventChangeTypeBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventChangeTypeBasicGuidArtifact.java index af79730865b..9cee2f7034e 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventChangeTypeBasicGuidArtifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventChangeTypeBasicGuidArtifact.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.event.model; +import org.eclipse.osee.framework.core.data.ArtifactTypeId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; @@ -19,14 +20,14 @@ import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; */ public class EventChangeTypeBasicGuidArtifact extends EventBasicGuidArtifact { - private final Long fromArtTypeGuid; + private final ArtifactTypeId fromArtTypeGuid; - public EventChangeTypeBasicGuidArtifact(BranchId branch, Long fromArtTypeGuid, Long artTypeGuid, String guid) { - super(EventModType.ChangeType, branch, artTypeGuid, guid); - this.fromArtTypeGuid = fromArtTypeGuid; + public EventChangeTypeBasicGuidArtifact(BranchId branch, ArtifactTypeId fromArtifactType, ArtifactTypeId artifactType, String guid) { + super(EventModType.ChangeType, branch, artifactType, guid); + this.fromArtTypeGuid = fromArtifactType; } - public Long getFromArtTypeGuid() { + public ArtifactTypeId getFromArtTypeGuid() { return fromArtTypeGuid; } @@ -34,7 +35,7 @@ public class EventChangeTypeBasicGuidArtifact extends EventBasicGuidArtifact { public String toString() { try { return String.format("[%s - %s from type [%s][%s] to [%s][%s]]", EventModType.ChangeType.name(), getGuid(), - fromArtTypeGuid, ArtifactTypeManager.getTypeByGuid(fromArtTypeGuid), getArtTypeGuid(), + fromArtTypeGuid, ArtifactTypeManager.getType(fromArtTypeGuid), getArtTypeGuid(), ArtifactTypeManager.getTypeByGuid(getArtTypeGuid())); } catch (OseeCoreException ex) { return String.format("[%s - %s from type [%s] to [%s]]", EventModType.ChangeType.name(), getGuid(), diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventModifiedBasicGuidArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventModifiedBasicGuidArtifact.java index 2064b3e997f..e2c5af4d78e 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventModifiedBasicGuidArtifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/EventModifiedBasicGuidArtifact.java @@ -11,6 +11,7 @@ package org.eclipse.osee.framework.skynet.core.event.model; import java.util.Collection; +import org.eclipse.osee.framework.core.data.ArtifactTypeId; import org.eclipse.osee.framework.core.data.BranchId; /** @@ -20,8 +21,8 @@ public class EventModifiedBasicGuidArtifact extends EventBasicGuidArtifact { private final Collection<AttributeChange> attributeChanges; - public EventModifiedBasicGuidArtifact(BranchId branch, Long artTypeGuid, String guid, Collection<AttributeChange> attributeChanges) { - super(EventModType.Modified, branch, artTypeGuid, guid); + public EventModifiedBasicGuidArtifact(BranchId branch, ArtifactTypeId artifactType, String guid, Collection<AttributeChange> attributeChanges) { + super(EventModType.Modified, branch, artifactType, guid); this.attributeChanges = attributeChanges; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java index 4977b9841f9..ae3662bb077 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java @@ -192,8 +192,8 @@ public final class CommitBranchHttpRequestOperation extends AbstractOperation { EventModifiedBasicGuidArtifact artEvent = artEventMap.get(artifactId.getId().intValue()); if (artEvent == null) { - artEvent = new EventModifiedBasicGuidArtifact(newTransaction.getBranch(), - change.getArtifactType().getGuid(), changedArtifact.getGuid(), + artEvent = new EventModifiedBasicGuidArtifact(newTransaction.getBranch(), change.getArtifactType(), + changedArtifact.getGuid(), new ArrayList<org.eclipse.osee.framework.skynet.core.event.model.AttributeChange>()); artifactEvent.getArtifacts().add(artEvent); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java index 35182746e20..bbb308eaf95 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java @@ -18,7 +18,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map.Entry; -import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.RelationTypeToken; import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.enums.RelationSorter; @@ -120,12 +119,9 @@ public class RelationOrderData { addOrderList(type, side, requestedSorterId, relativeSequence); relationOrderModType = RelationOrderModType.Absolute; } - BranchId branch = artifact.getBranch(); - DefaultBasicGuidArtifact guidArtifact = - new DefaultBasicGuidArtifact(branch, artifact.getArtifactTypeId().getId(), artifact.getGuid()); - - DefaultBasicUuidRelationReorder reorder = - new DefaultBasicUuidRelationReorder(relationOrderModType, branch, type.getGuid(), guidArtifact); + DefaultBasicGuidArtifact guidArtifact = artifact.getBasicGuidArtifact(); + DefaultBasicUuidRelationReorder reorder = new DefaultBasicUuidRelationReorder(relationOrderModType, + artifact.getBranch(), type.getGuid(), guidArtifact); accessor.store(artifact, this, reorder); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java index b56982b6a03..fac37045540 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java @@ -193,7 +193,7 @@ public final class StoreSkynetTransactionOperation extends AbstractDbTxOperation for (Artifact artifact : artifactReferences) { if (artifact.hasDirtyAttributes()) { EventModifiedBasicGuidArtifact guidArt = new EventModifiedBasicGuidArtifact(artifact.getBranch(), - artifact.getArtifactType().getGuid(), artifact.getGuid(), artifact.getDirtyFrameworkAttributeChanges()); + artifact.getArtifactType(), artifact.getGuid(), artifact.getDirtyFrameworkAttributeChanges()); artifactEvent.getArtifacts().add(guidArt); // Collection relation reorder records for events diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactOperation.java index 5e2e5c44cf7..0a439c9e7bc 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactOperation.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactOperation.java @@ -11,6 +11,7 @@ package org.eclipse.osee.framework.ui.skynet.render; +import com.google.common.collect.Lists; import java.io.File; import java.util.Collection; import java.util.LinkedList; @@ -39,7 +40,6 @@ import org.eclipse.osee.framework.ui.skynet.internal.Activator; import org.eclipse.osee.framework.ui.skynet.preferences.MsWordPreferencePage; import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI; import org.eclipse.osee.framework.ui.swt.Displays; -import com.google.common.collect.Lists; /** * @author Ryan D. Brooks @@ -95,7 +95,7 @@ public class UpdateArtifactOperation extends AbstractOperation { Collection<AttributeChange> attrChanges = getAttributeChanges(artifact, artChange); if (!attrChanges.isEmpty()) { EventModifiedBasicGuidArtifact guidArt = new EventModifiedBasicGuidArtifact(artifact.getBranch(), - artifact.getArtifactType().getGuid(), artifact.getGuid(), attrChanges); + artifact.getArtifactType(), artifact.getGuid(), attrChanges); artifactEvent.getArtifacts().add(guidArt); } } |