Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan E. Cook2017-03-27 19:03:05 +0000
committerdonald.g.dunne2017-04-26 16:24:32 +0000
commit04f10383525df3879005b5b548fbf752b9ae1b1f (patch)
tree2b12df04ef2ac1eb5ef0f4210df6dea1a8415f25
parent04678c58c38cc3beaf0e02be268ff9c7b5b06102 (diff)
downloadorg.eclipse.osee-04f10383525df3879005b5b548fbf752b9ae1b1f.tar.gz
org.eclipse.osee-04f10383525df3879005b5b548fbf752b9ae1b1f.tar.xz
org.eclipse.osee-04f10383525df3879005b5b548fbf752b9ae1b1f.zip
refactor: Condense ats Number Validation
Signed-off-by: Morgan E. Cook <Morgan.e.cook@boeing.com> Change-Id: Ic9c268fc90044042af4dac584082777cbae471e7
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetConstraint.java18
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinition.java34
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionFloatMinMaxConstraint.java24
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionIntMinMaxConstraint.java24
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionListMinMaxSelectedConstraint.java24
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinition.java21
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionFloatMinMaxConstraint.java51
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionIntMinMaxConstraint.java51
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionListMinMaxSelectedConstraint.java51
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsCore_Validator_JT_Suite.java3
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidatorTest.java114
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXListValidatorTest.java20
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXNumberValidatorTest.java (renamed from plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXFloatValidatorTest.java)25
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidatorTest.java153
-rw-r--r--plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsCoreXWidgetValidatorProvider.java3
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidator.java41
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXNumberValidator.java (renamed from plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXFloatValidator.java)11
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidator.java153
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionFloatMinMaxConstraint.java51
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionIntMinMaxConstraint.java51
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionListMinMaxSelectedConstraint.java51
-rw-r--r--plugins/org.eclipse.osee.ats.dsl.integration/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.ats.dsl.integration/src/org/eclipse/osee/ats/dsl/integration/internal/ConvertAtsDslToWorkDefinition.java16
-rw-r--r--plugins/org.eclipse.osee.ats.mocks/src/org/eclipse/osee/ats/mocks/MockWidgetDefinition.java21
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java12
26 files changed, 106 insertions, 921 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetConstraint.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetConstraint.java
deleted file mode 100644
index f15f4a27fa2..00000000000
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetConstraint.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.ats.api.workdef;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IAtsWidgetConstraint {
- // do nothing
-}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinition.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinition.java
index 44186426121..21afda89eb9 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinition.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinition.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.ats.api.workdef;
-import java.util.List;
-
/**
* @author Donald G. Dunne
*/
@@ -21,42 +19,46 @@ public interface IAtsWidgetDefinition extends IAtsLayoutItem {
* Identification
*/
@Override
- public abstract String getName();
+ public String getName();
- public abstract String getToolTip();
+ public String getToolTip();
- public abstract String getDescription();
+ public String getDescription();
/**
* Storage
*/
- public abstract String getAtrributeName();
+ public String getAtrributeName();
- public abstract String getDefaultValue();
+ public String getDefaultValue();
/**
* Options
*/
- public abstract boolean is(WidgetOption widgetOption);
+ public boolean is(WidgetOption widgetOption);
+
+ public IAtsWidgetOptionHandler getOptions();
+
+ public void setConstraint(double min, double max);
- public abstract IAtsWidgetOptionHandler getOptions();
+ public Double getMax();
- public abstract List<IAtsWidgetConstraint> getConstraints();
+ public Double getMin();
- public abstract void set(WidgetOption widgetOption);
+ public void set(WidgetOption widgetOption);
/**
* Widget Type
*/
- public abstract String getXWidgetName();
+ public String getXWidgetName();
- public abstract void setXWidgetName(String xWidgetName);
+ public void setXWidgetName(String xWidgetName);
- public abstract int getHeight();
+ public int getHeight();
- public abstract void setHeight(int height);
+ public void setHeight(int height);
@Override
- public abstract String toString();
+ public String toString();
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionFloatMinMaxConstraint.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionFloatMinMaxConstraint.java
deleted file mode 100644
index 43fbd674e16..00000000000
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionFloatMinMaxConstraint.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 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.ats.api.workdef;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IAtsWidgetDefinitionFloatMinMaxConstraint extends IAtsWidgetConstraint {
-
- public abstract void set(Double minValue, Double maxValue);
-
- public abstract Double getMinValue();
-
- public abstract Double getMaxValue();
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionIntMinMaxConstraint.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionIntMinMaxConstraint.java
deleted file mode 100644
index 1ca0132273e..00000000000
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionIntMinMaxConstraint.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 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.ats.api.workdef;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IAtsWidgetDefinitionIntMinMaxConstraint extends IAtsWidgetConstraint {
-
- public abstract void set(Integer minValue, Integer maxValue);
-
- public abstract Integer getMinValue();
-
- public abstract Integer getMaxValue();
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionListMinMaxSelectedConstraint.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionListMinMaxSelectedConstraint.java
deleted file mode 100644
index 0e902bd7f53..00000000000
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAtsWidgetDefinitionListMinMaxSelectedConstraint.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 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.ats.api.workdef;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IAtsWidgetDefinitionListMinMaxSelectedConstraint extends IAtsWidgetConstraint {
-
- public abstract void set(Integer minSelected, Integer maxSelected);
-
- public abstract Integer getMinSelected();
-
- public abstract Integer getMaxSelected();
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinition.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinition.java
index 403cc953655..e9eb3c50c49 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinition.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinition.java
@@ -10,9 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.ats.api.workdef.model;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetConstraint;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinition;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetOptionHandler;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
@@ -30,7 +27,8 @@ public class WidgetDefinition extends LayoutItem implements IAtsWidgetDefinition
private String xWidgetName;
private String defaultValue;
private final WidgetOptionHandler options = new WidgetOptionHandler();
- private final List<IAtsWidgetConstraint> constraints = new ArrayList<>();
+ private Double min;
+ private Double max;
public WidgetDefinition(String name) {
super(name);
@@ -114,8 +112,19 @@ public class WidgetDefinition extends LayoutItem implements IAtsWidgetDefinition
}
@Override
- public List<IAtsWidgetConstraint> getConstraints() {
- return constraints;
+ public void setConstraint(double min, double max) {
+ this.min = min;
+ this.max = max;
+ }
+
+ @Override
+ public Double getMin() {
+ return min;
+ }
+
+ @Override
+ public Double getMax() {
+ return max;
}
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionFloatMinMaxConstraint.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionFloatMinMaxConstraint.java
deleted file mode 100644
index 8d9f47d5d74..00000000000
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionFloatMinMaxConstraint.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.ats.api.workdef.model;
-
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionFloatMinMaxConstraint;
-
-/**
- * @author Donald G. Dunne
- */
-public class WidgetDefinitionFloatMinMaxConstraint implements IAtsWidgetDefinitionFloatMinMaxConstraint {
- private Double minValue = null;
- private Double maxValue = null;
-
- public WidgetDefinitionFloatMinMaxConstraint(Double minValue, Double maxValue) {
- set(minValue, maxValue);
- }
-
- public WidgetDefinitionFloatMinMaxConstraint(String minValue, String maxValue) {
- if (minValue != null) {
- this.minValue = new Double(minValue);
- }
- if (maxValue != null) {
- this.maxValue = new Double(maxValue);
- }
- }
-
- @Override
- public void set(Double minValue, Double maxValue) {
- this.minValue = minValue;
- this.maxValue = maxValue;
- }
-
- @Override
- public Double getMinValue() {
- return minValue;
- }
-
- @Override
- public Double getMaxValue() {
- return maxValue;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionIntMinMaxConstraint.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionIntMinMaxConstraint.java
deleted file mode 100644
index 1dc1dc01fb7..00000000000
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionIntMinMaxConstraint.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.ats.api.workdef.model;
-
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionIntMinMaxConstraint;
-
-/**
- * @author Donald G. Dunne
- */
-public class WidgetDefinitionIntMinMaxConstraint implements IAtsWidgetDefinitionIntMinMaxConstraint {
- private Integer minValue = null;
- private Integer maxValue = null;
-
- public WidgetDefinitionIntMinMaxConstraint(Integer minValue, Integer maxValue) {
- set(minValue, maxValue);
- }
-
- public WidgetDefinitionIntMinMaxConstraint(String minValue, String maxValue) {
- if (minValue != null) {
- this.minValue = new Integer(minValue);
- }
- if (maxValue != null) {
- this.maxValue = new Integer(maxValue);
- }
- }
-
- @Override
- public void set(Integer minValue, Integer maxValue) {
- this.minValue = minValue;
- this.maxValue = maxValue;
- }
-
- @Override
- public Integer getMinValue() {
- return minValue;
- }
-
- @Override
- public Integer getMaxValue() {
- return maxValue;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionListMinMaxSelectedConstraint.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionListMinMaxSelectedConstraint.java
deleted file mode 100644
index 33d918edb0f..00000000000
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/model/WidgetDefinitionListMinMaxSelectedConstraint.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.ats.api.workdef.model;
-
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionListMinMaxSelectedConstraint;
-
-/**
- * @author Donald G. Dunne
- */
-public class WidgetDefinitionListMinMaxSelectedConstraint implements IAtsWidgetDefinitionListMinMaxSelectedConstraint {
- private Integer minSelected = null;
- private Integer maxSelected = null;
-
- public WidgetDefinitionListMinMaxSelectedConstraint(Integer minSelected, Integer maxSelected) {
- set(minSelected, maxSelected);
- }
-
- public WidgetDefinitionListMinMaxSelectedConstraint(String minSelected, String maxSelected) {
- if (minSelected != null) {
- this.minSelected = new Integer(minSelected);
- }
- if (maxSelected != null) {
- this.maxSelected = new Integer(maxSelected);
- }
- }
-
- @Override
- public void set(Integer minSelected, Integer maxSelected) {
- this.minSelected = minSelected;
- this.maxSelected = maxSelected;
- }
-
- @Override
- public Integer getMinSelected() {
- return minSelected;
- }
-
- @Override
- public Integer getMaxSelected() {
- return maxSelected;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsCore_Validator_JT_Suite.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsCore_Validator_JT_Suite.java
index 801a5c6c1ec..c1ebba65187 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsCore_Validator_JT_Suite.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsCore_Validator_JT_Suite.java
@@ -21,8 +21,7 @@ import org.junit.runners.Suite;
AtsCoreXWidgetValidatorProviderTest.class,
AtsXWidgetValidatorTest.class,
AtsXTextValidatorTest.class,
- AtsXIntegerValidatorTest.class,
- AtsXFloatValidatorTest.class,
+ AtsXNumberValidatorTest.class,
AtsXDateValidatorTest.class,
AtsXListValidatorTest.class,
AtsXComboBooleanValidatorTest.class,
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidatorTest.java
deleted file mode 100644
index 7b1315ba49d..00000000000
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidatorTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.ats.core.validator;
-
-import java.util.Arrays;
-import org.eclipse.osee.ats.api.IAtsServices;
-import org.eclipse.osee.ats.api.IAtsWorkItem;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionIntMinMaxConstraint;
-import org.eclipse.osee.ats.api.workdef.StateType;
-import org.eclipse.osee.ats.api.workdef.WidgetOption;
-import org.eclipse.osee.ats.api.workdef.WidgetResult;
-import org.eclipse.osee.ats.api.workdef.WidgetStatus;
-import org.eclipse.osee.ats.core.workdef.SimpleWidgetDefinitionIntMinMaxConstraint;
-import org.eclipse.osee.ats.mocks.MockStateDefinition;
-import org.eclipse.osee.ats.mocks.MockValueProvider;
-import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.junit.Assert;
-import org.mockito.Mock;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsXIntegerValidatorTest {
- private IAtsServices atsServices;
- // @formatter:off
- @Mock IAtsWorkItem workItem;
- // @formatter:on
-
- @org.junit.Test
- public void testValidateTransition() throws OseeCoreException {
- AtsXIntegerValidator validator = new AtsXIntegerValidator();
-
- MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
- widgetDef.setXWidgetName("xList");
-
- MockStateDefinition fromStateDef = new MockStateDefinition("from");
- fromStateDef.setStateType(StateType.Working);
- MockStateDefinition toStateDef = new MockStateDefinition("to");
- toStateDef.setStateType(StateType.Working);
-
- // Valid for anything not XIntegerDam
- WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
- fromStateDef, toStateDef, atsServices);
- ValidatorTestUtil.assertValidResult(result);
-
- widgetDef.setXWidgetName("XIntegerDam");
-
- result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
- ValidatorTestUtil.assertValidResult(result);
-
- widgetDef.getOptions().add(WidgetOption.REQUIRED_FOR_TRANSITION);
-
- // Not valid if widgetDef required and no values set
- result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef, fromStateDef,
- toStateDef, atsServices);
- Assert.assertEquals(WidgetStatus.Invalid_Incompleted, result.getStatus());
- }
-
- @org.junit.Test
- public void testValidateTransition_MinMaxConstraint() throws OseeCoreException {
- AtsXIntegerValidator validator = new AtsXIntegerValidator();
-
- IAtsWidgetDefinitionIntMinMaxConstraint constraint = new SimpleWidgetDefinitionIntMinMaxConstraint("0", "0");
-
- MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
- widgetDef.setXWidgetName("XIntegerDam");
- widgetDef.getConstraints().add(constraint);
-
- MockStateDefinition fromStateDef = new MockStateDefinition("from");
- fromStateDef.setStateType(StateType.Working);
- MockStateDefinition toStateDef = new MockStateDefinition("to");
- toStateDef.setStateType(StateType.Working);
-
- // Valid is nothing entered
- WidgetResult result = validator.validateTransition(workItem, ValidatorTestUtil.emptyValueProvider, widgetDef,
- fromStateDef, toStateDef, atsServices);
- ValidatorTestUtil.assertValidResult(result);
-
- //Invalid_Range if > than what should be
- constraint.set(0, 2);
- MockValueProvider provider = new MockValueProvider(Arrays.asList("0", "2", "3"));
- result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
- Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
-
- //Invalid_Range if less than supposed to
- constraint.set(1, 2);
- provider = new MockValueProvider(Arrays.asList("0"));
- result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
- Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
-
- //Valid if == what supposed to be
- constraint.set(2, 2);
- provider = new MockValueProvider(Arrays.asList("2", "2"));
- result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
- ValidatorTestUtil.assertValidResult(result);
-
- // test nulls
- constraint = new SimpleWidgetDefinitionIntMinMaxConstraint((String) null, null);
- Assert.assertEquals(null, constraint.getMinValue());
- Assert.assertEquals(null, constraint.getMaxValue());
-
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXListValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXListValidatorTest.java
index 49ceec558db..d5ba247f1a1 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXListValidatorTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXListValidatorTest.java
@@ -13,12 +13,10 @@ package org.eclipse.osee.ats.core.validator;
import java.util.Arrays;
import org.eclipse.osee.ats.api.IAtsServices;
import org.eclipse.osee.ats.api.IAtsWorkItem;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionListMinMaxSelectedConstraint;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
import org.eclipse.osee.ats.api.workdef.WidgetResult;
import org.eclipse.osee.ats.api.workdef.WidgetStatus;
-import org.eclipse.osee.ats.core.workdef.SimpleWidgetDefinitionListMinMaxSelectedConstraint;
import org.eclipse.osee.ats.mocks.MockStateDefinition;
import org.eclipse.osee.ats.mocks.MockValueProvider;
import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
@@ -70,12 +68,9 @@ public class AtsXListValidatorTest {
public void testValidateTransition_MinMaxConstraint() throws OseeCoreException {
AtsXListValidator validator = new AtsXListValidator();
- IAtsWidgetDefinitionListMinMaxSelectedConstraint constraint =
- new SimpleWidgetDefinitionListMinMaxSelectedConstraint("0", "0");
-
MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
widgetDef.setXWidgetName("XListDam");
- widgetDef.getConstraints().add(constraint);
+ widgetDef.setConstraint(0, 0);
MockStateDefinition fromStateDef = new MockStateDefinition("from");
fromStateDef.setStateType(StateType.Working);
@@ -88,28 +83,21 @@ public class AtsXListValidatorTest {
ValidatorTestUtil.assertValidResult(result);
//Invalid_Range if select more than supposed to
- constraint.set(0, 2);
+ widgetDef.setConstraint(0, 2);
MockValueProvider provider = new MockValueProvider(Arrays.asList("this", "is", "selected"));
result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
//Invalid_Range if less than supposed to
- constraint.set(2, 2);
+ widgetDef.setConstraint(2, 2);
provider = new MockValueProvider(Arrays.asList("this"));
result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
//Valid if less what supposed to
- constraint.set(2, 2);
+ widgetDef.setConstraint(2, 2);
provider = new MockValueProvider(Arrays.asList("this", "is"));
result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
-
- // test nulls
- constraint = new SimpleWidgetDefinitionListMinMaxSelectedConstraint((String) null, null);
- Assert.assertEquals(null, constraint.getMinSelected());
- Assert.assertEquals(null, constraint.getMaxSelected());
-
}
-
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXFloatValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXNumberValidatorTest.java
index f521efb15e3..2c7763da719 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXFloatValidatorTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXNumberValidatorTest.java
@@ -13,12 +13,10 @@ package org.eclipse.osee.ats.core.validator;
import java.util.Arrays;
import org.eclipse.osee.ats.api.IAtsServices;
import org.eclipse.osee.ats.api.IAtsWorkItem;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionFloatMinMaxConstraint;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
import org.eclipse.osee.ats.api.workdef.WidgetResult;
import org.eclipse.osee.ats.api.workdef.WidgetStatus;
-import org.eclipse.osee.ats.core.workdef.SimpleWidgetDefinitionFloatMinMaxConstraint;
import org.eclipse.osee.ats.mocks.MockStateDefinition;
import org.eclipse.osee.ats.mocks.MockValueProvider;
import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
@@ -29,7 +27,7 @@ import org.mockito.Mock;
/**
* @author Donald G. Dunne
*/
-public class AtsXFloatValidatorTest {
+public class AtsXNumberValidatorTest {
private IAtsServices atsServices;
// @formatter:off
@Mock IAtsWorkItem workItem;
@@ -37,7 +35,7 @@ public class AtsXFloatValidatorTest {
@org.junit.Test
public void testValidateTransition() throws OseeCoreException {
- AtsXFloatValidator validator = new AtsXFloatValidator();
+ AtsXNumberValidator validator = new AtsXNumberValidator();
MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
widgetDef.setXWidgetName("xList");
@@ -68,14 +66,11 @@ public class AtsXFloatValidatorTest {
@org.junit.Test
public void testValidateTransition_MinMaxConstraint() throws OseeCoreException {
- AtsXFloatValidator validator = new AtsXFloatValidator();
-
- IAtsWidgetDefinitionFloatMinMaxConstraint constraint =
- new SimpleWidgetDefinitionFloatMinMaxConstraint("0.0", "0.0");
+ AtsXNumberValidator validator = new AtsXNumberValidator();
MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
widgetDef.setXWidgetName("XFloatDam");
- widgetDef.getConstraints().add(constraint);
+ widgetDef.setConstraint(0.0, 0.0);
MockStateDefinition fromStateDef = new MockStateDefinition("from");
fromStateDef.setStateType(StateType.Working);
@@ -88,28 +83,22 @@ public class AtsXFloatValidatorTest {
ValidatorTestUtil.assertValidResult(result);
//Invalid_Range if > than what should be
- constraint.set(0.0, 2.0);
+ widgetDef.setConstraint(0.0, 2.0);
MockValueProvider provider = new MockValueProvider(Arrays.asList("0.0", "2.0", "3.0"));
result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
//Invalid_Range if less than supposed to
- constraint.set(1.0, 2.0);
+ widgetDef.setConstraint(1.0, 2.0);
provider = new MockValueProvider(Arrays.asList("0.0"));
result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
//Valid if == what supposed to be
- constraint.set(2.0, 2.0);
+ widgetDef.setConstraint(2.0, 2.0);
provider = new MockValueProvider(Arrays.asList("2.0", "2.0"));
result = validator.validateTransition(workItem, provider, widgetDef, fromStateDef, toStateDef, atsServices);
ValidatorTestUtil.assertValidResult(result);
-
- // test nulls
- constraint = new SimpleWidgetDefinitionFloatMinMaxConstraint((String) null, null);
- Assert.assertEquals(null, constraint.getMinValue());
- Assert.assertEquals(null, constraint.getMaxValue());
-
}
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidatorTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidatorTest.java
index 07fa900e878..f3dd697256d 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidatorTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidatorTest.java
@@ -17,16 +17,10 @@ import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.util.IValueProvider;
import org.eclipse.osee.ats.api.workdef.IAtsStateDefinition;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinition;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionFloatMinMaxConstraint;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionIntMinMaxConstraint;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionListMinMaxSelectedConstraint;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
import org.eclipse.osee.ats.api.workdef.WidgetResult;
import org.eclipse.osee.ats.api.workdef.WidgetStatus;
-import org.eclipse.osee.ats.core.workdef.SimpleWidgetDefinitionFloatMinMaxConstraint;
-import org.eclipse.osee.ats.core.workdef.SimpleWidgetDefinitionIntMinMaxConstraint;
-import org.eclipse.osee.ats.core.workdef.SimpleWidgetDefinitionListMinMaxSelectedConstraint;
import org.eclipse.osee.ats.mocks.MockStateDefinition;
import org.eclipse.osee.ats.mocks.MockValueProvider;
import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
@@ -136,135 +130,6 @@ public class AtsXWidgetValidatorTest {
}
@org.junit.Test
- public void testIsInteger() {
- Assert.assertFalse(validator.isInteger("asf"));
-
- Assert.assertFalse(validator.isInteger("4.5"));
-
- Assert.assertTrue(validator.isInteger("345"));
- }
-
- @org.junit.Test
- public void testGetInteger() {
- Assert.assertEquals(null, validator.getInteger("asf"));
-
- Assert.assertEquals(null, validator.getInteger("4.5"));
-
- Assert.assertEquals(new Integer(345), validator.getInteger("345"));
- }
-
- @org.junit.Test
- public void testGetConstraintOfType() {
- MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
-
- Assert.assertNull(validator.getConstraintOfType(widgetDef, IAtsWidgetDefinitionIntMinMaxConstraint.class));
-
- IAtsWidgetDefinitionIntMinMaxConstraint constraint = new SimpleWidgetDefinitionIntMinMaxConstraint(34, 45);
- widgetDef.getConstraints().add(constraint);
-
- Assert.assertEquals(constraint,
- validator.getConstraintOfType(widgetDef, IAtsWidgetDefinitionIntMinMaxConstraint.class));
- }
-
- @org.junit.Test
- public void testGetIntMinMaxValueSet() {
-
- MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
-
- Assert.assertNull(validator.getConstraintOfType(widgetDef, IAtsWidgetDefinitionIntMinMaxConstraint.class));
- Assert.assertEquals(null, validator.getIntMinValueSet(widgetDef));
- Assert.assertEquals(null, validator.getIntMaxValueSet(widgetDef));
-
- IAtsWidgetDefinitionIntMinMaxConstraint constraint = new SimpleWidgetDefinitionIntMinMaxConstraint(34, 45);
- widgetDef.getConstraints().add(constraint);
-
- Assert.assertEquals(new Integer(34), validator.getIntMinValueSet(widgetDef));
- Assert.assertEquals(new Integer(45), validator.getIntMaxValueSet(widgetDef));
- }
-
- @org.junit.Test
- public void testIsValidInteger() throws OseeCoreException {
- MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
-
- WidgetResult result = validator.isValidInteger(new MockValueProvider(Arrays.asList("asdf", "345")), widgetDef);
- Assert.assertEquals(WidgetStatus.Invalid_Type, result.getStatus());
- Assert.assertEquals(widgetDef.getName(), result.getWidgetDef().getName());
- Assert.assertTrue(Strings.isValid(result.getDetails()));
-
- result = validator.isValidInteger(new MockValueProvider(Arrays.asList("23", "345")), widgetDef);
- ValidatorTestUtil.assertValidResult(result);
-
- IAtsWidgetDefinitionIntMinMaxConstraint constraint = new SimpleWidgetDefinitionIntMinMaxConstraint(34, 45);
- widgetDef.getConstraints().add(constraint);
- result = validator.isValidInteger(new MockValueProvider(Arrays.asList("37", "42")), widgetDef);
- ValidatorTestUtil.assertValidResult(result);
-
- result = validator.isValidInteger(new MockValueProvider(Arrays.asList("12", "42")), widgetDef);
- Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
- Assert.assertEquals(widgetDef.getName(), result.getWidgetDef().getName());
- Assert.assertTrue(Strings.isValid(result.getDetails()));
- }
-
- @org.junit.Test
- public void testIsFloat() {
- Assert.assertFalse(validator.isFloat("asf"));
-
- Assert.assertFalse(validator.isFloat("4a"));
-
- Assert.assertTrue(validator.isFloat("345.0"));
- }
-
- @org.junit.Test
- public void testGetFloat() {
- Assert.assertEquals(null, validator.getFloat("asf"));
-
- Assert.assertEquals(null, validator.getFloat("4a"));
-
- Assert.assertEquals(new Double(345.0), validator.getFloat("345.0"));
- }
-
- @org.junit.Test
- public void testGetFloatMinMaxValueSet() {
-
- MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
-
- Assert.assertNull(validator.getConstraintOfType(widgetDef, IAtsWidgetDefinitionFloatMinMaxConstraint.class));
- Assert.assertEquals(null, validator.getFloatMinValueSet(widgetDef));
- Assert.assertEquals(null, validator.getFloatMaxValueSet(widgetDef));
-
- IAtsWidgetDefinitionFloatMinMaxConstraint constraint =
- new SimpleWidgetDefinitionFloatMinMaxConstraint(34.3, 45.5);
- widgetDef.getConstraints().add(constraint);
-
- Assert.assertEquals(new Double(34.3), validator.getFloatMinValueSet(widgetDef));
- Assert.assertEquals(new Double(45.5), validator.getFloatMaxValueSet(widgetDef));
- }
-
- @org.junit.Test
- public void testIsValidFloat() throws OseeCoreException {
- MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
-
- WidgetResult result = validator.isValidFloat(new MockValueProvider(Arrays.asList("asdf", "345.0")), widgetDef);
- Assert.assertEquals(WidgetStatus.Invalid_Type, result.getStatus());
- Assert.assertEquals(widgetDef.getName(), result.getWidgetDef().getName());
- Assert.assertTrue(Strings.isValid(result.getDetails()));
-
- result = validator.isValidFloat(new MockValueProvider(Arrays.asList("23.2", "345.0")), widgetDef);
- ValidatorTestUtil.assertValidResult(result);
-
- IAtsWidgetDefinitionFloatMinMaxConstraint constraint =
- new SimpleWidgetDefinitionFloatMinMaxConstraint(34.3, 45.5);
- widgetDef.getConstraints().add(constraint);
- result = validator.isValidFloat(new MockValueProvider(Arrays.asList("37.3", "42.1")), widgetDef);
- ValidatorTestUtil.assertValidResult(result);
-
- result = validator.isValidFloat(new MockValueProvider(Arrays.asList("12.0", "42.1")), widgetDef);
- Assert.assertEquals(WidgetStatus.Invalid_Range, result.getStatus());
- Assert.assertEquals(widgetDef.getName(), result.getWidgetDef().getName());
- Assert.assertTrue(Strings.isValid(result.getDetails()));
- }
-
- @org.junit.Test
public void testIsValidDate() throws OseeCoreException {
MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
@@ -273,22 +138,4 @@ public class AtsXWidgetValidatorTest {
}
- @org.junit.Test
- public void testGetListMinMaxValueSelected() {
-
- MockWidgetDefinition widgetDef = new MockWidgetDefinition("test");
-
- Assert.assertNull(
- validator.getConstraintOfType(widgetDef, IAtsWidgetDefinitionListMinMaxSelectedConstraint.class));
- Assert.assertEquals(null, validator.getListMinSelected(widgetDef));
- Assert.assertEquals(null, validator.getListMaxSelected(widgetDef));
-
- IAtsWidgetDefinitionListMinMaxSelectedConstraint constraint =
- new SimpleWidgetDefinitionListMinMaxSelectedConstraint(2, 4);
- widgetDef.getConstraints().add(constraint);
-
- Assert.assertEquals(new Integer(2), validator.getListMinSelected(widgetDef));
- Assert.assertEquals(new Integer(4), validator.getListMaxSelected(widgetDef));
- }
-
}
diff --git a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
index 6575a22e46e..96be82cd039 100644
--- a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@ Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.google.common.base,
com.google.common.cache,
+ org.apache.commons.lang;version="1.8.1",
org.codehaus.jackson,
org.codehaus.jackson.annotate,
org.codehaus.jackson.map,
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsCoreXWidgetValidatorProvider.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsCoreXWidgetValidatorProvider.java
index 9e93b030b88..7e86e2b7984 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsCoreXWidgetValidatorProvider.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsCoreXWidgetValidatorProvider.java
@@ -27,8 +27,7 @@ public class AtsCoreXWidgetValidatorProvider implements IAtsXWidgetValidatorProv
public Collection<IAtsXWidgetValidator> getValidators() {
if (atsValidators == null) {
atsValidators = new ArrayList<>();
- atsValidators.add(new AtsXIntegerValidator());
- atsValidators.add(new AtsXFloatValidator());
+ atsValidators.add(new AtsXNumberValidator());
atsValidators.add(new AtsXTextValidator());
atsValidators.add(new AtsXDateValidator());
atsValidators.add(new AtsXComboValidator());
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidator.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidator.java
deleted file mode 100644
index 20311f728d1..00000000000
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXIntegerValidator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.ats.core.validator;
-
-import org.eclipse.osee.ats.api.IAtsServices;
-import org.eclipse.osee.ats.api.IAtsWorkItem;
-import org.eclipse.osee.ats.api.util.IValueProvider;
-import org.eclipse.osee.ats.api.workdef.IAtsStateDefinition;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinition;
-import org.eclipse.osee.ats.api.workdef.WidgetResult;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsXIntegerValidator extends AtsXWidgetValidator {
-
- @Override
- public WidgetResult validateTransition(IAtsWorkItem workItem, IValueProvider provider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, IAtsServices atsServices) throws OseeCoreException {
- WidgetResult result = WidgetResult.Valid;
- if ("XIntegerDam".equals(widgetDef.getXWidgetName())) {
- result = validateWidgetIsRequired(provider, widgetDef, fromStateDef, toStateDef);
- if (!result.isValid()) {
- return result;
- }
- result = isValidInteger(provider, widgetDef);
- if (!result.isValid()) {
- return result;
- }
- }
- return result;
- }
-}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXFloatValidator.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXNumberValidator.java
index 814bee964b9..d976842fdb3 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXFloatValidator.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXNumberValidator.java
@@ -21,20 +21,19 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
/**
* @author Donald G. Dunne
*/
-public class AtsXFloatValidator extends AtsXWidgetValidator {
+public class AtsXNumberValidator extends AtsXWidgetValidator {
@Override
public WidgetResult validateTransition(IAtsWorkItem workItem, IValueProvider provider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, IAtsServices atsServices) throws OseeCoreException {
WidgetResult result = WidgetResult.Valid;
- if ("XFloatDam".equals(widgetDef.getXWidgetName())) {
+ String name = widgetDef.getXWidgetName();
+
+ if ("XFloatDam".equals(name) || "XIntegerDam".equals(name)) {
result = validateWidgetIsRequired(provider, widgetDef, fromStateDef, toStateDef);
if (!result.isValid()) {
return result;
}
- result = isValidFloat(provider, widgetDef);
- if (!result.isValid()) {
- return result;
- }
+ return isValid(provider, widgetDef);
}
return result;
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidator.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidator.java
index a7fa8ada8fc..eb6b4da0b7a 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidator.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidator.java
@@ -15,17 +15,14 @@ import org.eclipse.osee.ats.api.IAtsServices;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.util.IValueProvider;
import org.eclipse.osee.ats.api.workdef.IAtsStateDefinition;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetConstraint;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinition;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionFloatMinMaxConstraint;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionIntMinMaxConstraint;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionListMinMaxSelectedConstraint;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
import org.eclipse.osee.ats.api.workdef.WidgetResult;
import org.eclipse.osee.ats.api.workdef.WidgetStatus;
import org.eclipse.osee.ats.api.workflow.transition.IAtsXWidgetValidator;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.DateUtil;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
/**
* @author Donald G. Dunne
@@ -62,16 +59,6 @@ public abstract class AtsXWidgetValidator implements IAtsXWidgetValidator {
@Override
public abstract WidgetResult validateTransition(IAtsWorkItem workItem, IValueProvider valueProvider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef, IAtsServices services) throws OseeCoreException;
- @SuppressWarnings("unchecked")
- public <A> A getConstraintOfType(IAtsWidgetDefinition widgetDef, Class<A> clazz) {
- for (IAtsWidgetConstraint constraint : widgetDef.getConstraints()) {
- if (clazz.isInstance(constraint)) {
- return (A) constraint;
- }
- }
- return null;
- }
-
public WidgetResult isValidDate(IValueProvider valueProvider, IAtsWidgetDefinition widgetDef) throws OseeCoreException {
for (Date date : valueProvider.getDateValues()) {
if (widgetDef.is(WidgetOption.FUTURE_DATE_REQUIRED)) {
@@ -84,139 +71,39 @@ public abstract class AtsXWidgetValidator implements IAtsXWidgetValidator {
return WidgetResult.Valid;
}
- public WidgetResult isValidInteger(IValueProvider valueProvider, IAtsWidgetDefinition widgetDef) throws OseeCoreException {
+ public WidgetResult isValid(IValueProvider valueProvider, IAtsWidgetDefinition widgetDef) {
for (String attrStr : valueProvider.getValues()) {
- if (!isInteger(attrStr)) {
- return new WidgetResult(WidgetStatus.Invalid_Type, widgetDef, "[%s] value [%s] is not a valid integer",
- valueProvider.getName(), attrStr);
- }
- Integer value = getInteger(attrStr);
-
- Integer minValue = getIntMinValueSet(widgetDef);
- Integer maxValue = getIntMaxValueSet(widgetDef);
- if (minValue != null && value < minValue) {
- return new WidgetResult(WidgetStatus.Invalid_Range, widgetDef, "[%s] value [%d] must be >= [%d]",
- valueProvider.getName(), value, minValue);
- } else if (maxValue != null && value > maxValue) {
- return new WidgetResult(WidgetStatus.Invalid_Range, widgetDef, "[%s] value [%d] must be < [%d]",
- valueProvider.getName(), value, maxValue);
- }
- }
- return WidgetResult.Valid;
- }
- public boolean isInteger(String text) {
- return getInteger(text) != null;
- }
-
- public Integer getInteger(String text) {
- try {
- return new Integer(text);
- } catch (NumberFormatException e) {
- return null;
- }
- }
-
- public WidgetResult isValidFloat(IValueProvider valueProvider, IAtsWidgetDefinition widgetDef) throws OseeCoreException {
- for (String attrStr : valueProvider.getValues()) {
- if (!isFloat(attrStr)) {
- return new WidgetResult(WidgetStatus.Invalid_Type, widgetDef, "[%s] value [%s] is not a valid float",
+ if (attrStr.matches("[-+]?\\d*\\.?\\d*")) {
+ WidgetResult result = checkValid(widgetDef, Double.parseDouble(attrStr), valueProvider.getName());
+ if(!result.isValid()) {
+ return result;
+ }
+ } else {
+ return new WidgetResult(WidgetStatus.Invalid_Type, widgetDef, "[%s] value [%s] is not a valid number",
valueProvider.getName(), attrStr);
}
- Double value = getFloat(attrStr);
-
- Double minValue = getFloatMinValueSet(widgetDef);
- Double maxValue = getFloatMaxValueSet(widgetDef);
- if (minValue != null && value < minValue) {
- return new WidgetResult(WidgetStatus.Invalid_Range, widgetDef, "[%s] value [%f] must be >= [%f]",
- valueProvider.getName(), value, minValue);
- } else if (maxValue != null && value > maxValue) {
- return new WidgetResult(WidgetStatus.Invalid_Range, widgetDef, "[%s] value [%f] must be < [%f]",
- valueProvider.getName(), value, maxValue);
- }
}
return WidgetResult.Valid;
}
- public boolean isFloat(String text) {
- return getFloat(text) != null;
- }
-
- public Double getFloat(String text) {
- try {
- return new Double(text);
- } catch (NumberFormatException e) {
- return null;
- }
- }
-
- public Integer getIntMinValueSet(IAtsWidgetDefinition widgetDef) {
- IAtsWidgetDefinitionIntMinMaxConstraint intCon =
- getConstraintOfType(widgetDef, IAtsWidgetDefinitionIntMinMaxConstraint.class);
- if (intCon != null) {
- return intCon.getMinValue();
- }
- return null;
- }
+ private WidgetResult checkValid(IAtsWidgetDefinition widgetDef, double value, String valueProviderName) {
+ Double minValue = widgetDef.getMin();
+ Double maxValue = widgetDef.getMax();
- public Integer getIntMaxValueSet(IAtsWidgetDefinition widgetDef) {
- IAtsWidgetDefinitionIntMinMaxConstraint intCon =
- getConstraintOfType(widgetDef, IAtsWidgetDefinitionIntMinMaxConstraint.class);
- if (intCon != null) {
- return intCon.getMaxValue();
+ if (minValue != null && Lib.lessThan(value, minValue)) {
+ return new WidgetResult(WidgetStatus.Invalid_Range, widgetDef, "[%s] value [%s] must be >= [%s]",
+ valueProviderName, value, minValue);
+ } else if (maxValue != null && Lib.greaterThan(value, maxValue)) {
+ return new WidgetResult(WidgetStatus.Invalid_Range, widgetDef, "[%s] value [%s] must be <= [%s]",
+ valueProviderName, value, minValue, maxValue);
}
- return null;
- }
- public Double getFloatMinValueSet(IAtsWidgetDefinition widgetDef) {
- IAtsWidgetDefinitionFloatMinMaxConstraint floatCon =
- getConstraintOfType(widgetDef, IAtsWidgetDefinitionFloatMinMaxConstraint.class);
- if (floatCon != null) {
- return floatCon.getMinValue();
- }
- return null;
- }
-
- public Double getFloatMaxValueSet(IAtsWidgetDefinition widgetDef) {
- IAtsWidgetDefinitionFloatMinMaxConstraint floatCon =
- getConstraintOfType(widgetDef, IAtsWidgetDefinitionFloatMinMaxConstraint.class);
- if (floatCon != null) {
- return floatCon.getMaxValue();
- }
- return null;
- }
-
- public Integer getListMinSelected(IAtsWidgetDefinition widgetDef) {
- IAtsWidgetDefinitionListMinMaxSelectedConstraint intCon =
- getConstraintOfType(widgetDef, IAtsWidgetDefinitionListMinMaxSelectedConstraint.class);
- if (intCon != null) {
- return intCon.getMinSelected();
- }
- return null;
- }
-
- public Integer getListMaxSelected(IAtsWidgetDefinition widgetDef) {
- IAtsWidgetDefinitionListMinMaxSelectedConstraint intCon =
- getConstraintOfType(widgetDef, IAtsWidgetDefinitionListMinMaxSelectedConstraint.class);
- if (intCon != null) {
- return intCon.getMaxSelected();
- }
- return null;
+ return WidgetResult.Valid;
}
public WidgetResult isValidList(IValueProvider valueProvider, IAtsWidgetDefinition widgetDef) throws OseeCoreException {
- int selected = valueProvider.getValues().size();
-
- Integer minSelected = getListMinSelected(widgetDef);
- Integer maxSelected = getListMaxSelected(widgetDef);
- if (minSelected != null && selected < minSelected) {
- return new WidgetResult(WidgetStatus.Invalid_Range, widgetDef, "[%s] values selected [%d] must be >= [%d]",
- valueProvider.getName(), selected, minSelected);
- } else if (maxSelected != null && selected > maxSelected) {
- return new WidgetResult(WidgetStatus.Invalid_Range, widgetDef, "[%s] values selected [%d] must be < [%d]",
- valueProvider.getName(), selected, maxSelected);
- }
- return WidgetResult.Valid;
+ return checkValid(widgetDef, valueProvider.getValues().size(), valueProvider.getName());
}
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionFloatMinMaxConstraint.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionFloatMinMaxConstraint.java
deleted file mode 100644
index aaaad5e47b0..00000000000
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionFloatMinMaxConstraint.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.ats.core.workdef;
-
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionFloatMinMaxConstraint;
-
-/**
- * @author Donald G. Dunne
- */
-public class SimpleWidgetDefinitionFloatMinMaxConstraint implements IAtsWidgetDefinitionFloatMinMaxConstraint {
- private Double minValue = null;
- private Double maxValue = null;
-
- public SimpleWidgetDefinitionFloatMinMaxConstraint(Double minValue, Double maxValue) {
- set(minValue, maxValue);
- }
-
- public SimpleWidgetDefinitionFloatMinMaxConstraint(String minValue, String maxValue) {
- if (minValue != null) {
- this.minValue = new Double(minValue);
- }
- if (maxValue != null) {
- this.maxValue = new Double(maxValue);
- }
- }
-
- @Override
- public void set(Double minValue, Double maxValue) {
- this.minValue = minValue;
- this.maxValue = maxValue;
- }
-
- @Override
- public Double getMinValue() {
- return minValue;
- }
-
- @Override
- public Double getMaxValue() {
- return maxValue;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionIntMinMaxConstraint.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionIntMinMaxConstraint.java
deleted file mode 100644
index 1a95dd4812d..00000000000
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionIntMinMaxConstraint.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.ats.core.workdef;
-
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionIntMinMaxConstraint;
-
-/**
- * @author Donald G. Dunne
- */
-public class SimpleWidgetDefinitionIntMinMaxConstraint implements IAtsWidgetDefinitionIntMinMaxConstraint {
- private Integer minValue = null;
- private Integer maxValue = null;
-
- public SimpleWidgetDefinitionIntMinMaxConstraint(Integer minValue, Integer maxValue) {
- set(minValue, maxValue);
- }
-
- public SimpleWidgetDefinitionIntMinMaxConstraint(String minValue, String maxValue) {
- if (minValue != null) {
- this.minValue = new Integer(minValue);
- }
- if (maxValue != null) {
- this.maxValue = new Integer(maxValue);
- }
- }
-
- @Override
- public void set(Integer minValue, Integer maxValue) {
- this.minValue = minValue;
- this.maxValue = maxValue;
- }
-
- @Override
- public Integer getMinValue() {
- return minValue;
- }
-
- @Override
- public Integer getMaxValue() {
- return maxValue;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionListMinMaxSelectedConstraint.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionListMinMaxSelectedConstraint.java
deleted file mode 100644
index 8bbe674cad8..00000000000
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/workdef/SimpleWidgetDefinitionListMinMaxSelectedConstraint.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.ats.core.workdef;
-
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinitionListMinMaxSelectedConstraint;
-
-/**
- * @author Donald G. Dunne
- */
-public class SimpleWidgetDefinitionListMinMaxSelectedConstraint implements IAtsWidgetDefinitionListMinMaxSelectedConstraint {
- private Integer minSelected = null;
- private Integer maxSelected = null;
-
- public SimpleWidgetDefinitionListMinMaxSelectedConstraint(Integer minSelected, Integer maxSelected) {
- set(minSelected, maxSelected);
- }
-
- public SimpleWidgetDefinitionListMinMaxSelectedConstraint(String minSelected, String maxSelected) {
- if (minSelected != null) {
- this.minSelected = new Integer(minSelected);
- }
- if (maxSelected != null) {
- this.maxSelected = new Integer(maxSelected);
- }
- }
-
- @Override
- public void set(Integer minSelected, Integer maxSelected) {
- this.minSelected = minSelected;
- this.maxSelected = maxSelected;
- }
-
- @Override
- public Integer getMinSelected() {
- return minSelected;
- }
-
- @Override
- public Integer getMaxSelected() {
- return maxSelected;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.ats.dsl.integration/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.dsl.integration/META-INF/MANIFEST.MF
index aa8cbd7fba8..b9c0d8806bb 100644
--- a/plugins/org.eclipse.osee.ats.dsl.integration/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.dsl.integration/META-INF/MANIFEST.MF
@@ -7,7 +7,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Service-Component: OSGI-INF/*.xml
Bundle-Vendor: Eclipse Open System Engineering Environment
Bundle-ActivationPolicy: lazy
-Import-Package: org.eclipse.emf.common.util,
+Import-Package: org.apache.commons.lang,
+ org.eclipse.emf.common.util,
org.eclipse.emf.ecore,
org.eclipse.osee.ats.dsl,
org.eclipse.osee.ats.dsl.atsDsl,
diff --git a/plugins/org.eclipse.osee.ats.dsl.integration/src/org/eclipse/osee/ats/dsl/integration/internal/ConvertAtsDslToWorkDefinition.java b/plugins/org.eclipse.osee.ats.dsl.integration/src/org/eclipse/osee/ats/dsl/integration/internal/ConvertAtsDslToWorkDefinition.java
index 49ca76871c1..02820243cc7 100644
--- a/plugins/org.eclipse.osee.ats.dsl.integration/src/org/eclipse/osee/ats/dsl/integration/internal/ConvertAtsDslToWorkDefinition.java
+++ b/plugins/org.eclipse.osee.ats.dsl.integration/src/org/eclipse/osee/ats/dsl/integration/internal/ConvertAtsDslToWorkDefinition.java
@@ -40,9 +40,6 @@ import org.eclipse.osee.ats.api.workdef.model.PeerReviewDefinition;
import org.eclipse.osee.ats.api.workdef.model.ReviewBlockType;
import org.eclipse.osee.ats.api.workdef.model.StateDefinition;
import org.eclipse.osee.ats.api.workdef.model.WidgetDefinition;
-import org.eclipse.osee.ats.api.workdef.model.WidgetDefinitionFloatMinMaxConstraint;
-import org.eclipse.osee.ats.api.workdef.model.WidgetDefinitionIntMinMaxConstraint;
-import org.eclipse.osee.ats.api.workdef.model.WidgetDefinitionListMinMaxSelectedConstraint;
import org.eclipse.osee.ats.api.workdef.model.WorkDefinition;
import org.eclipse.osee.ats.dsl.BooleanDefUtil;
import org.eclipse.osee.ats.dsl.UserRefUtil;
@@ -422,14 +419,11 @@ public class ConvertAtsDslToWorkDefinition {
if (!Strings.isValid(minConstraint) && !Strings.isValid(maxConstraint)) {
return;
}
- if (widgetDef.getXWidgetName().contains("Float")) {
- widgetDef.getConstraints().add(new WidgetDefinitionFloatMinMaxConstraint(minConstraint, minConstraint));
- }
- if (widgetDef.getXWidgetName().contains("Integer")) {
- widgetDef.getConstraints().add(new WidgetDefinitionIntMinMaxConstraint(minConstraint, minConstraint));
- }
- if (widgetDef.getXWidgetName().contains("List")) {
- widgetDef.getConstraints().add(new WidgetDefinitionListMinMaxSelectedConstraint(minConstraint, minConstraint));
+ String name = widgetDef.getXWidgetName();
+
+ if ((name.contains("Float") || name.contains("Integer") || name.contains("List")) && minConstraint.matches(
+ "[-+]?\\d*\\.?\\d*") && maxConstraint.matches("[-+]?\\d*\\.?\\d*")) {
+ widgetDef.setConstraint(Double.parseDouble(minConstraint), Double.parseDouble(minConstraint));
}
}
diff --git a/plugins/org.eclipse.osee.ats.mocks/src/org/eclipse/osee/ats/mocks/MockWidgetDefinition.java b/plugins/org.eclipse.osee.ats.mocks/src/org/eclipse/osee/ats/mocks/MockWidgetDefinition.java
index 7b024dec620..c73bebf6184 100644
--- a/plugins/org.eclipse.osee.ats.mocks/src/org/eclipse/osee/ats/mocks/MockWidgetDefinition.java
+++ b/plugins/org.eclipse.osee.ats.mocks/src/org/eclipse/osee/ats/mocks/MockWidgetDefinition.java
@@ -10,9 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.ats.mocks;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.ats.api.workdef.IAtsWidgetConstraint;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinition;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetOptionHandler;
import org.eclipse.osee.ats.api.workdef.WidgetOption;
@@ -30,7 +27,8 @@ public class MockWidgetDefinition implements IAtsWidgetDefinition {
private String xWidgetName;
private String defaultValue;
private final WidgetOptionHandler options = new WidgetOptionHandler();
- private final List<IAtsWidgetConstraint> constraints = new ArrayList<>();
+ private Double min;
+ private Double max;
private String name;
public MockWidgetDefinition(String name) {
@@ -123,8 +121,19 @@ public class MockWidgetDefinition implements IAtsWidgetDefinition {
}
@Override
- public List<IAtsWidgetConstraint> getConstraints() {
- return constraints;
+ public void setConstraint(double min, double max) {
+ this.min = min;
+ this.max = max;
+ }
+
+ @Override
+ public Double getMin() {
+ return min;
+ }
+
+ @Override
+ public Double getMax() {
+ return max;
}
}
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
index 1bc71da1942..ab2ec3f7bd5 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
@@ -1786,4 +1786,16 @@ public final class Lib {
return names;
}
+ /**
+ * {@value #EPSILON} EPSILON is used to ignore extra floating numbers for compare
+ */
+ private static final double EPSILON = 1E-7;
+
+ public static boolean lessThan(double d1, double d2) {
+ return d1 + EPSILON < d2;
+ }
+
+ public static boolean greaterThan(double d1, double d2) {
+ return d1 > d2 + EPSILON;
+ }
}

Back to the top