Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2016-12-12 22:07:09 +0000
committerDavid W. Miller2016-12-12 22:07:09 +0000
commit27d23db481472a3326356fffe5f950720f128152 (patch)
treea7485badb4ad186b5733f316a59706839d01a96f
parent405defe328315545135f5ed17a05e86962cb6b67 (diff)
downloadorg.eclipse.osee-27d23db481472a3326356fffe5f950720f128152.tar.gz
org.eclipse.osee-27d23db481472a3326356fffe5f950720f128152.tar.xz
org.eclipse.osee-27d23db481472a3326356fffe5f950720f128152.zip
refactor: Remove IAttributeType usage from IOseeValidator
-rw-r--r--plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/report/ArtifactTraceCount.java3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumerationValidation.java7
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/ParagraphNumberAttributeValidation.java9
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/IOseeValidator.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeValidator.java65
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateArtifactValidator.java7
7 files changed, 26 insertions, 75 deletions
diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/report/ArtifactTraceCount.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/report/ArtifactTraceCount.java
index ca735800a50..fdeff1841fc 100644
--- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/report/ArtifactTraceCount.java
+++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/report/ArtifactTraceCount.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.define.traceability.report;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.RelationTypeSide;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
@@ -41,7 +42,7 @@ public class ArtifactTraceCount extends AbstractArtifactRelationReport {
}
private IAttributeType getSubsystemAttributeType(Artifact artifact) throws OseeCoreException {
- for (IAttributeType attributeType : artifact.getAttributeTypes()) {
+ for (AttributeTypeId attributeType : artifact.getAttributeTypes()) {
if (attributeType.equals(CoreAttributeTypes.Partition)) {
return CoreAttributeTypes.Partition;
} else if (attributeType.equals(CoreAttributeTypes.Csci)) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumerationValidation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumerationValidation.java
index 0f9eeecb772..067002cda68 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumerationValidation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumerationValidation.java
@@ -12,7 +12,8 @@ package org.eclipse.osee.framework.skynet.core.attribute;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.AttributeTypeId;
+import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.core.model.type.OseeEnumType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -30,12 +31,12 @@ public class OseeEnumerationValidation implements IOseeValidator {
}
@Override
- public boolean isApplicable(Artifact artifact, IAttributeType attributeType) throws OseeCoreException {
+ public boolean isApplicable(Artifact artifact, AttributeTypeId attributeType) throws OseeCoreException {
return AttributeTypeManager.getType(attributeType).isEnumerated();
}
@Override
- public IStatus validate(Artifact artifact, IAttributeType attributeType, Object proposedObject) throws OseeCoreException {
+ public IStatus validate(Artifact artifact, AttributeTypeToken attributeType, Object proposedObject) throws OseeCoreException {
String text = (String) proposedObject;
AttributeType type = AttributeTypeManager.getType(attributeType);
OseeEnumType enumType = type.getOseeEnumType();
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/ParagraphNumberAttributeValidation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/ParagraphNumberAttributeValidation.java
index 10b9a7cdfc0..39a984879db 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/ParagraphNumberAttributeValidation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/ParagraphNumberAttributeValidation.java
@@ -12,7 +12,8 @@ package org.eclipse.osee.framework.skynet.core.attribute;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.AttributeTypeId;
+import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -26,12 +27,12 @@ public class ParagraphNumberAttributeValidation implements IOseeValidator {
}
@Override
- public boolean isApplicable(Artifact artifact, IAttributeType attributeType) throws OseeCoreException {
- return AttributeTypeManager.getType(attributeType).equals(CoreAttributeTypes.ParagraphNumber);
+ public boolean isApplicable(Artifact artifact, AttributeTypeId attributeType) throws OseeCoreException {
+ return attributeType.equals(CoreAttributeTypes.ParagraphNumber);
}
@Override
- public IStatus validate(Artifact artifact, IAttributeType attributeType, Object proposedObject) throws OseeCoreException {
+ public IStatus validate(Artifact artifact, AttributeTypeToken attributeType, Object proposedObject) throws OseeCoreException {
if (artifact.getSoleAttributeValueAsString(attributeType, "").matches(".*[a-zA-Z].*")) {
return new Status(IStatus.ERROR, ParagraphNumberAttributeValidation.class.getName(),
"Invalid Paragraph Number - letters are not allowed");
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/IOseeValidator.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/IOseeValidator.java
index 1910f3309db..e028058cc0d 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/IOseeValidator.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/IOseeValidator.java
@@ -11,8 +11,8 @@
package org.eclipse.osee.framework.skynet.core.validation;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.core.data.AttributeTypeId;
+import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
public interface IOseeValidator {
@@ -23,7 +23,7 @@ public interface IOseeValidator {
public int getQualityOfService();
- public boolean isApplicable(Artifact artifact, IAttributeType attributeType) throws OseeCoreException;
+ public boolean isApplicable(Artifact artifact, AttributeTypeId attributeType);
- public IStatus validate(Artifact artifact, IAttributeType attributeType, Object proposedObject) throws OseeCoreException;
+ public IStatus validate(Artifact artifact, AttributeTypeToken attributeType, Object proposedObject);
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeValidator.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeValidator.java
index 16fc9f935ca..6b15b3a24f0 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeValidator.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeValidator.java
@@ -12,11 +12,10 @@ package org.eclipse.osee.framework.skynet.core.validation;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.plugin.core.util.ExtensionDefinedObjects;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
@@ -51,7 +50,7 @@ public class OseeValidator {
return status;
}
- public IStatus validate(int requiredQualityOfService, Artifact artifact, IAttributeType attributeType, Object proposedValue) {
+ public IStatus validate(int requiredQualityOfService, Artifact artifact, AttributeTypeToken attributeType, Object proposedValue) {
for (IOseeValidator validator : loadedObjects.getObjects()) {
if (requiredQualityOfService >= validator.getQualityOfService()) {
try {
@@ -75,23 +74,11 @@ public class OseeValidator {
public IStatus validate(int requiredQualityOfService, Artifact artifact) {
try {
- for (IAttributeType attributeType : artifact.getAttributeTypes()) {
- for (Attribute<?> attribute : artifact.getAttributes(attributeType)) {
- IStatus status = validate(requiredQualityOfService, artifact, attributeType, attribute.getValue());
+ for (AttributeTypeToken attributeType : artifact.getAttributeTypes()) {
+ for (Object value : artifact.getAttributeValues(attributeType)) {
+ IStatus status = validate(requiredQualityOfService, artifact, attributeType, value);
if (!status.isOK()) {
return status;
- // String messageToUse =
- // String.format("%s:[%s] - %s", artifact.getArtifactTypeName(), artifact.getDescriptiveName(),
- // status.getMessage());
- // if (status.isMultiStatus()) {
- // MultiStatus mStatus =
- // new MultiStatus(status.getPlugin(), status.getCode(), messageToUse, status.getException());
- // mStatus.merge(status);
- // return mStatus;
- // } else {
- // return new Status(status.getSeverity(), status.getPlugin(), status.getCode(), messageToUse,
- // status.getException());
- // }
}
}
}
@@ -100,44 +87,4 @@ public class OseeValidator {
}
return Status.OK_STATUS;
}
- // private void checkExtensionsLoaded() {
- // if (loadedObjects.isEmpty()) {
- // List<IConfigurationElement> elements = ExtensionPoints.getExtensionElements(EXTENSION_ID, EXTENSION_ELEMENT);
- // for (IConfigurationElement element : elements) {
- // // TODO Implement dynamic attribute type validation chain definition
- // // IExtension extension = ((IExtension) element.getParent());
- // // String identifier = extension.getUniqueIdentifier();
- // String attributeTypeName = element.getAttribute(ATTRIBUTE_TYPENAME);
- // String className = element.getAttribute(CLASS_NAME_ATTRIBUTE);
- // String bundleName = element.getContributor().getName();
- //
- // if (Strings.isValid(bundleName) && Strings.isValid(className)) {
- // try {
- // Bundle bundle = Platform.getBundle(bundleName);
- // Class<?> taskClass = bundle.loadClass(className);
- // IOseeValidator object = null;
- // try {
- // Method getInstance = taskClass.getMethod("getInstance", new Class[] {});
- // object = (IOseeValidator) getInstance.invoke(null, new Object[] {});
- // } catch (Exception ex) {
- // object = (IOseeValidator) taskClass.newInstance();
- // }
- // if (object != null) {
- // AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
- // loadedObjects.put(attributeType, object);
- // }
- // } catch (Exception ex) {
- // OseeLog.log(OseeActivator.class, Level.SEVERE, ex, "Unable to Load: [%s - %s]", bundleName,
- // className);
- // }
- // }
- // }
- // }
- // }
-
- // TODO Implement dynamic attribute type validation chain definition
- // public List<IValidator> createValidateChain(String xml) {
- // List<IValidator> validators = new ArrayList<>();
- // return validators;
- // }
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java
index bc4f31a7281..cfb344b3996 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java
@@ -404,7 +404,7 @@ public class ArtifactImportPage extends WizardDataTransferPage {
OseeLog.log(Activator.class, Level.SEVERE, ex);
}
} else {
- attributeTypeSelectPanel.setAllowedAttributeTypes(new ArrayList<IAttributeType>());
+ attributeTypeSelectPanel.setAllowedAttributeTypes(new ArrayList<>());
}
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateArtifactValidator.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateArtifactValidator.java
index d16c4541bbc..78aec387fb8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateArtifactValidator.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateArtifactValidator.java
@@ -13,7 +13,8 @@ package org.eclipse.osee.framework.ui.skynet.templates;
import java.util.Collection;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.AttributeTypeId;
+import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -34,13 +35,13 @@ public class TemplateArtifactValidator implements IOseeValidator {
}
@Override
- public boolean isApplicable(Artifact artifact, IAttributeType attributeType) {
+ public boolean isApplicable(Artifact artifact, AttributeTypeId attributeType) {
return artifact.isOfType(CoreArtifactTypes.RendererTemplate) && attributeType.equals(
CoreAttributeTypes.TemplateMatchCriteria);
}
@Override
- public IStatus validate(Artifact artifact, IAttributeType attributeType, Object proposedObject) throws OseeCoreException {
+ public IStatus validate(Artifact artifact, AttributeTypeToken attributeType, Object proposedObject) throws OseeCoreException {
if (proposedObject instanceof String) {
String toVerify = (String) proposedObject;
if (Strings.isValid(toVerify)) {

Back to the top