Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AttributeTypeCacheUpdateResponse.java')
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AttributeTypeCacheUpdateResponse.java61
1 files changed, 61 insertions, 0 deletions
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);
+ }
+}

Back to the top