Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2017-02-03 14:12:31 -0500
committerRyan D. Brooks2017-08-01 12:33:28 -0400
commit1ece99b5705478bd9dfe1cdf60c7308fe5298c39 (patch)
treef24d0b6011adbd04970c83688ded68ae1236c8a9
parent41442a4322fe2d68171b6f8a2d56c6aab8106678 (diff)
downloadorg.eclipse.osee-1ece99b5705478bd9dfe1cdf60c7308fe5298c39.tar.gz
org.eclipse.osee-1ece99b5705478bd9dfe1cdf60c7308fe5298c39.tar.xz
org.eclipse.osee-1ece99b5705478bd9dfe1cdf60c7308fe5298c39.zip
refactor: Use AttributeTypeId with attribute conflict
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflict.java30
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflictBuilder.java7
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditAttributeWizardPage.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java2
6 files changed, 25 insertions, 26 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java
index e86dd2bf78..a537425a48 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java
@@ -20,7 +20,6 @@ import java.util.Set;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.data.BranchId;
-import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist;
import org.eclipse.osee.framework.core.model.OseeEnumEntry;
import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache;
@@ -187,4 +186,8 @@ public class AttributeTypeManager {
return removalAllowed || !notAllowed;
}
+
+ public static String getName(AttributeTypeId type) {
+ return getCache().get(type).getName();
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflict.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflict.java
index 4b3c02c8dc..45b2a8a453 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflict.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflict.java
@@ -19,6 +19,7 @@ import java.util.logging.Level;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.AttributeId;
+import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.TransactionToken;
@@ -27,7 +28,6 @@ import org.eclipse.osee.framework.core.enums.ConflictType;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.core.exception.AttributeDoesNotExist;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
@@ -56,20 +56,21 @@ public class AttributeConflict extends Conflict {
public final static String DIFF_MERGE_MARKUP =
"Can not run a diff against an attribute that has merge markup. Finish merging the document to be able to resolve the conflict.";
private final AttributeId attrId;
- private final long attrTypeId;
private Object sourceObject;
private Object destObject;
- private AttributeType attributeType;
+ private final AttributeTypeId attributeType;
private boolean mergeEqualsSource;
private boolean mergeEqualsDest;
private boolean sourceEqualsDest;
private static final boolean DEBUG =
"TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.ui.skynet/debug/Merge"));
- public AttributeConflict(int sourceGamma, int destGamma, ArtifactId artId, TransactionToken toTransactionId, TransactionToken commitTransaction, String sourceValue, AttributeId attrId, long attrTypeId, BranchId mergeBranch, IOseeBranch sourceBranch, IOseeBranch destBranch) throws OseeCoreException {
+ private String changeItemName;
+
+ public AttributeConflict(int sourceGamma, int destGamma, ArtifactId artId, TransactionToken toTransactionId, TransactionToken commitTransaction, String sourceValue, AttributeId attrId, AttributeTypeId attributeType, BranchId mergeBranch, IOseeBranch sourceBranch, IOseeBranch destBranch) throws OseeCoreException {
super(sourceGamma, destGamma, artId, toTransactionId, commitTransaction, mergeBranch, sourceBranch, destBranch);
this.attrId = attrId;
- this.attrTypeId = attrTypeId;
+ this.attributeType = attributeType;
this.status = ConflictStatus.EDITED;
computeEqualsValues();
}
@@ -109,13 +110,7 @@ public class AttributeConflict extends Conflict {
return attribute;
}
- /**
- * @return the attributeType
- */
- public AttributeType getAttributeType() throws OseeCoreException {
- if (attributeType == null) {
- attributeType = AttributeTypeManager.getTypeByGuid(attrTypeId);
- }
+ public AttributeTypeId getAttributeType() {
return attributeType;
}
@@ -167,10 +162,6 @@ public class AttributeConflict extends Conflict {
return attrId;
}
- public long getTypeId() {
- return attrTypeId;
- }
-
@Override
public String getDestDisplayData() throws OseeCoreException {
String displayValue =
@@ -388,8 +379,11 @@ public class AttributeConflict extends Conflict {
}
@Override
- public String getChangeItem() throws OseeCoreException {
- return getAttributeType().getName();
+ public String getChangeItem() {
+ if (changeItemName == null) {
+ changeItemName = AttributeTypeManager.getName(attributeType);
+ }
+ return changeItemName;
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflictBuilder.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflictBuilder.java
index 70d98ff140..650ebc9d2a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflictBuilder.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflictBuilder.java
@@ -14,6 +14,7 @@ package org.eclipse.osee.framework.skynet.core.conflict;
import java.util.Set;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.AttributeId;
+import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.TransactionToken;
@@ -32,9 +33,9 @@ public class AttributeConflictBuilder extends ConflictBuilder {
private final String sourceValue;
private final AttributeId attrId;
- private final long attrTypeId;
+ private final AttributeTypeId attrTypeId;
- public AttributeConflictBuilder(int sourceGamma, int destGamma, ArtifactId artId, TransactionToken toTransactionId, IOseeBranch sourceBranch, IOseeBranch destBranch, String sourceValue, AttributeId attrId, long attrTypeId) {
+ public AttributeConflictBuilder(int sourceGamma, int destGamma, ArtifactId artId, TransactionToken toTransactionId, IOseeBranch sourceBranch, IOseeBranch destBranch, String sourceValue, AttributeId attrId, AttributeTypeId attrTypeId) {
super(sourceGamma, destGamma, artId, toTransactionId, sourceBranch, destBranch);
this.sourceValue = sourceValue;
this.attrId = attrId;
@@ -50,7 +51,7 @@ public class AttributeConflictBuilder extends ConflictBuilder {
}
AttributeConflict attributeConflict = new AttributeConflict(sourceGamma, destGamma, artId, toTransactionId, null,
sourceValue, attrId, attrTypeId, mergeBranch, sourceBranch, destBranch);
- if (attributeConflict.getChangeItem().toString().equals("Word Ole Data")) {
+ if (attributeConflict.getAttributeType().equals(CoreAttributeTypes.WordOleData)) {
return null;
} else if (attributeConflict.getAttributeType().equals(CoreAttributeTypes.RelationOrder)) {
Artifact left = attributeConflict.getSourceArtifact();
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java
index 07e0dd5120..ce5b46b0a5 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java
@@ -112,7 +112,8 @@ public class ConflictManagerInternal {
AttributeConflict attributeConflict = new AttributeConflict(chStmt.getInt("source_gamma_id"),
chStmt.getInt("dest_gamma_id"), ArtifactId.valueOf(chStmt.getLong("art_id")), null, commitTransaction,
chStmt.getString("source_value"), AttributeId.valueOf(chStmt.getInt("attr_id")),
- chStmt.getLong("attr_type_id"), BranchId.valueOf(chStmt.getLong("merge_branch_id")), sourceBranch,
+ AttributeTypeId.valueOf(chStmt.getLong("attr_type_id")),
+ BranchId.valueOf(chStmt.getLong("merge_branch_id")), sourceBranch,
BranchManager.getBranchToken(chStmt.getLong("dest_branch_id")));
attributeConflict.setStatus(ConflictStatus.valueOf(chStmt.getInt("status")));
conflicts.add(attributeConflict);
@@ -296,7 +297,7 @@ public class ConflictManagerInternal {
ArtifactId artId = ArtifactId.valueOf(chStmt.getLong("art_id"));
int sourceGamma = chStmt.getInt("source_gamma");
int destGamma = chStmt.getInt("dest_gamma");
- long attrTypeId = chStmt.getLong("attr_type_id");
+ AttributeTypeId attrTypeId = AttributeTypeId.valueOf(chStmt.getLong("attr_type_id"));
String sourceValue = chStmt.getString("source_value") != null ? chStmt.getString(
"source_value") : chStmt.getString("dest_value");
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditAttributeWizardPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditAttributeWizardPage.java
index ac2d04d002..84a1c76958 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditAttributeWizardPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditAttributeWizardPage.java
@@ -84,7 +84,7 @@ public class EditAttributeWizardPage extends WizardPage {
super(TITLE);
try {
this.conflict = conflict;
- changeType = conflict.getAttributeType().getName();
+ changeType = conflict.getChangeItem();
if (!conflict.isWordAttribute()) {
editor = EmbededAttributeEditorFactory.getEmbeddedEditor(conflict.getAttributeType(),
conflict.getSourceDisplayData(), Arrays.asList(conflict), true);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java
index c06a26857b..dd7f5ac047 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java
@@ -127,7 +127,7 @@ public class EditWFCAttributeWizardPage extends WizardPage {
try {
if (conflict != null) {
this.conflict = conflict;
- changeType = conflict.getAttributeType().getName();
+ changeType = conflict.getChangeItem();
}
} catch (Exception ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);

Back to the top