From 9886075d21028ae734d1c530fed4575a6522c067 Mon Sep 17 00:00:00 2001 From: rbrooks Date: Wed, 11 Aug 2010 07:52:52 +0000 Subject: converted more string based type references to use type tokens --- .../osee/ote/define/AUTOGEN/OteAttributeTypes.java | 72 ++++++-------- .../ote/define/artifacts/OteArtifactFetcher.java | 8 +- .../ote/define/artifacts/OteToAttributeMap.java | 110 +++++++++++---------- .../osee/ote/define/artifacts/TestRunOperator.java | 55 ++++++----- .../ote/define/utilities/OutfileDataCollector.java | 9 +- 5 files changed, 125 insertions(+), 129 deletions(-) (limited to 'plugins/org.eclipse.osee.ote.define') diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteAttributeTypes.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteAttributeTypes.java index 15466d9a565..bf0054dccf4 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteAttributeTypes.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteAttributeTypes.java @@ -14,49 +14,37 @@ import org.eclipse.osee.framework.core.data.IAttributeType; import org.eclipse.osee.framework.core.data.NamedIdentity; public class OteAttributeTypes extends NamedIdentity implements IAttributeType { - public static final OteAttributeTypes BUILD_ID = new OteAttributeTypes("AAMFEXG6_W9diA9nUXAA", "Build Id"); - public static final OteAttributeTypes CHECKSUM = new OteAttributeTypes("AAMFEXJbaHt5uKG9kogA", "Checksum"); - public static final OteAttributeTypes ELAPSED_DATE = new OteAttributeTypes("AAMFEWuD6yH04y89M3wA", "Elapsed Date"); - public static final OteAttributeTypes END_DATE = new OteAttributeTypes("AAMFEWryxym0P9FFckgA", "End Date"); - public static final OteAttributeTypes EXTENSION = new OteAttributeTypes("AAMFEcUbJEERZTnwJzAA", "Extension"); - public static final OteAttributeTypes FAILED = new OteAttributeTypes("AAMFEWynSU+XeRG7nRAA", "Failed"); - public static final OteAttributeTypes IS_BATCH_MODE_ALLOWED = new OteAttributeTypes("AAMFEW+CcA6F5GEjsSgA", - "Is Batch Mode Allowed"); - public static final OteAttributeTypes LAST_AUTHOR = new OteAttributeTypes("AAMFEWE83iPq3+2DGrQA", "Last Author"); - public static final OteAttributeTypes LAST_DATE_UPLOADED = new OteAttributeTypes("AAMFEXCm5ju5gvq142QA", - "Last Date Uploaded"); - public static final OteAttributeTypes LAST_MODIFIED_DATE = new OteAttributeTypes("AAMFEWHw7V1uWv4IKcQA", - "Last Modified Date"); - public static final OteAttributeTypes MODIFIED_FLAG = new OteAttributeTypes("AAMFEWCruiS26nCN68wA", "Modified Flag"); - public static final OteAttributeTypes OSEE_SERVER_JAR_VERSION = new OteAttributeTypes("AAMFEWV1OQtXL67OfOQA", - "OSEE Server Jar Version"); - public static final OteAttributeTypes OSEE_SERVER_TITLE = new OteAttributeTypes("AAMFEWTnXGYRfdzY3gAA", - "OSEE Server Title"); - public static final OteAttributeTypes OSEE_VERSION = new OteAttributeTypes("AAMFEWQ_TTkstJvjnGQA", "OSEE Version"); - public static final OteAttributeTypes OS_ARCHITECTURE = new OteAttributeTypes("AAMFEWKJtG+Jc8OkRYgA", - "OS Architecture"); - public static final OteAttributeTypes OS_NAME = new OteAttributeTypes("AAMFEWMdBmP9aCgsysgA", "OS Name"); - public static final OteAttributeTypes OS_VERSION = new OteAttributeTypes("AAMFEWOvQWV6JJvh9NQA", "OS Version"); - public static final OteAttributeTypes OUTFILE_URL = new OteAttributeTypes("AAMFEVlyBndUvySg+gwA", "Outfile URL"); - public static final OteAttributeTypes PASSED = new OteAttributeTypes("AAMFEWwT92IzQp6Dh3gA", "Passed"); - public static final OteAttributeTypes PROCESSOR_ID = new OteAttributeTypes("AAMFEWYOAGkplo4RjTQA", "Processor ID"); - public static final OteAttributeTypes QUALIFICATION_LEVEL = new OteAttributeTypes("AAMFEXEvTztOWwoGyRAA", - "Qualification Level"); - public static final OteAttributeTypes RAN_IN_BATCH_MODE = new OteAttributeTypes("AAMFEW7uBlg0KLp8mhQA", - "Ran In Batch Mode"); - public static final OteAttributeTypes REVISION = new OteAttributeTypes("AAMFEWAal2I3j7EJligA", "Revision"); - public static final OteAttributeTypes SCRIPT_ABORTED = new OteAttributeTypes("AAMFEW3M12AqHsCve4AA", - "Script Aborted"); - public static final OteAttributeTypes START_DATE = new OteAttributeTypes("AAMFEWpeXjfr2W5ZT5QA", "Start Date"); - public static final OteAttributeTypes TEST_SCRIPT_GUID = new OteAttributeTypes("AAMFEW5fEhinpcjeZ0wA", - "Test Script GUID"); - public static final OteAttributeTypes TEST_SCRIPT_URL = new OteAttributeTypes("AAMFEVn0+mhxtCuACgAA", - "Test Script URL"); - public static final OteAttributeTypes TOTAL_TEST_POINTS = new OteAttributeTypes("AAMFEW05hBfECFGfZkgA", - "Total Test Points"); - public static final OteAttributeTypes TEST_DISPOSITION = - new OteAttributeTypes("AAMFEXfoPWRZHNiOR3gA", "Disposition"); + // @formatter:off + public static final IAttributeType BUILD_ID = new OteAttributeTypes("AAMFEXG6_W9diA9nUXAA", "Build Id"); + public static final IAttributeType CHECKSUM = new OteAttributeTypes("AAMFEXJbaHt5uKG9kogA", "Checksum"); + public static final IAttributeType ELAPSED_DATE = new OteAttributeTypes("AAMFEWuD6yH04y89M3wA", "Elapsed Date"); + public static final IAttributeType END_DATE = new OteAttributeTypes("AAMFEWryxym0P9FFckgA", "End Date"); + public static final IAttributeType EXTENSION = new OteAttributeTypes("AAMFEcUbJEERZTnwJzAA", "Extension"); + public static final IAttributeType FAILED = new OteAttributeTypes("AAMFEWynSU+XeRG7nRAA", "Failed"); + public static final IAttributeType IS_BATCH_MODE_ALLOWED = new OteAttributeTypes("AAMFEW+CcA6F5GEjsSgA", "Is Batch Mode Allowed"); + public static final IAttributeType LAST_AUTHOR = new OteAttributeTypes("AAMFEWE83iPq3+2DGrQA", "Last Author"); + public static final IAttributeType LAST_DATE_UPLOADED = new OteAttributeTypes("AAMFEXCm5ju5gvq142QA", "Last Date Uploaded"); + public static final IAttributeType LAST_MODIFIED_DATE = new OteAttributeTypes("AAMFEWHw7V1uWv4IKcQA", "Last Modified Date"); + public static final IAttributeType MODIFIED_FLAG = new OteAttributeTypes("AAMFEWCruiS26nCN68wA", "Modified Flag"); + public static final IAttributeType OSEE_SERVER_JAR_VERSION = new OteAttributeTypes("AAMFEWV1OQtXL67OfOQA", "OSEE Server Jar Version"); + public static final IAttributeType OSEE_SERVER_TITLE = new OteAttributeTypes("AAMFEWTnXGYRfdzY3gAA", "OSEE Server Title"); + public static final IAttributeType OSEE_VERSION = new OteAttributeTypes("AAMFEWQ_TTkstJvjnGQA", "OSEE Version"); + public static final IAttributeType OS_ARCHITECTURE = new OteAttributeTypes("AAMFEWKJtG+Jc8OkRYgA", "OS Architecture"); + public static final IAttributeType OS_NAME = new OteAttributeTypes("AAMFEWMdBmP9aCgsysgA", "OS Name"); + public static final IAttributeType OS_VERSION = new OteAttributeTypes("AAMFEWOvQWV6JJvh9NQA", "OS Version"); + public static final IAttributeType OUTFILE_URL = new OteAttributeTypes("AAMFEVlyBndUvySg+gwA", "Outfile URL"); + public static final IAttributeType PASSED = new OteAttributeTypes("AAMFEWwT92IzQp6Dh3gA", "Passed"); + public static final IAttributeType PROCESSOR_ID = new OteAttributeTypes("AAMFEWYOAGkplo4RjTQA", "Processor ID"); + public static final IAttributeType QUALIFICATION_LEVEL = new OteAttributeTypes("AAMFEXEvTztOWwoGyRAA", "Qualification Level"); + public static final IAttributeType RAN_IN_BATCH_MODE = new OteAttributeTypes("AAMFEW7uBlg0KLp8mhQA", "Ran In Batch Mode"); + public static final IAttributeType REVISION = new OteAttributeTypes("AAMFEWAal2I3j7EJligA", "Revision"); + public static final IAttributeType SCRIPT_ABORTED = new OteAttributeTypes("AAMFEW3M12AqHsCve4AA", "Script Aborted"); + public static final IAttributeType START_DATE = new OteAttributeTypes("AAMFEWpeXjfr2W5ZT5QA", "Start Date"); + public static final IAttributeType TEST_SCRIPT_URL = new OteAttributeTypes("AAMFEVn0+mhxtCuACgAA", "Test Script URL"); + public static final IAttributeType TOTAL_TEST_POINTS = new OteAttributeTypes("AAMFEW05hBfECFGfZkgA", "Total Test Points"); + public static final IAttributeType TestDisposition = new OteAttributeTypes("AAMFEXfoPWRZHNiOR3gA", "Disposition"); + // @formatter:on private OteAttributeTypes(String guid, String name) { super(guid, name); diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteArtifactFetcher.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteArtifactFetcher.java index f98ff6e1ac8..b078b045637 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteArtifactFetcher.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteArtifactFetcher.java @@ -16,8 +16,8 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.logging.Level; +import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.IAttributeType; -import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist; import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist; import org.eclipse.osee.framework.core.exception.OseeArgumentException; @@ -34,9 +34,9 @@ import org.eclipse.osee.ote.define.OteDefinePlugin; * @author Roberto E. Escobar */ public class OteArtifactFetcher { - private final CoreArtifactTypes oteArtifactType; + private final IArtifactType oteArtifactType; - protected OteArtifactFetcher(CoreArtifactTypes oteArtifactType) { + protected OteArtifactFetcher(IArtifactType oteArtifactType) { this.oteArtifactType = oteArtifactType; } @@ -49,7 +49,7 @@ public class OteArtifactFetcher { @SuppressWarnings("unchecked") public T getNewArtifact(Branch branch) throws OseeCoreException { checkForNull(branch); - return (T) ArtifactTypeManager.addArtifact(oteArtifactType.getName(), branch); + return (T) ArtifactTypeManager.addArtifact(oteArtifactType, branch); } /** diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteToAttributeMap.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteToAttributeMap.java index acf25b13622..04252d6949c 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteToAttributeMap.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteToAttributeMap.java @@ -10,9 +10,19 @@ *******************************************************************************/ package org.eclipse.osee.ote.define.artifacts; +import static org.eclipse.osee.ote.define.AUTOGEN.OteAttributeTypes.END_DATE; +import static org.eclipse.osee.ote.define.AUTOGEN.OteAttributeTypes.FAILED; +import static org.eclipse.osee.ote.define.AUTOGEN.OteAttributeTypes.IS_BATCH_MODE_ALLOWED; +import static org.eclipse.osee.ote.define.AUTOGEN.OteAttributeTypes.LAST_MODIFIED_DATE; +import static org.eclipse.osee.ote.define.AUTOGEN.OteAttributeTypes.PASSED; +import static org.eclipse.osee.ote.define.AUTOGEN.OteAttributeTypes.RAN_IN_BATCH_MODE; +import static org.eclipse.osee.ote.define.AUTOGEN.OteAttributeTypes.SCRIPT_ABORTED; +import static org.eclipse.osee.ote.define.AUTOGEN.OteAttributeTypes.START_DATE; +import static org.eclipse.osee.ote.define.AUTOGEN.OteAttributeTypes.TOTAL_TEST_POINTS; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.Map; +import org.eclipse.osee.framework.core.data.IAttributeType; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.ote.define.TestRunField; @@ -26,52 +36,50 @@ public class OteToAttributeMap { private static final SimpleDateFormat lastModifiedFormat = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss a"); private static OteToAttributeMap instance = null; - private static Map outfileFieldToAttributeMap; + private static Map outfileFieldToAttributeMap; private OteToAttributeMap() { - outfileFieldToAttributeMap = new HashMap(); - - outfileFieldToAttributeMap.put(TestRunField.USER_ID, CoreAttributeTypes.UserId.getName()); - - outfileFieldToAttributeMap.put(TestRunField.SCRIPT_REVISION, OteAttributeTypes.REVISION.getName()); - outfileFieldToAttributeMap.put(TestRunField.SCRIPT_MODIFIED_FLAG, OteAttributeTypes.MODIFIED_FLAG.getName()); - outfileFieldToAttributeMap.put(TestRunField.SCRIPT_LAST_AUTHOR, OteAttributeTypes.LAST_AUTHOR.getName()); - outfileFieldToAttributeMap.put(TestRunField.SCRIPT_LAST_MODIFIED, OteAttributeTypes.LAST_MODIFIED_DATE.getName()); - outfileFieldToAttributeMap.put(TestRunField.SCRIPT_URL, OteAttributeTypes.TEST_SCRIPT_URL.getName()); - - outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OS_ARCH, OteAttributeTypes.OS_ARCHITECTURE.getName()); - outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OS_NAME, OteAttributeTypes.OS_NAME.getName()); - outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OS_VERSION, OteAttributeTypes.OS_VERSION.getName()); - outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OSEE_VERSION, OteAttributeTypes.OSEE_VERSION.getName()); - outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OSEE_SERVER_TITLE, - OteAttributeTypes.OSEE_SERVER_TITLE.getName()); + outfileFieldToAttributeMap = new HashMap(); + + outfileFieldToAttributeMap.put(TestRunField.USER_ID, CoreAttributeTypes.UserId); + + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_REVISION, OteAttributeTypes.REVISION); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_MODIFIED_FLAG, OteAttributeTypes.MODIFIED_FLAG); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_LAST_AUTHOR, OteAttributeTypes.LAST_AUTHOR); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_LAST_MODIFIED, OteAttributeTypes.LAST_MODIFIED_DATE); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_URL, OteAttributeTypes.TEST_SCRIPT_URL); + + outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OS_ARCH, OteAttributeTypes.OS_ARCHITECTURE); + outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OS_NAME, OteAttributeTypes.OS_NAME); + outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OS_VERSION, OteAttributeTypes.OS_VERSION); + outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OSEE_VERSION, OteAttributeTypes.OSEE_VERSION); + outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OSEE_SERVER_TITLE, OteAttributeTypes.OSEE_SERVER_TITLE); outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OSEE_SERVER_JAR_VERSIONS, - OteAttributeTypes.OSEE_SERVER_JAR_VERSION.getName()); + OteAttributeTypes.OSEE_SERVER_JAR_VERSION); - outfileFieldToAttributeMap.put(TestRunField.PROCESSOR_ID, OteAttributeTypes.PROCESSOR_ID.getName()); - outfileFieldToAttributeMap.put(TestRunField.SCRIPT_START_DATE, OteAttributeTypes.START_DATE.getName()); - outfileFieldToAttributeMap.put(TestRunField.SCRIPT_END_DATE, OteAttributeTypes.END_DATE.getName()); - outfileFieldToAttributeMap.put(TestRunField.SCRIPT_ELAPSED_TIME, OteAttributeTypes.ELAPSED_DATE.getName()); + outfileFieldToAttributeMap.put(TestRunField.PROCESSOR_ID, OteAttributeTypes.PROCESSOR_ID); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_START_DATE, OteAttributeTypes.START_DATE); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_END_DATE, OteAttributeTypes.END_DATE); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_ELAPSED_TIME, OteAttributeTypes.ELAPSED_DATE); - outfileFieldToAttributeMap.put(TestRunField.TEST_POINTS_PASSED, OteAttributeTypes.PASSED.getName()); - outfileFieldToAttributeMap.put(TestRunField.TEST_POINTS_FAILED, OteAttributeTypes.FAILED.getName()); - outfileFieldToAttributeMap.put(TestRunField.TOTAL_TEST_POINTS, OteAttributeTypes.TOTAL_TEST_POINTS.getName()); - outfileFieldToAttributeMap.put(TestRunField.TEST_ABORT_STATUS, OteAttributeTypes.SCRIPT_ABORTED.getName()); + outfileFieldToAttributeMap.put(TestRunField.TEST_POINTS_PASSED, OteAttributeTypes.PASSED); + outfileFieldToAttributeMap.put(TestRunField.TEST_POINTS_FAILED, OteAttributeTypes.FAILED); + outfileFieldToAttributeMap.put(TestRunField.TOTAL_TEST_POINTS, OteAttributeTypes.TOTAL_TEST_POINTS); + outfileFieldToAttributeMap.put(TestRunField.TEST_ABORT_STATUS, OteAttributeTypes.SCRIPT_ABORTED); - outfileFieldToAttributeMap.put(TestRunField.QUALIFICATION_LEVEL, OteAttributeTypes.QUALIFICATION_LEVEL.getName()); + outfileFieldToAttributeMap.put(TestRunField.QUALIFICATION_LEVEL, OteAttributeTypes.QUALIFICATION_LEVEL); - outfileFieldToAttributeMap.put(TestRunField.BUILD_ID, OteAttributeTypes.BUILD_ID.getName()); + outfileFieldToAttributeMap.put(TestRunField.BUILD_ID, OteAttributeTypes.BUILD_ID); - outfileFieldToAttributeMap.put(TestRunField.IS_BATCH_MODE_ALLOWED, - OteAttributeTypes.IS_BATCH_MODE_ALLOWED.getName()); - outfileFieldToAttributeMap.put(TestRunField.RAN_IN_BATCH_MODE, OteAttributeTypes.RAN_IN_BATCH_MODE.getName()); + outfileFieldToAttributeMap.put(TestRunField.IS_BATCH_MODE_ALLOWED, OteAttributeTypes.IS_BATCH_MODE_ALLOWED); + outfileFieldToAttributeMap.put(TestRunField.RAN_IN_BATCH_MODE, OteAttributeTypes.RAN_IN_BATCH_MODE); // outfileFieldToAttributeMap.put(TestRunField.SCRIPT_EXECUTION_TIME, // OTE_SKYNET_ATTRIBUTES.EgetName()); // outfileFieldToAttributeMap.put(TestRunField.SCRIPT_EXECUTION_RESULTS, - // OTE_SKYNET_ATTRIBUTES.getName()); + // OTE_SKYNET_ATTRIBUTES); // outfileFieldToAttributeMap.put(TestRunField.SCRIPT_EXECUTION_ERRORS, - // OTE_SKYNET_ATTRIBUTES.getName()); + // OTE_SKYNET_ATTRIBUTES); } public static OteToAttributeMap getInstance() { @@ -81,7 +89,7 @@ public class OteToAttributeMap { return instance; } - public String getAttributeName(String rawName) { + public IAttributeType getAttributeType(String rawName) { TestRunField field = getFieldId(rawName); return outfileFieldToAttributeMap.get(field); } @@ -96,16 +104,16 @@ public class OteToAttributeMap { return field; } - public Object asTypedObject(String attribute, String value) throws Exception { + public Object asTypedObject(IAttributeType attributeType, String value) throws Exception { Object toReturn = null; - if (isDate(attribute) != false) { - toReturn = getFormat(attribute).parse(value); - } else if (isInteger(attribute) != false) { + if (isDate(attributeType)) { + toReturn = getFormat(attributeType).parse(value); + } else if (isInteger(attributeType) != false) { if (Strings.isValid(value) != true) { value = "0"; } toReturn = new Integer(value); - } else if (isBoolean(attribute) != false) { + } else if (isBoolean(attributeType) != false) { if (Strings.isValid(value) != true) { value = "false"; } @@ -116,24 +124,22 @@ public class OteToAttributeMap { return toReturn; } - private SimpleDateFormat getFormat(String attribute) { - SimpleDateFormat toReturn = scriptStartEndDataFormat; - if (attribute.equals(OteAttributeTypes.LAST_MODIFIED_DATE.getName())) { - toReturn = lastModifiedFormat; + private SimpleDateFormat getFormat(IAttributeType attributeType) { + if (attributeType.equals(LAST_MODIFIED_DATE)) { + return lastModifiedFormat; } - return toReturn; + return scriptStartEndDataFormat; } - private boolean isDate(String attribute) { - return attribute.equals(OteAttributeTypes.LAST_MODIFIED_DATE.getName()) || attribute.equals(OteAttributeTypes.START_DATE.getName()) || attribute.equals(OteAttributeTypes.END_DATE.getName()); + private boolean isDate(IAttributeType attributeType) { + return attributeType.matches(LAST_MODIFIED_DATE, START_DATE, END_DATE); } - private boolean isInteger(String attribute) { - return attribute.equals(OteAttributeTypes.TOTAL_TEST_POINTS.getName()) || attribute.equals(OteAttributeTypes.PASSED.getName()) || attribute.equals(OteAttributeTypes.FAILED.getName()); + private boolean isInteger(IAttributeType attributeType) { + return attributeType.matches(TOTAL_TEST_POINTS, PASSED, FAILED); } - private boolean isBoolean(String attribute) { - return attribute.equals(OteAttributeTypes.SCRIPT_ABORTED.getName()) || attribute.equals(OteAttributeTypes.RAN_IN_BATCH_MODE.getName()) || attribute.equals(OteAttributeTypes.IS_BATCH_MODE_ALLOWED.getName()); + private boolean isBoolean(IAttributeType attributeType) { + return attributeType.matches(SCRIPT_ABORTED, RAN_IN_BATCH_MODE, IS_BATCH_MODE_ALLOWED); } - -} +} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/TestRunOperator.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/TestRunOperator.java index 6cc1d991625..fe47235ac3e 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/TestRunOperator.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/TestRunOperator.java @@ -15,6 +15,7 @@ import java.io.InputStream; import java.net.URI; import java.util.Date; import java.util.List; +import org.eclipse.osee.framework.core.data.IAttributeType; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.exception.AttributeDoesNotExist; @@ -87,35 +88,35 @@ public class TestRunOperator { } public String getScriptRevision() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.REVISION.getName(), ""); + return artifact.getSoleAttributeValue(OteAttributeTypes.REVISION, ""); } public String getScriptUrl() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.TEST_SCRIPT_URL.getName(), ""); + return artifact.getSoleAttributeValue(OteAttributeTypes.TEST_SCRIPT_URL, ""); } public void setLastDateUploaded(Date value) throws OseeCoreException { - artifact.setSoleAttributeValue(OteAttributeTypes.LAST_DATE_UPLOADED.getName(), value); + artifact.setSoleAttributeValue(OteAttributeTypes.LAST_DATE_UPLOADED, value); } public Date getLastDateUploaded() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.LAST_DATE_UPLOADED.getName(), null); + return artifact.getSoleAttributeValue(OteAttributeTypes.LAST_DATE_UPLOADED, null); } public void setChecksum(String value) throws OseeCoreException { - artifact.setSoleAttributeValue(OteAttributeTypes.CHECKSUM.getName(), value); + artifact.setSoleAttributeValue(OteAttributeTypes.CHECKSUM, value); } public String getChecksum() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.CHECKSUM.getName(), ""); + return artifact.getSoleAttributeValue(OteAttributeTypes.CHECKSUM, ""); } public String getOutfileExtension() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.EXTENSION.getName(), ""); + return artifact.getSoleAttributeValue(OteAttributeTypes.EXTENSION, ""); } public void setOutfileExtension(String outfile) throws OseeCoreException { - artifact.setSoleAttributeValue(OteAttributeTypes.EXTENSION.getName(), outfile); + artifact.setSoleAttributeValue(OteAttributeTypes.EXTENSION, outfile); } public boolean isFromLocalWorkspace() throws OseeCoreException, AttributeDoesNotExist { @@ -130,7 +131,7 @@ public class TestRunOperator { } public String getOutfileUrl() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.OUTFILE_URL.getName()); + return artifact.getSoleAttributeValue(OteAttributeTypes.OUTFILE_URL); } public String getOutfileContents() throws OseeCoreException { @@ -144,7 +145,7 @@ public class TestRunOperator { } public Attribute getOutfileAttribute() throws AttributeDoesNotExist, OseeCoreException { - List> attributes = artifact.getAttributes(OteAttributeTypes.OUTFILE_URL.getName()); + List> attributes = artifact.getAttributes(OteAttributeTypes.OUTFILE_URL); return attributes != null && attributes.size() > 0 ? attributes.get(0) : null; } @@ -187,7 +188,7 @@ public class TestRunOperator { getTestScriptFetcher().searchForUniqueArtifactMatching(CoreAttributeTypes.Name, artifact.getName(), artifact.getBranch()); if (testScript != null) { - artifact.setSoleAttributeValue(OteAttributeTypes.TEST_SCRIPT_GUID.getName(), testScript.getGuid()); + artifact.setSoleAttributeValue(CoreAttributeTypes.TestScriptGuid, testScript.getGuid()); } } @@ -210,15 +211,15 @@ public class TestRunOperator { } public int getTestPointsPassed() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.PASSED.getName()); + return artifact.getSoleAttributeValue(OteAttributeTypes.PASSED); } public int getTestPointsFailed() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.FAILED.getName()); + return artifact.getSoleAttributeValue(OteAttributeTypes.FAILED); } public int getTotalTestPoints() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.TOTAL_TEST_POINTS.getName()); + return artifact.getSoleAttributeValue(OteAttributeTypes.TOTAL_TEST_POINTS); } public Date getEndDate() throws OseeCoreException { @@ -233,8 +234,8 @@ public class TestRunOperator { return processDateAttribute(OteAttributeTypes.START_DATE); } - private Date processDateAttribute(OteAttributeTypes attributeType) throws OseeCoreException { - Date date = artifact.getSoleAttributeValue(attributeType.getName(), null); + private Date processDateAttribute(IAttributeType attributeType) throws OseeCoreException { + Date date = artifact.getSoleAttributeValue(attributeType, null); if (date == null) { date = new Date(0); } @@ -244,7 +245,7 @@ public class TestRunOperator { public boolean wasAborted() { boolean toReturn = true; try { - toReturn = artifact.getSoleAttributeValue(OteAttributeTypes.SCRIPT_ABORTED.getName(), false); + toReturn = artifact.getSoleAttributeValue(OteAttributeTypes.SCRIPT_ABORTED, false); } catch (Exception ex) { } return toReturn; @@ -269,46 +270,46 @@ public class TestRunOperator { public boolean isBatchModeAllowed() { boolean toReturn = false; try { - toReturn = artifact.getSoleAttributeValue(OteAttributeTypes.IS_BATCH_MODE_ALLOWED.getName(), false); + toReturn = artifact.getSoleAttributeValue(OteAttributeTypes.IS_BATCH_MODE_ALLOWED, false); } catch (Exception ex) { } return toReturn; } public String getOseeVersion() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.OSEE_VERSION.getName(), "").trim(); + return artifact.getSoleAttributeValue(OteAttributeTypes.OSEE_VERSION, "").trim(); } public String getOseeServerTitle() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.OSEE_SERVER_TITLE.getName(), "").trim(); + return artifact.getSoleAttributeValue(OteAttributeTypes.OSEE_SERVER_TITLE, "").trim(); } public String getOseeServerVersion() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.OSEE_SERVER_JAR_VERSION.getName(), "").trim(); + return artifact.getSoleAttributeValue(OteAttributeTypes.OSEE_SERVER_JAR_VERSION, "").trim(); } public String getProcessorId() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.PROCESSOR_ID.getName(), ""); + return artifact.getSoleAttributeValue(OteAttributeTypes.PROCESSOR_ID, ""); } public String getRunDuration() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.ELAPSED_DATE.getName(), ""); + return artifact.getSoleAttributeValue(OteAttributeTypes.ELAPSED_DATE, ""); } public String getQualificationLevel() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.QUALIFICATION_LEVEL.getName(), ""); + return artifact.getSoleAttributeValue(OteAttributeTypes.QUALIFICATION_LEVEL, ""); } public String getBuildId() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.BUILD_ID.getName(), ""); + return artifact.getSoleAttributeValue(OteAttributeTypes.BUILD_ID, ""); } public String getRanOnOperatingSystem() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.OS_NAME.getName(), ""); + return artifact.getSoleAttributeValue(OteAttributeTypes.OS_NAME, ""); } public String getLastAuthor() throws OseeCoreException { - return artifact.getSoleAttributeValue(OteAttributeTypes.LAST_AUTHOR.getName(), null); + return artifact.getSoleAttributeValue(OteAttributeTypes.LAST_AUTHOR, null); } public String getScriptSimpleName() { diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileDataCollector.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileDataCollector.java index 37c34111e08..a7f3ac3b371 100644 --- a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileDataCollector.java +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileDataCollector.java @@ -13,6 +13,7 @@ package org.eclipse.osee.ote.define.utilities; import java.util.HashMap; import java.util.Map; import java.util.logging.Level; +import org.eclipse.osee.framework.core.data.IAttributeType; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.util.Conditions; import org.eclipse.osee.framework.jdk.core.util.Strings; @@ -43,12 +44,12 @@ public class OutfileDataCollector implements IDataListener { public void populate(Artifact artifact) throws OseeCoreException { Conditions.checkNotNull(artifact, "artifact"); for (String fieldName : collectedData.keySet()) { - String attribute = oteToAttributeMap.getAttributeName(fieldName); - if (Strings.isValid(attribute) && artifact.isAttributeTypeValid(attribute)) { + IAttributeType attributeType = oteToAttributeMap.getAttributeType(fieldName); + if (attributeType != null && artifact.isAttributeTypeValid(attributeType)) { try { String value = collectedData.get(fieldName); - Object object = oteToAttributeMap.asTypedObject(attribute, value); - artifact.setSoleAttributeValue(attribute, object); + Object object = oteToAttributeMap.asTypedObject(attributeType, value); + artifact.setSoleAttributeValue(attributeType, object); } catch (Exception ex) { OseeLog.log(OteDefinePlugin.class, Level.SEVERE, ex); } -- cgit v1.2.3