diff options
author | Roberto E. Escobar | 2013-05-23 00:54:52 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2013-06-03 23:21:35 +0000 |
commit | 74e5fc7e33ec4f8b30a69046e631f9e87aad8452 (patch) | |
tree | 25fb8769a0944777b34df0f9032ae5c6865573fc /plugins | |
parent | 2b9e44136a1187f818d94badd3e598b4f0e50776 (diff) | |
download | org.eclipse.osee-74e5fc7e33ec4f8b30a69046e631f9e87aad8452.tar.gz org.eclipse.osee-74e5fc7e33ec4f8b30a69046e631f9e87aad8452.tar.xz org.eclipse.osee-74e5fc7e33ec4f8b30a69046e631f9e87aad8452.zip |
feature[ats_U3BQK]: Add mediaType to AttributeType
Change-Id: I01741073ddaf89f17305bb2962344f4c03af9120
Diffstat (limited to 'plugins')
10 files changed, 54 insertions, 21 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 index e85d79c3d0d..62f4bd324c6 100644 --- 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 @@ -47,7 +47,8 @@ public class AttributeTypeCacheUpdateResponse { AttributeType type = factory.create(item.getGuid(), item.getName(), item.getBaseAttributeTypeId(), item.getAttributeProviderId(), item.getFileTypeExtension(), item.getDefaultValue(), - item.getMinOccurrences(), item.getMaxOccurrences(), item.getDescription(), item.getTaggerId()); + item.getMinOccurrences(), item.getMaxOccurrences(), item.getDescription(), item.getTaggerId(), + item.getMediaType()); type.setId(item.getId()); type.setStorageState(item.getStorageState()); rows.add(type); 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 index 6d9dbd6c027..92c9ba5f89a 100644 --- 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 @@ -89,7 +89,8 @@ public class AttributeTypeCacheUpdateResponseTranslator implements ITranslator<A String.valueOf(type.getMinOccurrences()), type.getStorageState().name(), type.getName(), - type.getTaggerId()}; + type.getTaggerId(), + type.getMediaType()}; } private AttributeType createfromArray(AttributeTypeFactory factory, String[] data) throws OseeCoreException { @@ -105,10 +106,11 @@ public class AttributeTypeCacheUpdateResponseTranslator implements ITranslator<A StorageState storageState = StorageState.valueOf(data[9]); String name = data[10]; String taggerId = data[11]; + String mediaType = data[12]; AttributeType type = factory.create(remoteId, name, baseAttributeTypeId, attributeProviderId, fileTypeExtension, defaultValue, - minOccurrences, maxOccurrences, description, taggerId); + minOccurrences, maxOccurrences, description, taggerId, mediaType); type.setId(uniqueId); type.setStorageState(storageState); return type; diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java index 582332fa023..7925af69758 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java @@ -75,7 +75,7 @@ public final class MockDataFactory { OseeEnumTypeFactory oseeEnumTypeFactory = new OseeEnumTypeFactory(); AttributeType attributeType = new AttributeType(random.nextLong(), "name", "baseType", "providerName", ".xml", "", 1, 1, "description", - "tagger"); + "tagger", "mediaType"); attributeType.setOseeEnumType(oseeEnumTypeFactory.createEnumType(0x01L, "enum type name")); return attributeType; } @@ -111,7 +111,8 @@ public final class MockDataFactory { public static AttributeType createAttributeType(int index, OseeEnumType oseeEnumType) throws OseeCoreException { AttributeType type = new AttributeType(random.nextLong(), "attrType_" + index, "baseClass_" + index, "providerId_" + index, - "ext_" + index, "default_" + index, index * 2, index * 7, "description_" + index, "tag_" + index); + "ext_" + index, "default_" + index, index * 2, index * 7, "description_" + index, "tag_" + index, + "mediaType_" + index); type.setOseeEnumType(oseeEnumType); return type; } diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/ModelAsserts.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/ModelAsserts.java index fd1095bb65a..c7a7b76ed00 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/ModelAsserts.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/ModelAsserts.java @@ -156,7 +156,8 @@ public class ModelAsserts { public static AttributeType createAttributeType(Long guid, String name) { AttributeType attributeType = - new AttributeType(guid, name, "DummyBase", "DummyProvider", "none", "none", 1, 1, "test data", null); + new AttributeType(guid, name, "DummyBase", "DummyProvider", "none", "none", 1, 1, "test data", null, + "mediaType"); Assert.assertNotNull(attributeType); return attributeType; } diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeType.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeType.java index be4c72447bb..61db2776767 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeType.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeType.java @@ -33,12 +33,13 @@ public class AttributeType extends AbstractOseeType<Long> implements IAttributeT private static final String ATTRIBUTE_DESCRIPTION_FIELD_KEY = "osee.attribute.description.field"; private static final String ATTRIBUTE_FILE_EXTENSION_FIELD_KEY = "osee.attribute.file.type.extension.field"; private static final String ATTRIBUTE_TAGGER_ID_FIELD_KEY = "osee.attribute.tagger.id.field"; + private static final String ATTRIBUTE_MEDIA_TYPE_FIELD_KEY = "osee.attribute.media.type.field"; - public AttributeType(Long guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, int minOccurrences, int maxOccurrences, String description, String taggerId) { + public AttributeType(Long guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, int minOccurrences, int maxOccurrences, String description, String taggerId, String mediaType) { super(guid, typeName); initializeFields(); setFields(typeName, baseAttributeTypeId, attributeProviderNameId, fileTypeExtension, defaultValue, null, - minOccurrences, maxOccurrences, description, taggerId); + minOccurrences, maxOccurrences, description, taggerId, mediaType); } protected void initializeFields() { @@ -51,9 +52,10 @@ public class AttributeType extends AbstractOseeType<Long> implements IAttributeT addField(ATTRIBUTE_DESCRIPTION_FIELD_KEY, new OseeField<String>()); addField(ATTRIBUTE_FILE_EXTENSION_FIELD_KEY, new OseeField<String>()); addField(ATTRIBUTE_TAGGER_ID_FIELD_KEY, new OseeField<String>()); + addField(ATTRIBUTE_MEDIA_TYPE_FIELD_KEY, new OseeField<String>()); } - public void setFields(String name, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId) { + public void setFields(String name, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId, String mediaType) { String fileExtensionToSet = fileTypeExtension != null ? fileTypeExtension : ""; setName(name); setFieldLogException(ATTRIBUTE_BASE_TYPE_ID_FIELD_KEY, baseAttributeTypeId); @@ -65,6 +67,7 @@ public class AttributeType extends AbstractOseeType<Long> implements IAttributeT setFieldLogException(ATTRIBUTE_DESCRIPTION_FIELD_KEY, description); setFieldLogException(ATTRIBUTE_FILE_EXTENSION_FIELD_KEY, fileExtensionToSet); setFieldLogException(ATTRIBUTE_TAGGER_ID_FIELD_KEY, taggerId); + setFieldLogException(ATTRIBUTE_MEDIA_TYPE_FIELD_KEY, mediaType); } public String getBaseAttributeTypeId() { @@ -124,6 +127,30 @@ public class AttributeType extends AbstractOseeType<Long> implements IAttributeT } /** + * Get the media type for this attribute type + * + * @return format id + */ + public String getMediaType() { + return getFieldValueLogException("", ATTRIBUTE_MEDIA_TYPE_FIELD_KEY); + } + + /** + * Whether this attribute type has a media type. + * + * @return <b>true</b> if this attribute type has a media type. <b>false</b> if this is attribute does not have a + * media type. + */ + public boolean hasMediaType() { + boolean toReturn = false; + String format = getMediaType(); + if (format != null) { + toReturn = Strings.isValid(format.trim()); + } + return toReturn; + } + + /** * Whether this attribute type is taggable. * * @return <b>true</b> if this attribute type is taggable. <b>false</b> if this is not taggable. diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java index f070fd16864..8f57a29b8d0 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java @@ -23,7 +23,7 @@ import org.eclipse.osee.framework.jdk.core.util.Strings; */ public class AttributeTypeFactory implements IOseeTypeFactory { - public AttributeType create(long guid, String name, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, int minOccurrences, int maxOccurrences, String tipText, String taggerId) throws OseeCoreException { + public AttributeType create(long guid, String name, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, int minOccurrences, int maxOccurrences, String tipText, String taggerId, String mediaType) throws OseeCoreException { Conditions.checkNotNullOrEmpty(name, "attribute type name"); // checkNameUnique(cache, name); Conditions.checkNotNullOrEmpty(baseAttributeTypeId, "attribute base type id"); @@ -37,42 +37,42 @@ public class AttributeTypeFactory implements IOseeTypeFactory { return new AttributeType(guid, name, Strings.intern(baseAttributeTypeId), Strings.intern(attributeProviderNameId), Strings.intern(fileTypeExtension), defaultValue, minOccurrences, - maxOccurrences, tipText, Strings.intern(taggerId)); + maxOccurrences, tipText, Strings.intern(taggerId), Strings.intern(mediaType)); } - public AttributeType createOrUpdate(AttributeTypeCache cache, long guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId) throws OseeCoreException { + public AttributeType createOrUpdate(AttributeTypeCache cache, long guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId, String mediaType) throws OseeCoreException { Conditions.checkNotNull(cache, "AttributeTypeCache"); AttributeType attributeType = cache.getByGuid(guid); if (attributeType == null) { attributeType = create(guid, typeName, baseAttributeTypeId, attributeProviderNameId, fileTypeExtension, defaultValue, - minOccurrences, maxOccurrences, description, taggerId); + minOccurrences, maxOccurrences, description, taggerId, mediaType); attributeType.setOseeEnumType(oseeEnumType); } else { cache.decache(attributeType); attributeType.setFields(typeName, baseAttributeTypeId, attributeProviderNameId, fileTypeExtension, - defaultValue, oseeEnumType, minOccurrences, maxOccurrences, description, taggerId); + defaultValue, oseeEnumType, minOccurrences, maxOccurrences, description, taggerId, mediaType); } cache.cache(attributeType); return attributeType; } - public AttributeType createOrUpdate(IOseeCache<Long, AttributeType> cache, int uniqueId, StorageState storageState, Long guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId) throws OseeCoreException { + public AttributeType createOrUpdate(IOseeCache<Long, AttributeType> cache, int uniqueId, StorageState storageState, Long guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId, String mediaType) throws OseeCoreException { Conditions.checkNotNull(cache, "AttributeTypeCache"); AttributeType attributeType = cache.getById(uniqueId); if (attributeType == null) { attributeType = create(guid, typeName, baseAttributeTypeId, attributeProviderNameId, fileTypeExtension, defaultValue, - minOccurrences, maxOccurrences, description, taggerId); + minOccurrences, maxOccurrences, description, taggerId, mediaType); attributeType.setOseeEnumType(oseeEnumType); attributeType.setId(uniqueId); attributeType.setStorageState(storageState); } else { cache.decache(attributeType); attributeType.setFields(typeName, baseAttributeTypeId, attributeProviderNameId, fileTypeExtension, - defaultValue, oseeEnumType, minOccurrences, maxOccurrences, description, taggerId); + defaultValue, oseeEnumType, minOccurrences, maxOccurrences, description, taggerId, mediaType); } cache.cache(attributeType); return attributeType; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientAttributeTypeAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientAttributeTypeAccessor.java index 45603a048da..cd09b265cb0 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientAttributeTypeAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientAttributeTypeAccessor.java @@ -66,7 +66,7 @@ public class ClientAttributeTypeAccessor extends AbstractClientDataAccessor<Long factory.createOrUpdate(cache, row.getId(), row.getStorageState(), row.getGuid(), row.getName(), row.getBaseAttributeTypeId(), row.getAttributeProviderId(), row.getFileTypeExtension(), row.getDefaultValue(), oseeEnumType, row.getMinOccurrences(), row.getMaxOccurrences(), - row.getDescription(), row.getTaggerId()); + row.getDescription(), row.getTaggerId(), row.getMediaType()); } return updatedItems; } diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolverTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolverTest.java index 4dde5602781..816366aa86e 100644 --- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolverTest.java +++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolverTest.java @@ -126,7 +126,7 @@ public class AttributeClassResolverTest { } private static AttributeType createType(String baseType) { - return new AttributeType(1L, "dummy", baseType, "", "", "", 1, 1, "", ""); + return new AttributeType(1L, "dummy", baseType, "", "", "", 1, 1, "", "", ""); } @Parameters diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeToXtextOperation.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeToXtextOperation.java index d71b9cf5bc8..5178b370885 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeToXtextOperation.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeToXtextOperation.java @@ -132,6 +132,7 @@ public class OseeToXtextOperation extends AbstractOperation { modelType.setDescription(attributeType.getDescription()); modelType.setDefaultValue(attributeType.getDefaultValue()); modelType.setTaggerId(attributeType.getTaggerId()); + modelType.setMediaType(attributeType.getMediaType()); OseeEnumType oseeEnumType = attributeType.getOseeEnumType(); if (oseeEnumType != null) { diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/XTextToOseeTypeOperation.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/XTextToOseeTypeOperation.java index 234130aef8e..6d08294935c 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/XTextToOseeTypeOperation.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/XTextToOseeTypeOperation.java @@ -332,8 +332,8 @@ public class XTextToOseeTypeOperation extends AbstractOperation { min, // max, // xAttributeType.getDescription(), // - xAttributeType.getTaggerId()// - ); + xAttributeType.getTaggerId(),// + xAttributeType.getMediaType()); } private String getQualifiedTypeName(String id) { |