Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan E. Cook2017-02-22 11:09:51 -0500
committerRyan Brooks2017-02-27 17:23:13 -0500
commit7eef713c3d6411b06f0ab9c36741cd7fb846785f (patch)
tree71122e2d5dd8a60be2b787389847006c8aac5cf8
parentaac55875c6c0d426738421c0a345812f17df237d (diff)
downloadorg.eclipse.osee-7eef713c3d6411b06f0ab9c36741cd7fb846785f.tar.gz
org.eclipse.osee-7eef713c3d6411b06f0ab9c36741cd7fb846785f.tar.xz
org.eclipse.osee-7eef713c3d6411b06f0ab9c36741cd7fb846785f.zip
bug[ats_ATS349133]: Fix applicability not preserved when deleting artifact
Change-Id: I0ad9174ecc8c8d37a5f153122102057442e8a7cd Signed-off-by: Morgan E. Cook <Morgan.e.cook@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java24
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java20
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactFactory.java17
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTransactionData.java9
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTransactionData.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTransactionData.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java21
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ApplicabilityQueryImpl.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java6
10 files changed, 80 insertions, 41 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java
index 19fe18284e..8d4aaef821 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java
@@ -21,9 +21,9 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
*/
public enum OseeSql {
- TX_GET_PREVIOUS_TX_NOT_CURRENT_ARTIFACTS("SELECT txs.transaction_id, txs.gamma_id FROM osee_artifact art, osee_txs txs WHERE art.art_id = ? AND art.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue()),
- TX_GET_PREVIOUS_TX_NOT_CURRENT_ATTRIBUTES("SELECT txs.transaction_id, txs.gamma_id FROM osee_attribute atr, osee_txs txs WHERE atr.attr_id = ? AND atr.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue()),
- TX_GET_PREVIOUS_TX_NOT_CURRENT_RELATIONS("SELECT txs.transaction_id, txs.gamma_id FROM osee_relation_link rel, osee_txs txs WHERE rel.rel_link_id = ? AND rel.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue()),
+ TX_GET_PREVIOUS_TX_NOT_CURRENT_ARTIFACTS("SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_artifact art, osee_txs txs WHERE art.art_id = ? AND art.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue()),
+ TX_GET_PREVIOUS_TX_NOT_CURRENT_ATTRIBUTES("SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_attribute atr, osee_txs txs WHERE atr.attr_id = ? AND atr.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue()),
+ TX_GET_PREVIOUS_TX_NOT_CURRENT_RELATIONS("SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_relation_link rel, osee_txs txs WHERE rel.rel_link_id = ? AND rel.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue()),
MERGE_GET_ARTIFACTS_FOR_BRANCH("SELECT art.art_id FROM osee_txs txs, osee_artifact art WHERE txs.branch_id = ? and txs.gamma_id = art.gamma_id"),
MERGE_GET_ATTRIBUTES_FOR_BRANCH("SELECT atr.art_id, atr.attr_id FROM osee_txs txs, osee_attribute atr WHERE txs.branch_id = ? and txs.gamma_id = atr.gamma_id"),
@@ -34,11 +34,11 @@ public enum OseeSql {
CONFLICT_GET_ATTRIBUTES("SELECT%s atr1.art_id, txs1.mod_type, atr1.attr_type_id, atr1.attr_id, atr1.gamma_id AS source_gamma, atr1.value AS source_value, atr2.gamma_id AS dest_gamma, atr2.value as dest_value, txs2.mod_type AS dest_mod_type FROM osee_txs txs1, osee_attribute atr1, osee_attribute atr2, osee_txs txs2 WHERE txs1.branch_id = ? AND txs1.transaction_id <> ? AND txs1.tx_current in (1,2) AND txs1.gamma_id = atr1.gamma_id AND atr1.attr_id = atr2.attr_id AND atr2.gamma_id = txs2.gamma_id AND txs2.branch_id = ? AND txs2.tx_current in (1,2) AND NOT EXISTS (SELECT 1 FROM osee_txs txs WHERE txs.branch_id = ? AND txs.transaction_id = ? AND ((txs1.gamma_id = txs.gamma_id and txs1.mod_type = txs.mod_type) OR (txs2.gamma_id = txs.gamma_id and txs2.mod_type = txs.mod_type))) ORDER BY attr_id", Strings.HINTS__ORDERED__INDEX__ATTRIBUTE_CONFLICT),
CONFLICT_GET_HISTORICAL_ATTRIBUTES("SELECT%s atr.attr_id, atr.art_id, source_gamma_id, dest_gamma_id, attr_type_id, mer.merge_branch_id, mer.dest_branch_id, value as source_value, status, mer.source_branch_id FROM osee_merge mer, osee_conflict con, osee_attribute atr Where mer.commit_transaction_id = ? AND mer.merge_branch_id = con.merge_branch_id And con.source_gamma_id = atr.gamma_id AND con.status in (" + ConflictStatus.COMMITTED.getValue() + ", " + ConflictStatus.INFORMATIONAL.getValue() + " ) order by attr_id", Strings.HintsOrdered),
- LOAD_HISTORICAL_ARTIFACTS("SELECT%s aj.art_id, txs.branch_id, txs.gamma_id, txs.mod_type, art_type_id, guid, aj.transaction_id as stripe_transaction_id FROM osee_join_artifact aj, osee_artifact art, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.transaction_id <= aj.transaction_id AND txs.branch_id = aj.branch_id order by aj.branch_id, art.art_id, txs.transaction_id desc", Strings.HintsOrdered),
- LOAD_HISTORICAL_ARCHIVED_ARTIFACTS("SELECT%s aj.art_id, txs.branch_id, txs.gamma_id, txs.mod_type, art_type_id, guid, aj.transaction_id as stripe_transaction_id FROM osee_join_artifact aj, osee_artifact art, osee_txs_archived txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.transaction_id <= aj.transaction_id AND txs.branch_id = aj.branch_id order by aj.branch_id, art.art_id, txs.transaction_id desc", Strings.HintsOrdered),
+ LOAD_HISTORICAL_ARTIFACTS("SELECT%s aj.art_id, txs.branch_id, txs.gamma_id, txs.mod_type, art_type_id, guid, aj.transaction_id as stripe_transaction_id, txs.app_id FROM osee_join_artifact aj, osee_artifact art, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.transaction_id <= aj.transaction_id AND txs.branch_id = aj.branch_id order by aj.branch_id, art.art_id, txs.transaction_id desc", Strings.HintsOrdered),
+ LOAD_HISTORICAL_ARCHIVED_ARTIFACTS("SELECT%s aj.art_id, txs.branch_id, txs.gamma_id, txs.mod_type, art_type_id, guid, aj.transaction_id as stripe_transaction_id, txs.app_id FROM osee_join_artifact aj, osee_artifact art, osee_txs_archived txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.transaction_id <= aj.transaction_id AND txs.branch_id = aj.branch_id order by aj.branch_id, art.art_id, txs.transaction_id desc", Strings.HintsOrdered),
- LOAD_HISTORICAL_ATTRIBUTES("SELECT att.art_id, att.attr_id, att.value, att.gamma_id, att.attr_type_id, att.uri, aj.branch_id, txs.mod_type, txs.transaction_id, aj.transaction_id as stripe_transaction_id FROM osee_join_artifact aj, osee_attribute att, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = att.art_id AND att.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.transaction_id <= aj.transaction_id order by txs.branch_id, att.art_id, att.attr_id, txs.transaction_id desc"),
- LOAD_HISTORICAL_ARCHIVED_ATTRIBUTES("SELECT att.art_id, att.attr_id, att.value, att.gamma_id, att.attr_type_id, att.uri, aj.branch_id, txs.mod_type, txs.transaction_id, aj.transaction_id as stripe_transaction_id FROM osee_join_artifact aj, osee_attribute att, osee_txs_archived txs WHERE aj.query_id = ? AND aj.art_id = att.art_id AND att.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.transaction_id <= aj.transaction_id order by txs.branch_id, att.art_id, att.attr_id, txs.transaction_id desc"),
+ LOAD_HISTORICAL_ATTRIBUTES("SELECT att.art_id, att.attr_id, att.value, att.gamma_id, att.attr_type_id, att.uri, aj.branch_id, txs.mod_type, txs.transaction_id, aj.transaction_id as stripe_transaction_id, txs.app_id FROM osee_join_artifact aj, osee_attribute att, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = att.art_id AND att.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.transaction_id <= aj.transaction_id order by txs.branch_id, att.art_id, att.attr_id, txs.transaction_id desc"),
+ LOAD_HISTORICAL_ARCHIVED_ATTRIBUTES("SELECT att.art_id, att.attr_id, att.value, att.gamma_id, att.attr_type_id, att.uri, aj.branch_id, txs.mod_type, txs.transaction_id, aj.transaction_id as stripe_transaction_id, txs.app_id FROM osee_join_artifact aj, osee_attribute att, osee_txs_archived txs WHERE aj.query_id = ? AND aj.art_id = att.art_id AND att.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.transaction_id <= aj.transaction_id order by txs.branch_id, att.art_id, att.attr_id, txs.transaction_id desc"),
LOAD_CURRENT_ATTRIBUTES(Strings.SELECT_CURRENT_ATTRIBUTES_PREFIX + "= 1 order by al1.branch_id, al1.art_id, att1.attr_id, txs.transaction_id desc", Strings.HintsOrdered),
LOAD_CURRENT_ATTRIBUTES_WITH_DELETED(Strings.SELECT_CURRENT_ATTRIBUTES_PREFIX + "IN (1, 3) order by al1.branch_id, al1.art_id, att1.attr_id, txs.transaction_id desc", Strings.HintsOrdered),
@@ -47,7 +47,7 @@ public enum OseeSql {
LOAD_CURRENT_ARCHIVED_ATTRIBUTES_WITH_DELETED(Strings.SELECT_CURRENT_ARCHIVED_ATTRIBUTES_PREFIX + "IN (1, 3) order by al1.branch_id, al1.art_id, att1.attr_id, txs.transaction_id desc", Strings.HintsOrdered),
LOAD_ALL_CURRENT_ARCHIVED_ATTRIBUTES(Strings.SELECT_CURRENT_ARCHIVED_ATTRIBUTES_PREFIX + "IN (1, 2, 3) order by al1.branch_id, al1.art_id, att1.attr_id, txs.transaction_id desc", Strings.HintsOrdered),
- LOAD_RELATIONS("SELECT%s txs.mod_type, rel_link_id, a_art_id, b_art_id, rel_link_type_id, rel.gamma_id, rationale, txs.branch_id FROM osee_join_artifact aj, osee_relation_link rel, osee_txs txs WHERE aj.query_id = ? AND (aj.art_id = rel.a_art_id OR aj.art_id = rel.b_art_id) AND rel.gamma_id = txs.gamma_id AND txs.tx_current = " + TxChange.CURRENT.getValue() + " AND aj.branch_id = txs.branch_id", Strings.HintsOrdered),
+ LOAD_RELATIONS("SELECT%s txs.mod_type, rel_link_id, a_art_id, b_art_id, rel_link_type_id, rel.gamma_id, rationale, txs.branch_id, txs.app_id FROM osee_join_artifact aj, osee_relation_link rel, osee_txs txs WHERE aj.query_id = ? AND (aj.art_id = rel.a_art_id OR aj.art_id = rel.b_art_id) AND rel.gamma_id = txs.gamma_id AND txs.tx_current = " + TxChange.CURRENT.getValue() + " AND aj.branch_id = txs.branch_id", Strings.HintsOrdered),
LOAD_CURRENT_ARTIFACTS(Strings.SELECT_CURRENT_ARTIFACTS_PREFIX + "= 1", Strings.HintsOrdered),
LOAD_CURRENT_ARTIFACTS_WITH_DELETED(Strings.SELECT_CURRENT_ARTIFACTS_PREFIX + "in (1, 2)", Strings.HintsOrdered),
LOAD_CURRENT_ARCHIVED_ARTIFACTS(Strings.SELECT_CURRENT_ARCHIVED_ARTIFACTS_PREFIX + "= 1", Strings.HintsOrdered),
@@ -118,15 +118,15 @@ public enum OseeSql {
" /*+ ordered index(atr1) index(atr2) index(txs2) */";
private static final String SELECT_CURRENT_ATTRIBUTES_PREFIX =
- "SELECT%s att1.art_id, att1.attr_id, att1.value, att1.gamma_id, att1.attr_type_id, att1.uri, al1.branch_id, txs.mod_type, txs.transaction_id FROM osee_join_artifact al1, osee_attribute att1, osee_txs txs WHERE al1.query_id = ? AND al1.art_id = att1.art_id AND att1.gamma_id = txs.gamma_id AND txs.branch_id = al1.branch_id AND txs.tx_current ";
+ "SELECT%s att1.art_id, att1.attr_id, att1.value, att1.gamma_id, att1.attr_type_id, att1.uri, al1.branch_id, txs.mod_type, txs.transaction_id, txs.app_id FROM osee_join_artifact al1, osee_attribute att1, osee_txs txs WHERE al1.query_id = ? AND al1.art_id = att1.art_id AND att1.gamma_id = txs.gamma_id AND txs.branch_id = al1.branch_id AND txs.tx_current ";
private static final String SELECT_CURRENT_ARTIFACTS_PREFIX =
- "SELECT%s aj.art_id, txs.gamma_id, mod_type, art_type_id, guid, txs.branch_id FROM osee_join_artifact aj, osee_artifact art, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.tx_current ";
+ "SELECT%s aj.art_id, txs.gamma_id, mod_type, art_type_id, guid, txs.branch_id, txs.app_id FROM osee_join_artifact aj, osee_artifact art, osee_txs txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.tx_current ";
private static final String SELECT_CURRENT_ARCHIVED_ATTRIBUTES_PREFIX =
- "SELECT%s att1.art_id, att1.attr_id, att1.value, att1.gamma_id, att1.attr_type_id, att1.uri, al1.branch_id, txs.mod_type, txs.transaction_id FROM osee_join_artifact al1, osee_attribute att1, osee_txs_archived txs WHERE al1.query_id = ? AND al1.art_id = att1.art_id AND att1.gamma_id = txs.gamma_id AND txs.branch_id = al1.branch_id AND txs.tx_current ";
+ "SELECT%s att1.art_id, att1.attr_id, att1.value, att1.gamma_id, att1.attr_type_id, att1.uri, al1.branch_id, txs.mod_type, txs.transaction_id, txs.app_id FROM osee_join_artifact al1, osee_attribute att1, osee_txs_archived txs WHERE al1.query_id = ? AND al1.art_id = att1.art_id AND att1.gamma_id = txs.gamma_id AND txs.branch_id = al1.branch_id AND txs.tx_current ";
private static final String SELECT_CURRENT_ARCHIVED_ARTIFACTS_PREFIX =
- "SELECT%s aj.art_id, txs.gamma_id, mod_type, art_type_id, guid, txs.branch_id FROM osee_join_artifact aj, osee_artifact art, osee_txs_archived txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.tx_current ";
+ "SELECT%s aj.art_id, txs.gamma_id, mod_type, art_type_id, guid, txs.branch_id, txs.app_id FROM osee_join_artifact aj, osee_artifact art, osee_txs_archived txs WHERE aj.query_id = ? AND aj.art_id = art.art_id AND art.gamma_id = txs.gamma_id AND txs.branch_id = aj.branch_id AND txs.tx_current ";
}
} \ No newline at end of file
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 53127adfb5..cfe04e9710 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
@@ -25,6 +25,7 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.regex.Pattern;
import org.eclipse.osee.framework.core.data.Adaptable;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
@@ -111,13 +112,14 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
private EditState objectEditState;
private boolean useBackingData;
private IArtifactType artifactTypeToken;
+ private ApplicabilityId applicabilityId;
public Artifact(String guid, BranchId branch, IArtifactType artifactType) throws OseeCoreException {
super(GUID.checkOrCreate(guid), "");
this.artifactTypeToken = artifactType;
objectEditState = EditState.NO_CHANGE;
internalSetModType(ModificationType.NEW, false);
-
+ internalSetApplicablityId(ApplicabilityId.BASE);
this.branch = branch;
}
@@ -1039,6 +1041,10 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
this.gammaId = gammaId;
}
+ public final void internalSetApplicablityId(ApplicabilityId applicabilityId) {
+ this.applicabilityId = applicabilityId;
+ }
+
protected final void internalSetModType(ModificationType modType, boolean useBackingData) {
lastValidModType = this.modType;
this.modType = modType;
@@ -1457,7 +1463,7 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
Artifact introduceShallowArtifact(BranchId destinationBranch) throws OseeCoreException {
Artifact shallowArt = ArtifactTypeManager.getFactory(getArtifactType()).reflectExisitingArtifact(artId, getGuid(),
- getArtifactType(), gammaId, destinationBranch, modType);
+ getArtifactType(), gammaId, destinationBranch, modType, applicabilityId);
return shallowArt;
}
@@ -1476,13 +1482,14 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
return transaction;
}
- /**
- * @return Returns the gammaId.
- */
public final int getGammaId() {
return gammaId;
}
+ public final ApplicabilityId getApplicablityId() {
+ return applicabilityId;
+ }
+
public final Collection<AttributeChange> getDirtyFrameworkAttributeChanges() throws OseeDataStoreException {
List<AttributeChange> dirtyAttributes = new LinkedList<>();
@@ -1637,10 +1644,11 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
/**
* This method should never be called from outside the OSEE Application Framework
*/
- void internalSetPersistenceData(int gammaId, TransactionToken transactionId, ModificationType modType, boolean historical, boolean useBackingData) {
+ void internalSetPersistenceData(int gammaId, TransactionToken transactionId, ModificationType modType, ApplicabilityId applicabilityId, boolean historical, boolean useBackingData) {
this.gammaId = gammaId;
this.transaction = transactionId;
this.historical = historical;
+ internalSetApplicablityId(applicabilityId);
internalSetModType(modType, useBackingData);
this.objectEditState = EditState.NO_CHANGE;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactFactory.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactFactory.java
index 2b46cb85e9..cdce312561 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactFactory.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactFactory.java
@@ -14,6 +14,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
+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.data.OseeData;
@@ -81,9 +82,9 @@ public abstract class ArtifactFactory {
return uuid == null ? (int) ConnectionHandler.getNextSequence(OseeData.ART_ID_SEQ, true) : uuid.intValue();
}
- public synchronized Artifact reflectExisitingArtifact(int artId, String guid, IArtifactType artifactType, int gammaId, BranchId branch, ModificationType modificationType) throws OseeCoreException {
- Artifact toReturn = internalExistingArtifact(artId, guid, artifactType, gammaId, branch, modificationType, false,
- TransactionToken.SENTINEL, true);
+ public synchronized Artifact reflectExisitingArtifact(int artId, String guid, IArtifactType artifactType, int gammaId, BranchId branch, ModificationType modificationType, ApplicabilityId applicabilityId) throws OseeCoreException {
+ Artifact toReturn = internalExistingArtifact(artId, guid, artifactType, gammaId, branch, modificationType,
+ applicabilityId, false, TransactionToken.SENTINEL, true);
ArtifactCache.cache(toReturn);
return toReturn;
}
@@ -91,11 +92,11 @@ public abstract class ArtifactFactory {
/**
* This method does not cache the artifact, ArtifactLoader will cache existing artifacts
*/
- private Artifact internalExistingArtifact(int artId, String guid, IArtifactType artifactType, int gammaId, BranchId branch, ModificationType modType, boolean historical, TransactionToken transactionId, boolean useBackingData) throws OseeCoreException {
+ private Artifact internalExistingArtifact(int artId, String guid, IArtifactType artifactType, int gammaId, BranchId branch, ModificationType modType, ApplicabilityId applicabilityId, boolean historical, TransactionToken transactionId, boolean useBackingData) throws OseeCoreException {
Artifact artifact = getArtifactInstance(guid, branch, artifactType, true);
artifact.setArtId(artId);
- artifact.internalSetPersistenceData(gammaId, transactionId, modType, historical, useBackingData);
+ artifact.internalSetPersistenceData(gammaId, transactionId, modType, applicabilityId, historical, useBackingData);
return artifact;
}
@@ -103,9 +104,9 @@ public abstract class ArtifactFactory {
/**
* This method does not cache the artifact, ArtifactLoader will cache existing artifacts
*/
- public synchronized Artifact loadExisitingArtifact(int artId, String guid, IArtifactType artifactType, int gammaId, BranchId branch, TransactionToken transactionId, ModificationType modType, boolean historical) throws OseeCoreException {
- return internalExistingArtifact(artId, guid, artifactType, gammaId, branch, modType, historical, transactionId,
- false);
+ public synchronized Artifact loadExisitingArtifact(int artId, String guid, IArtifactType artifactType, int gammaId, BranchId branch, TransactionToken transactionId, ModificationType modType, ApplicabilityId applicabilityId, boolean historical) throws OseeCoreException {
+ return internalExistingArtifact(artId, guid, artifactType, gammaId, branch, modType, applicabilityId, historical,
+ transactionId, false);
}
/**
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java
index 0ce10d398e..5316b6aabf 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java
@@ -21,6 +21,7 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
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.IArtifactType;
import org.eclipse.osee.framework.core.data.TokenFactory;
@@ -317,6 +318,7 @@ public final class ArtifactLoader {
int artifactId = chStmt.getInt("art_id");
BranchId branch = TokenFactory.createBranch(chStmt.getLong("branch_id"));
TransactionToken transactionId = TransactionToken.SENTINEL;
+ ApplicabilityId appId = ApplicabilityId.valueOf(chStmt.getLong("app_id"));
if (historical) {
transactionId = TransactionToken.valueOf(chStmt.getLong("stripe_transaction_id"), branch);
}
@@ -328,12 +330,12 @@ public final class ArtifactLoader {
artifact =
factory.loadExisitingArtifact(artifactId, chStmt.getString("guid"), artifactType, chStmt.getInt("gamma_id"),
- branch, transactionId, ModificationType.getMod(chStmt.getInt("mod_type")), historical);
+ branch, transactionId, ModificationType.getMod(chStmt.getInt("mod_type")), appId, historical);
}
if (reload == LoadType.RELOAD_CACHE) {
artifact.internalSetPersistenceData(chStmt.getInt("gamma_id"), transactionId,
- ModificationType.getMod(chStmt.getInt("mod_type")), historical, false);
+ ModificationType.getMod(chStmt.getInt("mod_type")), appId, historical, false);
}
return artifact;
}
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 8fc7eb49c2..2d723452a2 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.sql.OseeSql;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -48,7 +49,8 @@ public class ArtifactTransactionData extends BaseTransactionData {
@Override
protected void internalUpdate(TransactionRecord transactionId) throws OseeCoreException {
- artifact.internalSetPersistenceData(getGammaId(), transactionId, getModificationType(), false, false);
+ artifact.internalSetPersistenceData(getGammaId(), transactionId, getModificationType(), getApplicabilityId(),
+ false, false);
}
@Override
@@ -83,4 +85,9 @@ public class ArtifactTransactionData extends BaseTransactionData {
}
}
+ @Override
+ protected ApplicabilityId getApplicabilityId() {
+ return artifact.getApplicablityId();
+ }
+
} \ No newline at end of file
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 7db8f9a36c..6b70c13aa4 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.attribute;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.sql.OseeSql;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -138,4 +139,9 @@ public class AttributeTransactionData extends BaseTransactionData {
return;
}
+ @Override
+ protected ApplicabilityId getApplicabilityId() {
+ return ApplicabilityId.BASE;
+ }
+
} \ No newline at end of file
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 c341c1c466..8ea86bda6b 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.relation;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.event.DefaultBasicUuidRelation;
@@ -79,7 +80,6 @@ public class RelationTransactionData extends BaseTransactionData {
@Override
protected void internalAddToEvents(ArtifactEvent artifactEvent) throws OseeCoreException {
- // try {
DefaultBasicUuidRelation defaultBasicGuidRelation = new DefaultBasicUuidRelation(relation.getBranch().getUuid(),
relation.getRelationType().getGuid(), relation.getId(), relation.getGammaId(),
relation.getArtifactA().getBasicGuidArtifact(), relation.getArtifactB().getBasicGuidArtifact());
@@ -89,9 +89,11 @@ public class RelationTransactionData extends BaseTransactionData {
event.setRationale(relation.getRationale());
}
artifactEvent.getRelations().add(event);
- // } catch (Exception ex) {
+ }
- // }
+ @Override
+ protected ApplicabilityId getApplicabilityId() {
+ return ApplicabilityId.BASE;
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java
index 55c2abf94f..f33420c9f3 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/BaseTransactionData.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.transaction;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.TxChange;
@@ -42,6 +43,7 @@ public abstract class BaseTransactionData {
private final int itemId;
private ModificationType modificationType;
private Integer gammaId;
+ private ApplicabilityId applicabilityId;
public BaseTransactionData(int itemId, ModificationType modificationType) {
this.modificationType = modificationType;
@@ -65,10 +67,9 @@ public abstract class BaseTransactionData {
protected void addInsertToBatch(InsertDataCollector collector) throws OseeCoreException {
ModificationType modTypeToStore = getAdjustedModificationType();
- internalAddInsertToBatch(collector, Integer.MAX_VALUE, INSERT_INTO_TRANSACTION_TABLE,
- collector.getTransaction(), getGammaId(), modTypeToStore.getValue(),
- TxChange.getCurrent(modTypeToStore).getValue(), collector.getBranchId(), 1);
- //TODO: remove hack defaulting to 1
+ internalAddInsertToBatch(collector, Integer.MAX_VALUE, INSERT_INTO_TRANSACTION_TABLE, collector.getTransaction(),
+ getGammaId(), modTypeToStore.getValue(), TxChange.getCurrent(modTypeToStore).getValue(),
+ collector.getBranchId(), getApplicId());
}
//Replaces the replace_with_version modtype with modification for storage.
@@ -88,6 +89,13 @@ public abstract class BaseTransactionData {
return modificationType;
}
+ protected final ApplicabilityId getApplicId() {
+ if (applicabilityId == null) {
+ applicabilityId = getApplicabilityId();
+ }
+ return applicabilityId;
+ }
+
protected final int getGammaId() throws OseeCoreException {
if (gammaId == null) {
gammaId = createGammaId();
@@ -130,6 +138,11 @@ public abstract class BaseTransactionData {
protected abstract int createGammaId() throws OseeCoreException;
/**
+ * Should not be called by application. This method will be called by the base class when required;
+ */
+ protected abstract ApplicabilityId getApplicabilityId();
+
+ /**
* Should not be called by application. This should only be called once after the transaction has been committed.
*
* @param artifactEvent TODO
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ApplicabilityQueryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ApplicabilityQueryImpl.java
index 0df83dd001..f422447aeb 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ApplicabilityQueryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/ApplicabilityQueryImpl.java
@@ -30,10 +30,10 @@ import org.eclipse.osee.orcs.search.TupleQuery;
*/
public class ApplicabilityQueryImpl implements ApplicabilityQuery {
private static final String SELECT_APPLIC_FOR_ART =
- "SELECT distinct e2, value FROM osee_artifact art, osee_txs txs1, osee_tuple2 app, osee_txs txs2, osee_key_value WHERE art_id = ? and art.gamma_id = txs1.gamma_id and txs1.branch_id = ? AND txs1.tx_current = 1 and tuple_type = 2 AND e2 = txs1.app_id AND app.gamma_id = txs2.gamma_id AND txs2.branch_id = txs1.branch_id AND txs2.tx_current = 1 AND e2 = key";
+ "SELECT distinct e2, value FROM osee_artifact art, osee_txs txs1, osee_tuple2 app, osee_txs txs2, osee_key_value WHERE art_id = ? and art.gamma_id = txs1.gamma_id and txs1.branch_id = ? AND txs1.tx_current in (1, 2) and tuple_type = 2 AND e2 = txs1.app_id AND app.gamma_id = txs2.gamma_id AND txs2.branch_id = txs1.branch_id AND txs2.tx_current in (1, 2) AND e2 = key";
private static final String SELECT_APPLIC_FOR_ARTS =
- "SELECT distinct e2, value, art.art_id FROM osee_artifact art, osee_txs txs1, osee_tuple2 app, osee_txs txs2, osee_key_value, osee_join_id jid WHERE art_id = jid.id and jid.query_id =? and art.gamma_id = txs1.gamma_id and txs1.branch_id = ? AND txs1.tx_current = 1 and tuple_type = 2 AND e2 = txs1.app_id AND app.gamma_id = txs2.gamma_id AND txs2.branch_id = txs1.branch_id AND txs2.tx_current = 1 AND e2 = key";
+ "SELECT distinct e2, value, art.art_id FROM osee_artifact art, osee_txs txs1, osee_tuple2 app, osee_txs txs2, osee_key_value, osee_join_id jid WHERE art_id = jid.id and jid.query_id =? and art.gamma_id = txs1.gamma_id and txs1.branch_id = ? AND txs1.tx_current in (1, 2) and tuple_type = 2 AND e2 = txs1.app_id AND app.gamma_id = txs2.gamma_id AND txs2.branch_id = txs1.branch_id AND txs2.tx_current in (1, 2) AND e2 = key";
private final TupleQuery tupleQuery;
private final JdbcClient jdbcClient;
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java
index 9ea98d29fc..5a3904b181 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java
@@ -56,13 +56,13 @@ public class TransactionWriter {
"INSERT INTO osee_tx_details (transaction_id, osee_comment, time, author, branch_id, tx_type) VALUES (?, ?, ?, ?, ?, ?)";
private static final String TX_GET_PREVIOUS_TX_NOT_CURRENT_ARTIFACTS =
- "SELECT txs.transaction_id, txs.gamma_id FROM osee_join_id jid, osee_artifact art, osee_txs txs WHERE jid.query_id = ? AND art.art_id = jid.id AND art.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue();
+ "SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_join_id jid, osee_artifact art, osee_txs txs WHERE jid.query_id = ? AND art.art_id = jid.id AND art.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue();
private static final String TX_GET_PREVIOUS_TX_NOT_CURRENT_ATTRIBUTES =
- "SELECT txs.transaction_id, txs.gamma_id FROM osee_join_id jid, osee_attribute attr, osee_txs txs WHERE jid.query_id = ? AND attr.attr_id = jid.id AND attr.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue();
+ "SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_join_id jid, osee_attribute attr, osee_txs txs WHERE jid.query_id = ? AND attr.attr_id = jid.id AND attr.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue();
private static final String TX_GET_PREVIOUS_TX_NOT_CURRENT_RELATIONS =
- "SELECT txs.transaction_id, txs.gamma_id FROM osee_join_id jid, osee_relation_link rel, osee_txs txs WHERE jid.query_id = ? AND rel.rel_link_id = jid.id AND rel.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue();
+ "SELECT txs.transaction_id, txs.gamma_id, txs.app_id FROM osee_join_id jid, osee_relation_link rel, osee_txs txs WHERE jid.query_id = ? AND rel.rel_link_id = jid.id AND rel.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> " + TxChange.NOT_CURRENT.getValue();
public static enum SqlOrderEnum {
ARTIFACTS(INSERT_ARTIFACT, TX_GET_PREVIOUS_TX_NOT_CURRENT_ARTIFACTS),

Back to the top