Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/plugin.xml6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/ParagraphNumberAttributeValidation.java42
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/AbstractWordCompare.java65
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/WordUiUtil.java3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java19
5 files changed, 115 insertions, 20 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/plugin.xml b/plugins/org.eclipse.osee.framework.skynet.core/plugin.xml
index 6cfbb26469..5f653dc741 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/plugin.xml
+++ b/plugins/org.eclipse.osee.framework.skynet.core/plugin.xml
@@ -212,6 +212,12 @@
</OseeValidator>
</extension>
<extension
+ point="org.eclipse.osee.framework.skynet.core.OseeValidator">
+ <OseeValidator
+ classname="org.eclipse.osee.framework.skynet.core.attribute.ParagraphNumberAttributeValidation">
+ </OseeValidator>
+ </extension>
+ <extension
point="org.eclipse.osee.framework.skynet.core.HttpServerRequest">
<IHttpServerRequest
classname="org.eclipse.osee.framework.skynet.core.httpRequests.ClientDashboardRequestHandler">
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
new file mode 100644
index 0000000000..10b9a7cdfc
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/ParagraphNumberAttributeValidation.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 20016 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+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.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.validation.IOseeValidator;
+
+public class ParagraphNumberAttributeValidation implements IOseeValidator {
+
+ @Override
+ public int getQualityOfService() {
+ return 0;
+ }
+
+ @Override
+ public boolean isApplicable(Artifact artifact, IAttributeType attributeType) throws OseeCoreException {
+ return AttributeTypeManager.getType(attributeType).equals(CoreAttributeTypes.ParagraphNumber);
+ }
+
+ @Override
+ public IStatus validate(Artifact artifact, IAttributeType 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");
+ }
+ return Status.OK_STATUS;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/AbstractWordCompare.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/AbstractWordCompare.java
index cae382a78a..88d39a8b5b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/AbstractWordCompare.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/AbstractWordCompare.java
@@ -23,6 +23,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OperationTimedoutException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.Pair;
@@ -79,31 +80,61 @@ public abstract class AbstractWordCompare implements IComparator {
@Override
public void compare(IProgressMonitor monitor, CompareDataCollector collector, PresentationType presentationType, ArtifactDelta artifactDelta, String pathPrefix) throws OseeCoreException {
- Artifact artifact = artifactDelta.getStartArtifact();
- if (artifact == null) {
- artifact = artifactDelta.getEndArtifact();
+ boolean invalid = false;
+ Artifact startArt = artifactDelta.getStartArtifact();
+ Artifact endArt = artifactDelta.getEndArtifact();
+ String paraNumStart = null;
+ String paraNumEnd = null;
+ if (startArt != null) {
+ paraNumStart = startArt.getSoleAttributeValueAsString(CoreAttributeTypes.ParagraphNumber, null);
+ }
+ if (endArt != null) {
+ paraNumEnd =
+ artifactDelta.getEndArtifact().getSoleAttributeValueAsString(CoreAttributeTypes.ParagraphNumber, null);
}
- IOseeBranch branch = artifact.getBranchToken();
- IVbaDiffGenerator diffGenerator = createGenerator(Collections.singletonList(artifact), branch, presentationType);
+ if (paraNumStart != null && paraNumStart.matches(".*[a-zA-Z].*")) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP,
+ String.format("Invalid Paragraph Number on Artifact [%s], cannot contain letters",
+ artifactDelta.getEndArtifact().getArtId()));
+ invalid = true;
+ }
+ if (paraNumEnd != null && paraNumEnd.matches(".*[a-zA-Z].*")) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP,
+ String.format("Invalid Paragraph Number on Artifact [%s], cannot contain letters",
+ artifactDelta.getEndArtifact().getArtId()));
+ invalid = true;
+ }
- String resultPath =
- getDiffPath(artifactDelta.getStartArtifact(), artifactDelta.getEndArtifact(), presentationType, pathPrefix);
- String vbsPath = RenderingUtil.getRenderPath(renderer, branch, presentationType, null, "compareDocs", ".vbs");
+ if (!invalid) {
+ Artifact artifact = artifactDelta.getStartArtifact();
+ if (artifact == null) {
+ artifact = artifactDelta.getEndArtifact();
+ }
+ IOseeBranch branch = artifact.getBranchToken();
- CompareData data = new CompareData(resultPath, vbsPath);
+ IVbaDiffGenerator diffGenerator =
+ createGenerator(Collections.singletonList(artifact), branch, presentationType);
- addToCompare(monitor, data, presentationType, artifactDelta);
- try {
- diffGenerator.generate(monitor, data);
- } catch (OperationTimedoutException ex) {
- if (!skipDialogs) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, String.format(
- "The View Word Change Report Timed-out for Artifact(s) [%s] on Branch [%s]", artifact, branch));
+ String resultPath =
+ getDiffPath(artifactDelta.getStartArtifact(), artifactDelta.getEndArtifact(), presentationType, pathPrefix);
+ String vbsPath = RenderingUtil.getRenderPath(renderer, branch, presentationType, null, "compareDocs", ".vbs");
+
+ CompareData data = new CompareData(resultPath, vbsPath);
+
+ addToCompare(monitor, data, presentationType, artifactDelta);
+ try {
+ diffGenerator.generate(monitor, data);
+ } catch (OperationTimedoutException ex) {
+ if (!skipDialogs) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, String.format(
+ "The View Word Change Report Timed-out for Artifact(s) [%s] on Branch [%s]", artifact, branch));
+ }
}
+
+ collector.onCompare(data);
}
- collector.onCompare(data);
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/WordUiUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/WordUiUtil.java
index e886772a0c..3079eb5af9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/WordUiUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/WordUiUtil.java
@@ -37,8 +37,7 @@ public final class WordUiUtil {
"\t\nInvalid Link: artifact with guid: " + unknownGuid + " does not exist on this branch.";
}
displayUnhandledArtifacts(java.util.Collections.singleton(artifact),
- String.format("\nThe following referenced GUIDs cannot be found: \n\n%s",
- invalidLinkMessage));
+ String.format("\nThe following referenced GUIDs cannot be found: \n\n%s", invalidLinkMessage));
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java
index 6be120d1bc..f7006aa357 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java
@@ -50,7 +50,7 @@ import org.eclipse.ui.progress.UIJob;
/**
* @author Roberto E. Escobar
*/
-public class XStackedDam extends XStackedWidget<String>implements IAttributeWidget {
+public class XStackedDam extends XStackedWidget<String> implements IAttributeWidget {
private Artifact artifact;
private IAttributeType attributeType;
private final Map<String, XWidget> xWidgets;
@@ -331,5 +331,22 @@ public class XStackedDam extends XStackedWidget<String>implements IAttributeWidg
sText.setBackground(Displays.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
}
}
+
+ @Override
+ public IStatus isValid() {
+ IStatus status = super.isValid();
+ if (status.isOK()) {
+ try {
+ if (getArtifact() != null && getAttributeType() != null) {
+ status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, getArtifact(), getAttributeType(),
+ get());
+ }
+ } catch (OseeCoreException ex) {
+ status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error getting Artifact", ex);
+ }
+ }
+ return status;
+ }
+
}
}

Back to the top