Search in sources :

Example 1 with ValidationResult

use of uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationResult in project miso-lims by miso-lims.

the class DefaultSampleTypeService method validateDeletion.

@Override
public ValidationResult validateDeletion(SampleType object) throws IOException {
    ValidationResult result = new ValidationResult();
    long usage = sampleTypeDao.getUsage(object);
    if (usage > 0L) {
        result.addError(ValidationError.forDeletionUsage(object, usage, Pluralizer.samples(usage)));
    }
    return result;
}
Also used : ValidationResult(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationResult)

Example 2 with ValidationResult

use of uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationResult in project miso-lims by miso-lims.

the class DefaultSequencingContainerModelService method validateDeletion.

@Override
public ValidationResult validateDeletion(SequencingContainerModel object) throws IOException {
    ValidationResult result = new ValidationResult();
    long usage = containerModelDao.getUsage(object);
    if (usage > 0) {
        result.addError(ValidationError.forDeletionUsage(object, usage, "sequencing " + Pluralizer.containers(usage)));
    }
    return result;
}
Also used : ValidationResult(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationResult)

Example 3 with ValidationResult

use of uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationResult in project miso-lims by miso-lims.

the class DefaultSampleClassService method validateDeletion.

@Override
public ValidationResult validateDeletion(SampleClass object) throws IOException {
    ValidationResult result = new ValidationResult();
    long usage = sampleClassDao.getUsage(object);
    if (usage > 0L) {
        result.addError(ValidationError.forDeletionUsage(object, usage, Pluralizer.samples(usage)));
    }
    return result;
}
Also used : ValidationResult(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationResult)

Example 4 with ValidationResult

use of uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationResult in project miso-lims by miso-lims.

the class DefaultWorksetCategoryService method validateDeletion.

@Override
public ValidationResult validateDeletion(WorksetCategory object) throws IOException {
    ValidationResult result = new ValidationResult();
    long usage = worksetCategoryDao.getUsage(object);
    if (usage > 0L) {
        result.addError(ValidationError.forDeletionUsage(object, usage, Pluralizer.worksets(usage)));
    }
    return result;
}
Also used : ValidationResult(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationResult)

Example 5 with ValidationResult

use of uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationResult in project miso-lims by miso-lims.

the class DefaultWorksetStageService method validateDeletion.

@Override
public ValidationResult validateDeletion(WorksetStage object) throws IOException {
    ValidationResult result = new ValidationResult();
    long usage = worksetStageDao.getUsage(object);
    if (usage > 0L) {
        result.addError(ValidationError.forDeletionUsage(object, usage, Pluralizer.worksets(usage)));
    }
    return result;
}
Also used : ValidationResult(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationResult)

Aggregations

ValidationResult (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationResult)55 ValidationError (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError)6 User (com.eaglegenomics.simlims.core.User)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Objects (java.util.Objects)1 ConstraintViolationException (org.hibernate.exception.ConstraintViolationException)1 DataIntegrityViolationException (org.springframework.dao.DataIntegrityViolationException)1 Transactional (org.springframework.transaction.annotation.Transactional)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1 Box (uk.ac.bbsrc.tgac.miso.core.data.Box)1 BoxPosition (uk.ac.bbsrc.tgac.miso.core.data.BoxPosition)1 BoxableId (uk.ac.bbsrc.tgac.miso.core.data.BoxableId)1 BoxableView (uk.ac.bbsrc.tgac.miso.core.data.impl.view.box.BoxableView)1 ValidationException (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationException)1