Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2014-08-29 16:22:59 +0000
committerRoberto E. Escobar2014-10-01 21:03:23 +0000
commit6d9632667faafd9d14930175e45d67bbe1272ef8 (patch)
tree8929d30a4294594085a8123005233b8592703c4c /plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core
parent1e8d8d173767d8eddbbfb7d7faf7953a43e47592 (diff)
downloadorg.eclipse.osee-6d9632667faafd9d14930175e45d67bbe1272ef8.tar.gz
org.eclipse.osee-6d9632667faafd9d14930175e45d67bbe1272ef8.tar.xz
org.eclipse.osee-6d9632667faafd9d14930175e45d67bbe1272ef8.zip
refactor[ats_ATS46139]: Remove branch cache from servlets
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/BranchCacheStoreRequest.java41
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java28
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java202
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java8
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java18
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheStoreRequestTranslator.java43
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheUpdateResponseTranslator.java37
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java14
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java99
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java37
10 files changed, 5 insertions, 522 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java
deleted file mode 100644
index fb607278c9a..00000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.core.message;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchCacheStoreRequest extends AbstractBranchCacheMessage {
-
- private boolean isServerUpdateMessage;
-
- public BranchCacheStoreRequest() {
- this.isServerUpdateMessage = false;
- }
-
- public static BranchCacheStoreRequest fromCache(Collection<Branch> types) throws OseeCoreException {
- BranchCacheStoreRequest request = new BranchCacheStoreRequest();
- BranchCacheUpdateUtil.loadFromCache(request, types);
- return request;
- }
-
- public void setServerUpdateMessage(boolean isServerUpdateMessage) {
- this.isServerUpdateMessage = isServerUpdateMessage;
- }
-
- public boolean isServerUpdateMessage() {
- return isServerUpdateMessage;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java
deleted file mode 100644
index 4371b7ced9e..00000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.core.message;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.cache.IOseeCache;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchCacheUpdateResponse extends AbstractBranchCacheMessage {
-
- public static BranchCacheUpdateResponse fromCache(IOseeCache<Long, Branch> cache, Collection<Branch> types) throws OseeCoreException {
- BranchCacheUpdateResponse response = new BranchCacheUpdateResponse();
- BranchCacheUpdateUtil.loadFromCache(response, types);
- return response;
- }
-}
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
deleted file mode 100644
index 3570986f04c..00000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.core.message;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-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.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;
-
-/**
- * @author Megumi Telles
- */
-public final class BranchCacheUpdateUtil {
-
- private enum Fields {
- BRANCH_COUNT,
- BRANCH_ROW,
- CHILD_TO_PARENT,
- BRANCH_TO_BASE_TX,
- BRANCH_TO_SRC_TX,
- BRANCH_TO_ASSOC_ART,
- BRANCH_TO_ALIASES,
- SRC_DEST_MERGE;
- }
-
- private final BranchFactory factory;
- public static final Long DEFAULT_UUID = -1L;
- private final BranchCache branchCache;
-
- public BranchCacheUpdateUtil(BranchFactory factory, BranchCache branchCache) {
- this.factory = factory;
- this.branchCache = branchCache;
- }
-
- public Collection<Branch> updateCache(AbstractBranchCacheMessage cacheMessage) throws OseeCoreException {
- List<Branch> updatedItems = new ArrayList<Branch>();
-
- Map<Long, Integer> branchToAssocArt = cacheMessage.getBranchToAssocArt();
-
- preLoadTransactions(cacheMessage);
-
- for (BranchRow srcItem : cacheMessage.getBranchRows()) {
- long branchUuid = srcItem.getBranchId();
- Branch updated =
- factory.createOrUpdate(branchCache, branchUuid, srcItem.getBranchName(), srcItem.getBranchType(),
- srcItem.getBranchState(), srcItem.getBranchArchived().isArchived(), srcItem.getStorageState(),
- srcItem.isInheritAccessControl());
- updatedItems.add(updated);
-
- Integer artifactId = branchToAssocArt.get(branchUuid);
- if (artifactId != null) {
- updated.setAssociatedArtifactId(artifactId);
- }
-
- updated.setBaseTransaction(getTx(cacheMessage.getBranchToBaseTx(), branchUuid));
- updated.setSourceTransaction(getTx(cacheMessage.getBranchToSourceTx(), branchUuid));
- }
-
- for (Entry<Long, Long> entry : cacheMessage.getChildToParent().entrySet()) {
- Branch parent = branchCache.getById(entry.getValue());
- if (parent != null) {
- 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 ? branchCache.getByGuid(entry.getFirst()) : null;
- IOseeBranch destinationBranch = entry.getSecond() > 0 ? branchCache.getByGuid(entry.getSecond()) : null;
-
- Branch branch = branchCache.getByGuid(entry.getThird());
- MergeBranch mergeBranch = null;
- try {
- mergeBranch = (MergeBranch) branch;
- mergeBranch.setSourceBranch(sourceBranch);
- mergeBranch.setDestinationBranch(destinationBranch);
- } catch (ClassCastException ex) {
- throw new OseeCoreException(ex, "Problem casting branch [%s] to MergeBranch, source: [%s], dest: [%s]",
- branch, sourceBranch, destinationBranch);
- }
- }
- return updatedItems;
- }
-
- private void preLoadTransactions(AbstractBranchCacheMessage cacheMessage) throws OseeCoreException {
- Set<Integer> txIdsToLoad = new HashSet<Integer>();
- addValidTxIds(cacheMessage.getBranchToBaseTx().values(), txIdsToLoad);
- addValidTxIds(cacheMessage.getBranchToSourceTx().values(), txIdsToLoad);
- branchCache.loadTransactions(txIdsToLoad);
- }
-
- private void addValidTxIds(Collection<Integer> source, Collection<Integer> destination) {
- for (Integer txId : source) {
- if (txId != null && txId > 0) {
- destination.add(txId);
- }
- }
- }
-
- private TransactionRecord getTx(Map<Long, Integer> branchToTx, Long branchUuid) throws OseeCoreException {
- TransactionRecord tx = null;
- Integer txId = branchToTx.get(branchUuid);
- if (txId != null && txId > 0) {
- tx = branchCache.getOrLoad(txId);
- }
- return tx;
- }
-
- public static void loadFromCache(AbstractBranchCacheMessage message, Collection<Branch> types) throws OseeCoreException {
- for (Branch br : types) {
- Long branchUuid = br.getUuid();
- message.getBranchRows().add(
- new BranchRow(br.getUuid(), br.getName(), br.getBranchType(), br.getBranchState(), br.getArchiveState(),
- br.getStorageState(), br.isInheritAccessControl()));
- if (br.hasParentBranch()) {
- message.getChildToParent().put(branchUuid, br.getParentBranch().getUuid());
- }
- addTxRecord(message.getBranchToBaseTx(), branchUuid, br.getBaseTransaction());
- addTxRecord(message.getBranchToSourceTx(), branchUuid, br.getSourceTransaction());
- addAssocArtifact(message.getBranchToAssocArt(), branchUuid, br.getAssociatedArtifactId());
- if (br.getBranchType().isMergeBranch()) {
- addMergeBranches(message.getMergeBranches(), (MergeBranch) br);
- }
- }
- }
-
- private static void addAssocArtifact(Map<Long, Integer> map, Long branchUuid, Integer artId) {
- if (artId != null) {
- map.put(branchUuid, artId);
- } else {
- map.put(branchUuid, -1);
- }
- }
-
- private static void addMergeBranches(List<Triplet<Long, Long, Long>> srcDestMerge, MergeBranch mergeBranch) throws OseeCoreException {
- Long src = mergeBranch.getSourceBranch() != null ? mergeBranch.getSourceBranch().getGuid() : DEFAULT_UUID;
- Long dest =
- mergeBranch.getDestinationBranch() != null ? mergeBranch.getDestinationBranch().getGuid() : DEFAULT_UUID;
- Long merge = mergeBranch.getUuid();
- srcDestMerge.add(new Triplet<Long, Long, Long>(src, dest, merge));
- }
-
- private static void addTxRecord(Map<Long, Integer> map, Long branchUuid, TransactionRecord toAdd) {
- if (toAdd != null) {
- map.put(branchUuid, toAdd.getId());
- } else {
- map.put(branchUuid, -1);
- }
- }
-
- public static void loadMessage(AbstractBranchCacheMessage message, PropertyStore store) {
- List<BranchRow> rows = message.getBranchRows();
- int rowCount = store.getInt(Fields.BRANCH_COUNT.name());
- for (int index = 0; index < rowCount; index++) {
- String[] rowData = store.getArray(TranslationUtil.createKey(Fields.BRANCH_ROW, index));
- rows.add(BranchRow.fromArray(rowData));
- }
- TranslationUtil.loadMapLong(message.getChildToParent(), store, Fields.CHILD_TO_PARENT);
- TranslationUtil.loadMap(message.getBranchToBaseTx(), store, Fields.BRANCH_TO_BASE_TX);
- TranslationUtil.loadMap(message.getBranchToSourceTx(), store, Fields.BRANCH_TO_SRC_TX);
- TranslationUtil.loadMap(message.getBranchToAssocArt(), store, Fields.BRANCH_TO_ASSOC_ART);
- TranslationUtil.loadArrayMap(message.getBranchAliases(), store, Fields.BRANCH_TO_ALIASES);
- TranslationUtil.loadTripletListForMergeBranches(message.getMergeBranches(), store, Fields.SRC_DEST_MERGE);
- }
-
- public static void loadStore(PropertyStore store, AbstractBranchCacheMessage message) {
- List<BranchRow> rows = message.getBranchRows();
- for (int index = 0; index < rows.size(); index++) {
- BranchRow row = rows.get(index);
- store.put(TranslationUtil.createKey(Fields.BRANCH_ROW, index), row.toArray());
- }
- store.put(Fields.BRANCH_COUNT.name(), rows.size());
-
- TranslationUtil.putMapLong(store, Fields.CHILD_TO_PARENT, message.getChildToParent());
- TranslationUtil.putMap(store, Fields.BRANCH_TO_BASE_TX, message.getBranchToBaseTx());
- TranslationUtil.putMap(store, Fields.BRANCH_TO_SRC_TX, message.getBranchToSourceTx());
- TranslationUtil.putMap(store, Fields.BRANCH_TO_ASSOC_ART, message.getBranchToAssocArt());
- TranslationUtil.putArrayMap(store, Fields.BRANCH_TO_ALIASES, message.getBranchAliases());
- TranslationUtil.putTripletList(store, Fields.SRC_DEST_MERGE, message.getMergeBranches());
- }
-}
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 26693a6baea..8dab3ffc464 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
@@ -21,7 +21,6 @@ import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
-import org.eclipse.osee.framework.core.services.TempCachingService;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.core.translation.ITranslatorId;
@@ -40,22 +39,17 @@ public class DataTranslationService implements IDataTranslationService {
new ConcurrentHashMap<ITranslatorId, ITranslator<?>>();
private IOseeModelFactoryService modelFactory;
- private TempCachingService cachingService;
public void setModelFactory(IOseeModelFactoryService modelFactory) {
this.modelFactory = modelFactory;
}
- public void setTempCachingService(TempCachingService cachingService) {
- this.cachingService = cachingService;
- }
-
public void start() throws OseeCoreException {
TransactionRecordFactory txFactory = modelFactory.getTransactionFactory();
AttributeTypeFactory attributeTypeFactory = modelFactory.getAttributeTypeFactory();
translators.clear();
- factoryConfigurator.configureService(this, txFactory, attributeTypeFactory, cachingService);
+ factoryConfigurator.configureService(this, txFactory, attributeTypeFactory);
}
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 a8b4e85665a..e7268c10465 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
@@ -13,8 +13,6 @@ package org.eclipse.osee.framework.core.message.internal;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.message.internal.translation.ArtifactTypeCacheUpdateResponseTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.AttributeTypeCacheUpdateResponseTranslator;
-import org.eclipse.osee.framework.core.message.internal.translation.BranchCacheStoreRequestTranslator;
-import org.eclipse.osee.framework.core.message.internal.translation.BranchCacheUpdateResponseTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.BranchChangeArchivedStateRequestTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.BranchChangeStateRequestTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.BranchChangeTypeRequestTranslator;
@@ -32,12 +30,8 @@ import org.eclipse.osee.framework.core.message.internal.translation.OseeImportMo
import org.eclipse.osee.framework.core.message.internal.translation.PurgeBranchRequestTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.RelationTypeCacheUpdateResponseTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.TableDataTranslator;
-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.TempCachingService;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -51,15 +45,12 @@ public class DataTranslationServiceFactory {
//
}
- public void configureService(IDataTranslationService service, TransactionRecordFactory txRecordFactory, AttributeTypeFactory attributeTypeFactory, TempCachingService cachingService) throws OseeCoreException {
- BranchCache branchCache = cachingService.getBranchCache();
- service.addTranslator(new TransactionRecordTranslator(), CoreTranslatorId.TRANSACTION_RECORD);
-
+ public void configureService(IDataTranslationService service, TransactionRecordFactory txRecordFactory, AttributeTypeFactory attributeTypeFactory) throws OseeCoreException {
service.addTranslator(new BranchCreationRequestTranslator(), CoreTranslatorId.BRANCH_CREATION_REQUEST);
service.addTranslator(new BranchCreationResponseTranslator(), CoreTranslatorId.BRANCH_CREATION_RESPONSE);
service.addTranslator(new BranchCommitRequestTranslator(), CoreTranslatorId.BRANCH_COMMIT_REQUEST);
- service.addTranslator(new BranchCommitResponseTranslator(service), CoreTranslatorId.BRANCH_COMMIT_RESPONSE);
+ service.addTranslator(new BranchCommitResponseTranslator(), CoreTranslatorId.BRANCH_COMMIT_RESPONSE);
service.addTranslator(new BranchChangeTypeRequestTranslator(), CoreTranslatorId.CHANGE_BRANCH_TYPE);
service.addTranslator(new BranchChangeStateRequestTranslator(), CoreTranslatorId.CHANGE_BRANCH_STATE);
@@ -72,11 +63,6 @@ public class DataTranslationServiceFactory {
service.addTranslator(new CacheUpdateRequestTranslator(), CoreTranslatorId.OSEE_CACHE_UPDATE_REQUEST);
- service.addTranslator(new BranchCacheUpdateResponseTranslator(), CoreTranslatorId.BRANCH_CACHE_UPDATE_RESPONSE);
- service.addTranslator(new BranchCacheStoreRequestTranslator(), CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST);
- service.addTranslator(new TransactionCacheUpdateResponseTranslator(txRecordFactory, branchCache),
- CoreTranslatorId.TX_CACHE_UPDATE_RESPONSE);
-
service.addTranslator(new ArtifactTypeCacheUpdateResponseTranslator(),
CoreTranslatorId.ARTIFACT_TYPE_CACHE_UPDATE_RESPONSE);
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheStoreRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheStoreRequestTranslator.java
deleted file mode 100644
index 257b945da9c..00000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheStoreRequestTranslator.java
+++ /dev/null
@@ -1,43 +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.core.message.internal.translation;
-
-import org.eclipse.osee.framework.core.message.BranchCacheStoreRequest;
-import org.eclipse.osee.framework.core.message.BranchCacheUpdateUtil;
-import org.eclipse.osee.framework.core.translation.ITranslator;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-
-/**
- * @author Roberto E. Escobar
- * @author Jeff C. Phillips
- */
-public class BranchCacheStoreRequestTranslator implements ITranslator<BranchCacheStoreRequest> {
-
- private static enum Field {
- IS_SERVER_MESSAGE;
- }
-
- @Override
- public BranchCacheStoreRequest convert(PropertyStore store) {
- BranchCacheStoreRequest request = new BranchCacheStoreRequest();
- BranchCacheUpdateUtil.loadMessage(request, store);
- request.setServerUpdateMessage(store.getBoolean(Field.IS_SERVER_MESSAGE.name()));
- return request;
- }
-
- @Override
- public PropertyStore convert(BranchCacheStoreRequest object) {
- PropertyStore store = new PropertyStore();
- BranchCacheUpdateUtil.loadStore(store, object);
- store.put(Field.IS_SERVER_MESSAGE.name(), object.isServerUpdateMessage());
- return store;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheUpdateResponseTranslator.java
deleted file mode 100644
index 2fa8e133ab7..00000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheUpdateResponseTranslator.java
+++ /dev/null
@@ -1,37 +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.core.message.internal.translation;
-
-import org.eclipse.osee.framework.core.message.BranchCacheUpdateResponse;
-import org.eclipse.osee.framework.core.message.BranchCacheUpdateUtil;
-import org.eclipse.osee.framework.core.translation.ITranslator;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-
-/**
- * @author Roberto E. Escobar
- * @author Jeff C. Phillips
- */
-public class BranchCacheUpdateResponseTranslator implements ITranslator<BranchCacheUpdateResponse> {
-
- @Override
- public BranchCacheUpdateResponse convert(PropertyStore store) {
- BranchCacheUpdateResponse response = new BranchCacheUpdateResponse();
- BranchCacheUpdateUtil.loadMessage(response, store);
- return response;
- }
-
- @Override
- public PropertyStore convert(BranchCacheUpdateResponse object) {
- PropertyStore store = new PropertyStore();
- BranchCacheUpdateUtil.loadStore(store, object);
- return store;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java
index f9c79e4ff7b..41f77b083f3 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java
@@ -10,9 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.message.internal.translation;
-import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.message.BranchCommitResponse;
-import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
@@ -26,17 +24,10 @@ public class BranchCommitResponseTranslator implements ITranslator<BranchCommitR
TRANSACTION_NUMBER
}
- private final IDataTranslationService service;
-
- public BranchCommitResponseTranslator(IDataTranslationService service) {
- this.service = service;
- }
-
@Override
public BranchCommitResponse convert(PropertyStore propertyStore) throws OseeCoreException {
BranchCommitResponse response = new BranchCommitResponse();
- PropertyStore innerStore = propertyStore.getPropertyStore(Entry.TRANSACTION_NUMBER.name());
- Integer transactionRecord = service.convert(innerStore, CoreTranslatorId.TRANSACTION_RECORD);
+ Integer transactionRecord = propertyStore.getInt(Entry.TRANSACTION_NUMBER.name());
response.setTransactionId(transactionRecord);
return response;
}
@@ -45,8 +36,7 @@ public class BranchCommitResponseTranslator implements ITranslator<BranchCommitR
public PropertyStore convert(BranchCommitResponse data) throws OseeCoreException {
PropertyStore store = new PropertyStore();
Integer record = data.getTransactionId();
- PropertyStore property = service.convert(record, CoreTranslatorId.TRANSACTION_RECORD);
- store.put(Entry.TRANSACTION_NUMBER.name(), property);
+ store.put(Entry.TRANSACTION_NUMBER.name(), record);
return store;
}
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
deleted file mode 100644
index 55a4d436105..00000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java
+++ /dev/null
@@ -1,99 +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.core.message.internal.translation;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
-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.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-
-/**
- * @author Roberto E. Escobar
- * @author Jeff C. Phillips
- */
-public class TransactionCacheUpdateResponseTranslator implements ITranslator<TransactionCacheUpdateResponse> {
-
- private static enum Fields {
- TX_COUNT,
- TX_ROW,
- TX_TO_BRANCH;
- }
-
- private final TransactionRecordFactory txRecordFactory;
- private final BranchCache branchCache;
-
- public TransactionCacheUpdateResponseTranslator(TransactionRecordFactory txRecordFactory, BranchCache branchCache) {
- this.txRecordFactory = txRecordFactory;
- this.branchCache = branchCache;
- }
-
- private TransactionRecordFactory getFactory() {
- return txRecordFactory;
- }
-
- @Override
- public TransactionCacheUpdateResponse convert(PropertyStore store) throws OseeCoreException {
- TransactionRecordFactory factory = getFactory();
- List<TransactionRecord> rows = new ArrayList<TransactionRecord>();
- int rowCount = store.getInt(Fields.TX_COUNT.name());
- for (int index = 0; index < rowCount; index++) {
- String[] rowData = store.getArray(createKey(Fields.TX_ROW, index));
- rows.add(fromArray(factory, rowData));
- }
- return new TransactionCacheUpdateResponse(rows);
- }
-
- @Override
- public PropertyStore convert(TransactionCacheUpdateResponse object) {
- PropertyStore store = new PropertyStore();
- List<TransactionRecord> rows = object.getTxRows();
- for (int index = 0; index < rows.size(); index++) {
- TransactionRecord row = rows.get(index);
- store.put(createKey(Fields.TX_ROW, index), toArray(row));
- }
- store.put(Fields.TX_COUNT.name(), rows.size());
- return store;
- }
-
- private String createKey(Fields key, int index) {
- return String.format("%s_%s", key.name(), index);
- }
-
- private String[] toArray(TransactionRecord row) {
- return new String[] {
- String.valueOf(row.getId()),
- row.getTxType().name(),
- row.getComment(),
- String.valueOf(row.getTimeStamp().getTime()),
- String.valueOf(row.getAuthor()),
- String.valueOf(row.getCommit()),
- String.valueOf(row.getBranchId())};
- }
-
- private TransactionRecord fromArray(TransactionRecordFactory factory, String[] data) throws OseeCoreException {
- int index = 0;
- int txId = Integer.valueOf(data[index++]);
- TransactionDetailsType txType = TransactionDetailsType.valueOf(data[index++]);
- String comment = data[index++];
- Date timeStamp = new Date(Long.valueOf(data[index++]));
- int authorArtId = Integer.valueOf(data[index++]);
- int commitArtId = Integer.valueOf(data[index++]);
- long branchUuid = Long.valueOf(data[index++]);
- return factory.create(txId, branchUuid, 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
deleted file mode 100644
index beb7f785c3c..00000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java
+++ /dev/null
@@ -1,37 +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.core.message.internal.translation;
-
-import org.eclipse.osee.framework.core.translation.ITranslator;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class TransactionRecordTranslator implements ITranslator<Integer> {
-
- private static enum Entry {
- TRANSACTION_ID,
- }
-
- @Override
- public Integer convert(PropertyStore store) throws OseeCoreException {
- return store.getInt(Entry.TRANSACTION_ID.name());
- }
-
- @Override
- public PropertyStore convert(Integer transactionId) {
- PropertyStore store = new PropertyStore();
- store.put(Entry.TRANSACTION_ID.name(), transactionId);
- return store;
- }
-}

Back to the top