package org.nl.acs.auto.initial;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

@Component
@Lazy(false)
public class WebAutoInitialExecuter {
    @Autowired(required = false)
    List<WebAutoInitial> webAutoInitial;

    private List<WebAutoInitial> getWebAutoInitialService() {
        return (List) (this.webAutoInitial != null && this.webAutoInitial.size() != 0
                ? this.webAutoInitial
                : new ArrayList());
    }

    public void init() throws Exception {
        List services = this.getWebAutoInitialService();
        Iterator arg1 = services.iterator();

        while (arg1.hasNext()) {
            WebAutoInitial service = (WebAutoInitial) arg1.next();
            service.autoInitial();
        }

    }
}
