Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-06-19 01:12:12 +0000
committerrescobar2010-06-19 01:12:12 +0000
commit9c11caaa40976f710dc3b7111104b0c04344993e (patch)
tree7f939e3504affb5dd14c72fbeb3f2f8cbc6bcf60 /plugins
parent524afe296876d796dcae9e058b30c357c44b3a22 (diff)
downloadorg.eclipse.osee-9c11caaa40976f710dc3b7111104b0c04344993e.tar.gz
org.eclipse.osee-9c11caaa40976f710dc3b7111104b0c04344993e.tar.xz
org.eclipse.osee-9c11caaa40976f710dc3b7111104b0c04344993e.zip
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/.classpath7
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/.project28
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/.settings/org.eclipse.pde.core.prefs5
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF24
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/build.properties4
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AbstractBranchCacheMessage.java70
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactChangeItem.java23
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java149
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AttributeChangeItem.java25
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AttributeTypeCacheUpdateResponse.java61
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java42
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java32
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java179
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitRequest.java46
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitResponse.java32
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationRequest.java90
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationResponse.java31
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java77
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/CacheUpdateRequest.java42
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchArchiveStateRequest.java36
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchStateRequest.java36
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchTypeRequest.java36
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeItem.java82
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeItemUtil.java125
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeReportRequest.java33
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeReportResponse.java44
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeVersion.java123
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingService.java26
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingServiceProvider.java21
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeEnumTypeCacheUpdateResponse.java54
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelRequest.java52
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelResponse.java63
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/PurgeBranchRequest.java28
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationChangeItem.java37
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationTypeCacheUpdateResponse.java142
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TableData.java42
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TransactionCacheUpdateResponse.java43
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/Activator.java116
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java129
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java114
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java72
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java106
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheStoreRequestTranslator.java44
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheUpdateResponseTranslator.java38
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchChangeArchivedStateRequestTranslator.java43
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchChangeStateRequestTranslator.java43
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchChangeTypeRequestTranslator.java43
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitRequestTranslator.java49
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java52
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationRequestTranslator.java79
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationResponseTranslator.java39
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/CacheUpdateRequestTranslator.java64
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeItemTranslator.java148
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportRequestTranslator.java43
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java66
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeVersionTranslator.java64
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeEnumTypeCacheUpdateResponseTranslator.java76
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelRequestTranslator.java52
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelResponseTranslator.java85
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/PurgeBranchRequestTranslator.java40
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/RelationTypeCacheUpdateResponseTranslator.java57
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java65
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java92
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java69
65 files changed, 3886 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.message/.classpath b/plugins/org.eclipse.osee.framework.core.message/.classpath
new file mode 100644
index 00000000000..8a8f1668cdc
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.framework.core.message/.project b/plugins/org.eclipse.osee.framework.core.message/.project
new file mode 100644
index 00000000000..f5a591a8812
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.framework.core.message</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.framework.core.message/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.osee.framework.core.message/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..33b8d0f0060
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Jun 18 14:54:31 MST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/plugins/org.eclipse.osee.framework.core.message/.settings/org.eclipse.pde.core.prefs b/plugins/org.eclipse.osee.framework.core.message/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 00000000000..81b771aa9d8
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,5 @@
+#Fri Jun 18 14:54:31 MST 2010
+eclipse.preferences.version=1
+pluginProject.equinox=false
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..b84b120f21f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Core Message
+Bundle-SymbolicName: org.eclipse.osee.framework.core.message;singleton:=true
+Bundle-Version: 0.9.5.qualifier
+Bundle-Activator: org.eclipse.osee.framework.core.message.internal.Activator
+Bundle-Vendor: Eclipse.org
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.eclipse.core.runtime,
+ org.eclipse.osee.framework.core.data,
+ org.eclipse.osee.framework.core.enums,
+ org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.core.model.cache,
+ org.eclipse.osee.framework.core.model.type,
+ org.eclipse.osee.framework.core.services,
+ org.eclipse.osee.framework.core.translation,
+ org.eclipse.osee.framework.core.util,
+ org.eclipse.osee.framework.jdk.core.type,
+ org.osgi.framework,
+ org.osgi.util.tracker
+Export-Package: org.eclipse.osee.framework.core.message
+Bundle-ActivationPolicy: lazy
+Eclipse-ExtensibleAPI: true
diff --git a/plugins/org.eclipse.osee.framework.core.message/build.properties b/plugins/org.eclipse.osee.framework.core.message/build.properties
new file mode 100644
index 00000000000..41eb6ade2b4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AbstractBranchCacheMessage.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AbstractBranchCacheMessage.java
new file mode 100644
index 00000000000..705f1ce4efc
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AbstractBranchCacheMessage.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.osee.framework.jdk.core.type.Triplet;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractBranchCacheMessage {
+
+ private final List<BranchRow> rows;
+ private final Map<Integer, Integer> childToParent;
+ private final Map<Integer, Integer> branchToBaseTx;
+ private final Map<Integer, Integer> branchToSourceTx;
+ private final Map<Integer, Integer> branchToAssocArt;
+ private final Map<Integer, String[]> branchToAliases;
+ private final List<Triplet<Integer, Integer, Integer>> srcDestMerge;
+
+ protected AbstractBranchCacheMessage() {
+ this.rows = new ArrayList<BranchRow>();
+ this.childToParent = new HashMap<Integer, Integer>();
+ this.branchToBaseTx = new HashMap<Integer, Integer>();
+ this.branchToSourceTx = new HashMap<Integer, Integer>();
+ this.branchToAssocArt = new HashMap<Integer, Integer>();
+ this.branchToAliases = new HashMap<Integer, String[]>();
+ this.srcDestMerge = new ArrayList<Triplet<Integer, Integer, Integer>>();
+ }
+
+ public List<BranchRow> getBranchRows() {
+ return rows;
+ }
+
+ public Map<Integer, Integer> getChildToParent() {
+ return childToParent;
+ }
+
+ public Map<Integer, Integer> getBranchToBaseTx() {
+ return branchToBaseTx;
+ }
+
+ public Map<Integer, Integer> getBranchToSourceTx() {
+ return branchToSourceTx;
+ }
+
+ public Map<Integer, Integer> getBranchToAssocArt() {
+ return branchToAssocArt;
+ }
+
+ public Map<Integer, String[]> getBranchAliases() {
+ return branchToAliases;
+ }
+
+ public List<Triplet<Integer, Integer, Integer>> getMergeBranches() {
+ return srcDestMerge;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactChangeItem.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactChangeItem.java
new file mode 100644
index 00000000000..89b637b4216
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactChangeItem.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.osee.framework.core.enums.ModificationType;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ArtifactChangeItem extends ChangeItem {
+
+ public ArtifactChangeItem(int artId, int artTypeId, long currentSourceGammaId, ModificationType currentSourceModType) {
+ super(artId, artTypeId, artId, currentSourceGammaId, currentSourceModType);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java
new file mode 100644
index 00000000000..9f48c257968
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.eclipse.osee.framework.core.enums.StorageState;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.jdk.core.type.Triplet;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactTypeCacheUpdateResponse {
+
+ private final List<ArtifactTypeRow> rows;
+ private final Map<Integer, Integer[]> baseToSuper;
+ private final List<Triplet<Integer, Integer, Integer>> artAttrs;
+
+ public ArtifactTypeCacheUpdateResponse(List<ArtifactTypeRow> rows, Map<Integer, Integer[]> baseToSuper, List<Triplet<Integer, Integer, Integer>> artAttrs) {
+ this.rows = rows;
+ this.baseToSuper = baseToSuper;
+ this.artAttrs = artAttrs;
+ }
+
+ public List<ArtifactTypeRow> getArtTypeRows() {
+ return rows;
+ }
+
+ public Map<Integer, Integer[]> getBaseToSuperTypes() {
+ return baseToSuper;
+ }
+
+ public List<Triplet<Integer, Integer, Integer>> getAttributeTypes() {
+ return artAttrs;
+ }
+
+ public static final class ArtifactTypeRow {
+ private final int id;
+ private final String name;
+ private final String guid;
+ private final boolean isAbstract;
+ private StorageState storageState;
+
+ protected ArtifactTypeRow(int id, String guid, String name, boolean isAbstract, StorageState storageState) {
+ super();
+ this.id = id;
+ this.guid = guid;
+ this.name = name;
+ this.isAbstract = isAbstract;
+ this.storageState = storageState;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public boolean isAbstract() {
+ return isAbstract;
+ }
+
+ public StorageState getStorageState() {
+ return storageState;
+ }
+
+ public void setStorageState(StorageState storageState) {
+ this.storageState = storageState;
+ }
+
+ public String[] toArray() {
+ return new String[] {String.valueOf(getId()), getGuid(), getName(), String.valueOf(isAbstract()),
+ getStorageState().name()};
+ }
+
+ public static ArtifactTypeRow fromArray(String[] data) {
+ int id = Integer.valueOf(data[0]);
+ String guid = data[1];
+ String name = data[2];
+ boolean isAbstract = Boolean.valueOf(data[3]);
+ StorageState storageState = StorageState.valueOf(data[4]);
+ return new ArtifactTypeRow(id, guid, name, isAbstract, storageState);
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s (%s)", name, guid);
+ }
+ }
+
+ public static ArtifactTypeCacheUpdateResponse fromCache(Collection<ArtifactType> types) throws OseeCoreException {
+ List<ArtifactTypeRow> rows = new ArrayList<ArtifactTypeRow>();
+ Map<Integer, Integer[]> baseToSuper = new HashMap<Integer, Integer[]>();
+ List<Triplet<Integer, Integer, Integer>> artAttrs = new ArrayList<Triplet<Integer, Integer, Integer>>();
+ for (ArtifactType art : types) {
+ rows.add(new ArtifactTypeRow(art.getId(), art.getGuid(), art.getName(), art.isAbstract(),
+ art.getStorageState()));
+
+ Integer artId = art.getId();
+ Collection<ArtifactType> superTypes = art.getSuperArtifactTypes();
+ if (!superTypes.isEmpty()) {
+ Integer[] intSuperTypes = new Integer[superTypes.size()];
+ int index = 0;
+ for (ArtifactType superType : superTypes) {
+ intSuperTypes[index++] = superType.getId();
+ }
+ baseToSuper.put(artId, intSuperTypes);
+ }
+
+ for (Entry<Branch, Collection<AttributeType>> entry : art.getLocalAttributeTypes().entrySet()) {
+ Integer branchId = entry.getKey().getId();
+ Collection<AttributeType> attrTypes = entry.getValue();
+ for (AttributeType type : attrTypes) {
+ artAttrs.add(new Triplet<Integer, Integer, Integer>(artId, branchId, type.getId()));
+ }
+
+ }
+ }
+ return new ArtifactTypeCacheUpdateResponse(rows, baseToSuper, artAttrs);
+ }
+
+ @Override
+ public String toString() {
+ return "ArtifactTypeCacheUpdateResponse [artAttrs=" + artAttrs + ", baseToSuper=" + baseToSuper + ", rows=" + rows + "]";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AttributeChangeItem.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AttributeChangeItem.java
new file mode 100644
index 00000000000..9f0efe72427
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AttributeChangeItem.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.osee.framework.core.enums.ModificationType;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class AttributeChangeItem extends ChangeItem {
+
+ public AttributeChangeItem(int attrId, int attrTypeId, int artId, long currentSourceGammaId, ModificationType currentSourceModType, String value) {
+ super(attrId, attrTypeId, artId, currentSourceGammaId, currentSourceModType);
+ this.getCurrentVersion().setValue(value);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AttributeTypeCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AttributeTypeCacheUpdateResponse.java
new file mode 100644
index 00000000000..009c2878573
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AttributeTypeCacheUpdateResponse.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeTypeCacheUpdateResponse {
+
+ private final List<AttributeType> rows;
+ private final Map<Integer, Integer> attrToEnum;
+
+ public AttributeTypeCacheUpdateResponse(List<AttributeType> rows, Map<Integer, Integer> attrToEnum) {
+ this.rows = rows;
+ this.attrToEnum = attrToEnum;
+ }
+
+ public List<AttributeType> getAttrTypeRows() {
+ return rows;
+ }
+
+ public Map<Integer, Integer> getAttrToEnums() {
+ return attrToEnum;
+ }
+
+ public static AttributeTypeCacheUpdateResponse fromCache(AttributeTypeFactory factory, Collection<AttributeType> types) throws OseeCoreException {
+ List<AttributeType> rows = new ArrayList<AttributeType>();
+ Map<Integer, Integer> attrToEnum = new HashMap<Integer, Integer>();
+ for (AttributeType item : types) {
+ AttributeType type =
+ factory.create(item.getGuid(), item.getName(), item.getBaseAttributeTypeId(),
+ item.getAttributeProviderId(), item.getFileTypeExtension(), item.getDefaultValue(),
+ item.getMinOccurrences(), item.getMaxOccurrences(), item.getDescription(), item.getTaggerId());
+ type.setId(item.getId());
+ type.setStorageState(item.getStorageState());
+ rows.add(type);
+
+ if (item.getOseeEnumType() != null) {
+ attrToEnum.put(item.getId(), item.getOseeEnumTypeId());
+ }
+ }
+ return new AttributeTypeCacheUpdateResponse(rows, attrToEnum);
+ }
+}
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
new file mode 100644
index 00000000000..657ececb412
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchCacheStoreRequest extends AbstractBranchCacheMessage {
+
+ private boolean isServerUpdateMessage;
+
+ public BranchCacheStoreRequest() {
+ super();
+ 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
new file mode 100644
index 00000000000..a88b49bb068
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.cache.IOseeCache;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchCacheUpdateResponse extends AbstractBranchCacheMessage {
+
+ public BranchCacheUpdateResponse() {
+ super();
+ }
+
+ public static BranchCacheUpdateResponse fromCache(IOseeCache<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
new file mode 100644
index 00000000000..c33f8315284
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * 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.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.BranchFactory;
+import org.eclipse.osee.framework.core.model.IArtifactFactory;
+import org.eclipse.osee.framework.core.model.IBasicArtifact;
+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.translation.TranslationUtil;
+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;
+ private final TransactionCache txCache;
+ private final IArtifactFactory<?> artFactory;
+
+ public BranchCacheUpdateUtil(BranchFactory factory, TransactionCache txCache, IArtifactFactory<?> artFactory) {
+ super();
+ this.factory = factory;
+ this.txCache = txCache;
+ this.artFactory = artFactory;
+ }
+
+ public Collection<Branch> updateCache(AbstractBranchCacheMessage cacheMessage, IOseeCache<Branch> cache) throws OseeCoreException {
+ List<Branch> updatedItems = new ArrayList<Branch>();
+
+ Map<Integer, Integer> branchToAssocArt = cacheMessage.getBranchToAssocArt();
+
+ for (BranchRow srcItem : cacheMessage.getBranchRows()) {
+ int branchId = srcItem.getBranchId();
+ Branch updated =
+ factory.createOrUpdate(cache, srcItem.getBranchId(), srcItem.getStorageState(), srcItem.getBranchGuid(),
+ srcItem.getBranchName(), srcItem.getBranchType(), srcItem.getBranchState(),
+ srcItem.getBranchArchived().isArchived());
+ updatedItems.add(updated);
+
+ updated.setBaseTransaction(getTx(cacheMessage.getBranchToBaseTx(), branchId));
+ updated.setSourceTransaction(getTx(cacheMessage.getBranchToSourceTx(), branchId));
+
+ Integer artifactId = branchToAssocArt.get(branchId);
+ if (artifactId != null) {
+ updated.setAssociatedArtifact(artFactory.createArtifact(artifactId));
+ }
+ }
+
+ for (Entry<Integer, Integer> entry : cacheMessage.getChildToParent().entrySet()) {
+ Branch parent = cache.getById(entry.getValue());
+ if (parent != null) {
+ Branch child = cache.getById(entry.getKey());
+ if (child != null) {
+ child.setParentBranch(parent);
+ }
+ }
+ }
+ for (Triplet<Integer, Integer, Integer> entry : cacheMessage.getMergeBranches()) {
+ Branch sourceBranch = cache.getById(entry.getFirst());
+ Branch destinationBranch = cache.getById(entry.getSecond());
+ MergeBranch mergeBranch = (MergeBranch) cache.getById(entry.getThird());
+ mergeBranch.setSourceBranch(sourceBranch);
+ mergeBranch.setDestinationBranch(destinationBranch);
+ }
+ return updatedItems;
+ }
+
+ private TransactionRecord getTx(Map<Integer, Integer> branchToTx, Integer branchId) throws OseeCoreException {
+ TransactionRecord tx = null;
+ Integer txId = branchToTx.get(branchId);
+ if (txId != null && txId > 0) {
+ tx = txCache.getOrLoad(txId);
+ }
+ return tx;
+ }
+
+ public static void loadFromCache(AbstractBranchCacheMessage message, Collection<Branch> types) throws OseeCoreException {
+ for (Branch br : types) {
+ Integer branchId = br.getId();
+ message.getBranchRows().add(
+ new BranchRow(br.getId(), br.getGuid(), br.getName(), br.getBranchType(), br.getBranchState(),
+ br.getArchiveState(), br.getStorageState()));
+ if (br.hasParentBranch()) {
+ message.getChildToParent().put(branchId, br.getParentBranch().getId());
+ }
+ addTxRecord(message.getBranchToBaseTx(), branchId, br.getBaseTransaction());
+ addTxRecord(message.getBranchToSourceTx(), branchId, br.getSourceTransaction());
+ addAssocArtifact(message.getBranchToAssocArt(), branchId, br.getAssociatedArtifact());
+ if (br.getBranchType().isMergeBranch()) {
+ addMergeBranches(message.getMergeBranches(), (MergeBranch) br);
+ }
+ }
+ }
+
+ private static void addAssocArtifact(Map<Integer, Integer> map, Integer branchId, IBasicArtifact<?> art) {
+ if (art != null) {
+ map.put(branchId, art.getArtId());
+ } else {
+ map.put(branchId, -1);
+ }
+ }
+
+ private static void addMergeBranches(List<Triplet<Integer, Integer, Integer>> srcDestMerge, MergeBranch mergeBranch) throws OseeCoreException {
+ Integer src = mergeBranch.getSourceBranch() != null ? mergeBranch.getSourceBranch().getId() : -1;
+ Integer dest = mergeBranch.getDestinationBranch() != null ? mergeBranch.getDestinationBranch().getId() : -1;
+ Integer merge = mergeBranch.getId();
+ srcDestMerge.add(new Triplet<Integer, Integer, Integer>(src, dest, merge));
+ }
+
+ private static void addTxRecord(Map<Integer, Integer> map, Integer branchId, TransactionRecord toAdd) {
+ if (toAdd != null) {
+ map.put(branchId, toAdd.getId());
+ } else {
+ map.put(branchId, -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.loadMap(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.loadTripletList(message.getMergeBranches(), store, Fields.SRC_DEST_MERGE);
+ }
+
+ public static void loadStore(PropertyStore store, AbstractBranchCacheMessage message) throws OseeCoreException {
+ 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.putMap(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/BranchCommitRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitRequest.java
new file mode 100644
index 00000000000..29d02bf2591
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitRequest.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchCommitRequest {
+
+ private final int userArtifact;
+ private final int sourceBranch;
+ private final int destinationBranch;
+ private final boolean isArchiveAllowed;
+
+ public BranchCommitRequest(int userArtifact, int sourceBranch, int destinationBranch, boolean isArchiveAllowed) {
+ super();
+ this.userArtifact = userArtifact;
+ this.sourceBranch = sourceBranch;
+ this.destinationBranch = destinationBranch;
+ this.isArchiveAllowed = isArchiveAllowed;
+ }
+
+ public int getUserArtId() {
+ return userArtifact;
+ }
+
+ public int getSourceBranchId() {
+ return sourceBranch;
+ }
+
+ public int getDestinationBranchId() {
+ return destinationBranch;
+ }
+
+ public boolean isArchiveAllowed() {
+ return isArchiveAllowed;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitResponse.java
new file mode 100644
index 00000000000..fa085da96cd
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitResponse.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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 org.eclipse.osee.framework.core.model.TransactionRecord;
+
+/**
+ * @author Megumi Telles
+ */
+public class BranchCommitResponse {
+ private TransactionRecord transactionRecord;
+
+ public BranchCommitResponse() {
+ this.transactionRecord = null;
+ }
+
+ public TransactionRecord getTransaction() {
+ return transactionRecord;
+ }
+
+ public void setTransaction(TransactionRecord transactionRecord) {
+ this.transactionRecord = transactionRecord;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationRequest.java
new file mode 100644
index 00000000000..f859b5d4e18
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationRequest.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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 org.eclipse.osee.framework.core.enums.BranchType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchCreationRequest {
+ private final String branchName;
+ private final int parentBranchId;
+ private final int associatedArtifactId;
+
+ private final BranchType branchType;
+ private final int sourceTransactionId;
+ private final String branchGuid;
+
+ private final int authorId;
+
+ private final String creationComment;
+ private final int populateBaseTxFromAddressingQueryId;
+ private final int destinationBranchId;
+
+ public BranchCreationRequest(BranchType branchType, int sourceTransactionId, int parentBranchId, String branchGuid, String branchName, int associatedArtifactId, int authorId, String creationComment, int populateBaseTxFromAddressingQueryId, int destinationBranchId) {
+ this.parentBranchId = parentBranchId;
+ this.branchName = branchName;
+ this.associatedArtifactId = associatedArtifactId;
+ this.branchType = branchType;
+ this.sourceTransactionId = sourceTransactionId;
+ this.branchGuid = branchGuid;
+ this.authorId = authorId;
+ this.creationComment = creationComment;
+ this.populateBaseTxFromAddressingQueryId = populateBaseTxFromAddressingQueryId;
+ this.destinationBranchId = destinationBranchId;
+ }
+
+ public String getBranchName() {
+ return branchName;
+ }
+
+ public int getParentBranchId() {
+ return parentBranchId;
+ }
+
+ public int getAssociatedArtifactId() {
+ return associatedArtifactId;
+ }
+
+ public BranchType getBranchType() {
+ return branchType;
+ }
+
+ public int getSourceTransactionId() {
+ return sourceTransactionId;
+ }
+
+ public String getBranchGuid() {
+ return branchGuid;
+ }
+
+ public int getAuthorId() {
+ return authorId;
+ }
+
+ public String getCreationComment() {
+ return creationComment;
+ }
+
+ public int getPopulateBaseTxFromAddressingQueryId() {
+ return populateBaseTxFromAddressingQueryId;
+ }
+
+ public int getDestinationBranchId() {
+ return destinationBranchId;
+ }
+
+ @Override
+ public String toString() {
+ return "Branch [associatedArtifactId=" + associatedArtifactId + ", branchGuid=" + branchGuid + ", branchType=" + branchType + ", name=" + branchName + ", parentBranchId=" + parentBranchId + ", parentTransactionId=" + sourceTransactionId + "]";
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationResponse.java
new file mode 100644
index 00000000000..e48e90f96e3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationResponse.java
@@ -0,0 +1,31 @@
+/*
+ * Created on Dec 1, 2009
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.core.message;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchCreationResponse {
+
+ private int branchId;
+
+ public BranchCreationResponse(int branchId) {
+ this.branchId = branchId;
+ }
+
+ public int getBranchId() {
+ return branchId;
+ }
+
+ public void setBranchId(int branchId) {
+ this.branchId = branchId;
+ }
+
+ @Override
+ public String toString() {
+ return "BranchCreationResponse [branchId=" + branchId + "]";
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java
new file mode 100644
index 00000000000..bad237baec2
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java
@@ -0,0 +1,77 @@
+package org.eclipse.osee.framework.core.message;
+
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.enums.StorageState;
+
+public final class BranchRow {
+ private final int branchId;
+ private final String branchGuid;
+
+ private final String branchName;
+ private final BranchType branchType;
+ private final BranchState branchState;
+ private final BranchArchivedState branchArchived;
+ private StorageState storageState;
+
+ // TODO remove
+ public void setStorageState(StorageState storageState) {
+ this.storageState = storageState;
+ }
+
+ public BranchRow(int branchId, String branchGuid, String branchName, BranchType branchType, BranchState branchState, BranchArchivedState branchArchived, StorageState storageState) {
+ super();
+ this.branchId = branchId;
+ this.branchGuid = branchGuid;
+ this.branchName = branchName;
+ this.branchType = branchType;
+ this.branchState = branchState;
+ this.branchArchived = branchArchived;
+ this.storageState = storageState;
+ }
+
+ public int getBranchId() {
+ return branchId;
+ }
+
+ public String getBranchGuid() {
+ return branchGuid;
+ }
+
+ public String getBranchName() {
+ return branchName;
+ }
+
+ public BranchType getBranchType() {
+ return branchType;
+ }
+
+ public BranchState getBranchState() {
+ return branchState;
+ }
+
+ public BranchArchivedState getBranchArchived() {
+ return branchArchived;
+ }
+
+ public StorageState getStorageState() {
+ return storageState;
+ }
+
+ public String[] toArray() {
+ return new String[] {getBranchArchived().name(), getBranchGuid(), String.valueOf(getBranchId()), getBranchName(),
+ getBranchState().name(), getBranchType().name(), getStorageState().name()};
+ }
+
+ public static BranchRow fromArray(String[] data) {
+ BranchArchivedState archived = BranchArchivedState.valueOf(data[0]);
+ String branchGuid = data[1];
+ int branchId = Integer.valueOf(data[2]);
+ String branchName = data[3];
+ BranchState branchState = BranchState.valueOf(data[4]);
+ BranchType branchType = BranchType.valueOf(data[5]);
+ StorageState storageState = StorageState.valueOf(data[6]);
+ return new BranchRow(branchId, branchGuid, branchName, branchType, branchState, archived, storageState);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/CacheUpdateRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/CacheUpdateRequest.java
new file mode 100644
index 00000000000..22e8648f059
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/CacheUpdateRequest.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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 java.util.Collections;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+
+/**
+ * @author Roberto E. Escobar
+ * @author Jeff C. Phillips
+ */
+public class CacheUpdateRequest {
+
+ private final OseeCacheEnum cacheId;
+ private final Collection<Integer> itemsIds;
+
+ public CacheUpdateRequest(OseeCacheEnum cacheId) {
+ this(cacheId, Collections.<Integer> emptyList());
+ }
+
+ public CacheUpdateRequest(OseeCacheEnum cacheId, Collection<Integer> itemsIds) {
+ this.cacheId = cacheId;
+ this.itemsIds = itemsIds;
+ }
+
+ public OseeCacheEnum getCacheId() {
+ return cacheId;
+ }
+
+ public Collection<Integer> getItemsIds() {
+ return itemsIds;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchArchiveStateRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchArchiveStateRequest.java
new file mode 100644
index 00000000000..72502d32035
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchArchiveStateRequest.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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 org.eclipse.osee.framework.core.enums.BranchArchivedState;
+
+/**
+ * @author Megumi Telles
+ */
+public class ChangeBranchArchiveStateRequest {
+ private final int branchId;
+ private final BranchArchivedState state;
+
+ public ChangeBranchArchiveStateRequest(int branchId, BranchArchivedState state) {
+ super();
+ this.branchId = branchId;
+ this.state = state;
+ }
+
+ public int getBranchId() {
+ return branchId;
+ }
+
+ public BranchArchivedState getState() {
+ return state;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchStateRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchStateRequest.java
new file mode 100644
index 00000000000..4cc115076ed
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchStateRequest.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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 org.eclipse.osee.framework.core.enums.BranchState;
+
+/**
+ * @author Megumi Telles
+ */
+public class ChangeBranchStateRequest {
+ private final int branchId;
+ private final BranchState state;
+
+ public ChangeBranchStateRequest(int branchId, BranchState state) {
+ super();
+ this.branchId = branchId;
+ this.state = state;
+ }
+
+ public int getBranchId() {
+ return branchId;
+ }
+
+ public BranchState getState() {
+ return state;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchTypeRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchTypeRequest.java
new file mode 100644
index 00000000000..02281aa32bd
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeBranchTypeRequest.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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 org.eclipse.osee.framework.core.enums.BranchType;
+
+/**
+ * @author Megumi Telles
+ */
+public class ChangeBranchTypeRequest {
+ private final int branchId;
+ private final BranchType type;
+
+ public ChangeBranchTypeRequest(int branchId, BranchType type) {
+ super();
+ this.branchId = branchId;
+ this.type = type;
+ }
+
+ public int getBranchId() {
+ return branchId;
+ }
+
+ public BranchType getType() {
+ return type;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeItem.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeItem.java
new file mode 100644
index 00000000000..2325e3e9679
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeItem.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.osee.framework.core.enums.ModificationType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class ChangeItem {
+ private final int artId;
+ private final int itemId;
+ private final int itemTypeId;
+
+ private final ChangeVersion baseEntry;
+ private final ChangeVersion firstChange;
+ private final ChangeVersion currentEntry;
+ private final ChangeVersion destinationEntry;
+ private final ChangeVersion netEntry;
+
+ protected ChangeItem(int itemId, int itemTypeId, int artId, long currentSourceGammaId, ModificationType currentSourceModType) {
+ super();
+ this.itemId = itemId;
+ this.itemTypeId = itemTypeId;
+ this.artId = artId;
+
+ this.currentEntry = new ChangeVersion(currentSourceGammaId, currentSourceModType);
+
+ this.baseEntry = new ChangeVersion();
+ this.firstChange = new ChangeVersion();
+ this.destinationEntry = new ChangeVersion();
+ this.netEntry = new ChangeVersion();
+ }
+
+ public int getArtId() {
+ return artId;
+ }
+
+ public int getItemId() {
+ return itemId;
+ }
+
+ public int getItemTypeId() {
+ return itemTypeId;
+ }
+
+ public ChangeVersion getBaselineVersion() {
+ return baseEntry;
+ }
+
+ public ChangeVersion getFirstNonCurrentChange() {
+ return firstChange;
+ }
+
+ public ChangeVersion getCurrentVersion() {
+ return currentEntry;
+ }
+
+ public ChangeVersion getDestinationVersion() {
+ return destinationEntry;
+ }
+
+ public ChangeVersion getNetChange() {
+ return netEntry;
+ }
+
+ @Override
+ public String toString() {
+ return String.format(
+ "ChangeItem - itemId:[%s] artId:%s typeId:%s base:%s first:%s current:%s destination:%s net:%s", itemId,
+ getArtId(), getItemTypeId(), getBaselineVersion(), getFirstNonCurrentChange(), getCurrentVersion(),
+ getDestinationVersion(), getNetChange());
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeItemUtil.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeItemUtil.java
new file mode 100644
index 00000000000..c3aab1b92c0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeItemUtil.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.util.Conditions;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ChangeItemUtil {
+
+ private ChangeItemUtil() {
+ }
+
+ public static ChangeVersion getStartingVersion(ChangeItem item) throws OseeCoreException {
+ if (item == null) {
+ throw new OseeArgumentException("ChangeItem cannot be null");
+ }
+ ChangeVersion toReturn = item.getBaselineVersion();
+ if (!toReturn.isValid()) {
+ toReturn = item.getFirstNonCurrentChange();
+ if (!toReturn.isValid()) {
+ toReturn = item.getCurrentVersion();
+ if (!toReturn.isValid()) {
+ throw new OseeStateException(String.format("Cannot find a valid starting point for change item: %s",
+ item));
+ }
+ }
+ }
+ return toReturn;
+ }
+
+ public static void copy(ChangeVersion source, ChangeVersion dest) throws OseeCoreException{
+ Conditions.checkNotNull(source, "source");
+ Conditions.checkNotNull(dest, "Dest");
+
+ dest.setGammaId(source.getGammaId());
+ dest.setModType(source.getModType());
+ dest.setValue(source.getValue());
+ }
+
+ public static boolean isModType(ChangeVersion changeVersion, ModificationType matchModType) {
+ return changeVersion != null && changeVersion.getModType() == matchModType;
+ }
+
+ public static boolean isNew(ChangeVersion changeVersion) {
+ return isModType(changeVersion, ModificationType.NEW);
+ }
+
+ public static boolean isIntroduced(ChangeVersion changeVersion) {
+ return isModType(changeVersion, ModificationType.INTRODUCED);
+ }
+
+ public static boolean isDeleted(ChangeVersion changeVersion) {
+ return changeVersion != null && changeVersion.getModType() != null && changeVersion.getModType().isDeleted();
+ }
+
+ public static boolean wasNewOnSource(ChangeItem changeItem) {
+ return isNew(changeItem.getFirstNonCurrentChange()) || isNew(changeItem.getCurrentVersion());
+ }
+
+ public static boolean wasIntroducedOnSource(ChangeItem changeItem) {
+ return isIntroduced(changeItem.getFirstNonCurrentChange()) || isIntroduced(changeItem.getCurrentVersion());
+ }
+
+ public static boolean wasNewOrIntroducedOnSource(ChangeItem changeItem) {
+ return wasNewOnSource(changeItem) || wasIntroducedOnSource(changeItem);
+ }
+
+ public static boolean isAlreadyOnDestination(ChangeItem changeItem) {
+ return areGammasEqual(changeItem.getCurrentVersion(), changeItem.getDestinationVersion()) && //
+ isDeleted(changeItem.getCurrentVersion()) == isDeleted(changeItem.getDestinationVersion());
+ }
+
+ public static boolean areGammasEqual(ChangeVersion object1, ChangeVersion object2) {
+ boolean result = false;
+ if (object1 == null && object2 == null) {
+ result = true;
+ } else if (object1 != null && object2 != null) {
+ if (object1.getGammaId() == object2.getGammaId()) {
+ result = true;
+ } else if (object1.getGammaId() != null) {
+ result = object1.getGammaId().equals(object2.getGammaId());
+ }
+ }
+ return result;
+ }
+
+ public static boolean isIgnoreCase(ChangeItem changeItem) {
+ return //
+ wasCreatedAndDeleted(changeItem) || //
+ isAlreadyOnDestination(changeItem) || //
+ isDeletedAndDoesNotExistInDestination(changeItem) || //
+ hasBeenDeletedInDestination(changeItem) || //
+ isDestinationEqualOrNewerThanCurrent(changeItem);
+ }
+
+ public static boolean wasCreatedAndDeleted(ChangeItem changeItem) {
+ return wasNewOrIntroducedOnSource(changeItem) && isDeleted(changeItem.getCurrentVersion());
+ }
+
+ public static boolean isDeletedAndDoesNotExistInDestination(ChangeItem changeItem) {
+ return !changeItem.getDestinationVersion().isValid() && isDeleted(changeItem.getCurrentVersion());
+ }
+
+ public static boolean hasBeenDeletedInDestination(ChangeItem changeItem) {
+ return changeItem.getDestinationVersion().isValid() && isDeleted(changeItem.getDestinationVersion());
+ }
+
+ public static boolean isDestinationEqualOrNewerThanCurrent(ChangeItem changeItem) {
+ return (isNew(changeItem.getCurrentVersion()) || isIntroduced(changeItem.getCurrentVersion())) && changeItem.getDestinationVersion().isValid();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeReportRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeReportRequest.java
new file mode 100644
index 00000000000..63702b2f614
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeReportRequest.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ChangeReportRequest {
+ private final int srcTx;
+ private final int destTx;
+
+ public ChangeReportRequest(int srcTx, int destTx) {
+ super();
+ this.srcTx = srcTx;
+ this.destTx = destTx;
+ }
+
+ public int getSourceTx() {
+ return srcTx;
+ }
+
+ public int getDestinationTx() {
+ return destTx;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeReportResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeReportResponse.java
new file mode 100644
index 00000000000..48a12ce28cc
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeReportResponse.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ChangeReportResponse {
+
+ private final List<ChangeItem> changeItems;
+
+ public ChangeReportResponse() {
+ super();
+ this.changeItems = new ArrayList<ChangeItem>();
+ }
+
+ public void setChangeItems(Collection<ChangeItem> items) {
+ this.changeItems.addAll(items);
+ }
+
+ public void addItem(ChangeItem item) {
+ this.changeItems.add(item);
+ }
+
+ public List<ChangeItem> getChangeItems() {
+ return changeItems;
+ }
+
+ public boolean wasSuccessful() {
+ return !changeItems.isEmpty();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeVersion.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeVersion.java
new file mode 100644
index 00000000000..2f10b3df6d6
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ChangeVersion.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.osee.framework.core.enums.ModificationType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class ChangeVersion {
+ private Long gammaId;
+ private ModificationType modType;
+ private String value;
+
+ public ChangeVersion() {
+ this(null, null, null);
+ }
+
+ public ChangeVersion(Long gammaId, ModificationType modType) {
+ this(null, gammaId, modType);
+ }
+
+ public ChangeVersion(String value, Long gammaId, ModificationType modType) {
+ super();
+ this.value = value;
+ this.gammaId = gammaId;
+ this.modType = modType;
+ }
+
+ public Long getGammaId() {
+ return gammaId;
+ }
+
+ public ModificationType getModType() {
+ return modType;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setGammaId(Long gammaId) {
+ this.gammaId = gammaId;
+ }
+
+ public void setModType(ModificationType modType) {
+ this.modType = modType;
+ }
+
+ public boolean isValid() {
+ return getModType() != null && getGammaId() != null;// && getTransactionNumber() != null;
+ }
+
+ public void copy(ChangeVersion item) {
+ setGammaId(item.getGammaId());
+ setModType(item.getModType());
+ setValue(item.getValue());
+ }
+
+ @Override
+ public String toString() {
+ return String.format("[%s,%s]", getGammaId(), getModType());
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (gammaId == null ? 0 : gammaId.hashCode());
+ result = prime * result + (modType == null ? 0 : modType.hashCode());
+ result = prime * result + (value == null ? 0 : value.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ChangeVersion other = (ChangeVersion) obj;
+ if (gammaId == null) {
+ if (other.gammaId != null) {
+ return false;
+ }
+ } else if (!gammaId.equals(other.gammaId)) {
+ return false;
+ }
+ if (modType == null) {
+ if (other.modType != null) {
+ return false;
+ }
+ } else if (!modType.equals(other.modType)) {
+ return false;
+ }
+ if (value == null) {
+ if (other.value != null) {
+ return false;
+ }
+ } else if (!value.equals(other.value)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingService.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingService.java
new file mode 100644
index 00000000000..029165a75e3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingService.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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;
+
+import java.io.OutputStream;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface IOseeModelingService {
+
+ void importOseeTypes(IProgressMonitor monitor, boolean isInitializing, OseeImportModelRequest request, OseeImportModelResponse response) throws OseeCoreException;
+
+ void exportOseeTypes(IProgressMonitor monitor, OutputStream outputStream) throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingServiceProvider.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingServiceProvider.java
new file mode 100644
index 00000000000..503537ab69f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingServiceProvider.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface IOseeModelingServiceProvider {
+
+ IOseeModelingService getOseeModelingService() throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeEnumTypeCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeEnumTypeCacheUpdateResponse.java
new file mode 100644
index 00000000000..937642dfb65
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeEnumTypeCacheUpdateResponse.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.OseeEnumEntry;
+import org.eclipse.osee.framework.core.model.type.OseeEnumType;
+
+/**
+ * @author Roberto E. Escobar
+ * @author Ryan D. Brooks
+ */
+public class OseeEnumTypeCacheUpdateResponse {
+ private final List<String[]> enumTypeRows;
+ private final List<String[]> enumEntryRows;
+
+ public OseeEnumTypeCacheUpdateResponse(List<String[]> enumTypeRows, List<String[]> enumEntryRows) {
+ this.enumTypeRows = enumTypeRows;
+ this.enumEntryRows = enumEntryRows;
+ }
+
+ public List<String[]> getEnumTypeRows() {
+ return enumTypeRows;
+ }
+
+ public List<String[]> getEnumEntryRows() {
+ return enumEntryRows;
+ }
+
+ public static OseeEnumTypeCacheUpdateResponse fromCache(Collection<OseeEnumType> types) throws OseeCoreException {
+ List<String[]> enumTypeRows = new ArrayList<String[]>();
+ List<String[]> enumEntryRows = new ArrayList<String[]>();
+ for (OseeEnumType type : types) {
+ enumTypeRows.add(new String[] {String.valueOf(type.getId()), type.getStorageState().toString(),
+ type.getGuid(), type.getName()});
+ for (OseeEnumEntry entry : type.values()) {
+ enumEntryRows.add(new String[] {type.getGuid(), entry.getGuid(), entry.getName(),
+ String.valueOf(entry.ordinal())});
+ }
+ }
+ return new OseeEnumTypeCacheUpdateResponse(enumTypeRows, enumEntryRows);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelRequest.java
new file mode 100644
index 00000000000..524f29ca029
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelRequest.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OseeImportModelRequest {
+
+ private final String model;
+ private final String modelName;
+ private final boolean isPersistAllowed;
+ private final boolean createTypeChangeReport;
+ private final boolean createCompareReport;
+
+ public OseeImportModelRequest(String modelName, String model, boolean createTypeChangeReport, boolean createCompareReport, boolean isPersistAllowed) {
+ this.modelName = modelName;
+ this.model = model;
+ this.isPersistAllowed = isPersistAllowed;
+ this.createCompareReport = createCompareReport;
+ this.createTypeChangeReport = createTypeChangeReport;
+ }
+
+ public String getModel() {
+ return model;
+ }
+
+ public boolean isCreateTypeChangeReport() {
+ return createTypeChangeReport;
+ }
+
+ public boolean isCreateCompareReport() {
+ return createCompareReport;
+ }
+
+ public boolean isPersistAllowed() {
+ return isPersistAllowed;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelResponse.java
new file mode 100644
index 00000000000..c70404a7d60
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelResponse.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.List;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OseeImportModelResponse {
+
+ private final List<TableData> reportData;
+ private boolean wasPersisted;
+ private String comparisonSnapshotModel;
+ private String comparisonSnapshotModelName;
+
+ public OseeImportModelResponse() {
+ this.wasPersisted = false;
+ this.reportData = new ArrayList<TableData>();
+ }
+
+ public List<TableData> getReportData() {
+ return reportData;
+ }
+
+ public void setReportData(Collection<TableData> data) {
+ reportData.addAll(data);
+ }
+
+ public boolean wasPersisted() {
+ return wasPersisted;
+ }
+
+ public void setPersisted(boolean wasPersisted) {
+ this.wasPersisted = wasPersisted;
+ }
+
+ public String getComparisonSnapshotModel() {
+ return comparisonSnapshotModel;
+ }
+
+ public String getComparisonSnapshotModelName() {
+ return comparisonSnapshotModelName;
+ }
+
+ public void setComparisonSnapshotModel(String comparisonSnapshotModel) {
+ this.comparisonSnapshotModel = comparisonSnapshotModel;
+ }
+
+ public void setComparisonSnapshotModelName(String comparisonSnapshotModelName) {
+ this.comparisonSnapshotModelName = comparisonSnapshotModelName;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/PurgeBranchRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/PurgeBranchRequest.java
new file mode 100644
index 00000000000..45facf8070a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/PurgeBranchRequest.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * @author Jeff C. Phillips
+ * @author Megumi Telles
+ */
+public class PurgeBranchRequest {
+ private final int branchId;
+
+ public PurgeBranchRequest(int branchId) {
+ super();
+ this.branchId = branchId;
+ }
+
+ public int getBranchId() {
+ return branchId;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationChangeItem.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationChangeItem.java
new file mode 100644
index 00000000000..57006c4f0a2
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationChangeItem.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.osee.framework.core.enums.ModificationType;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class RelationChangeItem extends ChangeItem {
+ private final int bArtId;
+ private final String rationale;
+
+ public RelationChangeItem(int relLinkId, int relTypeId, long currentSourceGammaId, ModificationType currentSourceModType, int aArtId, int bArtId, String rationale) {
+ super(relLinkId, relTypeId, aArtId, currentSourceGammaId, currentSourceModType);
+
+ this.getCurrentVersion().setValue(rationale);
+ this.bArtId = bArtId;
+ this.rationale = rationale;
+ }
+
+ public int getBArtId() {
+ return bArtId;
+ }
+
+ public String getRationale() {
+ return rationale;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationTypeCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationTypeCacheUpdateResponse.java
new file mode 100644
index 00000000000..7f9646e3da3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationTypeCacheUpdateResponse.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * 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.List;
+import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity;
+import org.eclipse.osee.framework.core.enums.StorageState;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.RelationType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RelationTypeCacheUpdateResponse {
+
+ private final List<RelationTypeRow> rows;
+
+ public RelationTypeCacheUpdateResponse(List<RelationTypeRow> rows) {
+ this.rows = rows;
+ }
+
+ public List<RelationTypeRow> getRelationTypeRows() {
+ return rows;
+ }
+
+ public static final class RelationTypeRow {
+ private final int id;
+ private final String name;
+ private final String guid;
+ private StorageState storageState;
+
+ private final String sideAName;
+ private final String sideBName;
+ private final int artifactTypeSideA;
+ private final int artifactTypeSideB;
+ private final RelationTypeMultiplicity multiplicity;
+ private final String defaultOrderTypeGuid;
+
+ public RelationTypeRow(int id, String name, String guid, StorageState storageState, String sideAName, String sideBName, int artifactTypeSideA, int artifactTypeSideB, RelationTypeMultiplicity multiplicity, String defaultOrderTypeGuid) {
+ super();
+ this.id = id;
+ this.name = name;
+ this.guid = guid;
+ this.storageState = storageState;
+ this.sideAName = sideAName;
+ this.sideBName = sideBName;
+ this.artifactTypeSideA = artifactTypeSideA;
+ this.artifactTypeSideB = artifactTypeSideB;
+ this.multiplicity = multiplicity;
+ this.defaultOrderTypeGuid = defaultOrderTypeGuid;
+ }
+
+ public int getArtifactTypeSideA() {
+ return artifactTypeSideA;
+ }
+
+ public int getArtifactTypeSideB() {
+ return artifactTypeSideB;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public StorageState getStorageState() {
+ return storageState;
+ }
+
+ public void setStorageState(StorageState storageState) {
+ this.storageState = storageState;
+ }
+
+ public String getSideBName() {
+ return sideBName;
+ }
+
+ public String getSideAName() {
+ return sideAName;
+ }
+
+ public String getDefaultOrderTypeGuid() {
+ return defaultOrderTypeGuid;
+ }
+
+ public RelationTypeMultiplicity getMultiplicity() {
+ return multiplicity;
+ }
+
+ public String[] toArray() {
+ return new String[] {String.valueOf(getId()), getGuid(), getName(), getStorageState().name(), getSideAName(),
+ getSideBName(), String.valueOf(getArtifactTypeSideA()), String.valueOf(getArtifactTypeSideB()),
+ getMultiplicity().name(), getDefaultOrderTypeGuid()};
+ }
+
+ public static RelationTypeRow fromArray(String[] data) {
+ int index = 0;
+
+ int id = Integer.valueOf(data[index++]);
+ String guid = data[index++];
+ String name = data[index++];
+ StorageState storageState = StorageState.valueOf(data[index++]);
+
+ String sideAName = data[index++];
+ String sideBName = data[index++];
+ int artifactTypeSideA = Integer.valueOf(data[index++]);
+ int artifactTypeSideB = Integer.valueOf(data[index++]);
+ RelationTypeMultiplicity multiplicity = RelationTypeMultiplicity.valueOf(data[index++]);
+ String defaultOrderTypeGuid = data[index++];
+
+ return new RelationTypeRow(id, name, guid, storageState, sideAName, sideBName, artifactTypeSideA,
+ artifactTypeSideB, multiplicity, defaultOrderTypeGuid);
+ }
+ }
+
+ public static RelationTypeCacheUpdateResponse fromCache(Collection<RelationType> types) throws OseeCoreException {
+ List<RelationTypeRow> rows = new ArrayList<RelationTypeRow>();
+ for (RelationType item : types) {
+ rows.add(new RelationTypeRow(item.getId(), item.getName(), item.getGuid(), item.getStorageState(),
+ item.getSideAName(), item.getSideBName(), item.getArtifactTypeSideA().getId(),
+ item.getArtifactTypeSideB().getId(), item.getMultiplicity(), item.getDefaultOrderTypeGuid()));
+ }
+ return new RelationTypeCacheUpdateResponse(rows);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TableData.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TableData.java
new file mode 100644
index 00000000000..5ecf48a87db
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TableData.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.List;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TableData {
+
+ private final String title;
+ private final String[] columns;
+ private final List<String[]> rows;
+
+ public TableData(String title, String[] columns, List<String[]> rows) {
+ this.title = title;
+ this.columns = columns;
+ this.rows = rows;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public String[] getColumns() {
+ return columns;
+ }
+
+ public List<String[]> getRows() {
+ return rows;
+ }
+
+}
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
new file mode 100644
index 00000000000..1037efe3846
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TransactionCacheUpdateResponse.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.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;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TransactionCacheUpdateResponse {
+
+ private final List<TransactionRecord> rows;
+
+ public TransactionCacheUpdateResponse(List<TransactionRecord> rows) {
+ this.rows = rows;
+ }
+
+ public List<TransactionRecord> getTxRows() {
+ return rows;
+ }
+
+ public static TransactionCacheUpdateResponse fromCache(TransactionRecordFactory factory, Collection<TransactionRecord> types) throws OseeCoreException {
+ 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()));
+ }
+ return new TransactionCacheUpdateResponse(rows);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/Activator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/Activator.java
new file mode 100644
index 00000000000..061e43e1244
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/Activator.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.osee.framework.core.enums.OseeServiceTrackerId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.BranchFactory;
+import org.eclipse.osee.framework.core.model.OseeModelFactoryService;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
+import org.eclipse.osee.framework.core.model.type.ArtifactTypeFactory;
+import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
+import org.eclipse.osee.framework.core.model.type.OseeEnumTypeFactory;
+import org.eclipse.osee.framework.core.model.type.RelationTypeFactory;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.core.services.IOseeCachingServiceProvider;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class Activator implements BundleActivator, IOseeCachingServiceProvider, IOseeModelFactoryServiceProvider {
+ public static final String PLUGIN_ID = "org.eclipse.osee.framework.core.model";
+ private static Activator instance = null;
+ private BundleContext bundleContext;
+
+ private final List<ServiceRegistration> services;
+ private final Map<OseeServiceTrackerId, ServiceTracker> mappedTrackers;
+
+ public Activator() {
+ services = new ArrayList<ServiceRegistration>();
+ mappedTrackers = new HashMap<OseeServiceTrackerId, ServiceTracker>();
+ }
+
+ public void start(BundleContext context) throws Exception {
+ instance = this;
+ instance.bundleContext = context;
+
+ IOseeModelFactoryService factories = createFactoryService();
+ IDataTranslationService service = new DataTranslationServiceFactory().createService(this, this);
+
+ createService(context, IOseeModelFactoryService.class, factories);
+ createService(context, IDataTranslationService.class, service);
+
+ createServiceTracker(context, IOseeCachingService.class, OseeServiceTrackerId.OSEE_CACHING_SERVICE);
+ createServiceTracker(context, IOseeModelFactoryService.class, OseeServiceTrackerId.OSEE_MODEL_FACTORY);
+ }
+
+ private IOseeModelFactoryService createFactoryService() {
+ return new OseeModelFactoryService(new BranchFactory(), new TransactionRecordFactory(),
+ new ArtifactTypeFactory(), new AttributeTypeFactory(), new RelationTypeFactory(), new OseeEnumTypeFactory());
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ for (ServiceRegistration service : services) {
+ service.unregister();
+ }
+
+ for (ServiceTracker tracker : mappedTrackers.values()) {
+ tracker.close();
+ }
+ services.clear();
+ mappedTrackers.clear();
+
+ instance.bundleContext = null;
+ instance = null;
+ }
+
+ public static BundleContext getBundleContext() {
+ return instance.bundleContext;
+ }
+
+ private void createService(BundleContext context, Class<?> serviceInterface, Object serviceImplementation) {
+ services.add(context.registerService(serviceInterface.getName(), serviceImplementation, null));
+ }
+
+ private void createServiceTracker(BundleContext context, Class<?> clazz, OseeServiceTrackerId trackerId) {
+ ServiceTracker tracker = new ServiceTracker(context, clazz.getName(), null);
+ tracker.open();
+ mappedTrackers.put(trackerId, tracker);
+ }
+
+ @Override
+ public IOseeCachingService getOseeCachingService() {
+ return getTracker(OseeServiceTrackerId.OSEE_CACHING_SERVICE, IOseeCachingService.class);
+ }
+
+ private <T> T getTracker(OseeServiceTrackerId trackerId, Class<T> clazz) {
+ ServiceTracker tracker = mappedTrackers.get(trackerId);
+ Object service = tracker.getService();
+ return clazz.cast(service);
+ }
+
+ @Override
+ public IOseeModelFactoryService getOseeFactoryService() throws OseeCoreException {
+ return getTracker(OseeServiceTrackerId.OSEE_MODEL_FACTORY, IOseeModelFactoryService.class);
+ }
+
+ public static Activator getInstance() {
+ return instance;
+ }
+}
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
new file mode 100644
index 00000000000..a418df63fdb
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * 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;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.ITranslatorId;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataTranslationService implements IDataTranslationService {
+
+ private final Map<ITranslatorId, ITranslator<?>> translators;
+
+ public DataTranslationService() {
+ this.translators = new HashMap<ITranslatorId, ITranslator<?>>();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T convert(PropertyStore propertyStore, ITranslatorId txId) throws OseeCoreException {
+ Conditions.checkNotNull(txId, "translator Id");
+
+ T object = null;
+ if (propertyStore != null && !propertyStore.isEmpty()) {
+ ITranslator<?> translator = getTranslator(txId);
+ object = (T) translator.convert(propertyStore);
+ }
+ return object;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> PropertyStore convert(T object, ITranslatorId txId) throws OseeCoreException {
+ PropertyStore propertyStore = null;
+ if (object == null) {
+ propertyStore = new PropertyStore();
+ } else {
+ ITranslator<T> translator = (ITranslator<T>) getTranslator(txId);
+ propertyStore = translator.convert(object);
+ }
+ return propertyStore;
+ }
+
+ @Override
+ public ITranslator<?> getTranslator(ITranslatorId txId) throws OseeCoreException {
+ Conditions.checkNotNull(txId, "translator Id");
+ ITranslator<?> toReturn = translators.get(txId);
+ if (toReturn == null) {
+ throw new OseeStateException(String.format("Unable to find a match for translator id [%s]", txId));
+ }
+ return toReturn;
+
+ }
+
+ @Override
+ public boolean addTranslator(ITranslator<?> translator, ITranslatorId txId) throws OseeCoreException {
+ Conditions.checkNotNull(txId, "translator Id");
+ Conditions.checkNotNull(translator, "translator");
+ boolean wasAdded = false;
+ if (!translators.containsKey(txId)) {
+ translators.put(txId, translator);
+ wasAdded = true;
+ }
+ return wasAdded;
+ }
+
+ @Override
+ public boolean removeTranslator(ITranslatorId txId) throws OseeCoreException {
+ Conditions.checkNotNull(txId, "translator Id");
+ return translators.remove(txId) != null;
+ }
+
+ @Override
+ public Collection<ITranslatorId> getSupportedClasses() {
+ return new HashSet<ITranslatorId>(translators.keySet());
+ }
+
+ @Override
+ public <T> T convert(InputStream inputStream, ITranslatorId txId) throws OseeCoreException {
+ Conditions.checkNotNull(inputStream, "inputStream");
+ Conditions.checkNotNull(txId, "translator Id");
+
+ T toReturn = null;
+ PropertyStore propertyStore = new PropertyStore();
+ try {
+ propertyStore.load(inputStream);
+ toReturn = convert(propertyStore, txId);
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return toReturn;
+ }
+
+ @Override
+ public <T> InputStream convertToStream(T object, ITranslatorId txId) throws OseeCoreException {
+ PropertyStore propertyStore = convert(object, txId);
+ InputStream inputStream = null;
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ try {
+ propertyStore.save(buffer);
+ inputStream = new ByteArrayInputStream(buffer.toByteArray());
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return inputStream;
+ }
+}
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
new file mode 100644
index 00000000000..7312b8f4c5e
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+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;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCommitRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCommitResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCreationRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCreationResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.CacheUpdateRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeItemTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeReportRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeReportResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeVersionTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.OseeEnumTypeCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.OseeImportModelRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.OseeImportModelResponseTranslator;
+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.services.IOseeCachingServiceProvider;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+
+/**
+ * @author Roberto E. Escobar
+ * @author Jeff C. Phillips
+ */
+public class DataTranslationServiceFactory {
+
+ public DataTranslationServiceFactory() {
+ }
+
+ public IDataTranslationService createService(IOseeCachingServiceProvider cachingService, IOseeModelFactoryServiceProvider factoryProvider) throws OseeCoreException {
+ IDataTranslationService service = new DataTranslationService();
+
+ // service.addTranslator(new BasicArtifactTranslator(),
+ // CoreTranslatorId.ARTIFACT_METADATA);
+ // service.addTranslator(new BranchTranslator(service, factoryProvider),
+ // CoreTranslatorId.BRANCH);
+
+ // service.addTranslator(new ArtifactTypeTranslator(service,
+ // factoryProvider), CoreTranslatorId.ARTIFACT_TYPE);
+ // service.addTranslator(new AttributeTypeTranslator(service,
+ // factoryProvider), CoreTranslatorId.ATTRIBUTE_TYPE);
+ // service.addTranslator(new RelationTypeTranslator(service,
+ // factoryProvider), CoreTranslatorId.RELATION_TYPE);
+ // service.addTranslator(new OseeEnumEntryTranslator(factoryProvider),
+ // CoreTranslatorId.OSEE_ENUM_ENTRY);
+ // service.addTranslator(new OseeEnumTypeTranslator(service,
+ // factoryProvider), CoreTranslatorId.OSEE_ENUM_TYPE);
+
+ service.addTranslator(new TransactionRecordTranslator(factoryProvider), CoreTranslatorId.TRANSACTION_RECORD);
+
+ 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 BranchChangeTypeRequestTranslator(), CoreTranslatorId.CHANGE_BRANCH_TYPE);
+ service.addTranslator(new BranchChangeStateRequestTranslator(), CoreTranslatorId.CHANGE_BRANCH_STATE);
+ service.addTranslator(new BranchChangeArchivedStateRequestTranslator(),
+ CoreTranslatorId.CHANGE_BRANCH_ARCHIVE_STATE);
+
+ service.addTranslator(new ChangeVersionTranslator(), CoreTranslatorId.CHANGE_VERSION);
+ service.addTranslator(new ChangeItemTranslator(service), CoreTranslatorId.CHANGE_ITEM);
+ service.addTranslator(new ChangeReportRequestTranslator(), CoreTranslatorId.CHANGE_REPORT_REQUEST);
+ service.addTranslator(new ChangeReportResponseTranslator(service), CoreTranslatorId.CHANGE_REPORT_RESPONSE);
+ service.addTranslator(new PurgeBranchRequestTranslator(), CoreTranslatorId.PURGE_BRANCH_REQUEST);
+
+ 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(factoryProvider),
+ CoreTranslatorId.TX_CACHE_UPDATE_RESPONSE);
+
+ service.addTranslator(new ArtifactTypeCacheUpdateResponseTranslator(),
+ CoreTranslatorId.ARTIFACT_TYPE_CACHE_UPDATE_RESPONSE);
+
+ service.addTranslator(new AttributeTypeCacheUpdateResponseTranslator(factoryProvider),
+ CoreTranslatorId.ATTRIBUTE_TYPE_CACHE_UPDATE_RESPONSE);
+
+ service.addTranslator(new RelationTypeCacheUpdateResponseTranslator(),
+ CoreTranslatorId.RELATION_TYPE_CACHE_UPDATE_RESPONSE);
+
+ service.addTranslator(new OseeEnumTypeCacheUpdateResponseTranslator(),
+ CoreTranslatorId.OSEE_ENUM_TYPE_CACHE_UPDATE_RESPONSE);
+
+ service.addTranslator(new OseeImportModelRequestTranslator(), CoreTranslatorId.OSEE_IMPORT_MODEL_REQUEST);
+ service.addTranslator(new OseeImportModelResponseTranslator(service), CoreTranslatorId.OSEE_IMPORT_MODEL_RESPONSE);
+ service.addTranslator(new TableDataTranslator(), CoreTranslatorId.TABLE_DATA);
+ return service;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java
new file mode 100644
index 00000000000..530633d4660
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ArtifactTypeCacheUpdateResponse;
+import org.eclipse.osee.framework.core.message.ArtifactTypeCacheUpdateResponse.ArtifactTypeRow;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.TranslationUtil;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+import org.eclipse.osee.framework.jdk.core.type.Triplet;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactTypeCacheUpdateResponseTranslator implements ITranslator<ArtifactTypeCacheUpdateResponse> {
+
+ private static enum Fields {
+ ITEM_COUNT,
+ ITEM_ROW,
+ BASE_TO_SUPER_TYPES,
+ BASE_BRANCH_ATTR;
+ }
+
+ @Override
+ public ArtifactTypeCacheUpdateResponse convert(PropertyStore store) throws OseeCoreException {
+ List<ArtifactTypeRow> rows = new ArrayList<ArtifactTypeRow>();
+ Map<Integer, Integer[]> baseToSuper = new HashMap<Integer, Integer[]>();
+ List<Triplet<Integer, Integer, Integer>> artAttrs = new ArrayList<Triplet<Integer, Integer, Integer>>();
+
+ int rowCount = store.getInt(Fields.ITEM_COUNT.name());
+ for (int index = 0; index < rowCount; index++) {
+ String[] rowData = store.getArray(createKey(Fields.ITEM_ROW, index));
+ rows.add(ArtifactTypeRow.fromArray(rowData));
+ }
+
+ TranslationUtil.loadIntArrayMap(baseToSuper, store, Fields.BASE_TO_SUPER_TYPES);
+ TranslationUtil.loadTripletList(artAttrs, store, Fields.BASE_BRANCH_ATTR);
+ return new ArtifactTypeCacheUpdateResponse(rows, baseToSuper, artAttrs);
+ }
+
+ @Override
+ public PropertyStore convert(ArtifactTypeCacheUpdateResponse object) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ List<ArtifactTypeRow> rows = object.getArtTypeRows();
+ for (int index = 0; index < rows.size(); index++) {
+ ArtifactTypeRow row = rows.get(index);
+ store.put(createKey(Fields.ITEM_ROW, index), row.toArray());
+ }
+ store.put(Fields.ITEM_COUNT.name(), rows.size());
+
+ TranslationUtil.putIntArrayMap(store, Fields.BASE_TO_SUPER_TYPES, object.getBaseToSuperTypes());
+ TranslationUtil.putTripletList(store, Fields.BASE_BRANCH_ATTR, object.getAttributeTypes());
+ return store;
+ }
+
+ private String createKey(Fields key, int index) {
+ return String.format("%s_%s", key.name(), index);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java
new file mode 100644
index 00000000000..32cec8fe720
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.osee.framework.core.enums.StorageState;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.AttributeTypeCacheUpdateResponse;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.TranslationUtil;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeTypeCacheUpdateResponseTranslator implements ITranslator<AttributeTypeCacheUpdateResponse> {
+
+ private static enum Fields {
+ ROW_COUNT, ROW, ATTR_TO_ENUM;
+ }
+
+ private final IOseeModelFactoryServiceProvider provider;
+
+ public AttributeTypeCacheUpdateResponseTranslator(IOseeModelFactoryServiceProvider provider) {
+ this.provider = provider;
+ }
+
+ private AttributeTypeFactory getFactory() throws OseeCoreException {
+ return provider.getOseeFactoryService().getAttributeTypeFactory();
+ }
+
+ @Override
+ public AttributeTypeCacheUpdateResponse convert(PropertyStore store) throws OseeCoreException {
+ List<AttributeType> rows = new ArrayList<AttributeType>();
+ int rowCount = store.getInt(Fields.ROW_COUNT.name());
+ AttributeTypeFactory factory = getFactory();
+ for (int index = 0; index < rowCount; index++) {
+ String[] rowData = store.getArray(createKey(Fields.ROW, index));
+ rows.add(createfromArray(factory, rowData));
+ }
+ Map<Integer, Integer> attrToEnum = new HashMap<Integer, Integer>();
+ TranslationUtil.loadMap(attrToEnum, store, Fields.ATTR_TO_ENUM);
+ return new AttributeTypeCacheUpdateResponse(rows, attrToEnum);
+ }
+
+ @Override
+ public PropertyStore convert(AttributeTypeCacheUpdateResponse object) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ List<AttributeType> rows = object.getAttrTypeRows();
+ for (int index = 0; index < rows.size(); index++) {
+ AttributeType row = rows.get(index);
+ store.put(createKey(Fields.ROW, index), toArray(row));
+ }
+ store.put(Fields.ROW_COUNT.name(), rows.size());
+
+ TranslationUtil.putMap(store, Fields.ATTR_TO_ENUM, object.getAttrToEnums());
+ return store;
+ }
+
+ private String createKey(Fields key, int index) {
+ return String.format("%s_%s", key.name(), index);
+ }
+
+ private String[] toArray(AttributeType type) {
+ return new String[] {type.getAttributeProviderId(), type.getBaseAttributeTypeId(), type.getDefaultValue(),
+ type.getDescription(), type.getFileTypeExtension(), type.getGuid(), String.valueOf(type.getId()),
+ String.valueOf(type.getMaxOccurrences()), String.valueOf(type.getMinOccurrences()),
+ type.getStorageState().name(), type.getName(), type.getTaggerId()};
+ }
+
+ private AttributeType createfromArray(AttributeTypeFactory factory, String[] data) throws OseeCoreException {
+ String attributeProviderId = data[0];
+ String baseAttributeTypeId = data[1];
+ String defaultValue = data[2];
+ String description = data[3];
+ String fileTypeExtension = data[4];
+ String guid = data[5];
+ int uniqueId = Integer.valueOf(data[6]);
+ int maxOccurrences = Integer.valueOf(data[7]);
+ int minOccurrences = Integer.valueOf(data[8]);
+ StorageState storageState = StorageState.valueOf(data[9]);
+ String name = data[10];
+ String taggerId = data[11];
+
+ AttributeType type =
+ factory.create(guid, name, baseAttributeTypeId, attributeProviderId, fileTypeExtension, defaultValue,
+ minOccurrences, maxOccurrences, description, taggerId);
+ type.setId(uniqueId);
+ type.setStorageState(storageState);
+ return type;
+ }
+}
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
new file mode 100644
index 00000000000..0ad33eae1c0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheStoreRequestTranslator.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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.exception.OseeCoreException;
+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) throws OseeCoreException {
+ 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) throws OseeCoreException {
+ 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
new file mode 100644
index 00000000000..ee9035a9622
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheUpdateResponseTranslator.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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.exception.OseeCoreException;
+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) throws OseeCoreException {
+ BranchCacheUpdateResponse response = new BranchCacheUpdateResponse();
+ BranchCacheUpdateUtil.loadMessage(response, store);
+ return response;
+ }
+
+ @Override
+ public PropertyStore convert(BranchCacheUpdateResponse object) throws OseeCoreException {
+ 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/BranchChangeArchivedStateRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchChangeArchivedStateRequestTranslator.java
new file mode 100644
index 00000000000..cea63910121
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchChangeArchivedStateRequestTranslator.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.enums.BranchArchivedState;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeBranchArchiveStateRequest;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Megumi Telles
+ */
+public final class BranchChangeArchivedStateRequestTranslator implements ITranslator<ChangeBranchArchiveStateRequest> {
+
+ private static enum Entry {
+ BRANCH_ID,
+ BRANCH_ARCHIVED_STATE,
+ }
+
+ public ChangeBranchArchiveStateRequest convert(PropertyStore propertyStore) throws OseeCoreException {
+ int branchId = propertyStore.getInt(Entry.BRANCH_ID.name());
+ BranchArchivedState state = BranchArchivedState.valueOf(propertyStore.get(Entry.BRANCH_ARCHIVED_STATE.name()));
+ ChangeBranchArchiveStateRequest data = new ChangeBranchArchiveStateRequest(branchId, state);
+ return data;
+ }
+
+ public PropertyStore convert(ChangeBranchArchiveStateRequest data) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Entry.BRANCH_ID.name(), data.getBranchId());
+ store.put(Entry.BRANCH_ARCHIVED_STATE.name(), data.getState().name());
+ return store;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchChangeStateRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchChangeStateRequestTranslator.java
new file mode 100644
index 00000000000..039c834cf9c
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchChangeStateRequestTranslator.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.enums.BranchState;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeBranchStateRequest;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Megumi Telles
+ */
+public final class BranchChangeStateRequestTranslator implements ITranslator<ChangeBranchStateRequest> {
+
+ private static enum Entry {
+ BRANCH_ID,
+ BRANCH_STATE,
+ }
+
+ public ChangeBranchStateRequest convert(PropertyStore propertyStore) throws OseeCoreException {
+ int branchId = propertyStore.getInt(Entry.BRANCH_ID.name());
+ BranchState state = BranchState.valueOf(propertyStore.get(Entry.BRANCH_STATE.name()));
+ ChangeBranchStateRequest data = new ChangeBranchStateRequest(branchId, state);
+ return data;
+ }
+
+ public PropertyStore convert(ChangeBranchStateRequest data) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Entry.BRANCH_ID.name(), data.getBranchId());
+ store.put(Entry.BRANCH_STATE.name(), data.getState().name());
+ return store;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchChangeTypeRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchChangeTypeRequestTranslator.java
new file mode 100644
index 00000000000..dda85d1e71a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchChangeTypeRequestTranslator.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.enums.BranchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeBranchTypeRequest;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Megumi Telles
+ */
+public final class BranchChangeTypeRequestTranslator implements ITranslator<ChangeBranchTypeRequest> {
+
+ private static enum Entry {
+ BRANCH_ID,
+ BRANCH_TYPE,
+ }
+
+ public ChangeBranchTypeRequest convert(PropertyStore propertyStore) throws OseeCoreException {
+ int branchId = propertyStore.getInt(Entry.BRANCH_ID.name());
+ BranchType type = BranchType.valueOf(propertyStore.get(Entry.BRANCH_TYPE.name()));
+ ChangeBranchTypeRequest data = new ChangeBranchTypeRequest(branchId, type);
+ return data;
+ }
+
+ public PropertyStore convert(ChangeBranchTypeRequest data) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Entry.BRANCH_ID.name(), data.getBranchId());
+ store.put(Entry.BRANCH_TYPE.name(), data.getType().name());
+ return store;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitRequestTranslator.java
new file mode 100644
index 00000000000..3412862c743
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitRequestTranslator.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.BranchCommitRequest;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class BranchCommitRequestTranslator implements ITranslator<BranchCommitRequest> {
+
+ private static enum Entry {
+ USER_ART_ID,
+ SRC_BRANCH_ID,
+ DEST_BRANCH_ID,
+ IS_ARCHIVE_ALLOWED;
+ }
+
+ public BranchCommitRequest convert(PropertyStore propertyStore) throws OseeCoreException {
+ int srcBranchId = propertyStore.getInt(Entry.SRC_BRANCH_ID.name());
+ int destBranchId = propertyStore.getInt(Entry.DEST_BRANCH_ID.name());
+ int userArtifactId = propertyStore.getInt(Entry.USER_ART_ID.name());
+
+ boolean isArchiveAllowed = propertyStore.getBoolean(Entry.IS_ARCHIVE_ALLOWED.name());
+ BranchCommitRequest data = new BranchCommitRequest(userArtifactId, srcBranchId, destBranchId, isArchiveAllowed);
+ return data;
+ }
+
+ public PropertyStore convert(BranchCommitRequest data) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Entry.IS_ARCHIVE_ALLOWED.name(), data.isArchiveAllowed());
+ store.put(Entry.USER_ART_ID.name(), data.getUserArtId());
+ store.put(Entry.SRC_BRANCH_ID.name(), data.getSourceBranchId());
+ store.put(Entry.DEST_BRANCH_ID.name(), data.getDestinationBranchId());
+ 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
new file mode 100644
index 00000000000..5848262a147
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.BranchCommitResponse;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Megumi Telles
+ */
+public class BranchCommitResponseTranslator implements ITranslator<BranchCommitResponse> {
+
+ private static enum Entry {
+ TRANSACTION_NUMBER
+ }
+
+ private final IDataTranslationService service;
+
+ public BranchCommitResponseTranslator(IDataTranslationService service) {
+ this.service = service;
+ }
+
+ public BranchCommitResponse convert(PropertyStore propertyStore) throws OseeCoreException {
+ BranchCommitResponse response = new BranchCommitResponse();
+ PropertyStore innerStore = propertyStore.getPropertyStore(Entry.TRANSACTION_NUMBER.name());
+ TransactionRecord transactionRecord = service.convert(innerStore, CoreTranslatorId.TRANSACTION_RECORD);
+ response.setTransaction(transactionRecord);
+ return response;
+ }
+
+ public PropertyStore convert(BranchCommitResponse data) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ TransactionRecord record = data.getTransaction();
+ PropertyStore property = service.convert(record, CoreTranslatorId.TRANSACTION_RECORD);
+ store.put(Entry.TRANSACTION_NUMBER.name(), property);
+ return store;
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationRequestTranslator.java
new file mode 100644
index 00000000000..7ae2dc9bcd1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationRequestTranslator.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.enums.BranchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.BranchCreationRequest;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchCreationRequestTranslator implements ITranslator<BranchCreationRequest> {
+
+ private static enum Fields {
+ BRANCH_NAME,
+ PARENT_BRANCH_ID,
+ ASSOCIATED_ART_ID,
+
+ BRANCH_TYPE,
+ SOURCE_TX_ID,
+ BRANCH_GUID,
+
+ AUTHOR_ID,
+
+ CREATION_COMMENT,
+ POPULATE_BASE_TX_FROM_ADDR_QUERY_ID,
+ DESTINATION_BRANCH_ID;
+ }
+
+ @Override
+ public BranchCreationRequest convert(PropertyStore store) throws OseeCoreException {
+ String branchName = store.get(Fields.BRANCH_NAME.name());
+ int parentBranchId = store.getInt(Fields.PARENT_BRANCH_ID.name());
+ int associatedArtifactId = store.getInt(Fields.ASSOCIATED_ART_ID.name());
+
+ BranchType branchType = BranchType.valueOf(store.get(Fields.BRANCH_TYPE.name()));
+ int sourceTransactionId = store.getInt(Fields.SOURCE_TX_ID.name());
+ String branchGuid = store.get(Fields.BRANCH_GUID.name());
+
+ int authorId = store.getInt(Fields.AUTHOR_ID.name());
+
+ String creationComment = store.get(Fields.CREATION_COMMENT.name());
+
+ int populateBaseTxFromAddressingQueryId = store.getInt(Fields.POPULATE_BASE_TX_FROM_ADDR_QUERY_ID.name());
+ int destinationBranchId = store.getInt(Fields.DESTINATION_BRANCH_ID.name());
+
+ return new BranchCreationRequest(branchType, sourceTransactionId, parentBranchId, branchGuid, branchName,
+ associatedArtifactId, authorId, creationComment, populateBaseTxFromAddressingQueryId, destinationBranchId);
+ }
+
+ @Override
+ public PropertyStore convert(BranchCreationRequest object) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Fields.BRANCH_NAME.name(), object.getBranchName());
+ store.put(Fields.PARENT_BRANCH_ID.name(), object.getParentBranchId());
+ store.put(Fields.ASSOCIATED_ART_ID.name(), object.getAssociatedArtifactId());
+ store.put(Fields.BRANCH_TYPE.name(), object.getBranchType().name());
+ store.put(Fields.SOURCE_TX_ID.name(), object.getSourceTransactionId());
+ store.put(Fields.BRANCH_GUID.name(), object.getBranchGuid());
+ store.put(Fields.AUTHOR_ID.name(), object.getAuthorId());
+ store.put(Fields.CREATION_COMMENT.name(), object.getCreationComment());
+
+ store.put(Fields.POPULATE_BASE_TX_FROM_ADDR_QUERY_ID.name(), object.getPopulateBaseTxFromAddressingQueryId());
+ store.put(Fields.DESTINATION_BRANCH_ID.name(), object.getDestinationBranchId());
+
+ return store;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationResponseTranslator.java
new file mode 100644
index 00000000000..e213c1b1a28
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationResponseTranslator.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.BranchCreationResponse;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchCreationResponseTranslator implements ITranslator<BranchCreationResponse> {
+
+ private static enum Fields {
+ BRANCH_ID;
+ }
+
+ @Override
+ public BranchCreationResponse convert(PropertyStore store) throws OseeCoreException {
+ int branchId = store.getInt(Fields.BRANCH_ID.name());
+ return new BranchCreationResponse(branchId);
+ }
+
+ @Override
+ public PropertyStore convert(BranchCreationResponse object) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Fields.BRANCH_ID.name(), object.getBranchId());
+ return store;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/CacheUpdateRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/CacheUpdateRequestTranslator.java
new file mode 100644
index 00000000000..78cd5cc94dd
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/CacheUpdateRequestTranslator.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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.internal.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.CacheUpdateRequest;
+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 CacheUpdateRequestTranslator implements ITranslator<CacheUpdateRequest> {
+
+ private static enum Entry {
+ CACHE_ID,
+ ITEM_IDS;
+ }
+
+ @Override
+ public CacheUpdateRequest convert(PropertyStore propertyStore) throws OseeCoreException {
+ OseeCacheEnum cacheId = OseeCacheEnum.valueOf(propertyStore.get(Entry.CACHE_ID.name()));
+ String[] itemId = propertyStore.getArray(Entry.ITEM_IDS.name());
+ List<Integer> itemIds = new ArrayList<Integer>();
+ if (itemId != null && itemId.length > 0) {
+ for (String item : itemId) {
+ if (item != null) {
+ itemIds.add(Integer.valueOf(item));
+ }
+ }
+ }
+ return new CacheUpdateRequest(cacheId, itemIds);
+ }
+
+ @Override
+ public PropertyStore convert(CacheUpdateRequest object) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+
+ store.put(Entry.CACHE_ID.name(), object.getCacheId().name());
+ Collection<Integer> itemIds = object.getItemsIds();
+ if (!itemIds.isEmpty()) {
+ String[] itemStr = new String[itemIds.size()];
+ int index = 0;
+ for (Integer item : itemIds) {
+ itemStr[index++] = String.valueOf(item);
+ }
+ store.put(Entry.ITEM_IDS.name(), itemStr);
+ }
+ return store;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeItemTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeItemTranslator.java
new file mode 100644
index 00000000000..d473c3fee58
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeItemTranslator.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * 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.enums.ChangeItemType;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.message.ArtifactChangeItem;
+import org.eclipse.osee.framework.core.message.AttributeChangeItem;
+import org.eclipse.osee.framework.core.message.ChangeItem;
+import org.eclipse.osee.framework.core.message.ChangeVersion;
+import org.eclipse.osee.framework.core.message.RelationChangeItem;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ChangeItemTranslator implements ITranslator<ChangeItem> {
+
+ private static enum Entry {
+ BASE_ENTRY,
+ FIRST_CHANGE,
+ CURRENT_ENTRY,
+ DESTINATION_ENTRY,
+ NET_ENTRY,
+ ART_ID,
+ A_ART_ID,
+ B_ART_ID,
+ TYPE,
+ ITEM_ID,
+ ITEM_TYPE_ID,
+ RATIONALE;
+ }
+
+ private final IDataTranslationService service;
+
+ public ChangeItemTranslator(IDataTranslationService service) {
+ super();
+ this.service = service;
+ }
+
+ @Override
+ public ChangeItem convert(PropertyStore store) throws OseeCoreException {
+ PropertyStore currentEntryStore = store.getPropertyStore(Entry.CURRENT_ENTRY.name());
+ ChangeVersion currentEntry = service.convert(currentEntryStore, CoreTranslatorId.CHANGE_VERSION);
+
+ ChangeItem changeItem = createChangeItem(store, currentEntry);
+
+ populateChangeVersion(store, changeItem.getCurrentVersion(), Entry.CURRENT_ENTRY);
+ populateChangeVersion(store, changeItem.getBaselineVersion(), Entry.BASE_ENTRY);
+ populateChangeVersion(store, changeItem.getDestinationVersion(), Entry.DESTINATION_ENTRY);
+ populateChangeVersion(store, changeItem.getFirstNonCurrentChange(), Entry.FIRST_CHANGE);
+ populateChangeVersion(store, changeItem.getNetChange(), Entry.NET_ENTRY);
+ return changeItem;
+ }
+
+ private ChangeItem createChangeItem(PropertyStore propertyStore, ChangeVersion currentChangeVersion) throws OseeStateException {
+ ChangeItem changeItem = null;
+
+ int itemId = Integer.parseInt(propertyStore.get(Entry.ITEM_ID.name()));
+ int itemTypeId = Integer.parseInt(propertyStore.get(Entry.ITEM_TYPE_ID.name()));
+
+ ChangeItemType type = ChangeItemType.getType(propertyStore.get(Entry.TYPE.name()));
+
+ switch (type) {
+ case ARTIFACT:
+ changeItem =
+ new ArtifactChangeItem(itemId, itemTypeId, currentChangeVersion.getGammaId(),
+ currentChangeVersion.getModType());
+ break;
+ case ATTRIBUTE:
+ int artId = Integer.parseInt(propertyStore.get(Entry.ART_ID.name()));
+ changeItem =
+ new AttributeChangeItem(itemId, itemTypeId, artId, currentChangeVersion.getGammaId(),
+ currentChangeVersion.getModType(), currentChangeVersion.getValue());
+ break;
+ case RELATION:
+ int aArtId = Integer.parseInt(propertyStore.get(Entry.A_ART_ID.name()));
+ int bArtId = Integer.parseInt(propertyStore.get(Entry.B_ART_ID.name()));
+ String rationale = propertyStore.get(Entry.RATIONALE.name());
+
+ changeItem =
+ new RelationChangeItem(itemId, itemTypeId, currentChangeVersion.getGammaId(),
+ currentChangeVersion.getModType(), aArtId, bArtId, rationale);
+ break;
+ default:
+ throw new OseeStateException("Invalid change item type");
+ }
+ return changeItem;
+ }
+
+ private void populateChangeVersion(PropertyStore store, ChangeVersion destVersion, Enum<?> key) throws OseeCoreException {
+ PropertyStore innerStore = store.getPropertyStore(key.name());
+ ChangeVersion srcVersion = service.convert(innerStore, CoreTranslatorId.CHANGE_VERSION);
+ if (srcVersion != null && destVersion != null && srcVersion.isValid()) {
+ destVersion.setGammaId(srcVersion.getGammaId());
+ destVersion.setModType(srcVersion.getModType());
+ destVersion.setValue(srcVersion.getValue());
+ }
+ }
+
+ @Override
+ public PropertyStore convert(ChangeItem changeItem) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+
+ store.put(Entry.ITEM_ID.name(), changeItem.getItemId());
+ store.put(Entry.ITEM_TYPE_ID.name(), changeItem.getItemTypeId());
+
+ if (changeItem instanceof ArtifactChangeItem) {
+ store.put(Entry.TYPE.name(), ChangeItemType.ARTIFACT.name());
+ } else if (changeItem instanceof AttributeChangeItem) {
+ store.put(Entry.ART_ID.name(), changeItem.getArtId());
+ store.put(Entry.TYPE.name(), ChangeItemType.ATTRIBUTE.name());
+ } else if (changeItem instanceof RelationChangeItem) {
+ store.put(Entry.TYPE.name(), ChangeItemType.RELATION.name());
+
+ RelationChangeItem relationChangeItem = (RelationChangeItem) changeItem;
+
+ store.put(Entry.A_ART_ID.name(), relationChangeItem.getArtId());
+ store.put(Entry.B_ART_ID.name(), relationChangeItem.getBArtId());
+ store.put(Entry.RATIONALE.name(), relationChangeItem.getRationale());
+ }
+
+ storeChangeVersion(store, Entry.CURRENT_ENTRY, changeItem.getCurrentVersion());
+
+ storeChangeVersion(store, Entry.BASE_ENTRY, changeItem.getBaselineVersion());
+ storeChangeVersion(store, Entry.FIRST_CHANGE, changeItem.getFirstNonCurrentChange());
+ storeChangeVersion(store, Entry.DESTINATION_ENTRY, changeItem.getDestinationVersion());
+ storeChangeVersion(store, Entry.NET_ENTRY, changeItem.getNetChange());
+ return store;
+ }
+
+ private void storeChangeVersion(PropertyStore store, Enum<?> entry, ChangeVersion changeVersion) throws OseeCoreException {
+ store.put(entry.name(), service.convert(changeVersion, CoreTranslatorId.CHANGE_VERSION));
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportRequestTranslator.java
new file mode 100644
index 00000000000..3cb93568d58
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportRequestTranslator.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeReportRequest;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ChangeReportRequestTranslator implements ITranslator<ChangeReportRequest> {
+ private static enum Entry {
+ SRC_TRANSACTION,
+ DEST_TRANSACTION,
+ }
+
+ @Override
+ public ChangeReportRequest convert(PropertyStore propertyStore) throws OseeCoreException {
+ int srcTx = propertyStore.getInt(Entry.SRC_TRANSACTION.name());
+ int destTx = propertyStore.getInt(Entry.DEST_TRANSACTION.name());
+
+ ChangeReportRequest data = new ChangeReportRequest(srcTx, destTx);
+ return data;
+ }
+
+ @Override
+ public PropertyStore convert(ChangeReportRequest data) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Entry.SRC_TRANSACTION.name(), data.getSourceTx());
+ store.put(Entry.DEST_TRANSACTION.name(), data.getDestinationTx());
+ return store;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java
new file mode 100644
index 00000000000..265889f8119
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.List;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeItem;
+import org.eclipse.osee.framework.core.message.ChangeReportResponse;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.TranslationUtil;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ChangeReportResponseTranslator implements ITranslator<ChangeReportResponse> {
+ private static enum Entry {
+ CHANGE_ITEM,
+ COUNT;
+ }
+
+ private final IDataTranslationService service;
+
+ public ChangeReportResponseTranslator(IDataTranslationService service) {
+ super();
+ this.service = service;
+ }
+
+ @Override
+ public ChangeReportResponse convert(PropertyStore propertyStore) throws OseeCoreException {
+ ChangeReportResponse data = new ChangeReportResponse();
+ int numberOfItems = propertyStore.getInt(Entry.COUNT.name());
+
+ for (int index = 0; index < numberOfItems; index++) {
+ String key = TranslationUtil.createKey(Entry.CHANGE_ITEM, index);
+ PropertyStore innerStore = propertyStore.getPropertyStore(key);
+ ChangeItem changeItem = service.convert(innerStore, CoreTranslatorId.CHANGE_ITEM);
+ data.addItem(changeItem);
+ }
+ return data;
+ }
+
+ @Override
+ public PropertyStore convert(ChangeReportResponse changeReportResponseData) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ List<ChangeItem> items = changeReportResponseData.getChangeItems();
+
+ for (int index = 0; index < items.size(); index++) {
+ ChangeItem changeItem = items.get(index);
+ PropertyStore innerStore = service.convert(changeItem, CoreTranslatorId.CHANGE_ITEM);
+ store.put(TranslationUtil.createKey(Entry.CHANGE_ITEM, index), innerStore);
+ }
+ store.put(Entry.COUNT.name(), items.size());
+ return store;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeVersionTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeVersionTranslator.java
new file mode 100644
index 00000000000..f0cebb4045d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeVersionTranslator.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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.enums.ModificationType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeVersion;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ChangeVersionTranslator implements ITranslator<ChangeVersion> {
+ private static enum Entry {
+ GAMMA_ID,
+ MOD_TYPE,
+ VALUE,
+ IS_VALID;
+ }
+
+ public ChangeVersionTranslator() {
+ super();
+ }
+
+ @Override
+ public ChangeVersion convert(PropertyStore propertyStore) throws OseeCoreException {
+ ChangeVersion changeVersion = new ChangeVersion();
+
+ if (!propertyStore.get(Entry.IS_VALID.name()).isEmpty()) {
+ String value = propertyStore.get(Entry.VALUE.name());
+ ModificationType modificationType =
+ ModificationType.getMod(Integer.parseInt(propertyStore.get(Entry.MOD_TYPE.name())));
+ Long gammaId = Long.parseLong(propertyStore.get(Entry.GAMMA_ID.name()));
+
+ changeVersion.setGammaId(gammaId);
+ changeVersion.setModType(modificationType);
+ changeVersion.setValue(value);
+ }
+ return changeVersion;
+ }
+
+ @Override
+ public PropertyStore convert(ChangeVersion changeVersion) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+
+ if (changeVersion.isValid()) {
+ store.put(Entry.IS_VALID.name(), "IS_VALID");
+ store.put(Entry.GAMMA_ID.name(), changeVersion.getGammaId());
+ store.put(Entry.MOD_TYPE.name(), changeVersion.getModType().getValue());
+ store.put(Entry.VALUE.name(), changeVersion.getValue());
+ }
+ return store;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeEnumTypeCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeEnumTypeCacheUpdateResponseTranslator.java
new file mode 100644
index 00000000000..2e776ea81c4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeEnumTypeCacheUpdateResponseTranslator.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.OseeEnumTypeCacheUpdateResponse;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OseeEnumTypeCacheUpdateResponseTranslator implements ITranslator<OseeEnumTypeCacheUpdateResponse> {
+
+ private static enum Fields {
+ ENUM_TYPE_ROW,
+ ENUM_TYPE_COUNT,
+ ENUM_ENTRY_ROW,
+ ENUM_ENTRY_COUNT;
+ }
+
+ @Override
+ public OseeEnumTypeCacheUpdateResponse convert(PropertyStore store) throws OseeCoreException {
+
+ int enumTypeRowCount = store.getInt(Fields.ENUM_TYPE_COUNT.name());
+ List<String[]> enumTypeRows = new ArrayList<String[]>(enumTypeRowCount);
+
+ for (int index = 0; index < enumTypeRowCount; index++) {
+ String[] rowData = store.getArray(createKey(Fields.ENUM_TYPE_ROW, index));
+ enumTypeRows.add(rowData);
+ }
+
+ int enumEntryRowCount = store.getInt(Fields.ENUM_ENTRY_COUNT.name());
+ List<String[]> enumEntryRows = new ArrayList<String[]>(enumEntryRowCount);
+
+ for (int index = 0; index < enumEntryRowCount; index++) {
+ String[] rowData = store.getArray(createKey(Fields.ENUM_ENTRY_ROW, index));
+ enumEntryRows.add(rowData);
+ }
+
+ return new OseeEnumTypeCacheUpdateResponse(enumTypeRows, enumEntryRows);
+ }
+
+ @Override
+ public PropertyStore convert(OseeEnumTypeCacheUpdateResponse response) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+
+ List<String[]> enumTypeRows = response.getEnumTypeRows();
+ for (int index = 0; index < enumTypeRows.size(); index++) {
+ store.put(createKey(Fields.ENUM_TYPE_ROW, index), enumTypeRows.get(index));
+ }
+ store.put(Fields.ENUM_TYPE_COUNT.name(), enumTypeRows.size());
+
+ List<String[]> enumEntryRows = response.getEnumEntryRows();
+ for (int index = 0; index < enumEntryRows.size(); index++) {
+ store.put(createKey(Fields.ENUM_ENTRY_ROW, index), enumEntryRows.get(index));
+ }
+ store.put(Fields.ENUM_ENTRY_COUNT.name(), enumEntryRows.size());
+
+ return store;
+ }
+
+ private String createKey(Fields key, int index) {
+ return String.format("%s_%s", key.name(), index);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelRequestTranslator.java
new file mode 100644
index 00000000000..756bdf1b4b4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelRequestTranslator.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.OseeImportModelRequest;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OseeImportModelRequestTranslator implements ITranslator<OseeImportModelRequest> {
+
+ private static enum Fields {
+ PERSIST,
+ GENERATE_EMF_COMPARE,
+ GENERATE_DIRTY_REPORT,
+ MODEL_NAME,
+ MODEL;
+ }
+
+ @Override
+ public OseeImportModelRequest convert(PropertyStore store) throws OseeCoreException {
+ String model = store.get(Fields.MODEL.name());
+ String modelName = store.get(Fields.MODEL_NAME.name());
+ boolean createTypeChangeReport = store.getBoolean(Fields.GENERATE_DIRTY_REPORT.name());
+ boolean createCompareReport = store.getBoolean(Fields.GENERATE_EMF_COMPARE.name());
+ boolean isPersistAllowed = store.getBoolean(Fields.PERSIST.name());
+
+ return new OseeImportModelRequest(modelName, model, createTypeChangeReport, createCompareReport, isPersistAllowed);
+ }
+
+ @Override
+ public PropertyStore convert(OseeImportModelRequest object) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Fields.MODEL_NAME.name(), object.getModelName());
+ store.put(Fields.MODEL.name(), object.getModel());
+ store.put(Fields.GENERATE_DIRTY_REPORT.name(), object.isCreateTypeChangeReport());
+ store.put(Fields.GENERATE_EMF_COMPARE.name(), object.isCreateCompareReport());
+ store.put(Fields.PERSIST.name(), object.isPersistAllowed());
+ return store;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelResponseTranslator.java
new file mode 100644
index 00000000000..3844b4ed25a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelResponseTranslator.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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.List;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.OseeImportModelResponse;
+import org.eclipse.osee.framework.core.message.TableData;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OseeImportModelResponseTranslator implements ITranslator<OseeImportModelResponse> {
+
+ private static enum Fields {
+ WAS_PERSISTED,
+ EMF_COMPARE_REPORT,
+ EMF_COMPARE_NAME,
+ DIRTY_REPORT,
+ TABLE_COUNT,
+ TABLE,
+ TITLE,
+ HEADERS,
+ ROW,
+ ROW_COUNT;
+ }
+
+ private final IDataTranslationService service;
+
+ public OseeImportModelResponseTranslator(IDataTranslationService service) {
+ this.service = service;
+ }
+
+ @Override
+ public OseeImportModelResponse convert(PropertyStore store) throws OseeCoreException {
+ OseeImportModelResponse response = new OseeImportModelResponse();
+ response.setPersisted(store.getBoolean(Fields.WAS_PERSISTED.name()));
+ response.setComparisonSnapshotModelName(store.get(Fields.EMF_COMPARE_NAME.name()));
+ response.setComparisonSnapshotModel(store.get(Fields.EMF_COMPARE_REPORT.name()));
+ List<TableData> data = new ArrayList<TableData>();
+
+ int numberOfTables = store.getInt(Fields.TABLE_COUNT.name());
+ for (int index = 0; index < numberOfTables; index++) {
+ PropertyStore innerStore = store.getPropertyStore(createKey(Fields.TABLE, index));
+ TableData table = service.convert(innerStore, CoreTranslatorId.TABLE_DATA);
+ data.add(table);
+ }
+ response.setReportData(data);
+ return response;
+ }
+
+ @Override
+ public PropertyStore convert(OseeImportModelResponse object) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Fields.WAS_PERSISTED.name(), object.wasPersisted());
+ store.put(Fields.EMF_COMPARE_NAME.name(), object.getComparisonSnapshotModelName());
+ store.put(Fields.EMF_COMPARE_REPORT.name(), object.getComparisonSnapshotModel());
+
+ List<TableData> tableData = object.getReportData();
+ for (int index = 0; index < tableData.size(); index++) {
+ TableData data = tableData.get(index);
+ PropertyStore innerStore = service.convert(data, CoreTranslatorId.TABLE_DATA);
+ store.put(createKey(Fields.TABLE, index), innerStore);
+ }
+ store.put(Fields.TABLE_COUNT.name(), tableData.size());
+ return store;
+ }
+
+ private String createKey(Enum<?> prefix, int index) {
+ return prefix.name() + "_" + index;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/PurgeBranchRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/PurgeBranchRequestTranslator.java
new file mode 100644
index 00000000000..dd08ad45ea1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/PurgeBranchRequestTranslator.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.PurgeBranchRequest;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Megumi Telles
+ * @author Jeff C. Phillips
+ */
+public class PurgeBranchRequestTranslator implements ITranslator<PurgeBranchRequest> {
+ private static enum Entry {
+ BRANCH_ID
+ }
+
+ @Override
+ public PurgeBranchRequest convert(PropertyStore propertyStore) throws OseeCoreException {
+ int branchId = propertyStore.getInt(Entry.BRANCH_ID.name());
+ PurgeBranchRequest request = new PurgeBranchRequest(branchId);
+ return request;
+ }
+
+ @Override
+ public PropertyStore convert(PurgeBranchRequest data) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Entry.BRANCH_ID.name(), data.getBranchId());
+ return store;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/RelationTypeCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/RelationTypeCacheUpdateResponseTranslator.java
new file mode 100644
index 00000000000..d2fbbe0edfa
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/RelationTypeCacheUpdateResponseTranslator.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.RelationTypeCacheUpdateResponse;
+import org.eclipse.osee.framework.core.message.RelationTypeCacheUpdateResponse.RelationTypeRow;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RelationTypeCacheUpdateResponseTranslator implements ITranslator<RelationTypeCacheUpdateResponse> {
+
+ private static enum Fields {
+ COUNT,
+ ROW
+ }
+
+ @Override
+ public RelationTypeCacheUpdateResponse convert(PropertyStore store) throws OseeCoreException {
+ List<RelationTypeRow> rows = new ArrayList<RelationTypeRow>();
+ int rowCount = store.getInt(Fields.COUNT.name());
+ for (int index = 0; index < rowCount; index++) {
+ String[] rowData = store.getArray(createKey(Fields.ROW, index));
+ rows.add(RelationTypeRow.fromArray(rowData));
+ }
+ return new RelationTypeCacheUpdateResponse(rows);
+ }
+
+ @Override
+ public PropertyStore convert(RelationTypeCacheUpdateResponse object) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ List<RelationTypeRow> rows = object.getRelationTypeRows();
+ for (int index = 0; index < rows.size(); index++) {
+ RelationTypeRow row = rows.get(index);
+ store.put(createKey(Fields.ROW, index), row.toArray());
+ }
+ store.put(Fields.COUNT.name(), rows.size());
+ return store;
+ }
+
+ private String createKey(Fields key, int index) {
+ return String.format("%s_%s", key.name(), index);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java
new file mode 100644
index 00000000000..14e67c1a89e
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.TableData;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.TranslationUtil;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TableDataTranslator implements ITranslator<TableData> {
+
+ private static enum Entry {
+ TABLE,
+ TITLE,
+ HEADERS,
+ ROW,
+ ROW_COUNT;
+ }
+
+ public TableDataTranslator() {
+ super();
+ }
+
+ @Override
+ public TableData convert(PropertyStore store) throws OseeCoreException {
+ String title = store.get(Entry.TITLE.name());
+ String[] columns = store.getArray(Entry.HEADERS.name());
+
+ List<String[]> rows = new ArrayList<String[]>();
+ int numberOfRows = store.getInt(Entry.ROW_COUNT.name());
+ for (int rowIndex = 0; rowIndex < numberOfRows; rowIndex++) {
+ rows.add(store.getArray(TranslationUtil.createKey(Entry.ROW, rowIndex)));
+ }
+ return new TableData(title, columns, rows);
+ }
+
+ @Override
+ public PropertyStore convert(TableData data) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Entry.TITLE.name(), data.getTitle());
+ store.put(Entry.HEADERS.name(), data.getColumns());
+
+ List<String[]> rows = data.getRows();
+ for (int index = 0; index < rows.size(); index++) {
+ store.put(TranslationUtil.createKey(Entry.ROW, index), rows.get(index));
+ }
+ store.put(Entry.ROW_COUNT.name(), rows.size());
+ 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
new file mode 100644
index 00000000000..7cc9f8cb1fe
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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.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.services.IOseeModelFactoryServiceProvider;
+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 TransactionCacheUpdateResponseTranslator implements ITranslator<TransactionCacheUpdateResponse> {
+
+ private static enum Fields {
+ TX_COUNT,
+ TX_ROW,
+ TX_TO_BRANCH;
+ }
+
+ private final IOseeModelFactoryServiceProvider provider;
+
+ public TransactionCacheUpdateResponseTranslator(IOseeModelFactoryServiceProvider provider) {
+ this.provider = provider;
+ }
+
+ private TransactionRecordFactory getFactory() throws OseeCoreException {
+ return provider.getOseeFactoryService().getTransactionFactory();
+ }
+
+ @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) throws OseeCoreException {
+ 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 static 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++]);
+ int branchId = Integer.valueOf(data[index++]);
+ return factory.create(txId, branchId, comment, timeStamp, authorArtId, commitArtId, txType);
+ }
+}
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
new file mode 100644
index 00000000000..f23b1c03e62
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.sql.Timestamp;
+import java.util.Date;
+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.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class TransactionRecordTranslator implements ITranslator<TransactionRecord> {
+
+ private static enum Entry {
+ TRANSACTION_ID,
+ TRANSACTION_BRANCH,
+ TRANSACTION_TX_TYPE,
+ TRANSACTION_COMMENT,
+ TRANSACTION_TIMESTAMP,
+ TRANSACTION_AUTHOR_ART_ID,
+ TRANSACTION_COMMIT_ART_ID;
+ }
+
+ private final IOseeModelFactoryServiceProvider factoryProvider;
+
+ public TransactionRecordTranslator(IOseeModelFactoryServiceProvider factoryProvider) {
+ this.factoryProvider = factoryProvider;
+ }
+
+ public TransactionRecord convert(PropertyStore store) throws OseeCoreException {
+ int transactionNumber = store.getInt(Entry.TRANSACTION_ID.name());
+ TransactionDetailsType txType = TransactionDetailsType.valueOf(store.get(Entry.TRANSACTION_TX_TYPE.name()));
+ String comment = store.get(Entry.TRANSACTION_COMMENT.name());
+ Date time = new Timestamp(store.getLong(Entry.TRANSACTION_TIMESTAMP.name()));
+ 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());
+ TransactionRecordFactory factory = factoryProvider.getOseeFactoryService().getTransactionFactory();
+ return factory.create(transactionNumber, branchId, comment, time, authorArtId, commitArtId, txType);
+ }
+
+ public PropertyStore convert(TransactionRecord data) throws OseeCoreException {
+ PropertyStore store = new PropertyStore();
+ store.put(Entry.TRANSACTION_ID.name(), data.getId());
+ store.put(Entry.TRANSACTION_TX_TYPE.name(), data.getTxType().name());
+ store.put(Entry.TRANSACTION_COMMENT.name(), data.getComment());
+ store.put(Entry.TRANSACTION_TIMESTAMP.name(), data.getTimeStamp().getTime());
+ store.put(Entry.TRANSACTION_AUTHOR_ART_ID.name(), data.getAuthor());
+
+ store.put(Entry.TRANSACTION_COMMIT_ART_ID.name(), data.getCommit());
+
+ store.put(Entry.TRANSACTION_BRANCH.name(), data.getBranchId());
+ return store;
+ }
+}

Back to the top