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

IDs for verifiers

refs 2620
parent 849ac6a2
No related branches found
No related tags found
No related merge requests found
......@@ -46,12 +46,15 @@ import org.fortiss.tooling.kernel.utils.LoggingUtils;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: DEF709B2A60B704890F683016225F042
* @ConQAT.Rating YELLOW Hash: 3ABD816805170DB2AB7ADBEB15E19025
*/
public final class ConstraintVerificationService extends
EObjectAwareServiceBase<IConstraintVerifier<IConstraint>> implements
IConstraintVerificationService {
/** Map ID -> Verifier. */
private HashMap<String, IConstraintVerifier<IConstraint>> idMap = new HashMap<>();
/** {@inheritDoc} */
@Override
public void startService() {
......@@ -69,6 +72,13 @@ public final class ConstraintVerificationService extends
addHandler(constraintElementClass, (IConstraintVerifier<IConstraint>)verifier);
}
/** {@inheritDoc} */
@Override
protected void addHandler(Class<?> modelElementClass, IConstraintVerifier<IConstraint> handler) {
super.addHandler(modelElementClass, handler);
idMap.put(handler.getID(), handler);
}
/** {@inheritDoc} */
@Override
public String getIntrospectionDescription() {
......@@ -332,21 +342,14 @@ public final class ConstraintVerificationService extends
/** {@inheritDoc} */
@Override
public Set<Class<?>> getConstraintTypes() {
return this.handlerMap.keySet();
}
/** {@inheritDoc} */
@Override
public <T extends IConstraint> String getDescription(Class<T> constraintEltClass) {
IConstraintVerifier<IConstraint> verifier = getFirstVerifier(constraintEltClass);
public <T extends IConstraint> String getDescription(String id) {
IConstraintVerifier<IConstraint> verifier = this.idMap.get(id);
return verifier != null ? verifier.getDescription() : null;
}
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
public Set<Class<?>> getDevelopmentProcessConstraintTypes() {
return this.handlerMap.keySet();
public Set<String> getDevelopmentProcessConstraintIDs() {
return this.idMap.keySet();
}
}
......@@ -20,7 +20,7 @@ import org.fortiss.tooling.kernel.utils.ServicesUtils;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 8F4CB2B6F1586468BBE44C0F17488DB8
* @ConQAT.Rating YELLOW Hash: E42068134B758F0C20812DC7A1067DF8
*/
public interface IConstraintVerificationService {
/**
......@@ -113,11 +113,6 @@ public interface IConstraintVerificationService {
*/
void setConstrained(IConstraint constraint, IConstrained constrained, int index);
/**
* @return The registered classes of constraints.
*/
Set<Class<?>> getConstraintTypes();
/** Registers the given verifier with the service. */
<T extends IConstraint> void registerConstraintVerifier(IConstraintVerifier<T> verifier,
Class<T> constraintElementClass);
......@@ -129,8 +124,9 @@ public interface IConstraintVerificationService {
*/
/** Gets a general description for the constraint type. */
<T extends IConstraint> String getDescription(Class<T> constraintEltClass);
public <T extends IConstraint> String getDescription(String id);
/** Gets the constraint types which can be used for constraint-based development process. */
<T extends IConstraint> Set<Class<T>> getDevelopmentProcessConstraintTypes();
public Set<String> getDevelopmentProcessConstraintIDs();
}
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