Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2013-10-08 21:14:20 +0000
committerGerrit Code Review @ Eclipse.org2013-10-09 15:44:57 +0000
commit5bf505ef9b5bc8698eebd627878ffb8317bb7f14 (patch)
tree745f092fa78f35f2ddb31e8b7d55acf50744d6b5 /plugins/org.eclipse.osee.ats/src
parent67aea92f6e50ecb296e9298132b13127e4a21240 (diff)
downloadorg.eclipse.osee-5bf505ef9b5bc8698eebd627878ffb8317bb7f14.tar.gz
org.eclipse.osee-5bf505ef9b5bc8698eebd627878ffb8317bb7f14.tar.xz
org.eclipse.osee-5bf505ef9b5bc8698eebd627878ffb8317bb7f14.zip
bug[ats_ZKYZF]: Update RelationSetRule to allow specified artifact types to be ignored
Diffstat (limited to 'plugins/org.eclipse.osee.ats/src')
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/RelationSetRule.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/RelationSetRule.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/RelationSetRule.java
index 82f511e3189..c2eca54bf25 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/RelationSetRule.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/RelationSetRule.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.ats.util.validate;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.data.IArtifactType;
@@ -26,11 +27,14 @@ public final class RelationSetRule extends AbstractValidationRule {
private final IArtifactType artifactType;
private final Integer minimumRelations;
private final IRelationTypeSide relationEnum;
+ private final Collection<IArtifactType> ignoreArtifactTypes;
- public RelationSetRule(IArtifactType artifactType, IRelationTypeSide relationEnum, Integer minimumRelations) {
+ public RelationSetRule(IArtifactType artifactType, IRelationTypeSide relationEnum, Integer minimumRelations, IArtifactType... ignoreArtifactTypes) {
this.artifactType = artifactType;
this.relationEnum = relationEnum;
this.minimumRelations = minimumRelations;
+ this.ignoreArtifactTypes =
+ (ignoreArtifactTypes.length == 0 ? new ArrayList<IArtifactType>() : Arrays.asList(ignoreArtifactTypes));
}
public Integer getMinimumRelations() {
@@ -49,8 +53,9 @@ public final class RelationSetRule extends AbstractValidationRule {
protected ValidationResult validate(Artifact artToValidate, IProgressMonitor monitor) throws OseeCoreException {
Collection<String> errorMessages = new ArrayList<String>();
boolean validationPassed = true;
- if (hasArtifactType(artToValidate.getArtifactType())) {
- // validate that artifact has one "Requirement Trace" relation to a Subsystem Requirement
+ ArtifactType type = artToValidate.getArtifactType();
+
+ if (!isIgnoreType(type) && hasArtifactType(type)) {
Collection<Artifact> arts = artToValidate.getRelatedArtifacts(relationEnum);
if (arts.size() < minimumRelations) {
errorMessages.add(ValidationReportOperation.getRequirementHyperlink(artToValidate) + " (" + artToValidate.getGammaId() + ") has less than minimum " + minimumRelations + " relation for type \"" + relationEnum + "\"");
@@ -69,4 +74,12 @@ public final class RelationSetRule extends AbstractValidationRule {
public String getRuleTitle() {
return "Relations Check:";
}
+
+ private Collection<IArtifactType> getIgnoreArtifactTypes() {
+ return ignoreArtifactTypes;
+ }
+
+ private boolean isIgnoreType(IArtifactType type) {
+ return getIgnoreArtifactTypes().contains(type);
+ }
} \ No newline at end of file

Back to the top