diff options
author | ddunne | 2010-07-29 21:18:33 +0000 |
---|---|---|
committer | ddunne | 2010-07-29 21:18:33 +0000 |
commit | 31f1757f2428b78b5f2faf0eb23ace5da3b37489 (patch) | |
tree | 716e5230463bbad70154641b095f0e1eec3931d4 /plugins | |
parent | 4d289081d25179d7b389abd1c42483b6ab509d72 (diff) | |
download | org.eclipse.osee-31f1757f2428b78b5f2faf0eb23ace5da3b37489.tar.gz org.eclipse.osee-31f1757f2428b78b5f2faf0eb23ace5da3b37489.tar.xz org.eclipse.osee-31f1757f2428b78b5f2faf0eb23ace5da3b37489.zip |
default date when null attribute added and no default value specified
Diffstat (limited to 'plugins')
3 files changed, 17 insertions, 3 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java index ac5e20d9178..217a289ca63 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java @@ -784,7 +784,11 @@ public class Artifact implements IArtifact, IAdaptable, Comparable<Artifact>, IB public void deleteSoleAttribute(String attributeTypeName) throws OseeCoreException { Attribute<?> attribute = getSoleAttribute(attributeTypeName); if (attribute != null) { - attribute.delete(); + if (!attribute.isInDb()) { + attributes.removeValue(attributeTypeName, attribute); + } else { + attribute.delete(); + } } } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java index 8ef341aef0c..442f3d40bd8 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java @@ -140,7 +140,7 @@ public abstract class Attribute<T> { setToDefaultValue(); } - private final void setToDefaultValue() throws OseeCoreException { + protected void setToDefaultValue() throws OseeCoreException { String defaultValue = getAttributeType().getDefaultValue(); if (defaultValue != null) { subClassSetValue(convertStringToValue(defaultValue)); @@ -367,7 +367,7 @@ public abstract class Attribute<T> { this.modificationType = modificationType; } - public void internalSetDeletedFromRemoteEvent() throws OseeCoreException { + public void internalSetDeletedFromRemoteEvent() { internalSetModificationType(ModificationType.DELETED); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/DateAttribute.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/DateAttribute.java index 4fcddb53d6f..a7712695852 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/DateAttribute.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/DateAttribute.java @@ -55,6 +55,16 @@ public class DateAttribute extends CharacterBackedAttribute<Date> { return toReturn; } + @Override + protected void setToDefaultValue() throws OseeCoreException { + String defaultValue = getAttributeType().getDefaultValue(); + if (Strings.isValid(defaultValue)) { + subClassSetValue(convertStringToValue(defaultValue)); + } else { + subClassSetValue(new Date()); + } + } + private Date handleLegacyDates(String rawValue) { Date toReturn = null; for (DateFormat format : legacyDateFormats) { |