Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2014-09-26 19:41:16 +0000
committerRoberto E. Escobar2014-09-29 22:06:47 +0000
commitebce8e5a205dcf5890138e6d2e8f92e7e560260e (patch)
tree26341cf97c73a40dc6b33a27f09b056d4c1e3fd6 /plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core
parenta53850c34fe8e03790e8b5b89aa2b1d6c9e48273 (diff)
downloadorg.eclipse.osee-ebce8e5a205dcf5890138e6d2e8f92e7e560260e.tar.gz
org.eclipse.osee-ebce8e5a205dcf5890138e6d2e8f92e7e560260e.tar.xz
org.eclipse.osee-ebce8e5a205dcf5890138e6d2e8f92e7e560260e.zip
refactor: Restrict access to txCache via BranchCache
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core')
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java27
1 files changed, 13 insertions, 14 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
index df3ff38c4c2..3570986f04c 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
@@ -22,8 +22,7 @@ import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.BranchFactory;
import org.eclipse.osee.framework.core.model.MergeBranch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.cache.IOseeCache;
-import org.eclipse.osee.framework.core.model.cache.TransactionCache;
+import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.type.Triplet;
@@ -45,15 +44,15 @@ public final class BranchCacheUpdateUtil {
}
private final BranchFactory factory;
- private final TransactionCache txCache;
public static final Long DEFAULT_UUID = -1L;
+ private final BranchCache branchCache;
- public BranchCacheUpdateUtil(BranchFactory factory, TransactionCache txCache) {
+ public BranchCacheUpdateUtil(BranchFactory factory, BranchCache branchCache) {
this.factory = factory;
- this.txCache = txCache;
+ this.branchCache = branchCache;
}
- public Collection<Branch> updateCache(AbstractBranchCacheMessage cacheMessage, IOseeCache<Long, Branch> cache) throws OseeCoreException {
+ public Collection<Branch> updateCache(AbstractBranchCacheMessage cacheMessage) throws OseeCoreException {
List<Branch> updatedItems = new ArrayList<Branch>();
Map<Long, Integer> branchToAssocArt = cacheMessage.getBranchToAssocArt();
@@ -63,7 +62,7 @@ public final class BranchCacheUpdateUtil {
for (BranchRow srcItem : cacheMessage.getBranchRows()) {
long branchUuid = srcItem.getBranchId();
Branch updated =
- factory.createOrUpdate(cache, branchUuid, srcItem.getBranchName(), srcItem.getBranchType(),
+ factory.createOrUpdate(branchCache, branchUuid, srcItem.getBranchName(), srcItem.getBranchType(),
srcItem.getBranchState(), srcItem.getBranchArchived().isArchived(), srcItem.getStorageState(),
srcItem.isInheritAccessControl());
updatedItems.add(updated);
@@ -78,19 +77,19 @@ public final class BranchCacheUpdateUtil {
}
for (Entry<Long, Long> entry : cacheMessage.getChildToParent().entrySet()) {
- Branch parent = cache.getById(entry.getValue());
+ Branch parent = branchCache.getById(entry.getValue());
if (parent != null) {
- Branch child = cache.getById(entry.getKey());
+ Branch child = branchCache.getById(entry.getKey());
if (child != null) {
child.setParentBranch(parent);
}
}
}
for (Triplet<Long, Long, Long> entry : cacheMessage.getMergeBranches()) {
- IOseeBranch sourceBranch = entry.getFirst() > 0 ? cache.getByGuid(entry.getFirst()) : null;
- IOseeBranch destinationBranch = entry.getSecond() > 0 ? cache.getByGuid(entry.getSecond()) : null;
+ IOseeBranch sourceBranch = entry.getFirst() > 0 ? branchCache.getByGuid(entry.getFirst()) : null;
+ IOseeBranch destinationBranch = entry.getSecond() > 0 ? branchCache.getByGuid(entry.getSecond()) : null;
- Branch branch = cache.getByGuid(entry.getThird());
+ Branch branch = branchCache.getByGuid(entry.getThird());
MergeBranch mergeBranch = null;
try {
mergeBranch = (MergeBranch) branch;
@@ -108,7 +107,7 @@ public final class BranchCacheUpdateUtil {
Set<Integer> txIdsToLoad = new HashSet<Integer>();
addValidTxIds(cacheMessage.getBranchToBaseTx().values(), txIdsToLoad);
addValidTxIds(cacheMessage.getBranchToSourceTx().values(), txIdsToLoad);
- txCache.loadTransactions(txIdsToLoad);
+ branchCache.loadTransactions(txIdsToLoad);
}
private void addValidTxIds(Collection<Integer> source, Collection<Integer> destination) {
@@ -123,7 +122,7 @@ public final class BranchCacheUpdateUtil {
TransactionRecord tx = null;
Integer txId = branchToTx.get(branchUuid);
if (txId != null && txId > 0) {
- tx = txCache.getOrLoad(txId);
+ tx = branchCache.getOrLoad(txId);
}
return tx;
}

Back to the top