Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan E. Cook2017-02-22 16:10:07 +0000
committerMorgan Cook2017-02-27 23:29:14 +0000
commit83b53e1b042abd602f7b2d36ea200bef26a085a2 (patch)
treeeef18233cd8e8fdffc17c12a26bebf14a8b5764b
parent7eef713c3d6411b06f0ab9c36741cd7fb846785f (diff)
downloadorg.eclipse.osee-83b53e1b042abd602f7b2d36ea200bef26a085a2.tar.gz
org.eclipse.osee-83b53e1b042abd602f7b2d36ea200bef26a085a2.tar.xz
org.eclipse.osee-83b53e1b042abd602f7b2d36ea200bef26a085a2.zip
bug[ats_ATS349133]: Fix applic not preserved when deleting attrs/rels
Change-Id: I642a8e24bb432f2416366a6120225f311d6e0aca Signed-off-by: Morgan E. Cook <Morgan.e.cook@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationCacheTest.java3
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/utils/TestUtil.java3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java18
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IntroduceArtifactOperation.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/ArtifactChange.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/AttributeChange.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/Change.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/ErrorChange.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/RelationChange.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/RelationChangeWorker.java126
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AttributeChange.java17
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/ArtifactRemoteEventHandler.java11
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationLink.java10
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java7
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceAttributeWithBaselineOperation.java9
20 files changed, 76 insertions, 183 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationCacheTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationCacheTest.java
index 019f3630425..53a7bd14e96 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationCacheTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/RelationCacheTest.java
@@ -19,6 +19,7 @@ import org.eclipse.osee.client.integration.tests.integration.skynet.core.utils.T
import org.eclipse.osee.client.test.framework.OseeClientIntegrationRule;
import org.eclipse.osee.client.test.framework.OseeLogMonitor;
import org.eclipse.osee.client.test.framework.OseeLogMonitorRule;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.enums.ModificationType;
@@ -370,7 +371,7 @@ public class RelationCacheTest {
RelationType type = new RelationType(0x00L, "type name", artifactA.getName(), artifactB.getName(),
CoreArtifactTypes.Artifact, CoreArtifactTypes.Artifact, RelationTypeMultiplicity.MANY_TO_MANY, "");
RelationLink link = new RelationLink(new MockLinker("linker"), artifactA.getArtId(), artifactB.getArtId(),
- testBranch, type, 77, 88, "", ModificationType.MODIFIED);
+ testBranch, type, 77, 88, "", ModificationType.MODIFIED, ApplicabilityId.BASE);
relCache.cache(artifactA, link);
relCache.cache(artifactB, link);
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/utils/TestUtil.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/utils/TestUtil.java
index 02bbeb1b395..bd50ffe4bb0 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/utils/TestUtil.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/utils/TestUtil.java
@@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.enums.BranchState;
@@ -90,7 +91,7 @@ public final class TestUtil {
public static RelationLink createRelationLink(int relationId, int artA, int artB, Branch branch, RelationType relationType) {
return new RelationLink(new MockLinker("Linker"), artA, artB, branch, relationType, relationId, 0,
- "relation: " + relationId, ModificationType.MODIFIED);
+ "relation: " + relationId, ModificationType.MODIFIED, ApplicabilityId.BASE);
}
public static List<RelationLink> createLinks(int total, Branch branch) {
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 cfe04e97107..587a44fbaca 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
@@ -464,13 +464,15 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
private <T> Attribute<T> initializeAttribute(IAttributeType attributeType, ModificationType modificationType, boolean markDirty, boolean setDefaultValue) throws OseeCoreException {
Attribute<T> attribute = createAttribute(attributeType);
- attribute.internalInitialize(attributeType, this, modificationType, markDirty, setDefaultValue);
+ attribute.internalInitialize(attributeType, this, modificationType, ApplicabilityId.BASE, markDirty,
+ setDefaultValue);
return attribute;
}
- public final <T> Attribute<T> internalInitializeAttribute(IAttributeType attributeType, int attributeId, int gammaId, ModificationType modificationType, boolean markDirty, Object... data) throws OseeCoreException {
+ public final <T> Attribute<T> internalInitializeAttribute(IAttributeType attributeType, int attributeId, int gammaId, ModificationType modificationType, ApplicabilityId applicabilityId, boolean markDirty, Object... data) throws OseeCoreException {
Attribute<T> attribute = createAttribute(attributeType);
- attribute.internalInitialize(attributeType, this, modificationType, attributeId, gammaId, markDirty, false);
+ attribute.internalInitialize(attributeType, this, modificationType, applicabilityId, attributeId, gammaId,
+ markDirty, false);
attribute.getAttributeDataProvider().loadData(data);
return attribute;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java
index 7aedfeb46f6..421bad3af25 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java
@@ -17,6 +17,7 @@ import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.logging.Level;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.ModificationType;
@@ -45,12 +46,13 @@ public abstract class Attribute<T> implements Comparable<Attribute<T>>, IAttribu
private ModificationType modificationType;
private boolean useBackingData;
private IAttributeType attributeTypeToken;
+ private ApplicabilityId applicabilityId;
- void internalInitialize(IAttributeType attributeType, Artifact artifact, ModificationType modificationType, boolean markDirty, boolean setDefaultValue) throws OseeCoreException {
+ void internalInitialize(IAttributeType attributeType, Artifact artifact, ModificationType modificationType, ApplicabilityId applicabilityId, boolean markDirty, boolean setDefaultValue) throws OseeCoreException {
this.attributeTypeToken = attributeType;
this.artifactRef = new WeakReference<>(artifact);
internalSetModType(modificationType, false, markDirty);
-
+ internalSetApplicabilityId(applicabilityId);
try {
Class<? extends IAttributeDataProvider> providerClass =
AttributeTypeManager.getAttributeProviderClass(AttributeTypeManager.getType(attributeTypeToken));
@@ -67,6 +69,10 @@ public abstract class Attribute<T> implements Comparable<Attribute<T>>, IAttribu
uponInitialize();
}
+ private void internalSetApplicabilityId(ApplicabilityId applicabilityId) {
+ this.applicabilityId = applicabilityId;
+ }
+
/**
* Base implementation does nothing. Subclasses may override to do setup that depends on the attribute state data.
*/
@@ -94,8 +100,8 @@ public abstract class Attribute<T> implements Comparable<Attribute<T>>, IAttribu
return attributeChange;
}
- public void internalInitialize(IAttributeType attributeType, Artifact artifact, ModificationType modificationType, int attributeId, int gammaId, boolean markDirty, boolean setDefaultValue) throws OseeCoreException {
- internalInitialize(attributeType, artifact, modificationType, markDirty, setDefaultValue);
+ public void internalInitialize(IAttributeType attributeType, Artifact artifact, ModificationType modificationType, ApplicabilityId applicabilityId, int attributeId, int gammaId, boolean markDirty, boolean setDefaultValue) throws OseeCoreException {
+ internalInitialize(attributeType, artifact, modificationType, applicabilityId, markDirty, setDefaultValue);
this.attrId = attributeId;
this.gammaId = gammaId;
}
@@ -306,6 +312,10 @@ public abstract class Attribute<T> implements Comparable<Attribute<T>>, IAttribu
return gammaId;
}
+ public ApplicabilityId getApplicabilityId() {
+ return applicabilityId;
+ }
+
public void internalSetGammaId(int gammaId) {
this.gammaId = gammaId;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java
index 89840e19fb8..eac1233bef1 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java
@@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.TransactionToken;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
@@ -87,6 +88,7 @@ public class AttributeLoader {
public String value = "";
public int stripeId = -1;
public String uri = "";
+ public ApplicabilityId applicabilityId = ApplicabilityId.BASE;
public AttrData() {
// do nothing
@@ -106,6 +108,7 @@ public class AttributeLoader {
stripeId = chStmt.getInt("stripe_transaction_id");
}
uri = chStmt.getString("uri");
+ applicabilityId = ApplicabilityId.valueOf(chStmt.getLong("app_id"));
}
public static boolean isDifferentArtifact(AttrData previous, AttrData current) {
@@ -171,7 +174,7 @@ public class AttributeLoader {
}
boolean markDirty = false;
artifact.internalInitializeAttribute(attributeType, current.attrId, current.gammaId,
- ModificationType.getMod(current.modType), markDirty, value, current.uri);
+ ModificationType.getMod(current.modType), current.applicabilityId, markDirty, value, current.uri);
}
private static boolean isEnumOrBoolean(IAttributeType attributeType) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IntroduceArtifactOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IntroduceArtifactOperation.java
index f7e68f0b52d..1d2a8ec8111 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IntroduceArtifactOperation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IntroduceArtifactOperation.java
@@ -125,7 +125,7 @@ public class IntroduceArtifactOperation {
if (destinationAttribute == null) {
destinationArtifact.internalInitializeAttribute(sourceAttribute.getAttributeType(), sourceAttribute.getId(),
- sourceAttribute.getGammaId(), sourceAttribute.getModificationType(), true,
+ sourceAttribute.getGammaId(), sourceAttribute.getModificationType(), sourceAttribute.getApplicabilityId(), true,
sourceAttribute.getAttributeDataProvider().getData()).internalSetModType(
sourceAttribute.getModificationType(), true, true);
} else {
@@ -160,7 +160,7 @@ public class IntroduceArtifactOperation {
ModificationType modType = sourceRelation.getModificationType();
destinationRelation = RelationManager.getOrCreate(aArtifactId, bArtifactId, destinationBranch,
sourceRelation.getRelationType(), sourceRelation.getId(), sourceRelation.getGammaId(),
- sourceRelation.getRationale(), modType);
+ sourceRelation.getRationale(), modType, sourceRelation.getApplicabilityId());
destinationRelation.internalSetModType(modType, true, true);
}
} else {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java
index de3cbe85271..82f013510ac 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.framework.skynet.core.artifact;
import static org.eclipse.osee.framework.core.enums.LoadLevel.ARTIFACT_AND_ATTRIBUTE_DATA;
import static org.eclipse.osee.framework.core.enums.LoadLevel.ARTIFACT_DATA;
import java.util.Collection;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.LoadLevel;
@@ -54,9 +55,10 @@ class RelationLoader {
int gammaId = chStmt.getInt("gamma_id");
String rationale = chStmt.getString("rationale");
ModificationType modificationType = ModificationType.getMod(chStmt.getInt("mod_type"));
+ ApplicabilityId applicabilityId = ApplicabilityId.valueOf(chStmt.getLong("app_id"));
RelationManager.getOrCreate(aArtifactId, bArtifactId, branch, relationType, relationId, gammaId, rationale,
- modificationType);
+ modificationType, applicabilityId);
}
} finally {
chStmt.close();
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java
index 6b70c13aa4c..ad01b98362c 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java
@@ -140,8 +140,8 @@ public class AttributeTransactionData extends BaseTransactionData {
}
@Override
- protected ApplicabilityId getApplicabilityId() {
- return ApplicabilityId.BASE;
+ protected ApplicabilityId getApplicabilityId() throws OseeCoreException {
+ return attribute.getApplicabilityId();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/ArtifactChange.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/ArtifactChange.java
index 32a43d2ad21..61de6be139d 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/ArtifactChange.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/ArtifactChange.java
@@ -21,7 +21,6 @@ import org.eclipse.osee.framework.skynet.core.revision.LoadChangeType;
*/
public final class ArtifactChange extends Change {
private static LoadChangeType changeType = LoadChangeType.artifact;
- private static Class<ArtifactChangeWorker> worker = ArtifactChangeWorker.class;
private final String isValue;
private final String wasValue;
@@ -70,9 +69,4 @@ public final class ArtifactChange extends Change {
public LoadChangeType getChangeType() {
return changeType;
}
-
- @Override
- public Class<? extends IChangeWorker> getWorker() {
- return worker;
- }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/AttributeChange.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/AttributeChange.java
index 463f2c1b339..f82c280c90e 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/AttributeChange.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/AttributeChange.java
@@ -30,7 +30,6 @@ import org.eclipse.osee.framework.skynet.core.revision.LoadChangeType;
*/
public final class AttributeChange extends Change {
private final static LoadChangeType changeType = LoadChangeType.attribute;
- private final static Class<AttributeChangeWorker> worker = AttributeChangeWorker.class;
private final String isValue;
private final String wasValue;
@@ -147,9 +146,4 @@ public final class AttributeChange extends Change {
public LoadChangeType getChangeType() {
return changeType;
}
-
- @Override
- public Class<? extends IChangeWorker> getWorker() {
- return worker;
- }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/Change.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/Change.java
index 557faa98156..dacaa26cfb4 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/Change.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/Change.java
@@ -163,8 +163,6 @@ public abstract class Change implements IAdaptable, Comparable<Change>, HasBranc
public abstract LoadChangeType getChangeType();
- public abstract Class<? extends IChangeWorker> getWorker();
-
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> type) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/ErrorChange.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/ErrorChange.java
index 5bde6c9f764..b254a9e6cc0 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/ErrorChange.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/ErrorChange.java
@@ -68,10 +68,4 @@ public final class ErrorChange extends Change {
public LoadChangeType getChangeType() {
return null;
}
-
- @Override
- public Class<? extends IChangeWorker> getWorker() {
- return null;
- }
-
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/RelationChange.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/RelationChange.java
index 32fb453e829..8d28c138356 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/RelationChange.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/RelationChange.java
@@ -23,7 +23,6 @@ import org.eclipse.osee.framework.skynet.core.revision.LoadChangeType;
*/
public final class RelationChange extends Change {
private final static LoadChangeType changeType = LoadChangeType.relation;
- private final static Class<RelationChangeWorker> worker = RelationChangeWorker.class;
private final int bArtId;
private final Artifact endTxBArtifact;
@@ -113,9 +112,4 @@ public final class RelationChange extends Change {
public int getItemId() {
return relLinkId;
}
-
- @Override
- public Class<? extends IChangeWorker> getWorker() {
- return worker;
- }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/RelationChangeWorker.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/RelationChangeWorker.java
deleted file mode 100644
index 4f186b868c2..00000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/RelationChangeWorker.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.skynet.core.change;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.DeletionFlag;
-import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
-import org.eclipse.osee.framework.skynet.core.relation.RelationManager;
-import org.eclipse.osee.framework.skynet.core.relation.order.RelationOrderData;
-import org.eclipse.osee.framework.skynet.core.relation.order.RelationOrderFactory;
-import org.eclipse.osee.framework.skynet.core.relation.order.RelationOrderMergeUtility;
-import org.eclipse.osee.framework.skynet.core.relation.order.RelationOrderParser;
-
-/**
- * @author Jeff C. Phillips
- * @author Wilik Karol
- */
-public class RelationChangeWorker implements IChangeWorker {
- private final RelationChange change;
- private final Artifact artifact;
- private RelationLink link;
-
- public RelationChangeWorker(Change change, Artifact artifact) {
- this.change = (RelationChange) change;
- this.artifact = artifact;
- }
-
- private RelationLink setRelationLink() throws OseeCoreException {
- if (link == null) {
- link = RelationManager.getOrCreate(change.getArtId(), change.getBArtId(), artifact.getBranch(),
- change.getRelationType(), change.getRelLinkId(), (int) change.getGamma(), change.getRationale(),
- change.getModificationType());
- }
- return link;
- }
-
- @Override
- public void revert() throws OseeCoreException {
-
- setRelationLink();
-
- if (change.isBaseline()) {
- link.replaceWithVersion((int) change.getBaselineGamma());
-
- Artifact otherSideCurrent =
- ArtifactQuery.getArtifactFromId(link.getArtifactOnOtherSide(artifact).getArtId(), artifact.getBranch());
-
- if (hasRelationOrder(otherSideCurrent)) {
-
- Artifact otherSideBase =
- ArtifactQuery.getHistoricalArtifactFromId(link.getArtifactOnOtherSide(artifact).getArtId(),
- BranchManager.getBaseTransaction(artifact.getBranch()), DeletionFlag.INCLUDE_DELETED);
-
- RelationOrderData mergedOrderData =
- RelationOrderMergeUtility.mergeRelationOrder(otherSideBase, otherSideCurrent);
-
- if (mergedOrderData != null) {
-
- int baselineOrderGamma = otherSideBase.getSoleAttribute(CoreAttributeTypes.RelationOrder).getGammaId();
-
- Attribute<?> relationOrder = setRelationOrder(otherSideCurrent, mergedOrderData);
-
- Object currentRelationOrder =
- otherSideCurrent.getSoleAttribute(CoreAttributeTypes.RelationOrder).getValue();
-
- Object baseRelationOrder = otherSideBase.getSoleAttribute(CoreAttributeTypes.RelationOrder).getValue();
-
- //If the relationOrder merge is the same as baseline there will be no change.
- if (currentRelationOrder.equals(baseRelationOrder)) {
- relationOrder.replaceWithVersion(baselineOrderGamma);
- }
- } else {
- //Append to the relation order
- RelationOrderData relationOrderData =
- new RelationOrderFactory().createRelationOrderData(otherSideCurrent);
-
- List<String> guids = new ArrayList<>();
-
- for (Entry<Pair<String, String>, Pair<String, List<String>>> relationOrderGuidData : relationOrderData.entrySet()) {
- guids.addAll(relationOrderGuidData.getValue().getSecond());
- }
- guids.add(artifact.getGuid());
-
- relationOrderData.addOrderList(link.getRelationType(), link.getSide(artifact),
- RelationOrderBaseTypes.USER_DEFINED, guids);
- setRelationOrder(otherSideCurrent, relationOrderData);
- }
- otherSideCurrent.persist("Replace With Baseline Version resolved by appending");
- }
- } else {
- link.delete(true);
- }
- }
-
- private boolean hasRelationOrder(Artifact artifact) throws OseeCoreException {
- return artifact.getAttributeCount(CoreAttributeTypes.RelationOrder) > 0;
- }
-
- private Attribute<?> setRelationOrder(Artifact artifact, RelationOrderData relationOrderData) throws OseeCoreException {
- Attribute<?> relationOrder;
-
- RelationOrderParser parser = new RelationOrderParser();
- String attributeXMLValue = parser.toXml(relationOrderData);
- relationOrder = artifact.getSoleAttribute(CoreAttributeTypes.RelationOrder);
- relationOrder.setFromString(attributeXMLValue);
- return relationOrder;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AttributeChange.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AttributeChange.java
index 8a53af2368b..eee9f00be0c 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AttributeChange.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/model/AttributeChange.java
@@ -13,6 +13,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.messaging.event.res.AttributeEventModificationType;
import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
@@ -51,6 +52,8 @@ public class AttributeChange implements FrameworkEvent {
protected int gammaId;
@XmlElement(required = true)
protected List<String> data;
+ @XmlElement(required = true)
+ protected ApplicabilityId applicabilityId;
/**
* Gets the value of the attrTypeGuid property.
@@ -110,6 +113,20 @@ public class AttributeChange implements FrameworkEvent {
}
/**
+ * Sets the value of the applicabilityId property.
+ */
+ public void setApplicabilityId(ApplicabilityId applicabilityId) {
+ this.applicabilityId = applicabilityId;
+ }
+
+ /**
+ * Gets the value of the applicabilityId property.
+ */
+ public ApplicabilityId getApplicabilityId() {
+ return applicabilityId;
+ }
+
+ /**
* Sets the value of the gammaId property.
*/
public void setGammaId(int value) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/ArtifactRemoteEventHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/ArtifactRemoteEventHandler.java
index e7ac3e24d5f..ce1cff7f3fe 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/ArtifactRemoteEventHandler.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/event/handlers/ArtifactRemoteEventHandler.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.skynet.core.internal.event.handlers;
import java.util.Collection;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.data.TransactionToken;
@@ -151,7 +152,7 @@ public class ArtifactRemoteEventHandler implements EventHandlerRemote<RemotePers
continue;
}
artifact.internalInitializeAttribute(attributeType, attrChange.getAttributeId(),
- attrChange.getGammaId(), modificationType, false,
+ attrChange.getGammaId(), modificationType, attrChange.getApplicabilityId(), false,
attrChange.getData().toArray(new Object[attrChange.getData().size()]));
}
} catch (OseeCoreException ex) {
@@ -192,10 +193,14 @@ public class ArtifactRemoteEventHandler implements EventHandlerRemote<RemotePers
RelationEventType eventType = guidArt.getModType();
switch (eventType) {
case Added:
- if (relation == null || relation.getModificationType() == ModificationType.DELETED || relation.getModificationType() == ModificationType.ARTIFACT_DELETED) {
+ if (relation == null) {
relation = RelationManager.getOrCreate(guidArt.getArtAId(), guidArt.getArtBId(), branch,
relationType, guidArt.getRelationId(), guidArt.getGammaId(), guidArt.getRationale(),
- ModificationType.NEW);
+ ModificationType.NEW, ApplicabilityId.BASE);
+ } else if (relation.getModificationType() == ModificationType.DELETED || relation.getModificationType() == ModificationType.ARTIFACT_DELETED) {
+ relation = RelationManager.getOrCreate(guidArt.getArtAId(), guidArt.getArtBId(), branch,
+ relationType, guidArt.getRelationId(), guidArt.getGammaId(), guidArt.getRationale(),
+ ModificationType.NEW, relation.getApplicabilityId());
}
break;
case ModifiedRationale:
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationLink.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationLink.java
index bbc8b3d976b..0985d830d5d 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationLink.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationLink.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.framework.skynet.core.relation;
import static org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes.USER_DEFINED;
import java.util.logging.Level;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.HasBranch;
import org.eclipse.osee.framework.core.data.IRelationSorterId;
@@ -58,6 +59,7 @@ public class RelationLink implements HasBranch {
private final int bArtifactId;
private final BranchId branch;
private ModificationType modificationType;
+ private ApplicabilityId applicabilityId;
private static final boolean SET_DIRTY = true;
private static final boolean SET_NOT_DIRTY = false;
@@ -65,7 +67,7 @@ public class RelationLink implements HasBranch {
private final ArtifactLinker artifactLinker;
private boolean useBackingData;
- public RelationLink(ArtifactLinker artifactLinker, int aArtifactId, int bArtifactId, BranchId branch, RelationType relationType, int relationId, int gammaId, String rationale, ModificationType modificationType) {
+ public RelationLink(ArtifactLinker artifactLinker, int aArtifactId, int bArtifactId, BranchId branch, RelationType relationType, int relationId, int gammaId, String rationale, ModificationType modificationType, ApplicabilityId applicabilityId) {
this.artifactLinker = artifactLinker;
this.relationType = relationType;
this.relationId = relationId;
@@ -75,6 +77,7 @@ public class RelationLink implements HasBranch {
this.aArtifactId = aArtifactId;
this.bArtifactId = bArtifactId;
this.branch = branch;
+ this.applicabilityId = applicabilityId;
internalSetModType(modificationType, false, false);
}
@@ -135,9 +138,12 @@ public class RelationLink implements HasBranch {
return dirty;
}
+ public ApplicabilityId getApplicabilityId() {
+ return applicabilityId;
+ }
+
public void delete(boolean reorderRelations) {
delete(reorderRelations, null);
-
}
public void delete(boolean reorderRelations, SkynetTransaction transaction) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java
index 73f0f71642a..5ccc9db5e83 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IRelationSorterId;
import org.eclipse.osee.framework.core.data.IRelationType;
@@ -524,7 +525,7 @@ public class RelationManager {
ensureRelationCanBeAdded(relationTypeToken, artifactA, artifactB);
relation = getOrCreate(artifactA.getArtId(), artifactB.getArtId(), artifactA.getBranch(), relationType, 0, 0,
- rationale, ModificationType.NEW);
+ rationale, ModificationType.NEW, ApplicabilityId.BASE);
relation.setDirty();
if (relation.isDeleted()) {
relation.undelete();
@@ -596,7 +597,7 @@ public class RelationManager {
* @param relationId 0 or relationId if already created
* @throws OseeCoreException
*/
- public static synchronized RelationLink getOrCreate(int aArtifactId, int bArtifactId, BranchId branch, RelationType relationType, int relationId, int gammaId, String rationale, ModificationType modificationType) throws OseeCoreException {
+ public static synchronized RelationLink getOrCreate(int aArtifactId, int bArtifactId, BranchId branch, RelationType relationType, int relationId, int gammaId, String rationale, ModificationType modificationType, ApplicabilityId applicabilityId) throws OseeCoreException {
RelationLink relation = null;
if (relationId != 0) {
relation = getLoadedRelationById(relationId, aArtifactId, bArtifactId, branch);
@@ -605,7 +606,7 @@ public class RelationManager {
}
if (relation == null) {
relation = new RelationLink(new RelationArtifactLinker(), aArtifactId, bArtifactId, branch, relationType,
- relationId, gammaId, rationale, modificationType);
+ relationId, gammaId, rationale, modificationType, applicabilityId);
}
manageRelation(relation, RelationSide.SIDE_A);
manageRelation(relation, RelationSide.SIDE_B);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java
index 8ea86bda6b4..39c423c12aa 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java
@@ -92,8 +92,8 @@ public class RelationTransactionData extends BaseTransactionData {
}
@Override
- protected ApplicabilityId getApplicabilityId() {
- return ApplicabilityId.BASE;
+ protected ApplicabilityId getApplicabilityId() throws OseeCoreException {
+ return relation.getApplicabilityId();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceAttributeWithBaselineOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceAttributeWithBaselineOperation.java
index 7e7c9678701..92d069e9ab4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceAttributeWithBaselineOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceAttributeWithBaselineOperation.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.blam.operation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -23,6 +21,7 @@ import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.change.AttributeChangeWorker;
import org.eclipse.osee.framework.skynet.core.change.Change;
import org.eclipse.osee.framework.skynet.core.change.IChangeWorker;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
@@ -74,12 +73,10 @@ public class ReplaceAttributeWithBaselineOperation extends AbstractOperation {
}
}
- private void revertAttribute(Artifact artifact, Change change) throws OseeStateException, OseeCoreException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
+ private void revertAttribute(Artifact artifact, Change change) throws OseeStateException, OseeCoreException, SecurityException, IllegalArgumentException {
Attribute<?> attribute = artifact.getAttributeById(change.getItemId(), true);
if (attribute != null && change.getItemId() == attribute.getId()) {
- Class<? extends IChangeWorker> workerClass = change.getWorker();
- Constructor<?> ctor = workerClass.getConstructor(Change.class, Artifact.class);
- IChangeWorker worker = (IChangeWorker) ctor.newInstance(change, artifact);
+ IChangeWorker worker = new AttributeChangeWorker(change, artifact);
worker.revert();
}
}

Back to the top