Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Avila2016-10-12 18:03:04 +0000
committerdonald.g.dunne2016-10-12 18:03:04 +0000
commitc84df2a55bf56df34918209014f1675340dd6b75 (patch)
tree856e340a4f1a9c1cb5fffa494a7404d2f4c6284c /plugins
parentec3bd50869e0c9b47cdbd3307a77eaf15a505e27 (diff)
downloadorg.eclipse.osee-c84df2a55bf56df34918209014f1675340dd6b75.tar.gz
org.eclipse.osee-c84df2a55bf56df34918209014f1675340dd6b75.tar.xz
org.eclipse.osee-c84df2a55bf56df34918209014f1675340dd6b75.zip
feature[ats_ATS302903]: Support Tuple in change report and commit
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java24
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeType.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/TupleChange.java79
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/TupleChangeWorker.java30
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java47
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/LoadChangeType.java3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/images/tuple.pngbin0 -> 279 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactImageManager.java14
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkImage.java1
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java37
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java63
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java42
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TupleResource.java18
15 files changed, 337 insertions, 39 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java
index a002633b411..84e42a2ec1e 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java
@@ -18,6 +18,7 @@ import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.GammaId;
import org.eclipse.osee.framework.core.data.RelationId;
import org.eclipse.osee.framework.core.data.RelationTypeId;
+import org.eclipse.osee.framework.core.data.TupleTypeId;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -87,6 +88,29 @@ public final class ChangeItemUtil {
return item;
}
+ public static ChangeItem newTupleChange(TupleTypeId tupleTypeId, GammaId gammaId, ApplicabilityToken appToken, Long... e) {
+ ChangeItem item = new ChangeItem();
+ item.setChangeType(ChangeType.TUPLE_CHANGE);
+
+ item.setItemId(gammaId);
+ item.setItemTypeId(tupleTypeId);
+ item.setSynthetic(false);
+
+ ChangeVersion current = item.getCurrentVersion();
+ current.setGammaId(gammaId);
+ current.setModType(ModificationType.MODIFIED);
+ current.setApplicabilityToken(appToken);
+
+ if (e.length == 2) {
+ item.getCurrentVersion().setValue(String.format("Tuple2|%s, %s", e[0], e[1]));
+ } else if (e.length == 3) {
+ item.getCurrentVersion().setValue(String.format("Tuple3|%s, %s, %s", e[0], e[1], e[2]));
+ } else if (e.length == 4) {
+ item.getCurrentVersion().setValue(String.format("Tuple4|%s, %s, %s, %s", e[0], e[1], e[2], e[3]));
+ }
+ return item;
+ }
+
public static ChangeVersion getStartingVersion(ChangeItem item) throws OseeCoreException {
if (item == null) {
throw new OseeArgumentException("ChangeItem cannot be null");
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeType.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeType.java
index c0370b73b38..947f22c62a3 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeType.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeType.java
@@ -17,6 +17,7 @@ public enum ChangeType {
ARTIFACT_CHANGE,
ATTRIBUTE_CHANGE,
RELATION_CHANGE,
+ TUPLE_CHANGE,
UNKNOWN_CHANGE;
public boolean isArtifactChange() {
@@ -30,4 +31,8 @@ public enum ChangeType {
public boolean isRelationChange() {
return this == RELATION_CHANGE;
}
+
+ public boolean isTupleChange() {
+ return this == TUPLE_CHANGE;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/TupleChange.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/TupleChange.java
new file mode 100644
index 00000000000..88974b2cb58
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/TupleChange.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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 org.eclipse.osee.framework.core.data.ArtifactId;
+import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.GammaId;
+import org.eclipse.osee.framework.core.data.TupleTypeId;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.jdk.core.type.Id;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.revision.LoadChangeType;
+
+/**
+ * @author Angel Avila
+ */
+public class TupleChange extends Change {
+
+ private final String isValue;
+ private final String wasValue;
+ private final String itemKind;
+ private final TupleTypeId itemTypeId;
+
+ public TupleChange(BranchId branch, GammaId sourceGamma, ModificationType modType, TupleTypeId itemTypeId, String isValue, String wasValue, String itemKind, boolean isHistorical) {
+ super(branch, sourceGamma, ArtifactId.valueOf(0L), null, modType, isHistorical, null, null);
+ this.itemTypeId = itemTypeId;
+ this.isValue = isValue;
+ this.wasValue = wasValue;
+ this.itemKind = itemKind;
+ }
+
+ @Override
+ public TupleTypeId getItemTypeId() {
+ return itemTypeId;
+ }
+
+ @Override
+ public String getIsValue() {
+ return isValue;
+ }
+
+ @Override
+ public String getWasValue() {
+ return wasValue;
+ }
+
+ @Override
+ public String getItemTypeName() throws OseeCoreException {
+ return itemTypeId.getId().toString();
+ }
+
+ @Override
+ public String getName() {
+ return "N/A";
+ }
+
+ @Override
+ public String getItemKind() {
+ return itemKind;
+ }
+
+ @Override
+ public Id getItemId() {
+ return getGamma();
+ }
+
+ @Override
+ public LoadChangeType getChangeType() {
+ return LoadChangeType.attribute;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/TupleChangeWorker.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/TupleChangeWorker.java
new file mode 100644
index 00000000000..eb7279a6248
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/TupleChangeWorker.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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 org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+
+/**
+ * @author Angel Avila
+ */
+public class TupleChangeWorker implements IChangeWorker {
+
+ private final Change change;
+
+ public TupleChangeWorker(Change change) {
+ this.change = change;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ // Currenlty no ability to revert Tuple changes
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java
index 437c153d350..b9dfe423798 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java
@@ -16,6 +16,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.StringTokenizer;
import java.util.logging.Level;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.data.ArtifactId;
@@ -25,6 +26,7 @@ import org.eclipse.osee.framework.core.data.GammaId;
import org.eclipse.osee.framework.core.data.RelationId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.data.TransactionToken;
+import org.eclipse.osee.framework.core.data.TupleTypeId;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.model.TransactionDelta;
import org.eclipse.osee.framework.core.model.change.ChangeIgnoreType;
@@ -48,6 +50,7 @@ import org.eclipse.osee.framework.skynet.core.change.AttributeChange;
import org.eclipse.osee.framework.skynet.core.change.Change;
import org.eclipse.osee.framework.skynet.core.change.ErrorChange;
import org.eclipse.osee.framework.skynet.core.change.RelationChange;
+import org.eclipse.osee.framework.skynet.core.change.TupleChange;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil;
import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager;
@@ -173,17 +176,21 @@ public class ChangeDataLoader extends AbstractOperation {
Change change = null;
try {
ArtifactId artId = item.getArtId();
- Artifact startTxArtifact;
- Artifact endTxArtifact;
- if (txDelta.areOnTheSameBranch()) {
- startTxArtifact = bulkLoaded.get(txDelta.getStartTx(), artId);
- endTxArtifact = bulkLoaded.get(txDelta.getEndTx(), artId);
- } else {
- startTxArtifact = bulkLoaded.get(BranchManager.getBaseTransaction(txDelta.getStartTx().getBranch()), artId);
- endTxArtifact = bulkLoaded.get(txDelta.getStartTx(), artId);
+ ArtifactDelta artifactDelta = null;
+ if (!artId.equals(ArtifactId.valueOf(-1L))) {
+ Artifact startTxArtifact;
+ Artifact endTxArtifact;
+ if (txDelta.areOnTheSameBranch()) {
+ startTxArtifact = bulkLoaded.get(txDelta.getStartTx(), artId);
+ endTxArtifact = bulkLoaded.get(txDelta.getEndTx(), artId);
+ } else {
+ startTxArtifact =
+ bulkLoaded.get(BranchManager.getBaseTransaction(txDelta.getStartTx().getBranch()), artId);
+ endTxArtifact = bulkLoaded.get(txDelta.getStartTx(), artId);
+ }
+ artifactDelta = new ArtifactDelta(txDelta, startTxArtifact, endTxArtifact);
}
- ArtifactDelta artifactDelta = new ArtifactDelta(txDelta, startTxArtifact, endTxArtifact);
change = createChangeObject(bulkLoaded, item, txDelta, startTxBranch, artifactDelta);
change.setChangeItem(item);
@@ -206,7 +213,10 @@ public class ChangeDataLoader extends AbstractOperation {
// When we are comparing two different branches, the displayed artifact should be the start artifact or the artifact from the
// source branch. When we are comparing items from the same branch, the displayed artifact should be the artifact in the end transaction
// since that is the resulting change artifact.
- Artifact changeArtifact = artifactDelta.getEndArtifact();
+ Artifact changeArtifact = null;
+ if (artifactDelta != null) {
+ changeArtifact = artifactDelta.getEndArtifact();
+ }
boolean isHistorical = txDelta.areOnTheSameBranch();
switch (item.getChangeType()) {
@@ -282,6 +292,23 @@ public class ChangeDataLoader extends AbstractOperation {
relationType, isHistorical, changeArtifact, artifactDelta, endTxBArtifact);
}
break;
+ case TUPLE_CHANGE:
+ TupleTypeId tupleTypeId = TupleTypeId.valueOf(item.getItemTypeId().getId());
+ String value = item.getCurrentVersion().getValue();
+ StringTokenizer tok = new StringTokenizer(value, "|");
+
+ String itemKind = "";
+ String tupleIsValue = "";
+
+ if (tok.hasMoreTokens()) {
+ itemKind = tok.nextToken();
+ }
+ if (tok.hasMoreElements()) {
+ tupleIsValue = tok.nextToken();
+ }
+ change = new TupleChange(startTxBranch, itemGammaId, ModificationType.MODIFIED, tupleTypeId, tupleIsValue,
+ "?", itemKind, isHistorical);
+ break;
default:
throw new OseeCoreException("The change item must map to either an artifact, attribute or relation change");
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/LoadChangeType.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/LoadChangeType.java
index 4f70ad04888..42b7e66900b 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/LoadChangeType.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/LoadChangeType.java
@@ -16,5 +16,6 @@ package org.eclipse.osee.framework.skynet.core.revision;
public enum LoadChangeType {
attribute,
artifact,
- relation;
+ relation,
+ tuple;
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/images/tuple.png b/plugins/org.eclipse.osee.framework.ui.skynet/images/tuple.png
new file mode 100644
index 00000000000..a9a4da61803
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/images/tuple.png
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactImageManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactImageManager.java
index a69b9e46d0a..0f7dd1acd45 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactImageManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ArtifactImageManager.java
@@ -158,6 +158,20 @@ public final class ArtifactImageManager {
}
}
}
+ if (change.getItemKind().equals("Tuple")) {
+ modType = change.getModificationType();
+ if (ChangeImageType.CHANGE_TYPE == changeImageType) {
+ keyedImage = FrameworkImage.TUPLE;
+ } else {
+ ChangeItem changeItem = change.getChangeItem();
+ if (changeItem != null && isArtDeletedOnDestination(changeItem.getIgnoreType())) {
+ keyedImage = FrameworkImage.DELETE;
+ modType = ModificationType.DELETED_ON_DESTINATION;
+ } else {
+ keyedImage = FrameworkImage.RELATION;
+ }
+ }
+ }
if (keyedImage != null && modType != null) {
KeyedImage overlay = FrameworkImage.valueOf("OUTGOING_" + modType.toString());
toReturn = ImageManager.getImage(ImageManager.setupImageWithOverlay(keyedImage, overlay, Location.TOP_LEFT));
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkImage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkImage.java
index efb742bf49d..21e22f5669e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkImage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkImage.java
@@ -207,6 +207,7 @@ public enum FrameworkImage implements KeyedImage {
SWITCHED("switched.gif"),
TRASH("trash.gif"),
TOOLS("tools.gif"),
+ TUPLE("tuple.png"),
SKYWALKER("skywalker.gif"),
SUPPORT("users2.gif"),
USER("userPurple.gif"),
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java
index 0931629ffdf..46f7a145422 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/UpdatePreviousTxCurrent.java
@@ -12,9 +12,10 @@ package org.eclipse.osee.orcs.db.internal.accessor;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.enums.TxChange;
+import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.jdbc.JdbcClient;
import org.eclipse.osee.jdbc.JdbcConnection;
@@ -29,6 +30,8 @@ import org.eclipse.osee.orcs.db.internal.sql.join.SqlJoinFactory;
public class UpdatePreviousTxCurrent {
private static final String UPDATE_TXS_NOT_CURRENT =
"update osee_txs SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " where branch_id = ? AND gamma_id = ? and transaction_id = ?";
+ private static final String UPDATE_TXS_NOT_CURRENT_NO_TX =
+ "update osee_txs SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " where branch_id = ? AND gamma_id = ?";
private static final String SELECT_TXS_AND_GAMMAS =
"SELECT txs.transaction_id, txs.gamma_id FROM osee_join_id idj, %s item, osee_txs txs WHERE idj.query_id = ? and idj.id = item.%s AND item.gamma_id = txs.gamma_id AND txs.branch_id = ? AND txs.tx_current <> ?";
// @formatter:off
@@ -50,6 +53,7 @@ public class UpdatePreviousTxCurrent {
private IdJoinQuery artifactJoin;
private IdJoinQuery attributeJoin;
private IdJoinQuery relationJoin;
+ private List<Long> tuplesToUpdate;
public UpdatePreviousTxCurrent(JdbcClient jdbcClient, SqlJoinFactory joinFactory, JdbcConnection connection, BranchId branch) {
this.jdbcClient = jdbcClient;
@@ -58,31 +62,50 @@ public class UpdatePreviousTxCurrent {
this.connection = connection;
}
- public void addAttribute(int attributeId) {
+ public void addAttribute(Id attributeId) {
if (attributeJoin == null) {
attributeJoin = joinFactory.createIdJoinQuery();
}
- attributeJoin.add(attributeId);
+ attributeJoin.add(attributeId.getId());
}
- public void addArtifact(int artifactId) {
+ public void addArtifact(Id artifactId) {
if (artifactJoin == null) {
artifactJoin = joinFactory.createIdJoinQuery();
}
- artifactJoin.add(artifactId);
+ artifactJoin.add(artifactId.getId());
}
- public void addRelation(int relationId) {
+ public void addRelation(Id relationId) {
if (relationJoin == null) {
relationJoin = joinFactory.createIdJoinQuery();
}
- relationJoin.add(relationId);
+ relationJoin.add(relationId.getId());
+ }
+
+ public void addTuple(Id tupleId) {
+ if (tuplesToUpdate == null) {
+ tuplesToUpdate = new ArrayList<>();
+ }
+ tuplesToUpdate.add(tupleId.getId());
}
public void updateTxNotCurrents() throws OseeCoreException {
updateTxNotCurrents("osee_artifact", "art_id", artifactJoin);
updateTxNotCurrents("osee_attribute", "attr_id", attributeJoin);
updateTxNotCurrents("osee_relation_link", "rel_link_id", relationJoin);
+ updateTxNotCurrentsTuple("osee_tuple2", "e1", tuplesToUpdate);
+ }
+
+ private void updateTxNotCurrentsTuple(String tableName, String columnName, List<Long> tuplesToUpdate) throws OseeCoreException {
+ if (tuplesToUpdate != null) {
+ List<Object[]> updateData = new ArrayList<>();
+ for (Long tuple : tuplesToUpdate) {
+ updateData.add(new Object[] {branch, tuple});
+ }
+
+ jdbcClient.runBatchUpdate(connection, UPDATE_TXS_NOT_CURRENT_NO_TX, updateData);
+ }
}
private void updateTxNotCurrents(String tableName, String columnName, IdJoinQuery idJoin) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java
index 92c23e78f8d..c57d291cf90 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java
@@ -129,13 +129,16 @@ public class CommitBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<
for (ChangeItem change : changes) {
switch (change.getChangeType()) {
case ARTIFACT_CHANGE:
- updater.addArtifact(change.getItemId().getId().intValue());
+ updater.addArtifact(change.getItemId());
break;
case ATTRIBUTE_CHANGE:
- updater.addAttribute(change.getItemId().getId().intValue());
+ updater.addAttribute(change.getItemId());
break;
case RELATION_CHANGE:
- updater.addRelation(change.getItemId().getId().intValue());
+ updater.addRelation(change.getItemId());
+ break;
+ case TUPLE_CHANGE:
+ updater.addTuple(change.getCurrentVersion().getGammaId());
break;
default:
throw new OseeStateException("Unexpected change type");
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java
index d7aa013414a..c32fe73e848 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java
@@ -25,6 +25,7 @@ import org.eclipse.osee.framework.core.data.GammaId;
import org.eclipse.osee.framework.core.data.RelationId;
import org.eclipse.osee.framework.core.data.RelationTypeId;
import org.eclipse.osee.framework.core.data.TransactionId;
+import org.eclipse.osee.framework.core.data.TupleTypeId;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.TxChange;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
@@ -52,20 +53,29 @@ import org.eclipse.osee.orcs.search.ApplicabilityQuery;
public class LoadDeltasBetweenBranches extends AbstractDatastoreCallable<List<ChangeItem>> {
// @formatter:off
private static final String SELECT_ALL_SOURCE_ADDRESSING =
- "with\n"+
- "txsOuter as (select transaction_id, gamma_id, mod_type, app_id from osee_txs txs where \n" +
- "branch_id = ? and txs.tx_current <> ? and transaction_id <> ? AND \n" +
- "NOT EXISTS (SELECT 1 FROM osee_txs txs1 WHERE txs1.branch_id = ? AND txs1.transaction_id = ? \n" +
- "AND txs1.gamma_id = txs.gamma_id and txs1.mod_type = txs.mod_type and txs1.app_id = txs.app_id)) \n"+
- "SELECT 1 as table_type, attr_type_id as item_type_id, attr_id as item_id, art_id as item_first, 0 as item_second, value as item_value, item.gamma_id, mod_type, app_id \n" +
- "FROM osee_attribute item, txsOuter where txsOuter.gamma_id = item.gamma_id\n"+
- "UNION ALL\n"+
- "SELECT 2 as table_type, art_type_id as item_type_id, art_id as item_id, 0 as item_first, 0 as item_second, 'na' as item_value, item.gamma_id, mod_type, app_id \n" +
- "FROM osee_artifact item, txsOuter where txsOuter.gamma_id = item.gamma_id\n"+
- "UNION ALL\n"+
- "SELECT 3 as table_type, rel_link_type_id as item_type_id, rel_link_id as item_id, a_art_id as item_first, b_art_id as item_second, rationale as item_value, item.gamma_id, mod_type, app_id \n" +
- "FROM osee_relation_link item, txsOuter where txsOuter.gamma_id = item.gamma_id";
- // @formatter:on
+ "with\n" + "txsOuter as (select transaction_id, gamma_id, mod_type, app_id from osee_txs txs where \n" +
+ "branch_id = ? and txs.tx_current <> ? and transaction_id <> ? AND \n" +
+ "NOT EXISTS (SELECT 1 FROM osee_txs txs1 WHERE txs1.branch_id = ? AND txs1.transaction_id = ? \n" +
+ "AND txs1.gamma_id = txs.gamma_id and txs1.mod_type = txs.mod_type and txs1.app_id = txs.app_id)) \n" +
+ "SELECT 1 as table_type, attr_type_id as item_type_id, attr_id as item_id, art_id as item_first, 0 as item_second, 0 as item_third, 0 as item_fourth, value as item_value, item.gamma_id, mod_type, app_id \n" +
+ "FROM osee_attribute item, txsOuter where txsOuter.gamma_id = item.gamma_id\n" +
+ "UNION ALL\n" +
+ "SELECT 2 as table_type, art_type_id as item_type_id, art_id as item_id, 0 as item_first, 0 as item_second, 0 as item_third, 0 as item_fourth, 'na' as item_value, item.gamma_id, mod_type, app_id \n" +
+ "FROM osee_artifact item, txsOuter where txsOuter.gamma_id = item.gamma_id\n" +
+ "UNION ALL\n" +
+ "SELECT 3 as table_type, rel_link_type_id as item_type_id, rel_link_id as item_id, a_art_id as item_first, b_art_id as item_second, 0 as item_third, 0 as item_fourth, rationale as item_value, item.gamma_id, mod_type, app_id \n" +
+ "FROM osee_relation_link item, txsOuter where txsOuter.gamma_id = item.gamma_id\n" +
+ "UNION ALL\n" +
+ "SELECT 4 as table_type, tuple_type as item_type_id, 0 as item_id, e1 as item_first, e2 as item_second, 0 as item_third, 0 as item_fourth, 'na' as item_value, item.gamma_id, mod_type, app_id \n" +
+ "from osee_tuple2 item, txsOuter where txsOuter.gamma_id = item.gamma_id\n" +
+ "UNION ALL\n" +
+ "SELECT 5 as table_type, tuple_type as item_type_id, 0 as item_id, e1 as item_first, e2 as item_second, e3 as item_third, 0 as item_fourth, 'na' as item_value, item.gamma_id, mod_type, app_id \n" +
+ "from osee_tuple3 item, txsOuter where txsOuter.gamma_id = item.gamma_id\n" +
+ "UNION ALL\n" +
+ "SELECT 6 as table_type, tuple_type as item_type_id, 0 as item_id, e1 as item_first, e2 as item_second, e3 as item_third, e4 as item_fourth, 'na' as item_value, item.gamma_id, mod_type, app_id \n" +
+ "from osee_tuple4 item, txsOuter where txsOuter.gamma_id = item.gamma_id";
+
+ // @formatter:on
private static final String SELECT_BASE_TX = "select baseline_transaction_id from osee_branch where branch_id = ?";
private final BranchId sourceBranch, destinationBranch;
private final BranchId mergeBranch;
@@ -164,6 +174,31 @@ public class LoadDeltasBetweenBranches extends AbstractDatastoreCallable<List<Ch
gammaId, modType, aArtId, bArtId, rationale, getApplicabilityToken(appId)));
break;
}
+ case 4: {
+ long e1 = stmt.getLong("item_first");
+ long e2 = stmt.getLong("item_second");
+ hashChangeData.put(4, gammaId.getId(), ChangeItemUtil.newTupleChange(TupleTypeId.valueOf(itemTypeId),
+ gammaId, getApplicabilityToken(appId), e1, e2));
+ break;
+ }
+ case 5: {
+ long e1 = stmt.getLong("item_first");
+ long e2 = stmt.getLong("item_second");
+ long e3 = stmt.getLong("item_third");
+ hashChangeData.put(5, gammaId.getId(), ChangeItemUtil.newTupleChange(TupleTypeId.valueOf(itemTypeId),
+ gammaId, getApplicabilityToken(appId), e1, e2, e3));
+ break;
+ }
+ case 6: {
+ long e1 = stmt.getLong("item_first");
+ long e2 = stmt.getLong("item_second");
+ long e3 = stmt.getLong("item_third");
+ long e4 = stmt.getLong("item_fourth");
+ hashChangeData.put(6, gammaId.getId(), ChangeItemUtil.newTupleChange(TupleTypeId.valueOf(itemTypeId),
+ gammaId, getApplicabilityToken(appId), e1, e2, e3, e4));
+ break;
+ }
+
}
};
getJdbcClient().runQuery(consumer, JdbcConstants.JDBC__MAX_FETCH_SIZE, SELECT_ALL_SOURCE_ADDRESSING, sourceBranch,
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java
index f46fe4ea40c..ff3496dec20 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java
@@ -24,6 +24,7 @@ import org.eclipse.osee.framework.core.data.GammaId;
import org.eclipse.osee.framework.core.data.RelationId;
import org.eclipse.osee.framework.core.data.RelationTypeId;
import org.eclipse.osee.framework.core.data.TransactionToken;
+import org.eclipse.osee.framework.core.data.TupleTypeId;
import org.eclipse.osee.framework.core.enums.BranchArchivedState;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
@@ -53,14 +54,23 @@ public class LoadDeltasBetweenTxsOnTheSameBranch extends AbstractDatastoreCallab
// @formatter:off
private static final String SELECT_ITEMS_BETWEEN_TRANSACTIONS =
"with txsOuter as (select gamma_id, mod_type, app_id from osee_txs%s where branch_id = ? and transaction_id > ? and transaction_id <= ?) \n" +
- "SELECT 1 as table_type, attr_type_id as item_type_id, attr_id as item_id, art_id as item_first, 0 as item_second, value as item_value, item.gamma_id, mod_type, app_id \n" +
+ "SELECT 1 as table_type, attr_type_id as item_type_id, attr_id as item_id, art_id as item_first, 0 as item_second, 0 as item_third, 0 as item_fourth, value as item_value, item.gamma_id, mod_type, app_id \n" +
"FROM osee_attribute item, txsOuter where txsOuter.gamma_id = item.gamma_id\n" +
"UNION ALL\n" +
- "SELECT 2 as table_type, art_type_id as item_type_id, art_id as item_id, 0 as item_first, 0 as item_second, 'na' as item_value, item.gamma_id, mod_type, app_id \n" +
+ "SELECT 2 as table_type, art_type_id as item_type_id, art_id as item_id, 0 as item_first, 0 as item_second, 0 as item_third, 0 as item_fourth, 'na' as item_value, item.gamma_id, mod_type, app_id \n" +
"FROM osee_artifact item, txsOuter where txsOuter.gamma_id = item.gamma_id\n" +
"UNION ALL\n" +
- "SELECT 3 as table_type, rel_link_type_id as item_type_id, rel_link_id as item_id, a_art_id as item_first, b_art_id as item_second, rationale as item_value, item.gamma_id, mod_type, app_id \n" +
- "FROM osee_relation_link item, txsOuter where txsOuter.gamma_id = item.gamma_id";
+ "SELECT 3 as table_type, rel_link_type_id as item_type_id, rel_link_id as item_id, a_art_id as item_first, b_art_id as item_second, 0 as item_third, 0 as item_fourth, rationale as item_value, item.gamma_id, mod_type, app_id \n" +
+ "FROM osee_relation_link item, txsOuter where txsOuter.gamma_id = item.gamma_id\n" +
+ "UNION ALL\n" +
+ "SELECT 4 as table_type, tuple_type as item_type_id, 0 as item_id, e1 as item_first, e2 as item_second, 0 as item_third, 0 as item_fourth, 'na' as item_value, item.gamma_id, mod_type, app_id \n" +
+ "from osee_tuple2 item, txsOuter where txsOuter.gamma_id = item.gamma_id\n" +
+ "UNION ALL\n" +
+ "SELECT 5 as table_type, tuple_type as item_type_id, 0 as item_id, e1 as item_first, e2 as item_second, e3 as item_third, 0 as item_fourth, 'na' as item_value, item.gamma_id, mod_type, app_id \n" +
+ "from osee_tuple3 item, txsOuter where txsOuter.gamma_id = item.gamma_id\n" +
+ "UNION ALL\n" +
+ "SELECT 6 as table_type, tuple_type as item_type_id, 0 as item_id, e1 as item_first, e2 as item_second, e3 as item_third, e4 as item_fourth, 'na' as item_value, item.gamma_id, mod_type, app_id \n" +
+ "from osee_tuple4 item, txsOuter where txsOuter.gamma_id = item.gamma_id";
// @formatter:on
private static final String SELECT_IS_BRANCH_ARCHIVED = "select archived from osee_branch where branch_id = ?";
@@ -139,6 +149,30 @@ public class LoadDeltasBetweenTxsOnTheSameBranch extends AbstractDatastoreCallab
gammaId, modType, aArtId, bArtId, rationale, getApplicabilityToken(appId)));
break;
}
+ case 4: {
+ long e1 = stmt.getLong("item_first");
+ long e2 = stmt.getLong("item_second");
+ hashChangeData.put(4, gammaId.getId(), ChangeItemUtil.newTupleChange(TupleTypeId.valueOf(itemTypeId),
+ gammaId, getApplicabilityToken(appId), e1, e2));
+ break;
+ }
+ case 5: {
+ long e1 = stmt.getLong("item_first");
+ long e2 = stmt.getLong("item_second");
+ long e3 = stmt.getLong("item_third");
+ hashChangeData.put(5, gammaId.getId(), ChangeItemUtil.newTupleChange(TupleTypeId.valueOf(itemTypeId),
+ gammaId, getApplicabilityToken(appId), e1, e2, e3));
+ break;
+ }
+ case 6: {
+ long e1 = stmt.getLong("item_first");
+ long e2 = stmt.getLong("item_second");
+ long e3 = stmt.getLong("item_third");
+ long e4 = stmt.getLong("item_fourth");
+ hashChangeData.put(6, gammaId.getId(), ChangeItemUtil.newTupleChange(TupleTypeId.valueOf(itemTypeId),
+ gammaId, getApplicabilityToken(appId), e1, e2, e3, e4));
+ break;
+ }
}
};
String query = String.format(SELECT_ITEMS_BETWEEN_TRANSACTIONS, isArchived ? "_archived" : "");
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java
index 692b23b0ded..834187e51fa 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java
@@ -65,6 +65,7 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
Set<Integer> modifiedArtIds = new HashSet<>();
Multimap<Integer, Integer> modifiedAttrIds = LinkedListMultimap.create();
Multimap<Integer, Integer> modifiedRels = LinkedListMultimap.create();
+ Multimap<Long, Long> modifiedTuples = LinkedListMultimap.create();
for (ChangeItem change : changes) {
switch (change.getChangeType()) {
@@ -80,6 +81,9 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
modifiedRels.put(change.getArtId().getId().intValue(), change.getItemId().getId().intValue());
modifiedRels.put(change.getArtIdB().getId().intValue(), change.getItemId().getId().intValue());
break;
+ case TUPLE_CHANGE:
+ modifiedTuples.put(0L, 1L);
+ break;
default:
throw new OseeStateException("Unknonw change type detected [%s]", change);
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TupleResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TupleResource.java
index b5e22eccda8..8474bc87eb1 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TupleResource.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TupleResource.java
@@ -10,12 +10,16 @@
*******************************************************************************/
package org.eclipse.osee.orcs.rest.internal;
+import static org.eclipse.osee.framework.core.enums.CoreTupleFamilyTypes.DefaultFamily;
+import static org.eclipse.osee.framework.core.enums.CoreTupleFamilyTypes.ProductLineFamily;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.Tuple3Type;
+import org.eclipse.osee.framework.core.data.Tuple4Type;
import org.eclipse.osee.framework.core.data.TupleTypeId;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.SystemUser;
@@ -41,6 +45,20 @@ public class TupleResource {
this.branch = branch;
}
+ @Path("init")
+ @POST
+ public void addTuples() {
+ TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, getUser(), "Init Tuples");
+
+ Tuple3Type<Long, Long, Long> ViewApplicability22 = Tuple3Type.valueOf(ProductLineFamily, 20L);
+ Tuple4Type<Long, Long, Long, Long> OseeTypeDef22 = Tuple4Type.valueOf(DefaultFamily, 40L);
+
+ tx.addTuple3(ViewApplicability22, 412215L, 466L, 4L);
+ tx.addTuple4(OseeTypeDef22, 222112L, 44L, 54445L, 66L);
+
+ tx.commit();
+ }
+
@Path("/tuple2")
@POST
public <E1, E2> Long addTuple2(@QueryParam("tupleType") Long tupleType, @QueryParam("e1") String e1, @QueryParam("e2") String e2) {

Back to the top