Skip to content
Snippets Groups Projects
Commit 15afe8e0 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

adds process-related information to the service

refs 2620
parent 8e2c1cfe
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,7 @@ import org.fortiss.tooling.kernel.utils.LoggingUtils;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 7BEACA97ADA94E9730616EAB079DED86
* @ConQAT.Rating YELLOW Hash: 159EDD10E24A64448987075B5F8B7B14
*/
public final class ConstraintVerificationService extends
EObjectAwareServiceBase<IConstraintVerifier<IConstraint>> implements
......@@ -241,20 +241,29 @@ public final class ConstraintVerificationService extends
}
/**
* @param constraint
* @return the first registered verifier which can verify <code>constraint</code>
* @param clazz
* @return the first registered verifier which can verify a constraint of class
* <code>clazz</code>.
*/
protected IConstraintVerifier<IConstraint> getFirstVerifier(IConstraint constraint) {
List<IConstraintVerifier<IConstraint>> list = getRegisteredHandlers(constraint.getClass());
protected IConstraintVerifier<IConstraint> getFirstVerifier(Class<?> clazz) {
List<IConstraintVerifier<IConstraint>> list = getRegisteredHandlers(clazz);
if(list == null || list.isEmpty()) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
String.format("Cannot find verifier for constraint %s", constraint.getClass()));
String.format("Cannot find verifier for constraint %s", clazz));
return null;
}
// get(0) because we know the list is not empty and because we want the first element
return list.get(0);
}
/**
* @param constraint
* @return The first registered verifier which can verify <code>constraint</code>.
*/
protected IConstraintVerifier<IConstraint> getFirstVerifier(IConstraint constraint) {
return getFirstVerifier(constraint.getClass());
}
/** {@inheritDoc} */
@Override
protected String getExtensionPointName() {
......@@ -319,4 +328,18 @@ public final class ConstraintVerificationService extends
public Set<Class<?>> getConstraintTypes() {
return this.handlerMap.keySet();
}
/** {@inheritDoc} */
@Override
public <T extends IConstraint> String getDescription(Class<T> constraintEltClass) {
IConstraintVerifier<IConstraint> verifier = getFirstVerifier(constraintEltClass);
return verifier != null ? verifier.getDescription() : null;
}
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
public Set<Class<?>> getDevelopmentProcessConstraintTypes() {
return this.handlerMap.keySet();
}
}
......@@ -19,7 +19,7 @@ import org.fortiss.tooling.kernel.utils.ServicesUtils;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 8AC9115D8F013A0A319B5D91FBF5C3BA
* @ConQAT.Rating YELLOW Hash: B9E308FF26316341AC1B379A00443A22
*/
public interface IConstraintVerificationService {
/**
......@@ -116,4 +116,16 @@ public interface IConstraintVerificationService {
* @return The registered classes of constraints.
*/
public Set<Class<?>> getConstraintTypes();
/**
* The following features deal with the usage of constraints to drive the process.
*
* EXPERIMENTAL.
*/
/** Gets a general description for the constraint type. */
public <T extends IConstraint> String getDescription(Class<T> constraintEltClass);
/** Gets the constraint types which can be used for constraint-based development process. */
public <T extends IConstraint> Set<Class<T>> getDevelopmentProcessConstraintTypes();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment