From 8e007bece42017addb8083069790a2782663f2d7 Mon Sep 17 00:00:00 2001 From: rescobar Date: Fri, 4 Feb 2011 16:09:02 -0700 Subject: refactor: Update ArtifactConflict to use ModificationType objects --- .../skynet/core/conflict/ArtifactConflict.java | 25 ++++++++-------------- .../core/conflict/ArtifactConflictBuilder.java | 7 +++--- .../core/revision/ConflictManagerInternal.java | 9 ++++---- 3 files changed, 18 insertions(+), 23 deletions(-) (limited to 'plugins/org.eclipse.osee.framework.skynet.core') diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ArtifactConflict.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ArtifactConflict.java index d2f21091df4..a16f4216451 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ArtifactConflict.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ArtifactConflict.java @@ -26,16 +26,18 @@ public class ArtifactConflict extends Conflict { private static final String CHANGE_ITEM = "Artifact State"; private static final String ARTIFACT_DELETED = "DELETED"; private static final String ARTIFACT_MODIFIED = "MODIFIED"; - private final boolean sourceDeleted; + private final ModificationType sourceModType; + private final ModificationType destModType; - public ArtifactConflict(int sourceGamma, int destGamma, int artId, TransactionRecord toTransactionId, Branch mergeBranch, Branch sourceBranch, Branch destBranch, int sourceModType, int destModType, int artTypeId) { + public ArtifactConflict(int sourceGamma, int destGamma, int artId, TransactionRecord toTransactionId, Branch mergeBranch, Branch sourceBranch, Branch destBranch, ModificationType sourceModType, ModificationType destModType, int artTypeId) { super(sourceGamma, destGamma, artId, toTransactionId, null, mergeBranch, sourceBranch, destBranch); - sourceDeleted = sourceModType == ModificationType.DELETED.getValue(); + this.sourceModType = sourceModType; + this.destModType = destModType; } @Override public String getArtifactName() throws OseeCoreException { - if (sourceDeleted) { + if (sourceModType.isDeleted()) { return getDestArtifact().getName(); } else { return getSourceArtifact().getName(); @@ -63,12 +65,11 @@ public class ArtifactConflict extends Conflict { @Override public ConflictStatus computeStatus() throws OseeCoreException { - if (!sourceDeleted) { + if (!sourceModType.isDeleted()) { return super.computeStatus(getObjectId(), ConflictStatus.NOT_RESOLVABLE); } else { return super.computeStatus(getObjectId(), ConflictStatus.INFORMATIONAL); } - } @Override @@ -88,11 +89,7 @@ public class ArtifactConflict extends Conflict { @Override public String getDestDisplayData() { - if (sourceDeleted) { - return ARTIFACT_MODIFIED; - } else { - return ARTIFACT_DELETED; - } + return sourceModType.isDeleted() ? ARTIFACT_DELETED : ARTIFACT_MODIFIED; } @Override @@ -106,11 +103,7 @@ public class ArtifactConflict extends Conflict { @Override public String getSourceDisplayData() { - if (sourceDeleted) { - return ARTIFACT_DELETED; - } else { - return ARTIFACT_MODIFIED; - } + return sourceModType.isDeleted() ? ARTIFACT_DELETED : ARTIFACT_MODIFIED; } @Override diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ArtifactConflictBuilder.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ArtifactConflictBuilder.java index 9de1b382943..1a067bfd6d1 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ArtifactConflictBuilder.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ArtifactConflictBuilder.java @@ -12,6 +12,7 @@ package org.eclipse.osee.framework.skynet.core.conflict; import java.util.Set; +import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.TransactionRecord; @@ -19,11 +20,11 @@ import org.eclipse.osee.framework.core.model.TransactionRecord; * @author Theron Virgin */ public class ArtifactConflictBuilder extends ConflictBuilder { - private final int sourceModType; - private final int destModType; + private final ModificationType sourceModType; + private final ModificationType destModType; private final int artTypeId; - public ArtifactConflictBuilder(int sourceGamma, int destGamma, int artId, TransactionRecord toTransactionId, Branch sourceBranch, Branch destBranch, int sourceModType, int destModType, int artTypeId) { + public ArtifactConflictBuilder(int sourceGamma, int destGamma, int artId, TransactionRecord toTransactionId, Branch sourceBranch, Branch destBranch, ModificationType sourceModType, ModificationType destModType, int artTypeId) { super(sourceGamma, destGamma, artId, toTransactionId, sourceBranch, destBranch); this.artTypeId = artTypeId; this.sourceModType = sourceModType; 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 92f8ef8a733..cac97d823e8 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 @@ -193,14 +193,15 @@ public class ConflictManagerInternal { int nextArtId = chStmt.getInt("art_id"); int sourceGamma = chStmt.getInt("source_gamma"); int destGamma = chStmt.getInt("dest_gamma"); - int sourceModType = chStmt.getInt("source_mod_type"); - int destModType = chStmt.getInt("dest_mod_type"); + ModificationType sourceModType = ModificationType.getMod(chStmt.getInt("source_mod_type")); + ModificationType destModType = ModificationType.getMod(chStmt.getInt("dest_mod_type")); int artTypeId = chStmt.getInt("art_type_id"); if (artId != nextArtId) { artId = nextArtId; - if (destModType == ModificationType.DELETED.getValue() && sourceModType == ModificationType.MODIFIED.getValue() || destModType == ModificationType.MODIFIED.getValue() && sourceModType == ModificationType.DELETED.getValue()) { + if (destModType == ModificationType.DELETED && sourceModType == ModificationType.MODIFIED || // + destModType == ModificationType.MODIFIED && sourceModType == ModificationType.DELETED) { artifactConflictBuilder = new ArtifactConflictBuilder(sourceGamma, destGamma, artId, baselineTransaction, sourceBranch, @@ -208,7 +209,7 @@ public class ConflictManagerInternal { conflictBuilders.add(artifactConflictBuilder); artIdSet.add(artId); - } else if (destModType == ModificationType.DELETED.getValue() && sourceModType == ModificationType.DELETED.getValue()) { + } else if (destModType == ModificationType.DELETED && sourceModType == ModificationType.DELETED) { artIdSetDontShow.add(artId); artIdSetDontAdd.add(artId); } -- cgit v1.2.3