diff options
author | jmisinco | 2012-05-18 20:31:00 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2012-05-18 20:31:00 +0000 |
commit | 04c3aa09abe83729a38af78dde6bed4530b66bb1 (patch) | |
tree | d74b7e6293b522d24d53b09c7fe480d40986d583 /plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework | |
parent | effa0d7ffe1342e2a627346dd6d0ae563f88db05 (diff) | |
download | org.eclipse.osee-04c3aa09abe83729a38af78dde6bed4530b66bb1.tar.gz org.eclipse.osee-04c3aa09abe83729a38af78dde6bed4530b66bb1.tar.xz org.eclipse.osee-04c3aa09abe83729a38af78dde6bed4530b66bb1.zip |
bug[ats_9YVXA]: Fix intermittent null BranchCache in TransactionRecord
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework')
5 files changed, 29 insertions, 12 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TransactionCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TransactionCacheUpdateResponse.java index 03f61ffb192..694b3dda483 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TransactionCacheUpdateResponse.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TransactionCacheUpdateResponse.java @@ -13,9 +13,9 @@ package org.eclipse.osee.framework.core.message; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.core.model.TransactionRecordFactory; +import org.eclipse.osee.framework.core.model.cache.BranchCache; /** * @author Roberto E. Escobar @@ -32,11 +32,11 @@ public class TransactionCacheUpdateResponse { return rows; } - public static TransactionCacheUpdateResponse fromCache(TransactionRecordFactory factory, Collection<TransactionRecord> types) throws OseeCoreException { + public static TransactionCacheUpdateResponse fromCache(TransactionRecordFactory factory, Collection<TransactionRecord> types, BranchCache branchCache) { List<TransactionRecord> rows = new ArrayList<TransactionRecord>(); for (TransactionRecord tx : types) { rows.add(factory.create(tx.getId(), tx.getBranchId(), tx.getComment(), tx.getTimeStamp(), tx.getAuthor(), - tx.getCommit(), tx.getTxType())); + tx.getCommit(), tx.getTxType(), branchCache)); } return new TransactionCacheUpdateResponse(rows); } diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java index 3955501ce6e..0298e27c33b 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java @@ -22,6 +22,7 @@ import org.eclipse.osee.framework.core.exception.OseeExceptions; import org.eclipse.osee.framework.core.exception.OseeStateException; import org.eclipse.osee.framework.core.model.TransactionRecordFactory; import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory; +import org.eclipse.osee.framework.core.services.IOseeCachingService; import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.core.translation.ITranslator; @@ -39,17 +40,22 @@ public class DataTranslationService implements IDataTranslationService { new ConcurrentHashMap<ITranslatorId, ITranslator<?>>(); private IOseeModelFactoryService modelFactory; + private IOseeCachingService cachingService; public void setModelFactory(IOseeModelFactoryService modelFactory) { this.modelFactory = modelFactory; } + public void setOseeCachingService(IOseeCachingService cachingService) { + this.cachingService = cachingService; + } + public void start() throws OseeCoreException { TransactionRecordFactory txFactory = modelFactory.getTransactionFactory(); AttributeTypeFactory attributeTypeFactory = modelFactory.getAttributeTypeFactory(); translators.clear(); - factoryConfigurator.configureService(this, txFactory, attributeTypeFactory); + factoryConfigurator.configureService(this, txFactory, attributeTypeFactory, cachingService); } public void stop() { diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java index 4002fc9eb93..0781e925e39 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java @@ -38,7 +38,9 @@ import org.eclipse.osee.framework.core.message.internal.translation.TableDataTra import org.eclipse.osee.framework.core.message.internal.translation.TransactionCacheUpdateResponseTranslator; import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator; import org.eclipse.osee.framework.core.model.TransactionRecordFactory; +import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory; +import org.eclipse.osee.framework.core.services.IOseeCachingService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; /** @@ -51,8 +53,10 @@ public class DataTranslationServiceFactory { // } - public void configureService(IDataTranslationService service, TransactionRecordFactory txRecordFactory, AttributeTypeFactory attributeTypeFactory) throws OseeCoreException { - service.addTranslator(new TransactionRecordTranslator(txRecordFactory), CoreTranslatorId.TRANSACTION_RECORD); + public void configureService(IDataTranslationService service, TransactionRecordFactory txRecordFactory, AttributeTypeFactory attributeTypeFactory, IOseeCachingService cachingService) throws OseeCoreException { + BranchCache branchCache = cachingService.getBranchCache(); + service.addTranslator(new TransactionRecordTranslator(txRecordFactory, branchCache), + CoreTranslatorId.TRANSACTION_RECORD); service.addTranslator(new BranchCreationRequestTranslator(), CoreTranslatorId.BRANCH_CREATION_REQUEST); service.addTranslator(new BranchCreationResponseTranslator(), CoreTranslatorId.BRANCH_CREATION_RESPONSE); @@ -73,7 +77,7 @@ public class DataTranslationServiceFactory { service.addTranslator(new BranchCacheUpdateResponseTranslator(), CoreTranslatorId.BRANCH_CACHE_UPDATE_RESPONSE); service.addTranslator(new BranchCacheStoreRequestTranslator(), CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST); - service.addTranslator(new TransactionCacheUpdateResponseTranslator(txRecordFactory), + service.addTranslator(new TransactionCacheUpdateResponseTranslator(txRecordFactory, branchCache), CoreTranslatorId.TX_CACHE_UPDATE_RESPONSE); service.addTranslator(new ArtifactTypeCacheUpdateResponseTranslator(), diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java index a63102c5500..b2ca335f7c8 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java @@ -18,6 +18,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.message.TransactionCacheUpdateResponse; import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.core.model.TransactionRecordFactory; +import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.translation.ITranslator; import org.eclipse.osee.framework.jdk.core.type.PropertyStore; @@ -34,9 +35,11 @@ public class TransactionCacheUpdateResponseTranslator implements ITranslator<Tra } private final TransactionRecordFactory txRecordFactory; + private final BranchCache branchCache; - public TransactionCacheUpdateResponseTranslator(TransactionRecordFactory txRecordFactory) { + public TransactionCacheUpdateResponseTranslator(TransactionRecordFactory txRecordFactory, BranchCache branchCache) { this.txRecordFactory = txRecordFactory; + this.branchCache = branchCache; } private TransactionRecordFactory getFactory() { @@ -82,7 +85,7 @@ public class TransactionCacheUpdateResponseTranslator implements ITranslator<Tra String.valueOf(row.getBranchId())}; } - private static TransactionRecord fromArray(TransactionRecordFactory factory, String[] data) throws OseeCoreException { + private TransactionRecord fromArray(TransactionRecordFactory factory, String[] data) { int index = 0; int txId = Integer.valueOf(data[index++]); TransactionDetailsType txType = TransactionDetailsType.valueOf(data[index++]); @@ -91,6 +94,6 @@ public class TransactionCacheUpdateResponseTranslator implements ITranslator<Tra int authorArtId = Integer.valueOf(data[index++]); int commitArtId = Integer.valueOf(data[index++]); int branchId = Integer.valueOf(data[index++]); - return factory.create(txId, branchId, comment, timeStamp, authorArtId, commitArtId, txType); + return factory.create(txId, branchId, comment, timeStamp, authorArtId, commitArtId, txType, branchCache); } } diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java index 77b34050624..6d339b401cf 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java @@ -16,6 +16,7 @@ import org.eclipse.osee.framework.core.enums.TransactionDetailsType; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.core.model.TransactionRecordFactory; +import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.translation.ITranslator; import org.eclipse.osee.framework.jdk.core.type.PropertyStore; @@ -35,9 +36,11 @@ public final class TransactionRecordTranslator implements ITranslator<Transactio } private final TransactionRecordFactory txRecordFactory; + private final BranchCache branchCache; - public TransactionRecordTranslator(TransactionRecordFactory txRecordFactory) { + public TransactionRecordTranslator(TransactionRecordFactory txRecordFactory, BranchCache branchCache) { this.txRecordFactory = txRecordFactory; + this.branchCache = branchCache; } @Override @@ -49,7 +52,8 @@ public final class TransactionRecordTranslator implements ITranslator<Transactio int authorArtId = store.getInt(Entry.TRANSACTION_AUTHOR_ART_ID.name()); int commitArtId = store.getInt(Entry.TRANSACTION_COMMIT_ART_ID.name()); int branchId = store.getInt(Entry.TRANSACTION_BRANCH.name()); - return txRecordFactory.create(transactionNumber, branchId, comment, time, authorArtId, commitArtId, txType); + return txRecordFactory.create(transactionNumber, branchId, comment, time, authorArtId, commitArtId, txType, + branchCache); } @Override |