package uk.ac.ebi.spot.goci.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import uk.ac.ebi.spot.goci.model.Association;
import uk.ac.ebi.spot.goci.model.AssociationValidationError;

import java.util.Collection;

/**
 * Created by emma on 11/04/2016.
 *
 * @author emma
 *         <p>
 *         Entry point for validation system
 */
@Service
public class AssociationValidationService {

    private ValidationServiceBuilder validationBuilder;

    private CheckingService checkingService;

    private Logger log = LoggerFactory.getLogger(getClass());

    protected Logger getLog() {
        return log;
    }

    @Autowired
    public AssociationValidationService(ValidationServiceBuilder validationBuilder,
                                        CheckingService checkingService) {
        this.validationBuilder = validationBuilder;
        this.checkingService = checkingService;
    }

    public Collection<AssociationValidationError> runAssociationValidation(Association association,
                                                                           String validationLevel) {

        // Determine validation type
        AssociationCheckingService associationCheckingService = validationBuilder.buildValidator(validationLevel);
        return associationCheckingService.runChecks(association, checkingService);
    }
}

@@ -584,39 +584,55 @@
 ate 
-CheckingService checkingService
+ValidationChecksBuilder validationChecksBuilder
 ;%0A%0A 
@@ -895,39 +895,55 @@
     
-CheckingService checkingService
+ValidationChecksBuilder validationChecksBuilder
 ) %7B%0A
@@ -1011,41 +1011,57 @@
 his.
-checkingService = checkingService
+validationChecksBuilder = validationChecksBuilder
 ;%0A  
@@ -1076,16 +1076,29 @@
  public 
+synchronized 
 Collecti
@@ -1178,16 +1178,29 @@
 iation,%0A
+             
         
@@ -1514,23 +1514,31 @@
 on, 
-checkingService
+validationChecksBuilder
 );%0A 

Add builder dependancy