Search in sources :

Example 1 with InteractiveType

use of es.bsc.compss.types.resources.jaxb.InteractiveType in project compss by bsc-wdc.

the class Validator method validateSubmissionSystem.

private void validateSubmissionSystem(SubmissionSystemType subSys) throws InvalidElementException {
    List<Object> innerElements = subSys.getBatchOrInteractive();
    if (innerElements != null) {
        boolean batchTagFound = false;
        boolean interactiveTagFound = false;
        for (Object obj : innerElements) {
            if (obj instanceof BatchType) {
                if (batchTagFound) {
                    throw new InvalidElementException("SubmissionSystem", "Attribute Batch", "Appears more than once");
                } else {
                    batchTagFound = true;
                    validateBatch(((BatchType) obj));
                }
            } else if (obj instanceof InteractiveType) {
                if (interactiveTagFound) {
                    throw new InvalidElementException("SubmissionSystem", "Attribute Interactive", "Appears more than once");
                } else {
                    interactiveTagFound = true;
                    validateInteractive(((InteractiveType) obj));
                }
            } else {
                throw new InvalidElementException("SubmissionSystem", "Attribute " + obj.getClass(), "Invalid type");
            }
        }
        // Check minimum
        if (!batchTagFound && !interactiveTagFound) {
            throw new InvalidElementException("SubmissionSystem", "Interactive/Batch", "At least 1 submission system must be defined");
        }
    } else {
        // Empty inner elements
        throw new InvalidElementException("SubmissionSystem", "", "Content is empty");
    }
}
Also used : InteractiveType(es.bsc.compss.types.resources.jaxb.InteractiveType) InvalidElementException(es.bsc.compss.types.resources.exceptions.InvalidElementException) BatchType(es.bsc.compss.types.resources.jaxb.BatchType)

Aggregations

InvalidElementException (es.bsc.compss.types.resources.exceptions.InvalidElementException)1 BatchType (es.bsc.compss.types.resources.jaxb.BatchType)1 InteractiveType (es.bsc.compss.types.resources.jaxb.InteractiveType)1