Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjphillips2009-12-02 21:32:47 +0000
committerjphillips2009-12-02 21:32:47 +0000
commit3153ee679d73b2788a479b2063cdab6d85ae87f5 (patch)
treeda7078b08a226e17551d2e2f09ceb17e7085abb4
parent21608cc1d7c72fc41cc58ed649a5848d12d3eaa8 (diff)
downloadorg.eclipse.osee-3153ee679d73b2788a479b2063cdab6d85ae87f5.tar.gz
org.eclipse.osee-3153ee679d73b2788a479b2063cdab6d85ae87f5.tar.xz
org.eclipse.osee-3153ee679d73b2788a479b2063cdab6d85ae87f5.zip
-rw-r--r--org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ChangeTestSuite.java1
-rw-r--r--org.eclipse.osee.framework.branch.management/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ChangeItemUtil.java117
-rw-r--r--org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ComputeNetChangeOperation.java1
-rw-r--r--org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockDataFactory.java86
-rw-r--r--org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeItemTranslatorTest.java15
-rw-r--r--org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeVersionTranslatorTest.java17
-rw-r--r--org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataAsserts.java72
-rw-r--r--org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/ChangeItemUtilTest.java (renamed from org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ChangeItemUtilTest.java)4
-rw-r--r--org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/UtilTestSuite.java8
-rw-r--r--org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/DataTranslationServiceFactory.java1
-rw-r--r--org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/ChangeItemUtil.java (renamed from org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/ChangeItemUtil.java)2
-rw-r--r--org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Fast_Suite.java5
-rw-r--r--org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java5
-rw-r--r--org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/commit/LoadCommitItemsFromDbTest.java128
-rw-r--r--org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpChangeDataRequester.java14
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/ArtifactChangeItem.java27
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/AttributeChangeItem.java29
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/CommitDbOperation.java205
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/ComputeNetChangeOperation.java112
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/LoadChangeDataOperation.java344
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/RelationChangeItem.java47
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/UpdatePreviousTxCurrent.java72
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java9
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeReportDataLoader.java71
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/CommitService.java67
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/ICommitService.java18
28 files changed, 181 insertions, 1298 deletions
diff --git a/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ChangeTestSuite.java b/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ChangeTestSuite.java
index d66e72d4b18..e819365c77b 100644
--- a/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ChangeTestSuite.java
+++ b/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ChangeTestSuite.java
@@ -15,7 +15,6 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses( {//
-ChangeItemUtilTest.class, //
ComputeNetChangeTest.class, //
})
/**
diff --git a/org.eclipse.osee.framework.branch.management/META-INF/MANIFEST.MF b/org.eclipse.osee.framework.branch.management/META-INF/MANIFEST.MF
index 0f598b973c4..4caf6362b39 100644
--- a/org.eclipse.osee.framework.branch.management/META-INF/MANIFEST.MF
+++ b/org.eclipse.osee.framework.branch.management/META-INF/MANIFEST.MF
@@ -14,6 +14,7 @@ Import-Package: org.eclipse.core.runtime,
org.eclipse.osee.framework.core.operation,
org.eclipse.osee.framework.core.server,
org.eclipse.osee.framework.core.services,
+ org.eclipse.osee.framework.core.util,
org.eclipse.osee.framework.database,
org.eclipse.osee.framework.database.core,
org.eclipse.osee.framework.jdk.core.text,
diff --git a/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ChangeItemUtil.java b/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ChangeItemUtil.java
deleted file mode 100644
index c579a694db9..00000000000
--- a/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ChangeItemUtil.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.branch.management.change;
-
-import org.eclipse.osee.framework.core.data.ChangeItem;
-import org.eclipse.osee.framework.core.data.ChangeVersion;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ChangeItemUtil {
-
- private ChangeItemUtil() {
- }
-
- public static ChangeVersion getStartingVersion(ChangeItem item) throws OseeCoreException {
- if (item == null) {
- throw new OseeArgumentException("ChangeItem cannot be null");
- }
- ChangeVersion toReturn = item.getBaselineVersion();
- if (!toReturn.isValid()) {
- toReturn = item.getFirstNonCurrentChange();
- if (!toReturn.isValid()) {
- toReturn = item.getCurrentVersion();
- if (!toReturn.isValid()) {
- throw new OseeStateException(String.format("Cannot find a valid starting point for change item: %s",
- item));
- }
- }
- }
- return toReturn;
- }
-
- public static boolean isModType(ChangeVersion changeVersion, ModificationType matchModType) {
- return changeVersion != null && changeVersion.getModType() == matchModType;
- }
-
- public static boolean isNew(ChangeVersion changeVersion) {
- return isModType(changeVersion, ModificationType.NEW);
- }
-
- public static boolean isIntroduced(ChangeVersion changeVersion) {
- return isModType(changeVersion, ModificationType.INTRODUCED);
- }
-
- public static boolean isDeleted(ChangeVersion changeVersion) {
- return changeVersion != null && changeVersion.getModType() != null && changeVersion.getModType().isDeleted();
- }
-
- public static boolean wasNewOnSource(ChangeItem changeItem) {
- return isNew(changeItem.getFirstNonCurrentChange()) || isNew(changeItem.getCurrentVersion());
- }
-
- public static boolean wasIntroducedOnSource(ChangeItem changeItem) {
- return isIntroduced(changeItem.getFirstNonCurrentChange()) || isIntroduced(changeItem.getCurrentVersion());
- }
-
- public static boolean wasNewOrIntroducedOnSource(ChangeItem changeItem) {
- return wasNewOnSource(changeItem) || wasIntroducedOnSource(changeItem);
- }
-
- public static boolean isAlreadyOnDestination(ChangeItem changeItem) {
- return areGammasEqual(changeItem.getCurrentVersion(), changeItem.getDestinationVersion()) && //
- isDeleted(changeItem.getCurrentVersion()) == isDeleted(changeItem.getDestinationVersion());
- }
-
- public static boolean areGammasEqual(ChangeVersion object1, ChangeVersion object2) {
- boolean result = false;
- if (object1 == null && object2 == null) {
- result = true;
- } else if (object1 != null && object2 != null) {
- if (object1.getGammaId() == object2.getGammaId()) {
- result = true;
- } else if (object1.getGammaId() != null) {
- result = object1.getGammaId().equals(object2.getGammaId());
- }
- }
- return result;
- }
-
- public static boolean isIgnoreCase(ChangeItem changeItem) {
- return //
- wasCreatedAndDeleted(changeItem) || //
- isAlreadyOnDestination(changeItem) || //
- isDeletedAndDoesNotExistInDestination(changeItem) || //
- hasBeenDeletedInDestination(changeItem) || //
- isDestinationEqualOrNewerThanCurrent(changeItem);
- }
-
- public static boolean wasCreatedAndDeleted(ChangeItem changeItem) {
- return wasNewOrIntroducedOnSource(changeItem) && isDeleted(changeItem.getCurrentVersion());
- }
-
- public static boolean isDeletedAndDoesNotExistInDestination(ChangeItem changeItem) {
- return !changeItem.getDestinationVersion().isValid() && isDeleted(changeItem.getCurrentVersion());
- }
-
- public static boolean hasBeenDeletedInDestination(ChangeItem changeItem) {
- return changeItem.getDestinationVersion().isValid() && isDeleted(changeItem.getDestinationVersion());
- }
-
- public static boolean isDestinationEqualOrNewerThanCurrent(ChangeItem changeItem) {
- return (isNew(changeItem.getCurrentVersion()) || isIntroduced(changeItem.getCurrentVersion())) && changeItem.getDestinationVersion().isValid();
- }
-}
diff --git a/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ComputeNetChangeOperation.java b/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ComputeNetChangeOperation.java
index 6653b67e809..60216aae1a2 100644
--- a/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ComputeNetChangeOperation.java
+++ b/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/change/ComputeNetChangeOperation.java
@@ -20,6 +20,7 @@ import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.util.ChangeItemUtil;
/**
* @author Roberto E. Escobar
diff --git a/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockDataFactory.java b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockDataFactory.java
index e396a87f96c..8846e952460 100644
--- a/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockDataFactory.java
+++ b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockDataFactory.java
@@ -8,11 +8,13 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
+
package org.eclipse.osee.framework.core.test.mocks;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+
import org.eclipse.osee.framework.core.cache.ArtifactTypeCache;
import org.eclipse.osee.framework.core.cache.AttributeTypeCache;
import org.eclipse.osee.framework.core.cache.BranchCache;
@@ -23,6 +25,7 @@ import org.eclipse.osee.framework.core.data.ArtifactChangeItem;
import org.eclipse.osee.framework.core.data.BranchCreationRequest;
import org.eclipse.osee.framework.core.data.BranchCreationResponse;
import org.eclipse.osee.framework.core.data.CacheUpdateRequest;
+import org.eclipse.osee.framework.core.data.ChangeVersion;
import org.eclipse.osee.framework.core.data.DefaultBasicArtifact;
import org.eclipse.osee.framework.core.data.IBasicArtifact;
import org.eclipse.osee.framework.core.data.IOseeType;
@@ -74,21 +77,35 @@ public final class MockDataFactory {
int transactionNumber = (int) Math.random();
Long gammaIdNumber = Long.valueOf((int) Math.random());
- ArtifactChangeItem changeItem =
- new ArtifactChangeItem(gammaIdNumber, ModificationType.getMod(1), transactionNumber, artId);
- changeItem.getDestinationVersion().setGammaId(11L);
- changeItem.getDestinationVersion().setModType(ModificationType.getMod(1));
- changeItem.getDestinationVersion().setTransactionNumber(1);
- changeItem.getDestinationVersion().setValue("Value");
+ ArtifactChangeItem changeItem = new ArtifactChangeItem(gammaIdNumber,
+ ModificationType.getMod(1),
+ transactionNumber, artId);
+ populateChangeVersion(changeItem.getDestinationVersion(), 22);
+ populateChangeVersion(changeItem.getCurrentVersion(), 15);
return changeItem;
}
+ public static ChangeVersion createChangeVersion(int index) {
+ ModificationType modType = ModificationType.values()[index % ModificationType.values().length];
+ return new ChangeVersion("change_version_value_" + index, (long) (index * Integer.MAX_VALUE),
+ modType, index * 11);
+ }
+
+ public static void populateChangeVersion(ChangeVersion changeVersion, int index) {
+ ModificationType modType = ModificationType.values()[index % ModificationType.values().length];
+ changeVersion.setGammaId((long) (index * Integer.MAX_VALUE));
+ changeVersion.setModType(modType);
+ changeVersion.setTransactionNumber(index * 37);
+ changeVersion.setValue("change_version_value_" + index);
+ }
+
public static AttributeType createAttributeType() throws OseeCoreException {
OseeEnumTypeFactory oseeEnumTypeFactory = new OseeEnumTypeFactory();
- AttributeType attributeType =
- new AttributeType(GUID.create(), "name", "baseType", "providerName", ".xml", "", 1, 1, "description",
- "tagger");
- attributeType.setOseeEnumType(oseeEnumTypeFactory.createEnumType(GUID.create(), "enum type name"));
+ AttributeType attributeType = new AttributeType(GUID.create(), "name", "baseType",
+ "providerName", ".xml", "", 1, 1,
+ "description", "tagger");
+ attributeType.setOseeEnumType(oseeEnumTypeFactory.createEnumType(GUID.create(),
+ "enum type name"));
return attributeType;
}
@@ -100,13 +117,14 @@ public final class MockDataFactory {
}
public static TransactionRecord createTransaction(int index, int branchId) {
- TransactionDetailsType type =
- TransactionDetailsType.values()[Math.abs(index % TransactionDetailsType.values().length)];
+ TransactionDetailsType type = TransactionDetailsType.values()[Math.abs(index
+ % TransactionDetailsType.values().length)];
int value = index;
if (value == 0) {
value++;
}
- return new TransactionRecord(value * 47, branchId, "comment_" + value, new Date(), value * 37, value * 42, type);
+ return new TransactionRecord(value * 47, branchId, "comment_" + value, new Date(),
+ value * 37, value * 42, type);
}
public static OseeEnumEntry createEnumEntry(int index) {
@@ -118,9 +136,12 @@ public final class MockDataFactory {
}
public static AttributeType createAttributeType(int index, OseeEnumType oseeEnumType) throws OseeCoreException {
- AttributeType type =
- new AttributeType(GUID.create(), "attrType_" + index, "baseClass_" + index, "providerId_" + index,
- "ext_" + index, "default_" + index, index * 2, index * 7, "description_" + index, "tag_" + index);
+ AttributeType type = new AttributeType(GUID.create(), "attrType_" + index, "baseClass_"
+ + index,
+ "providerId_" + index, "ext_" + index, "default_"
+ + index,
+ index * 2, index * 7, "description_" + index, "tag_"
+ + index);
type.setOseeEnumType(oseeEnumType);
return type;
}
@@ -134,16 +155,19 @@ public final class MockDataFactory {
return new ArtifactType(baseType.getGuid(), baseType.getName(), true);
}
- public static RelationType createRelationType(int index, ArtifactType artTypeA, ArtifactType artTypeB) {
- RelationTypeMultiplicity multiplicity =
- RelationTypeMultiplicity.values()[Math.abs(index % RelationTypeMultiplicity.values().length)];
- String order = RelationOrderBaseTypes.values()[index % RelationTypeMultiplicity.values().length].getGuid();
- return new RelationType(GUID.create(), "relType_" + index, "sideA_" + index, "sideB_" + index, artTypeA,
- artTypeB, multiplicity, order);
+ public static RelationType createRelationType(int index, ArtifactType artTypeA,
+ ArtifactType artTypeB) {
+ RelationTypeMultiplicity multiplicity = RelationTypeMultiplicity.values()[Math.abs(index
+ % RelationTypeMultiplicity.values().length)];
+ String order = RelationOrderBaseTypes.values()[index
+ % RelationTypeMultiplicity.values().length].getGuid();
+ return new RelationType(GUID.create(), "relType_" + index, "sideA_" + index,
+ "sideB_" + index, artTypeA, artTypeB, multiplicity, order);
}
public static CacheUpdateRequest createRequest(int index) {
- OseeCacheEnum cacheEnum = OseeCacheEnum.values()[Math.abs(index % OseeCacheEnum.values().length)];
+ OseeCacheEnum cacheEnum = OseeCacheEnum.values()[Math.abs(index
+ % OseeCacheEnum.values().length)];
List<String> guids = new ArrayList<String>();
for (int j = 1; j <= index * 3; j++) {
guids.add(GUID.create());
@@ -153,7 +177,8 @@ public final class MockDataFactory {
public static IOseeModelFactoryService createFactoryService() {
return new OseeModelFactoryService(new BranchFactory(), new TransactionRecordFactory(),
- new ArtifactTypeFactory(), new AttributeTypeFactory(), new RelationTypeFactory(), new OseeEnumTypeFactory());
+ new ArtifactTypeFactory(), new AttributeTypeFactory(),
+ new RelationTypeFactory(), new OseeEnumTypeFactory());
}
public static IOseeModelFactoryServiceProvider createFactoryProvider() {
@@ -164,11 +189,13 @@ public final class MockDataFactory {
BranchCache brCache = new BranchCache(new MockOseeDataAccessor<Branch>());
TransactionCache txCache = new TransactionCache(new MockOseeTransactionDataAccessor());
ArtifactTypeCache artCache = new ArtifactTypeCache(new MockOseeDataAccessor<ArtifactType>());
- AttributeTypeCache attrCache = new AttributeTypeCache(new MockOseeDataAccessor<AttributeType>());
+ AttributeTypeCache attrCache = new AttributeTypeCache(
+ new MockOseeDataAccessor<AttributeType>());
RelationTypeCache relCache = new RelationTypeCache(new MockOseeDataAccessor<RelationType>());
OseeEnumTypeCache enumCache = new OseeEnumTypeCache(new MockOseeDataAccessor<OseeEnumType>());
- IOseeCachingService service = new OseeCachingService(brCache, txCache, artCache, attrCache, relCache, enumCache);
+ IOseeCachingService service = new OseeCachingService(brCache, txCache, artCache, attrCache,
+ relCache, enumCache);
return new MockOseeCachingServiceProvider(service);
}
@@ -188,9 +215,10 @@ public final class MockDataFactory {
int populateBaseTxFromAddressingQueryId = -1;
int destinationBranchId = -1;
- return new BranchCreationRequest(branchType, sourceTransactionId, parentBranchId, branchGuid, branchName,
- associatedArtifactId, staticBranchName, authorId, creationComment, populateBaseTxFromAddressingQueryId,
- destinationBranchId);
+ return new BranchCreationRequest(branchType, sourceTransactionId, parentBranchId, branchGuid,
+ branchName, associatedArtifactId, staticBranchName,
+ authorId, creationComment,
+ populateBaseTxFromAddressingQueryId, destinationBranchId);
}
public static Object createBranchCreateResponse(int index) {
diff --git a/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeItemTranslatorTest.java b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeItemTranslatorTest.java
index 545b97ff8c9..26d87eaa55e 100644
--- a/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeItemTranslatorTest.java
+++ b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeItemTranslatorTest.java
@@ -15,9 +15,10 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import junit.framework.Assert;
+
import org.eclipse.osee.framework.core.data.ChangeItem;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
import org.eclipse.osee.framework.core.translation.ChangeItemTranslator;
@@ -42,23 +43,19 @@ public class ChangeItemTranslatorTest extends BaseTranslatorTest<ChangeItem> {
@Override
protected void checkEquals(ChangeItem expected, ChangeItem actual) throws OseeCoreException {
+ Assert.assertNotSame(expected, actual);
DataAsserts.assertEquals(expected, actual);
}
@Parameters
public static Collection<Object[]> data() throws OseeCoreException {
DataTranslationService dataTranslationService = new DataTranslationService();
- dataTranslationService.addTranslator(new ChangeItemTranslator(dataTranslationService),
- CoreTranslatorId.CHANGE_ITEM);
- dataTranslationService.addTranslator(new ChangeVersionTranslator(), CoreTranslatorId.CHANGE_VERSION);
+ dataTranslationService.addTranslator(new ChangeVersionTranslator(),
+ CoreTranslatorId.CHANGE_VERSION);
List<Object[]> data = new ArrayList<Object[]>();
ITranslator<ChangeItem> translator = new ChangeItemTranslator(dataTranslationService);
- try {
- data.add(new Object[] {MockDataFactory.createArtifactChangeItem(), translator});
- } catch (OseeArgumentException ex) {
- throw new IllegalArgumentException(ex);
- }
+ data.add(new Object[] {MockDataFactory.createArtifactChangeItem(), translator});
return data;
}
}
diff --git a/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeVersionTranslatorTest.java b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeVersionTranslatorTest.java
index 8f9f23cfec3..f447ad651a6 100644
--- a/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeVersionTranslatorTest.java
+++ b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeVersionTranslatorTest.java
@@ -8,6 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
+
package org.eclipse.osee.framework.core.test.translation;
import java.util.ArrayList;
@@ -17,9 +18,8 @@ import java.util.List;
import junit.framework.Assert;
import org.eclipse.osee.framework.core.data.ChangeVersion;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
import org.eclipse.osee.framework.core.translation.ChangeVersionTranslator;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.junit.runner.RunWith;
@@ -40,22 +40,15 @@ public class ChangeVersionTranslatorTest extends BaseTranslatorTest<ChangeVersio
@Override
protected void checkEquals(ChangeVersion expected, ChangeVersion actual) throws OseeCoreException {
- Assert.assertEquals(expected.getGammaId(), actual.getGammaId());
- Assert.assertEquals(expected.getModType().getValue(), actual.getModType().getValue());
- Assert.assertEquals(expected.getTransactionNumber(), actual.getTransactionNumber());
- Assert.assertEquals(expected.getValue(), actual.getValue());
+ Assert.assertNotSame(expected, actual);
+ DataAsserts.assertEquals(expected, actual);
}
@Parameters
public static Collection<Object[]> data() {
List<Object[]> data = new ArrayList<Object[]>();
ITranslator<ChangeVersion> translator = new ChangeVersionTranslator();
- try {
- data.add(new Object[] {new ChangeVersion("test", 1L ,ModificationType.getMod(1),12), translator});
- }
- catch (OseeArgumentException ex) {
- throw new IllegalArgumentException(ex);
- }
+ data.add(new Object[] {MockDataFactory.createChangeVersion(22), translator});
return data;
}
}
diff --git a/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataAsserts.java b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataAsserts.java
index a69e1d95455..d203606b792 100644
--- a/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataAsserts.java
+++ b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataAsserts.java
@@ -8,9 +8,11 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
+
package org.eclipse.osee.framework.core.test.translation;
import junit.framework.Assert;
+
import org.eclipse.osee.framework.core.data.BranchCommitRequest;
import org.eclipse.osee.framework.core.data.BranchCommitResponse;
import org.eclipse.osee.framework.core.data.BranchCreationRequest;
@@ -37,21 +39,18 @@ public final class DataAsserts {
}
public static void assertEquals(ChangeItem expected, ChangeItem actual) throws OseeCoreException {
- Assert.assertEquals(expected.getArtId(), actual.getArtId());
- Assert.assertEquals(expected.getItemId(), actual.getItemId());
-
- checkChangeVersion(expected.getBaselineVersion(), actual.getBaselineVersion());
- checkChangeVersion(expected.getCurrentVersion(), actual.getCurrentVersion());
- checkChangeVersion(expected.getDestinationVersion(), actual.getDestinationVersion());
- checkChangeVersion(expected.getNetChange(), actual.getNetChange());
- checkChangeVersion(expected.getFirstNonCurrentChange(), actual.getFirstNonCurrentChange());
- }
+ if (expected == null) {
+ Assert.assertNull(actual);
+ }
+ else {
+ Assert.assertEquals(expected.getArtId(), actual.getArtId());
+ Assert.assertEquals(expected.getItemId(), actual.getItemId());
- private static void checkChangeVersion(ChangeVersion expected, ChangeVersion actual) {
- if (actual.isValid()) {
- Assert.assertEquals(expected.getGammaId(), actual.getGammaId());
- Assert.assertEquals(expected.getTransactionNumber(), actual.getTransactionNumber());
- Assert.assertEquals(expected.getModType(), actual.getModType());
+ assertEquals(expected.getBaselineVersion(), actual.getBaselineVersion());
+ assertEquals(expected.getCurrentVersion(), actual.getCurrentVersion());
+ assertEquals(expected.getDestinationVersion(), actual.getDestinationVersion());
+ assertEquals(expected.getNetChange(), actual.getNetChange());
+ assertEquals(expected.getFirstNonCurrentChange(), actual.getFirstNonCurrentChange());
}
}
@@ -78,7 +77,8 @@ public final class DataAsserts {
public static void assertEquals(Branch expected, Branch actual) throws OseeCoreException {
if (expected == null) {
Assert.assertNull(actual);
- } else {
+ }
+ else {
assertEquals((IOseeStorableType) expected, (IOseeStorableType) actual);
Assert.assertEquals(expected.getShortName(), actual.getShortName());
Assert.assertEquals(expected.getAccessControlBranch(), actual.getAccessControlBranch());
@@ -95,7 +95,8 @@ public final class DataAsserts {
public static void assertEquals(TransactionRecord expected, TransactionRecord actual) throws OseeCoreException {
if (expected == null) {
Assert.assertNull(actual);
- } else {
+ }
+ else {
Assert.assertEquals(expected.getId(), actual.getId());
Assert.assertEquals(expected.getAuthor(), actual.getAuthor());
Assert.assertEquals(expected.getComment(), actual.getComment());
@@ -109,7 +110,8 @@ public final class DataAsserts {
public static void assertEquals(IBasicArtifact<?> expected, IBasicArtifact<?> actual) throws OseeCoreException {
if (expected == null) {
Assert.assertNull(actual);
- } else {
+ }
+ else {
Assert.assertEquals(expected.getArtId(), actual.getArtId());
Assert.assertEquals(expected.getGuid(), actual.getGuid());
Assert.assertEquals(expected.getName(), actual.getName());
@@ -120,7 +122,8 @@ public final class DataAsserts {
public static void assertEquals(BranchCommitRequest expected, BranchCommitRequest actual) throws OseeCoreException {
if (expected == null) {
Assert.assertNull(actual);
- } else {
+ }
+ else {
Assert.assertEquals(expected.getUserArtId(), actual.getUserArtId());
Assert.assertEquals(expected.isArchiveAllowed(), actual.isArchiveAllowed());
Assert.assertEquals(expected.getSourceBranchId(), actual.getSourceBranchId());
@@ -131,7 +134,8 @@ public final class DataAsserts {
public static void assertEquals(BranchCommitResponse expected, BranchCommitResponse actual) throws OseeCoreException {
if (expected == null) {
Assert.assertNull(actual);
- } else {
+ }
+ else {
assertEquals(expected.getTransaction(), actual.getTransaction());
}
}
@@ -139,7 +143,8 @@ public final class DataAsserts {
public static void assertEquals(CacheUpdateRequest expected, CacheUpdateRequest actual) {
if (expected == null) {
Assert.assertNull(actual);
- } else {
+ }
+ else {
Assert.assertEquals(expected.getCacheId(), actual.getCacheId());
Assert.assertFalse(Compare.isDifferent(expected.getGuids(), actual.getGuids()));
}
@@ -148,7 +153,8 @@ public final class DataAsserts {
public static void assertEquals(RelationType expected, RelationType actual) throws OseeCoreException {
if (expected == null) {
Assert.assertNull(actual);
- } else {
+ }
+ else {
assertEquals((IOseeStorableType) expected, (IOseeStorableType) actual);
Assert.assertEquals(expected.getSideAName(), actual.getSideAName());
Assert.assertEquals(expected.getSideBName(), actual.getSideBName());
@@ -162,7 +168,8 @@ public final class DataAsserts {
public static void assertEquals(IOseeStorableType expected, IOseeStorableType actual) {
if (expected == null) {
Assert.assertNull(actual);
- } else {
+ }
+ else {
Assert.assertEquals(expected.getId(), actual.getId());
Assert.assertEquals(expected.getGuid(), actual.getGuid());
Assert.assertEquals(expected.getName(), actual.getName());
@@ -174,7 +181,8 @@ public final class DataAsserts {
public static void assertEquals(BranchCreationRequest expected, BranchCreationRequest actual) {
if (expected == null) {
Assert.assertNull(actual);
- } else {
+ }
+ else {
Assert.assertEquals(expected.getAssociatedArtifactId(), actual.getAssociatedArtifactId());
Assert.assertEquals(expected.getAuthorId(), actual.getAuthorId());
Assert.assertEquals(expected.getBranchGuid(), actual.getBranchGuid());
@@ -183,7 +191,7 @@ public final class DataAsserts {
Assert.assertEquals(expected.getDestinationBranchId(), actual.getDestinationBranchId());
Assert.assertEquals(expected.getParentBranchId(), actual.getParentBranchId());
Assert.assertEquals(expected.getPopulateBaseTxFromAddressingQueryId(),
- actual.getPopulateBaseTxFromAddressingQueryId());
+ actual.getPopulateBaseTxFromAddressingQueryId());
Assert.assertEquals(expected.getSourceTransactionId(), actual.getSourceTransactionId());
Assert.assertEquals(expected.getStaticBranchName(), actual.getStaticBranchName());
Assert.assertEquals(expected.getBranchType(), actual.getBranchType());
@@ -193,8 +201,22 @@ public final class DataAsserts {
public static void assertEquals(BranchCreationResponse expected, BranchCreationResponse actual) {
if (expected == null) {
Assert.assertNull(actual);
- } else {
+ }
+ else {
Assert.assertEquals(expected.getBranchId(), actual.getBranchId());
}
}
+
+ public static void assertEquals(ChangeVersion expected, ChangeVersion actual) {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ }
+ else {
+ Assert.assertEquals(expected.isValid(), actual.isValid());
+ Assert.assertEquals(expected.getGammaId(), actual.getGammaId());
+ Assert.assertEquals(expected.getModType(), actual.getModType());
+ Assert.assertEquals(expected.getTransactionNumber(), actual.getTransactionNumber());
+ Assert.assertEquals(expected.getValue(), actual.getValue());
+ }
+ }
}
diff --git a/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ChangeItemUtilTest.java b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/ChangeItemUtilTest.java
index 24aec549005..817379900c9 100644
--- a/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/change/ChangeItemUtilTest.java
+++ b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/ChangeItemUtilTest.java
@@ -8,14 +8,13 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.branch.management.test.change;
+package org.eclipse.osee.framework.core.test.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.osee.framework.branch.management.change.ChangeItemUtil;
import org.eclipse.osee.framework.core.data.ChangeItem;
import org.eclipse.osee.framework.core.data.ChangeVersion;
import org.eclipse.osee.framework.core.enums.ModificationType;
@@ -23,6 +22,7 @@ import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.core.test.data.ChangeTestUtility;
+import org.eclipse.osee.framework.core.util.ChangeItemUtil;
import org.eclipse.osee.framework.jdk.core.type.Triplet;
import org.junit.Assert;
import org.junit.Test;
diff --git a/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/UtilTestSuite.java b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/UtilTestSuite.java
index e473de6ad38..41cb8af75a2 100644
--- a/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/UtilTestSuite.java
+++ b/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/UtilTestSuite.java
@@ -8,13 +8,17 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.core.test.util;
+package org.eclipse.osee.framework.core.test.util;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
+
@RunWith(Suite.class)
-@Suite.SuiteClasses( {CompareTest.class})
+@Suite.SuiteClasses( {//
+ChangeItemUtilTest.class, //
+ CompareTest.class, //
+})
/**
* @author Roberto E. Escobar
*/
diff --git a/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/DataTranslationServiceFactory.java b/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/DataTranslationServiceFactory.java
index 62bb6824304..4f6e817319b 100644
--- a/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/DataTranslationServiceFactory.java
+++ b/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/DataTranslationServiceFactory.java
@@ -55,6 +55,7 @@ public class DataTranslationServiceFactory {
service.addTranslator(new ChangeVersionTranslator(), CoreTranslatorId.CHANGE_VERSION);
service.addTranslator(new ChangeItemTranslator(service), CoreTranslatorId.CHANGE_ITEM);
+
service.addTranslator(new ChangeReportRequestTranslator(), CoreTranslatorId.CHANGE_REPORT_REQUEST);
service.addTranslator(new ChangeReportResponseTranslator(service), CoreTranslatorId.CHANGE_REPORT_RESPONSE);
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/ChangeItemUtil.java b/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/ChangeItemUtil.java
index 9556e8deb5f..d903bebf0ae 100644
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/ChangeItemUtil.java
+++ b/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/ChangeItemUtil.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.skynet.core.commit;
+package org.eclipse.osee.framework.core.util;
import org.eclipse.osee.framework.core.data.ChangeItem;
import org.eclipse.osee.framework.core.data.ChangeVersion;
diff --git a/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Fast_Suite.java b/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Fast_Suite.java
index 6946bddb771..57928a10641 100644
--- a/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Fast_Suite.java
+++ b/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Fast_Suite.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.skynet.core.test;
import static org.junit.Assert.assertTrue;
+
import org.eclipse.osee.framework.core.client.ClientSessionManager;
import org.eclipse.osee.framework.skynet.core.test.branch.BranchTestSuite;
import org.eclipse.osee.framework.skynet.core.test.cases.ArtifactTypeInheritanceTest;
@@ -21,7 +22,6 @@ import org.eclipse.osee.framework.skynet.core.test.cases.RelationDeletionTest;
import org.eclipse.osee.framework.skynet.core.test.cases.RelationOrderingTest;
import org.eclipse.osee.framework.skynet.core.test.cases.SevereLogMonitorTest;
import org.eclipse.osee.framework.skynet.core.test.cases.StaticIdManagerTest;
-import org.eclipse.osee.framework.skynet.core.test.commit.LoadCommitItemsFromDbTest;
import org.eclipse.osee.framework.skynet.core.test.relation.RelationTestSuite;
import org.eclipse.osee.framework.skynet.core.test.types.OseeCacheTestSuite;
import org.junit.BeforeClass;
@@ -29,8 +29,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses( {BranchTestSuite.class, RelationTestSuite.class, OseeCacheTestSuite.class,
- LoadCommitItemsFromDbTest.class, ArtifactTypeInheritanceTest.class, Artifact_setAttributeValues.class,
+@Suite.SuiteClasses( {BranchTestSuite.class, RelationTestSuite.class, OseeCacheTestSuite.class, ArtifactTypeInheritanceTest.class, Artifact_setAttributeValues.class,
CsvArtifactTest.class, SevereLogMonitorTest.class, RelationDeletionTest.class, StaticIdManagerTest.class,
DuplicateHridTest.class, RelationOrderingTest.class})
/**
diff --git a/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java b/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
index 569c737a15f..6ead75f66c8 100644
--- a/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
+++ b/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.skynet.core.test;
import static org.junit.Assert.assertTrue;
+
import org.eclipse.osee.framework.core.client.ClientSessionManager;
import org.eclipse.osee.framework.skynet.core.test.branch.BranchTestSuite;
import org.eclipse.osee.framework.skynet.core.test.cases.ArtifactPurgeTest;
@@ -27,7 +28,6 @@ import org.eclipse.osee.framework.skynet.core.test.cases.RelationDeletionTest;
import org.eclipse.osee.framework.skynet.core.test.cases.RelationOrderingTest;
import org.eclipse.osee.framework.skynet.core.test.cases.SevereLogMonitorTest;
import org.eclipse.osee.framework.skynet.core.test.cases.StaticIdManagerTest;
-import org.eclipse.osee.framework.skynet.core.test.commit.LoadCommitItemsFromDbTest;
import org.eclipse.osee.framework.skynet.core.test.relation.RelationTestSuite;
import org.eclipse.osee.framework.skynet.core.test.types.OseeCacheTestSuite;
import org.junit.BeforeClass;
@@ -35,8 +35,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses( {BranchTestSuite.class, RelationTestSuite.class, OseeCacheTestSuite.class,
- LoadCommitItemsFromDbTest.class, ArtifactTypeInheritanceTest.class, ArtifactPurgeTest.class,
+@Suite.SuiteClasses( {BranchTestSuite.class, RelationTestSuite.class, OseeCacheTestSuite.class, ArtifactTypeInheritanceTest.class, ArtifactPurgeTest.class,
BranchPurgeTest.class, Artifact_setAttributeValues.class, CsvArtifactTest.class, NativeArtifactTest.class,
ConflictTest.class, ChangeManagerTest.class, SevereLogMonitorTest.class, RelationDeletionTest.class,
StaticIdManagerTest.class, BranchStateTest.class, DuplicateHridTest.class, RelationOrderingTest.class})
diff --git a/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/commit/LoadCommitItemsFromDbTest.java b/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/commit/LoadCommitItemsFromDbTest.java
deleted file mode 100644
index 7d4fe1edf11..00000000000
--- a/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/commit/LoadCommitItemsFromDbTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.test.commit;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import junit.framework.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.osee.framework.core.data.ChangeItem;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.commit.ArtifactChangeItem;
-import org.eclipse.osee.framework.skynet.core.commit.AttributeChangeItem;
-import org.eclipse.osee.framework.skynet.core.commit.ComputeNetChangeOperation;
-import org.eclipse.osee.framework.skynet.core.commit.LoadChangeDataOperation;
-import org.eclipse.osee.framework.skynet.core.commit.RelationChangeItem;
-import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
-import org.eclipse.osee.support.test.util.DemoSawBuilds;
-import org.junit.Test;
-
-/**
- * Checks commit load operation this test is dependent on PopulateDemo :
- *
- * @author Roberto E. Escobar
- */
-public class LoadCommitItemsFromDbTest {
-
- @Test
- public void testCommitItemsNonConflicting() throws OseeCoreException {
- final String branchName =
- "SAW (uncommitted) More Reqt Changes for Diagram View - SAW (uncommitted) More Reqt Changes for...";
- Branch destination = BranchManager.getBranch(DemoSawBuilds.SAW_Bld_2.name());
- Branch source = findASourceBranch(destination, branchName);
-
- Assert.assertNotNull(source);
- Assert.assertNotNull(destination);
-
- List<ChangeItem> items = new ArrayList<ChangeItem>();
-
- processItems(items, TransactionManager.getLastTransaction(source),
- TransactionManager.getLastTransaction(destination), null, 41, 41);
-
- checkNetItems(items, ModificationType.NEW, 2, 18, 4);
- checkNetItems(items, ModificationType.INTRODUCED, 0, 0, 0);
- checkNetItems(items, ModificationType.MODIFIED, 2, 4, 0);
- checkNetItems(items, ModificationType.MERGED, 0, 0, 0);
- checkNetItems(items, ModificationType.ARTIFACT_DELETED, 0, 9, 1);
- checkNetItems(items, ModificationType.DELETED, 1, 0, 0);
- }
-
- @Test
- public void testCommitItemsConflicting() throws OseeCoreException {
- final String branchName =
- "SAW (uncommitted-conflicted) More Requirement Changes for Diagram View - SAW (uncommitted-conflicted) More Requi...";
- Branch destination = BranchManager.getBranch(DemoSawBuilds.SAW_Bld_2.name());
- Branch source = findASourceBranch(destination, branchName);
-
- Assert.assertNotNull(source);
- Assert.assertNotNull(destination);
-
- List<ChangeItem> items = new ArrayList<ChangeItem>();
-
- processItems(items, TransactionManager.getLastTransaction(source),
- TransactionManager.getLastTransaction(destination), null, 5, 5);
-
- checkNetItems(items, ModificationType.NEW, 0, 1, 1);
- checkNetItems(items, ModificationType.INTRODUCED, 0, 0, 0);
- checkNetItems(items, ModificationType.MODIFIED, 1, 2, 0);
- checkNetItems(items, ModificationType.MERGED, 0, 0, 0);
- checkNetItems(items, ModificationType.ARTIFACT_DELETED, 0, 0, 0);
- checkNetItems(items, ModificationType.DELETED, 0, 0, 0);
- }
-
- private Branch findASourceBranch(Branch destination, String branchName) throws OseeCoreException {
- Branch source = null;
- for (Branch branch : BranchManager.getWorkingBranches(destination)) {
- if (branch.getName().contains(branchName)) {
- source = branch;
- }
- }
- return source;
- }
-
- private void processItems(Collection<ChangeItem> items, TransactionRecord source, TransactionRecord destination, TransactionRecord mergeBranch, int loadedItems, int netItems) throws OseeCoreException {
- IOperation operation = new LoadChangeDataOperation(source, destination, mergeBranch, items);
- Operations.executeWork(operation, new NullProgressMonitor(), -1);
- Assert.assertEquals(IStatus.OK, operation.getStatus().getSeverity());
- Assert.assertEquals(loadedItems, items.size());
-
- operation = new ComputeNetChangeOperation(items);
- Operations.executeWork(operation, new NullProgressMonitor(), -1);
- Assert.assertEquals(Lib.exceptionToString(operation.getStatus().getException()), IStatus.OK,
- operation.getStatus().getSeverity());
- Assert.assertEquals(netItems, items.size());
- }
-
- private void checkNetItems(Collection<ChangeItem> items, ModificationType modType, int artifacts, int attributes, int relations) {
- Assert.assertEquals(artifacts, getCount(items, ArtifactChangeItem.class, modType));
- Assert.assertEquals(attributes, getCount(items, AttributeChangeItem.class, modType));
- Assert.assertEquals(relations, getCount(items, RelationChangeItem.class, modType));
- }
-
- private int getCount(Collection<ChangeItem> items, Class<? extends ChangeItem> changeType, ModificationType type) {
- int count = 0;
- for (ChangeItem item : items) {
- if (item.getClass().isAssignableFrom(changeType) && item.getNetChange().getModType() == type) {
- count++;
- }
- }
- return count;
- }
-}
diff --git a/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF b/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
index 9cf23c7eab7..5979a39e07a 100644
--- a/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
@@ -28,7 +28,6 @@ Export-Package: org.eclipse.osee.framework.skynet.core,
org.eclipse.osee.framework.skynet.core.attribute.providers,
org.eclipse.osee.framework.skynet.core.attribute.utils,
org.eclipse.osee.framework.skynet.core.change,
- org.eclipse.osee.framework.skynet.core.commit,
org.eclipse.osee.framework.skynet.core.commit.actions,
org.eclipse.osee.framework.skynet.core.conflict,
org.eclipse.osee.framework.skynet.core.event,
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpChangeDataRequester.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpChangeDataRequester.java
index 2268289c48b..92ef98c77f8 100644
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpChangeDataRequester.java
+++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpChangeDataRequester.java
@@ -1,12 +1,18 @@
-/*
- * Created on Nov 10, 2009
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 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
*
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact;
import java.util.HashMap;
import java.util.Map;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.data.ChangeReportRequest;
import org.eclipse.osee.framework.core.data.ChangeReportResponse;
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/ArtifactChangeItem.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/ArtifactChangeItem.java
deleted file mode 100644
index d22af78c572..00000000000
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/ArtifactChangeItem.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.commit;
-
-import org.eclipse.osee.framework.core.data.ChangeItem;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-
-/**
- * @author Jeff C. Phillips
- */
-public class ArtifactChangeItem extends ChangeItem {
-
- public ArtifactChangeItem(long currentSourceGammaId, ModificationType currentSourceModType, int currentSourceTransactionNumber, int artId) {
- super(currentSourceGammaId, currentSourceModType, currentSourceTransactionNumber);
-
- this.setItemId(artId);
- this.setArtId(artId);
- }
-}
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/AttributeChangeItem.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/AttributeChangeItem.java
deleted file mode 100644
index ee6eef9dda4..00000000000
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/AttributeChangeItem.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.commit;
-
-import org.eclipse.osee.framework.core.data.ChangeItem;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-
-/**
- * @author Jeff C. Phillips
- */
-public class AttributeChangeItem extends ChangeItem {
-
- public AttributeChangeItem(long currentSourceGammaId, ModificationType currentSourceModType, int currentSourceTransactionNumber, int attrId, int artId, String value) {
- super(currentSourceGammaId, currentSourceModType, currentSourceTransactionNumber);
-
- this.setItemId(attrId);
- this.setArtId(artId);
- this.getCurrentVersion().setValue(value);
- }
-
-}
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/CommitDbOperation.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/CommitDbOperation.java
deleted file mode 100644
index 9468705e7ac..00000000000
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/CommitDbOperation.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.commit;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.data.ChangeItem;
-import org.eclipse.osee.framework.core.enums.BranchState;
-import org.eclipse.osee.framework.core.enums.ConflictStatus;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
-import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.database.core.AbstractDbTxOperation;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.database.core.SequenceManager;
-import org.eclipse.osee.framework.jdk.core.util.time.GlobalTime;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.access.AccessControlManager;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactLoad;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactLoader;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.event.BranchEventType;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
-import org.eclipse.osee.framework.skynet.core.types.IArtifact;
-
-/**
- * @author Ryan D. Brooks
- */
-public class CommitDbOperation extends AbstractDbTxOperation {
- private static final String INSERT_COMMIT_TRANSACTION =
- "insert into osee_tx_details(tx_type, branch_id, transaction_id, osee_comment, time, author, commit_art_id) values(?,?,?,?,?,?,?)";
-
- private static final String ARTIFACT_CHANGES =
- "SELECT av.art_id, txs1.branch_id FROM osee_txs txs1, osee_artifact_version av WHERE txs1.branch_id = ? AND txs1.transaction_id = ? AND txs1.gamma_id = av.gamma_id UNION ALL SELECT art.art_id, txs2.branch_id FROM osee_txs txs2, osee_relation_link rel, osee_artifact art WHERE txs2.branch_id = ? and txs2.transaction_id = ? AND txs2.gamma_id = rel.gamma_id AND (rel.a_art_id = art.art_id OR rel.b_art_id = art.art_id) UNION ALL SELECT att.attr_id, txs3.branch_id FROM osee_txs txs3, osee_attribute att WHERE txs3.branch_id = ? AND txs3.transaction_id = ? AND txs3.gamma_id = att.gamma_id";
-
- private static final String INSERT_COMMIT_ADDRESSING =
- "insert into osee_txs(transaction_id, gamma_id, mod_type, tx_current) values(?,?,?,?)";
-
- private static final String UPDATE_CONFLICT_STATUS =
- "UPDATE osee_conflict SET status = ? WHERE status = ? AND merge_branch_id = ?";
-
- private static final String UPDATE_MERGE_COMMIT_TX =
- "UPDATE osee_merge set commit_transaction_id = ? Where source_branch_id = ? and dest_branch_id = ?";
-
- private boolean success = true;
- private final Map<Branch, BranchState> savedBranchStates = new HashMap<Branch, BranchState>();
- private final Branch sourceBranch;
- private final Branch destinationBranch;
- private final Branch mergeBranch;
- private final List<ChangeItem> changes;
- private Integer newTransactionNumber;
- private OseeConnection connection;
-
- public CommitDbOperation(Branch sourceBranch, Branch destinationBranch, Branch mergeBranch, List<ChangeItem> changes) {
- super(null, "Commit Database Operation", Activator.PLUGIN_ID);
- this.sourceBranch = sourceBranch;
- this.destinationBranch = destinationBranch;
- this.mergeBranch = mergeBranch;
- this.changes = changes;
-
- savedBranchStates.put(sourceBranch, sourceBranch.getBranchState());
- savedBranchStates.put(destinationBranch, destinationBranch.getBranchState());
- }
-
- @Override
- protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
- this.connection = connection;
- if (changes.isEmpty()) {
- throw new OseeStateException(" A branch can not be commited without any changes made.");
- }
- newTransactionNumber = addCommitTransactionToDatabase(UserManager.getUser());
-
- AccessControlManager.removeAllPermissionsFromBranch(connection, sourceBranch);
-
- updatePreviousCurrentsOnDestinationBranch();
-
- insertCommitAddressing();
-
- updateMergeBranchCommitTx();
-
- manageBranchStates();
- }
-
- private void updateMergeBranchCommitTx() throws OseeDataStoreException {
- ConnectionHandler.runPreparedUpdate(connection, UPDATE_MERGE_COMMIT_TX, newTransactionNumber,
- sourceBranch.getId(), destinationBranch.getId());
- }
-
- private void updatePreviousCurrentsOnDestinationBranch() throws OseeStateException, OseeDataStoreException {
- UpdatePreviousTxCurrent updater = new UpdatePreviousTxCurrent(destinationBranch, connection);
- for (ChangeItem change : changes) {
- if (change instanceof ArtifactChangeItem) {
- updater.addArtifact(change.getItemId());
- } else if (change instanceof AttributeChangeItem) {
- updater.addAttribute(change.getItemId());
- } else if (change instanceof RelationChangeItem) {
- updater.addRelation(change.getItemId());
- } else {
- throw new OseeStateException("Unexpected change type");
- }
- }
- updater.updateTxNotCurrents();
- }
-
- @SuppressWarnings("unchecked")
- private int addCommitTransactionToDatabase(User userToBlame) throws OseeCoreException {
- int newTransactionNumber = SequenceManager.getNextTransactionId();
-
- Timestamp timestamp = GlobalTime.GreenwichMeanTimestamp();
- String comment = BranchManager.COMMIT_COMMENT + sourceBranch.getName();
- int authorId = userToBlame == null ? -1 : userToBlame.getArtId();
- ConnectionHandler.runPreparedUpdate(connection, INSERT_COMMIT_TRANSACTION,
- TransactionDetailsType.NonBaselined.getId(), destinationBranch.getId(), newTransactionNumber, comment,
- timestamp, authorId, sourceBranch.getAssociatedArtifact().getArtId());
-
- return newTransactionNumber;
- }
-
- private void insertCommitAddressing() throws OseeDataStoreException {
- List<Object[]> insertData = new ArrayList<Object[]>();
- for (ChangeItem change : changes) {
- ModificationType modType = change.getNetChange().getModType();
- insertData.add(new Object[] {newTransactionNumber, change.getNetChange().getGammaId(), modType.getValue(),
- TxChange.getCurrent(modType).getValue()});
- }
- ConnectionHandler.runBatchUpdate(connection, INSERT_COMMIT_ADDRESSING, insertData);
- }
-
- private void manageBranchStates() throws OseeCoreException {
- destinationBranch.setBranchState(BranchState.MODIFIED);
- BranchState sourceBranchState = sourceBranch.getBranchState();
- if (!sourceBranchState.isCreationInProgress() && !sourceBranchState.isRebaselined() && !sourceBranchState.isRebaselineInProgress() && !sourceBranchState.isCommitted()) {
- sourceBranch.setBranchState(BranchState.COMMITTED);
- }
- if (mergeBranch != null) {
- savedBranchStates.put(mergeBranch, mergeBranch.getBranchState());
- mergeBranch.setBranchState(BranchState.COMMITTED);
- BranchManager.persist(mergeBranch, destinationBranch, sourceBranch);
- } else {
- BranchManager.persist(destinationBranch, sourceBranch);
- }
- }
-
- @Override
- protected void handleTxException(IProgressMonitor monitor, Exception ex) {
- success = false;
- // Restore Original Branch States
- try {
- for (Entry<Branch, BranchState> entry : savedBranchStates.entrySet()) {
- entry.getKey().setBranchState(entry.getValue());
- }
- BranchManager.persist(savedBranchStates.keySet());
- } catch (OseeCoreException ex1) {
- OseeLog.log(Activator.class, Level.SEVERE, ex1);
- }
- }
-
- @Override
- protected void handleTxFinally(IProgressMonitor monitor) throws OseeCoreException {
- if (success) {
- // Update commit artifact cache with new information
- if (sourceBranch.getAssociatedArtifact().getArtId() > 0) {
- TransactionManager.cacheCommittedArtifactTransaction((IArtifact) sourceBranch.getAssociatedArtifact(),
- TransactionManager.getTransactionId(newTransactionNumber));
- }
-
- Object[] queryData =
- new Object[] {destinationBranch.getId(), newTransactionNumber, destinationBranch.getId(),
- newTransactionNumber, destinationBranch.getId(), newTransactionNumber};
- // reload the committed artifacts since the commit changed them on the destination branch
- ArtifactLoader.getArtifacts(ARTIFACT_CHANGES, queryData, 400, ArtifactLoad.FULL, true, null, true);
-
- // update conflict status, if necessary
- if (mergeBranch != null) {
- ConnectionHandler.runPreparedUpdate(connection, UPDATE_CONFLICT_STATUS,
- ConflictStatus.COMMITTED.getValue(), ConflictStatus.RESOLVED.getValue(), mergeBranch.getId());
- }
-
- OseeEventManager.kickBranchEvent(this, BranchEventType.Committed, sourceBranch.getId());
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/ComputeNetChangeOperation.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/ComputeNetChangeOperation.java
deleted file mode 100644
index be30e7937d9..00000000000
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/ComputeNetChangeOperation.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.commit;
-
-import java.util.Collection;
-import java.util.Iterator;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.data.ChangeItem;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ComputeNetChangeOperation extends AbstractOperation {
- private final Collection<ChangeItem> changes;
-
- public ComputeNetChangeOperation(Collection<ChangeItem> changes) {
- super("Compute Net Change", Activator.PLUGIN_ID);
- this.changes = changes;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- if (!changes.isEmpty()) {
- double workPercentage = 1.0 / changes.size();
-
- Iterator<ChangeItem> iterator = changes.iterator();
- while (iterator.hasNext()) {
- checkForCancelledStatus(monitor);
- ChangeItem change = iterator.next();
- if (ChangeItemUtil.isIgnoreCase(change)) {
- iterator.remove();
- } else {
- checkForInvalidStates(change);
-
- if (!ChangeItemUtil.isModType(change.getNetChange(), ModificationType.MERGED)) {
- ModificationType netModType = getNetModType(change);
- if (netModType == null) {
- throw new OseeStateException("Net Mod Type was null");
- }
- change.getNetChange().copy(change.getCurrentVersion());
- change.getNetChange().setModType(netModType);
- } else {
- if (ChangeItemUtil.isDeleted(change.getCurrentVersion())) {
- change.getNetChange().copy(change.getCurrentVersion());
- }
- }
- }
- monitor.worked(calculateWork(workPercentage));
- }
- } else {
- monitor.worked(calculateWork(1.0));
- }
- System.out.println("Commit change size: " + changes.size());
- }
-
- private ModificationType getNetModType(ChangeItem change) {
- ModificationType modificationType;
- modificationType = calculateNetWithDestinationBranch(change);
- return modificationType;
- }
-
- private ModificationType calculateNetWithDestinationBranch(ChangeItem change) {
- ModificationType netModType = change.getCurrentVersion().getModType();
- if (change.getDestinationVersion().isValid() && (change.getBaselineVersion().isValid() || change.getFirstNonCurrentChange().isValid())) {
- netModType = change.getCurrentVersion().getModType();
- } else if (ChangeItemUtil.wasNewOnSource(change)) {
- netModType = ModificationType.NEW;
- } else if (ChangeItemUtil.wasIntroducedOnSource(change)) {
- netModType = ModificationType.INTRODUCED;
- } else if (!change.getDestinationVersion().isValid()) {
- if (!change.getBaselineVersion().isValid()) {
- netModType = ModificationType.NEW;
- } else {
- // Case when committing into non-parent
- netModType = ModificationType.INTRODUCED;
- }
- }
- return netModType;
- }
-
- private void checkForInvalidStates(ChangeItem change) throws OseeCoreException {
- // check for case where destination branch is missing an artifact that was modified (not new) on the source branch
- if (!change.getDestinationVersion().isValid() && change.getBaselineVersion().isValid()) {
- throw new OseeStateException(
- "This should be supported in the future - destination branch is not the source's parent: " + change);
- }
-
- if (change.getDestinationVersion().isValid() && ChangeItemUtil.isDeleted(change.getDestinationVersion())) {
- throw new OseeStateException("Destination was deleted - source should not modify: " + change);
- }
-
- if ((ChangeItemUtil.isIntroduced(change.getCurrentVersion()) || ChangeItemUtil.isNew(change.getCurrentVersion())) //
- && change.getDestinationVersion().isValid()) {
- throw new OseeStateException(
- "Source item marked as new/introduced but destination already has item: " + change);
- }
-
- }
-}
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/LoadChangeDataOperation.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/LoadChangeDataOperation.java
deleted file mode 100644
index 5275dd47225..00000000000
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/LoadChangeDataOperation.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.commit;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.data.ChangeItem;
-import org.eclipse.osee.framework.core.data.ChangeVersion;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
-import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.database.core.JoinUtility;
-import org.eclipse.osee.framework.database.core.JoinUtility.IdJoinQuery;
-import org.eclipse.osee.framework.database.core.JoinUtility.TransactionJoinQuery;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-
-/**
- * @author Ryan D. Brooks
- * @author Roberto E. Escobar
- * @author Ryan Schmitt
- * @author Jeff C. Phillips
- */
-public class LoadChangeDataOperation extends AbstractOperation {
- private static final String SELECT_SOURCE_BRANCH_CHANGES =
- "select txs.transaction_id, gamma_id, mod_type from osee_tx_details txd, osee_txs txs where txd.branch_id = ? and txd.tx_type = ? and txd.transaction_id = txs.transaction_id and txd.branch_id = txs.branch_id and txs.tx_current <> ?";
-
- private static final String SELECT_SOURCE_TRANSACTION_CHANGES =
- "select transaction_id, gamma_id, mod_type from osee_txs where branch_id = ? and transaction_id = ?";
-
- private final HashMap<Integer, ChangeItem> artifactChangesByItemId = new HashMap<Integer, ChangeItem>();
- private final HashMap<Integer, ChangeItem> relationChangesByItemId = new HashMap<Integer, ChangeItem>();
- private final HashMap<Integer, ChangeItem> attributeChangesByItemId = new HashMap<Integer, ChangeItem>();
- private final HashMap<Long, Pair<Integer, ModificationType>> changeByGammaId =
- new HashMap<Long, Pair<Integer, ModificationType>>();
-
- private final Collection<ChangeItem> changeData;
- private final TransactionRecord sourceTransactionId;
- private final TransactionRecord destinationTransactionId;
- private final TransactionRecord mergeTransactionId;
- private final TransactionRecord transactionId;
-
- private static enum LoadingMode {
- FROM_SINGLE_TRANSACTION,
- FROM_ALL_BRANCH_TRANSACTIONS;
- }
-
- private final LoadingMode loadChangesEnum;
-
- public LoadChangeDataOperation(TransactionRecord transactionId, TransactionRecord destinationTransactionId, Collection<ChangeItem> changeData) {
- this(null, destinationTransactionId, null, changeData, transactionId, LoadingMode.FROM_SINGLE_TRANSACTION);
- }
-
- public LoadChangeDataOperation(TransactionRecord sourceBranch, TransactionRecord destinationBranch, TransactionRecord mergeBranch, Collection<ChangeItem> changeData) {
- this(sourceBranch, destinationBranch, mergeBranch, changeData, null, LoadingMode.FROM_ALL_BRANCH_TRANSACTIONS);
- }
-
- private LoadChangeDataOperation(TransactionRecord sourceTransactionId, TransactionRecord destinationTransactionId, TransactionRecord mergeTransactionId, Collection<ChangeItem> changeData, TransactionRecord transactionId, LoadingMode loadMode) {
- super("Load Change Data", Activator.PLUGIN_ID);
- this.mergeTransactionId = mergeTransactionId;
- this.sourceTransactionId = sourceTransactionId;
- this.destinationTransactionId = destinationTransactionId;
- this.changeData = changeData;
- this.loadChangesEnum = loadMode;
- this.transactionId = transactionId;
- }
-
- private int getSourceBranchId() {
- return sourceTransactionId.getBranchId();
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- TransactionJoinQuery txJoin = loadSourceBranchChanges(monitor);
- loadArtifactItemIdsBasedOnGammas(monitor, txJoin.getQueryId(), artifactChangesByItemId);
- loadAttributeItemIdsBasedOnGammas(monitor, txJoin.getQueryId(), attributeChangesByItemId);
- loadRelationItemIdsBasedOnGammas(monitor, txJoin.getQueryId(), relationChangesByItemId);
- txJoin.delete();
-
- loadByItemId(monitor, "osee_artifact_version", "art_id", artifactChangesByItemId, null);
- loadByItemId(monitor, "osee_attribute", "attr_id", attributeChangesByItemId, "value");
- loadByItemId(monitor, "osee_relation_link", "rel_link_id", relationChangesByItemId, "rationale");
-
- changeData.addAll(artifactChangesByItemId.values());
- changeData.addAll(attributeChangesByItemId.values());
- changeData.addAll(relationChangesByItemId.values());
- }
-
- private TransactionJoinQuery loadSourceBranchChanges(IProgressMonitor monitor) throws OseeCoreException {
- TransactionJoinQuery txJoin = JoinUtility.createTransactionJoinQuery();
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- Integer currentTransactionNumber;
-
- try {
- switch (loadChangesEnum) {
- case FROM_ALL_BRANCH_TRANSACTIONS:
- chStmt.runPreparedQuery(10000, SELECT_SOURCE_BRANCH_CHANGES, getSourceBranchId(),
- TransactionDetailsType.NonBaselined.getId(), TxChange.NOT_CURRENT.getValue());
- currentTransactionNumber = sourceTransactionId.getId();
- break;
- case FROM_SINGLE_TRANSACTION:
- chStmt.runPreparedQuery(10000, SELECT_SOURCE_TRANSACTION_CHANGES, transactionId.getBranchId(),
- transactionId.getId());
- currentTransactionNumber = transactionId.getId();
- break;
- default:
- throw new UnsupportedOperationException(String.format("Invalid load changes [%s] mode not supported",
- loadChangesEnum));
- }
-
- while (chStmt.next()) {
- checkForCancelledStatus(monitor);
- txJoin.add(chStmt.getLong("gamma_id"), -1);
- changeByGammaId.put(chStmt.getLong("gamma_id"), new Pair<Integer, ModificationType>(
- currentTransactionNumber, ModificationType.getMod(chStmt.getInt("mod_type"))));
- }
- txJoin.store();
- } finally {
- chStmt.close();
- }
- return txJoin;
- }
-
- private void loadArtifactItemIdsBasedOnGammas(IProgressMonitor monitor, int queryId, HashMap<Integer, ChangeItem> changesByItemId) throws OseeDataStoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- String query =
- "select art_id, txj.gamma_id from osee_artifact_version id, osee_join_transaction txj where id.gamma_id = txj.gamma_id and txj.query_id = ?";
-
- try {
- chStmt.runPreparedQuery(10000, query, queryId);
- while (chStmt.next()) {
- checkForCancelledStatus(monitor);
- Pair<Integer, ModificationType> txsTableData = changeByGammaId.get(chStmt.getLong("gamma_id"));
- ArtifactChangeItem changeItem =
- new ArtifactChangeItem(chStmt.getLong("gamma_id"), txsTableData.getSecond(), txsTableData.getFirst(),
- chStmt.getInt("art_id"));
- changesByItemId.put(changeItem.getItemId(), changeItem);
- }
- } finally {
- chStmt.close();
- }
- }
-
- private void loadAttributeItemIdsBasedOnGammas(IProgressMonitor monitor, int queryId, HashMap<Integer, ChangeItem> changesByItemId) throws OseeDataStoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- String query =
- "select art_id, attr_id, value, txj.gamma_id from osee_attribute id, osee_join_transaction txj where id.gamma_id = txj.gamma_id and txj.query_id = ?";
-
- try {
- chStmt.runPreparedQuery(10000, query, queryId);
- while (chStmt.next()) {
- checkForCancelledStatus(monitor);
- Pair<Integer, ModificationType> txsTableData = changeByGammaId.get(chStmt.getLong("gamma_id"));
- AttributeChangeItem changeItem =
- new AttributeChangeItem(chStmt.getLong("gamma_id"), txsTableData.getSecond(),
- txsTableData.getFirst(), chStmt.getInt("attr_id"), chStmt.getInt("art_id"),
- chStmt.getString("value"));
-
- changesByItemId.put(changeItem.getItemId(), changeItem);
- }
- } finally {
- chStmt.close();
- }
- }
-
- private void loadRelationItemIdsBasedOnGammas(IProgressMonitor monitor, int queryId, HashMap<Integer, ChangeItem> changesByItemId) throws OseeDataStoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- String query =
- "select a_art_id, b_art_id, rel_link_id, rel_link_type_id, rationale, txj.gamma_id from osee_relation_link id, osee_join_transaction txj where id.gamma_id = txj.gamma_id and txj.query_id = ?";
-
- try {
- chStmt.runPreparedQuery(10000, query, queryId);
- while (chStmt.next()) {
- checkForCancelledStatus(monitor);
- Pair<Integer, ModificationType> txsTableData = changeByGammaId.get(chStmt.getLong("gamma_id"));
- RelationChangeItem changeItem =
- new RelationChangeItem(chStmt.getLong("gamma_id"), txsTableData.getSecond(), txsTableData.getFirst(),
- chStmt.getInt("a_art_id"), chStmt.getInt("b_art_id"), chStmt.getInt("rel_link_id"),
- chStmt.getInt("rel_link_type_id"), chStmt.getString("rationale"));
-
- changesByItemId.put(changeItem.getItemId(), changeItem);
- }
- } finally {
- chStmt.close();
- }
- }
-
- private void loadByItemId(IProgressMonitor monitor, String tableName, String columnName, HashMap<Integer, ChangeItem> changesByItemId, String columnValueName) throws OseeCoreException {
- IdJoinQuery idJoin = JoinUtility.createIdJoinQuery();
- for (Entry<Integer, ChangeItem> entry : changesByItemId.entrySet()) {
- idJoin.add(entry.getKey());
- }
- idJoin.store();
-
- if (hasMergeBranch()) {
- loadCurrentData(monitor, tableName, columnName, idJoin, mergeTransactionId, changesByItemId);
- }
-
- if (hasDestinationBranch()) {
- loadCurrentData(monitor, tableName, columnName, idJoin, destinationTransactionId, changesByItemId);
- }
-
- if (hasSourceBranch()) {
- loadNonCurrentSourceData(monitor, tableName, columnName, idJoin, changesByItemId, columnValueName);
- }
-
- idJoin.delete();
- }
-
- private boolean hasMergeBranch() {
- return mergeTransactionId != null;
- }
-
- private boolean hasDestinationBranch() {
- return destinationTransactionId != null;
- }
-
- private boolean hasSourceBranch() {
- return sourceTransactionId != null;
- }
-
- private void loadCurrentData(IProgressMonitor monitor, String tableName, String columnName, IdJoinQuery idJoin, TransactionRecord destinationTransaction, HashMap<Integer, ChangeItem> changesByItemId) throws OseeCoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- String query;
-
- try {
- switch (loadChangesEnum) {
- case FROM_ALL_BRANCH_TRANSACTIONS:
- query =
- "select txs.transaction_id, txs.gamma_id, txs.mod_type, item." + columnName + " from osee_join_id idj, " //
- + tableName + " item, osee_txs txs, osee_tx_details txd where idj.query_id = ? and idj.id = item." + columnName + //
- " and item.gamma_id = txs.gamma_id and txs.tx_current <> ? and txs.transaction_id = txd.transaction_id and txd.branch_id = ? and txd.transaction_id <= ?";
-
- chStmt.runPreparedQuery(10000, query, idJoin.getQueryId(), TxChange.NOT_CURRENT.getValue(),
- destinationTransaction.getBranch().getId(), destinationTransaction.getId());
- break;
- case FROM_SINGLE_TRANSACTION:
- query =
- "select txs.transaction_id, txs.gamma_id, txs.mod_type, item." + columnName + " from osee_join_id idj, " //
- + tableName + " item, osee_txs txs, osee_tx_details txd where idj.query_id = ? and idj.id = item." + columnName + //
- " and item.gamma_id = txs.gamma_id and txs.transaction_id = txd.transaction_id and txd.branch_id = ? and txd.transaction_id <= ?";
-
- chStmt.runPreparedQuery(10000, query, idJoin.getQueryId(), destinationTransaction.getBranchId(),
- destinationTransaction.getId());
- break;
- default:
- throw new UnsupportedOperationException(String.format("Invalid load changes [%s] mode not supported",
- loadChangesEnum));
- }
-
- while (chStmt.next()) {
- checkForCancelledStatus(monitor);
- int itemId = chStmt.getInt(columnName);
-
- Long gammaId = chStmt.getLong("gamma_id");
- Integer transactionId = chStmt.getInt("transaction_id");
- ChangeItem change = changesByItemId.get(itemId);
-
- if (destinationTransaction.getBranch().getBranchType().isMergeBranch()) {
- change.getNetChange().setTransactionNumber(transactionId);
- change.getNetChange().setGammaId(gammaId);
- change.getNetChange().setModType(ModificationType.MERGED);
- } else {
- change.getDestinationVersion().setModType(ModificationType.getMod(chStmt.getInt("mod_type")));
- change.getDestinationVersion().setGammaId(gammaId);
- change.getDestinationVersion().setTransactionNumber(transactionId);
- }
- }
- } finally {
- chStmt.close();
- }
- }
-
- private void loadNonCurrentSourceData(IProgressMonitor monitor, String tableName, String columnName, IdJoinQuery idJoin, HashMap<Integer, ChangeItem> changesByItemId, String columnValueName) throws OseeCoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- String query;
-
- try {
- query =
- "select " + (columnValueName != null ? "item." + columnValueName + ", item." + columnName : "item." + columnName) + ", txs.gamma_id, txs.mod_type, txd.tx_type, txs.transaction_id from osee_join_id idj, " //
- + tableName + " item, osee_txs txs, osee_tx_details txd where idj.query_id = ? and idj.id = item." + columnName + //
- " and item.gamma_id = txs.gamma_id and txs.tx_current = ? and txs.transaction_id = txd.transaction_id and txd.branch_id = ? order by idj.id, txs.transaction_id asc";
-
- chStmt.runPreparedQuery(10000, query, idJoin.getQueryId(), TxChange.NOT_CURRENT.getValue(),
- getSourceBranchId());
-
- int previousItemId = -1;
- boolean isFirstSet = false;
- while (chStmt.next()) {
- checkForCancelledStatus(monitor);
-
- int itemId = chStmt.getInt(columnName);
- boolean isBaseline =
- TransactionDetailsType.toEnum(chStmt.getInt("tx_type")) == TransactionDetailsType.Baselined;
- ChangeItem change = changesByItemId.get(itemId);
-
- if (previousItemId != itemId) {
- isFirstSet = false;
- }
-
- if (isBaseline) {
- loadVersionData(chStmt, change.getBaselineVersion(), columnValueName);
- } else if (!isFirstSet) {
- loadVersionData(chStmt, change.getFirstNonCurrentChange(), columnValueName);
- isFirstSet = true;
- }
-
- previousItemId = itemId;
- }
- } finally {
- chStmt.close();
- }
- }
-
- private void loadVersionData(IOseeStatement chStmt, ChangeVersion versionedChange, String columnValueName) throws OseeArgumentException, OseeDataStoreException {
- //Tolerates the case of having more than one version of an item on a baseline transaction by picking the most recent one
- if (versionedChange.getGammaId() == null || versionedChange.getGammaId() < chStmt.getLong("gamma_id")) {
- if (columnValueName != null) {
- versionedChange.setValue(chStmt.getString(columnValueName));
- }
-
- versionedChange.setModType(ModificationType.getMod(chStmt.getInt("mod_type")));
- versionedChange.setGammaId(chStmt.getLong("gamma_id"));
- versionedChange.setTransactionNumber(chStmt.getInt("transaction_id"));
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/RelationChangeItem.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/RelationChangeItem.java
deleted file mode 100644
index 0bf1b5ec387..00000000000
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/RelationChangeItem.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.commit;
-
-import org.eclipse.osee.framework.core.data.ChangeItem;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-
-/**
- * @author Jeff C. Phillips
- */
-public class RelationChangeItem extends ChangeItem {
- private final int bArtId;
- private final int relTypeId;
- private final String rationale;
-
- public RelationChangeItem(long currentSourceGammaId, ModificationType currentSourceModType, int currentSourceTansactionNumber, int aArtId, int bArtId, int relLinkId, int relTypeId, String rationale) {
- super(currentSourceGammaId, currentSourceModType, currentSourceTansactionNumber);
-
- this.setItemId(relLinkId);
- this.getCurrentVersion().setValue(rationale);
- this.setArtId(aArtId);
-
- this.bArtId = bArtId;
- this.relTypeId = relTypeId;
- this.rationale = rationale;
- }
-
- public int getBArtId() {
- return bArtId;
- }
-
- public int getRelTypeId() {
- return relTypeId;
- }
-
- public String getRationale() {
- return rationale;
- }
-}
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/UpdatePreviousTxCurrent.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/UpdatePreviousTxCurrent.java
deleted file mode 100644
index ac4188b995d..00000000000
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/UpdatePreviousTxCurrent.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.osee.framework.skynet.core.commit;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.database.core.JoinUtility;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.database.core.JoinUtility.IdJoinQuery;
-
-/**
- * @author Ryan D. Brooks
- */
-public class UpdatePreviousTxCurrent {
- private final Branch branch;
- private final OseeConnection connection;
- private final IdJoinQuery artifactJoin = JoinUtility.createIdJoinQuery();
- private final IdJoinQuery attributeJoin = JoinUtility.createIdJoinQuery();
- private final IdJoinQuery relationJoin = JoinUtility.createIdJoinQuery();
- private static final String UPDATE_TXS_NOT_CURRENT =
- "update osee_txs SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " where transaction_id = ? AND gamma_id = ?";
-
- public UpdatePreviousTxCurrent(Branch branch, OseeConnection connection) {
- this.branch = branch;
- this.connection = connection;
- }
-
- public void addAttribute(int attributeId) {
- attributeJoin.add(attributeId);
- }
-
- public void addArtifact(int artifactId) {
- artifactJoin.add(artifactId);
- }
-
- public void addRelation(int relationId) {
- relationJoin.add(relationId);
- }
-
- public void updateTxNotCurrents() throws OseeDataStoreException {
- updateTxNotCurrents("osee_artifact_version", "art_id", artifactJoin);
- updateTxNotCurrents("osee_attribute", "attr_id", attributeJoin);
- updateTxNotCurrents("osee_relation_link", "rel_link_id", relationJoin);
- }
-
- private void updateTxNotCurrents(String tableName, String columnName, IdJoinQuery idJoin) throws OseeDataStoreException {
- idJoin.store(connection);
- updateNoLongerCurrentGammas(tableName, columnName, idJoin.getQueryId());
- idJoin.delete(connection);
- }
-
- private void updateNoLongerCurrentGammas(String tableName, String columnName, int queryId) throws OseeDataStoreException {
- List<Object[]> gammaTxPairs = new ArrayList<Object[]>();
- IOseeStatement chStmt = ConnectionHandler.getStatement(connection);
- String query =
- "SELECT txs.transaction_id, txs.gamma_id FROM osee_join_id idj, " + tableName + " item, osee_txs txs, osee_tx_details txd WHERE idj.query_id = ? and idj.id = item." + columnName + " AND item.gamma_id = txs.gamma_id AND txs.transaction_id = txd.transaction_id AND txd.branch_id = ?";
-
- try {
- chStmt.runPreparedQuery(10000, query, queryId, branch.getId());
- while (chStmt.next()) {
- gammaTxPairs.add(new Object[] {chStmt.getInt("transaction_id"), chStmt.getLong("gamma_id")});
- }
- } finally {
- chStmt.close();
- }
-
- ConnectionHandler.runBatchUpdate(connection, UPDATE_TXS_NOT_CURRENT, gammaTxPairs);
- }
-}
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java
index ce249a41ad5..9924963db12 100644
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java
+++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java
@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import org.eclipse.osee.framework.core.client.ClientSessionManager;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.services.IDataTranslationService;
@@ -22,8 +23,6 @@ import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
import org.eclipse.osee.framework.skynet.core.attribute.HttpAttributeTagger;
import org.eclipse.osee.framework.skynet.core.event.RemoteEventManager;
-import org.eclipse.osee.framework.skynet.core.serverCommit.CommitService;
-import org.eclipse.osee.framework.skynet.core.serverCommit.ICommitService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
@@ -60,10 +59,8 @@ public class Activator implements BundleActivator, IOseeModelFactoryServiceProvi
IOseeCachingService cachingService = new ClientCachingServiceFactory().createService(this);
createService(context, IOseeCachingService.class, cachingService);
- createService(context, ICommitService.class, new CommitService());
createServiceTracker(context, IOseeCachingService.class, TrackerId.OSEE_CACHING_SERVICE);
- createServiceTracker(context, ICommitService.class, TrackerId.COMMIT_SERVICE);
createServiceTracker(context, IDataTranslationService.class, TrackerId.TRANSLATION_SERVICE);
createServiceTracker(context, IOseeModelFactoryService.class, TrackerId.OSEE_FACTORY_SERVICE);
}
@@ -94,10 +91,6 @@ public class Activator implements BundleActivator, IOseeModelFactoryServiceProvi
return getTracker(TrackerId.OSEE_CACHING_SERVICE, IOseeCachingService.class);
}
- public ICommitService getCommitBranchService() {
- return getTracker(TrackerId.COMMIT_SERVICE, ICommitService.class);
- }
-
public IDataTranslationService getTranslationService() {
return getTracker(TrackerId.TRANSLATION_SERVICE, IDataTranslationService.class);
}
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeReportDataLoader.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeReportDataLoader.java
index d8fecf8effa..ced71e0a643 100644
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeReportDataLoader.java
+++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeReportDataLoader.java
@@ -1,8 +1,13 @@
-/*
- * Created on Nov 9, 2009
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 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
*
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
package org.eclipse.osee.framework.skynet.core.revision;
import java.sql.Timestamp;
@@ -13,22 +18,27 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
+
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.data.ArtifactChangeItem;
+import org.eclipse.osee.framework.core.data.AttributeChangeItem;
import org.eclipse.osee.framework.core.data.ChangeItem;
+import org.eclipse.osee.framework.core.data.ChangeReportResponse;
import org.eclipse.osee.framework.core.data.ChangeVersion;
+import org.eclipse.osee.framework.core.data.RelationChangeItem;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeWrappedException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.operation.CompositeOperation;
import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.core.util.ChangeItemUtil;
import org.eclipse.osee.framework.database.core.SQL3DataType;
import org.eclipse.osee.framework.jdk.core.util.time.GlobalTime;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactLoad;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactLoader;
+import org.eclipse.osee.framework.skynet.core.artifact.HttpChangeDataRequester;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.eclipse.osee.framework.skynet.core.change.ArtifactChange;
import org.eclipse.osee.framework.skynet.core.change.AttributeChange;
@@ -36,13 +46,6 @@ import org.eclipse.osee.framework.skynet.core.change.Change;
import org.eclipse.osee.framework.skynet.core.change.ChangeType;
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.commit.ArtifactChangeItem;
-import org.eclipse.osee.framework.skynet.core.commit.AttributeChangeItem;
-import org.eclipse.osee.framework.skynet.core.commit.ChangeItemUtil;
-import org.eclipse.osee.framework.skynet.core.commit.ComputeNetChangeOperation;
-import org.eclipse.osee.framework.skynet.core.commit.LoadChangeDataOperation;
-import org.eclipse.osee.framework.skynet.core.commit.RelationChangeItem;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager;
import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
@@ -184,29 +187,33 @@ public class ChangeReportDataLoader {
if (isHistorical) {
destinationTransactionId = TransactionManager.getPriorTransaction(transactionId);
sourceTransactionId = transactionId;
- ops.add(new LoadChangeDataOperation(sourceTransactionId, destinationTransactionId, changeItems));
+// ops.add(new LoadChangeDataOperation(sourceTransactionId, destinationTransactionId, changeItems));
} else {
destinationTransactionId = TransactionManager.getLastTransaction(sourceBranch.getParentBranch());
sourceTransactionId = TransactionManager.getLastTransaction(sourceBranch);
- ops.add(new LoadChangeDataOperation(sourceTransactionId, destinationTransactionId, null, changeItems));
+// ops.add(new LoadChangeDataOperation(sourceTransactionId, destinationTransactionId, null, changeItems));
}
- ops.add(new ComputeNetChangeOperation(changeItems));
-
- String opName =
- String.format("Gathering changes for %s",
- sourceBranch != null ? sourceBranch.getShortName() : transactionId);
- IOperation op = new CompositeOperation(opName, Activator.PLUGIN_ID, ops);
- Operations.executeWork(op, monitor, -1);
- try {
- Operations.checkForErrorStatus(op.getStatus());
- } catch (Exception ex) {
- if (ex instanceof OseeCoreException) {
- throw (OseeCoreException) ex;
- } else {
- throw new OseeWrappedException(ex);
- }
- }
- return changeItems;
+ ChangeReportResponse response = HttpChangeDataRequester.getChanges(sourceTransactionId, destinationTransactionId, monitor, isHistorical);
+// System.out.println(response.getChangeItems().size());
+//
+//
+// ops.add(new ComputeNetChangeOperation(changeItems));
+//
+// String opName =
+// String.format("Gathering changes for %s",
+// sourceBranch != null ? sourceBranch.getShortName() : transactionId);
+// IOperation op = new CompositeOperation(opName, Activator.PLUGIN_ID, ops);
+// Operations.executeWork(op, monitor, -1);
+// try {
+// Operations.checkForErrorStatus(op.getStatus());
+// } catch (Exception ex) {
+// if (ex instanceof OseeCoreException) {
+// throw (OseeCoreException) ex;
+// } else {
+// throw new OseeWrappedException(ex);
+// }
+// }
+ return response.getChangeItems();
}
}
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/CommitService.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/CommitService.java
deleted file mode 100644
index 6d77526d6b2..00000000000
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/CommitService.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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.serverCommit;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.data.ChangeItem;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.operation.CompositeOperation;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.commit.CommitDbOperation;
-import org.eclipse.osee.framework.skynet.core.commit.ComputeNetChangeOperation;
-import org.eclipse.osee.framework.skynet.core.commit.LoadChangeDataOperation;
-import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
-
-/**
- * @author Jeff C. Phillips
- * @author Ryan D. Brooks
- * @author Roberto E. Escobar
- */
-public class CommitService implements ICommitService {
-
- @Override
- public void commitBranch(IProgressMonitor monitor, ConflictManagerExternal conflictManager, boolean archiveSourceBranch) throws OseeCoreException {
- Branch sourceBranch = conflictManager.getSourceBranch();
- Branch destinationBranch = conflictManager.getDestinationBranch();
- Branch mergeBranch = BranchManager.getMergeBranch(sourceBranch, destinationBranch);
-
- List<ChangeItem> changes = new ArrayList<ChangeItem>();
- TransactionRecord sourceHeadTransaction =
- sourceBranch != null ? TransactionManager.getLastTransaction(sourceBranch) : null;
- TransactionRecord deatinationHeadTransaction =
- destinationBranch != null ? TransactionManager.getLastTransaction(destinationBranch) : null;
- TransactionRecord mergeHeadTransaction =
- mergeBranch != null ? TransactionManager.getLastTransaction(mergeBranch) : null;
-
- List<IOperation> ops = new ArrayList<IOperation>();
- ops.add(new LoadChangeDataOperation(sourceHeadTransaction, deatinationHeadTransaction, mergeHeadTransaction,
- changes));
- ops.add(new ComputeNetChangeOperation(changes));
- ops.add(new CommitDbOperation(sourceBranch, destinationBranch, mergeBranch, changes));
-
- String opName =
- String.format("Commit: [%s]->[%s]", sourceBranch.getShortName(), destinationBranch.getShortName());
- IOperation op = new CompositeOperation(opName, Activator.PLUGIN_ID, ops);
- Operations.executeWorkAndCheckStatus(op, monitor, -1);
- if (archiveSourceBranch) {
- sourceBranch.setArchived(true);
- BranchManager.persist(sourceBranch);
- }
- }
-}
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/ICommitService.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/ICommitService.java
deleted file mode 100644
index 1be7eb2deac..00000000000
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/serverCommit/ICommitService.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Created on Jul 31, 2009
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.framework.skynet.core.serverCommit;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
-
-/**
- * @author Jeff C. Phillips
- */
-public interface ICommitService {
-
- public void commitBranch(IProgressMonitor monitor, ConflictManagerExternal conflictManager, boolean archiveSourceBranch) throws OseeCoreException;
-}

Back to the top