Commit beddb6d8 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

removed constraint check for executables

refs 734
parent fbc4baef
......@@ -25,7 +25,6 @@ import java.util.List;
import org.conqat.lib.commons.reflect.ReflectionUtils;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.platform.language.executable.ExecutableBase;
import org.fortiss.af3.platform.language.executable.ExecutionUnitExecutableBase;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.PlatformConnectorUnit;
......@@ -35,10 +34,7 @@ import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.kernel.extension.IConstraintChecker;
import org.fortiss.tooling.kernel.extension.base.ConstraintViolationBase;
import org.fortiss.tooling.kernel.extension.data.IConstraintViolation;
import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity;
import org.fortiss.tooling.kernel.extension.exception.ChainTransformationFailedException;
import org.fortiss.tooling.kernel.model.INamedElement;
import org.fortiss.tooling.kernel.utils.TransformationUtils;
/**
* This constraint checker provides consistency checking for {@link PlatformArchitecture}. It
......@@ -49,7 +45,7 @@ import org.fortiss.tooling.kernel.utils.TransformationUtils;
* @author wandinger
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: B006827FFA20A47942671E45014EC5BA
* @ConQAT.Rating YELLOW Hash: AEE85ED9BF98BDA928B9901390A7D47E
*/
public class ExecutableGenerationConstraint implements IConstraintChecker<PlatformArchitecture> {
......@@ -67,12 +63,7 @@ public class ExecutableGenerationConstraint implements IConstraintChecker<Platfo
new LinkedList<IConstraintViolation<? extends EObject>>();
for(final IHierarchicElement element : modelElement.getContainedElementsList()) {
if(element instanceof ExecutionUnit && !testExecutionUnit((ExecutionUnit)element)) {
result.add(new ConstraintViolationBase<ExecutionUnit>((ExecutionUnit)element,
ESeverity.FATAL, ((INamedElement)element).getName() +
" cannot be transformed into an executable. " +
"Add an executable child unit or check the tool configuration."));
} else if(element instanceof ExecutionUnit) {
if(element instanceof ExecutionUnit) {
if(!isPlatformElementNameValid((INamedElement)element)) {
result.add(new ConstraintViolationBase<ExecutionUnit>((ExecutionUnit)element,
ERROR, invalidNameMessage((INamedElement)element)));
......@@ -104,22 +95,6 @@ public class ExecutableGenerationConstraint implements IConstraintChecker<Platfo
return result;
}
/** Tests the given execution unit and its children. */
private boolean testExecutionUnit(ExecutionUnit modelElement) {
try {
TransformationUtils.createTransformedObjectFor(modelElement,
ExecutionUnitExecutableBase.class, null);
return true;
} catch(ChainTransformationFailedException ctfe) {
for(IHierarchicElement element : modelElement.getContainedElementsList()) {
if(element instanceof ExecutionUnit && testExecutionUnit((ExecutionUnit)element)) {
return true;
}
}
}
return false;
}
/** Tests the name of the given platform element. */
private boolean isPlatformElementNameValid(INamedElement element) {
return element.getName().substring(0, 1).replaceAll("[A-Za-z_]", "").isEmpty() &&
......
Markdown is supported
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