Commit d8aa3b97 authored by Vivek Nigam's avatar Vivek Nigam
Browse files

Adding missing UI for the NoVAL constraint.

refs 3224
parent 7bf5c030
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.specification.ui.constraint;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.getFirstConstrained;
import java.util.Arrays;
import java.util.List;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.specification.constraint.FailedNoValAdmin;
import org.fortiss.tooling.kernel.model.constraints.ConstraintInstance;
import org.fortiss.tooling.kernel.model.constraints.FailedConstraintInstanceStatus;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
import org.fortiss.tooling.kernel.ui.extension.base.ConstraintUIBases.ConstraintUIBaseAutocheck;
import org.fortiss.tooling.kernel.ui.service.IConstraintUIService.IFix;
import org.fortiss.tooling.kernel.ui.util.ConstraintsUIUtils.FixBase;
/**
*
* @author vivek
*/
public class AdmissibleNoValUI extends ConstraintUIBaseAutocheck {
/** {@inheritDoc} */
@Override
public String getDescription() {
return "Provided all inputs have values, then all outputs ports have a values (different from NoVal).";
}
/** {@inheritDoc} */
@Override
public boolean shouldBeManuallyActivated() {
return true;
}
/** {@inheritDoc} */
@Override
public List<IFix> fixes(ConstraintInstance ci, IConstraintInstanceStatus status) {
if(status instanceof FailedConstraintInstanceStatus) {
String compName = ((Component)getFirstConstrained(ci)).getName();
if(compName != null && compName.isEmpty() == false) {
String splitFix = compName + ((FailedNoValAdmin)status).getMsg();
return Arrays.asList(new FixBase(splitFix, s -> compName.toString()));
}
}
return super.fixes(ci, status);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment