/*
 * Tanaguru - Automated webpage assessment
 * Copyright (C) 2008-2015  Tanaguru.org
 *
 * This file is part of Tanaguru.
 *
 * Tanaguru is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Contact us by mail: tanaguru AT tanaguru DOT org
 */
package org.opens.tanaguru.processor;

import org.opens.tanaguru.contentadapter.util.URLIdentifierFactory;
import org.opens.tanaguru.entity.factory.audit.EvidenceElementFactory;
import org.opens.tanaguru.entity.factory.audit.ProcessRemarkFactory;
import org.opens.tanaguru.entity.factory.audit.SourceCodeRemarkFactory;
import org.opens.tanaguru.entity.service.audit.EvidenceDataService;
import org.opens.tanaguru.entity.service.audit.PreProcessResultDataService;
import org.opens.tanaguru.processing.ProcessRemarkServiceFactory;
import org.opens.tanaguru.service.NomenclatureLoaderService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 *
 * @author enzolalay
 */
public class ProcessorFactoryImpl implements ProcessorFactory {// TODO Write javadoc

    private NomenclatureLoaderService nomenclatureLoaderService;
    public NomenclatureLoaderService getNomenclatureLoaderService() {
        return nomenclatureLoaderService;
    }
    
    @Autowired
    public void setNomenclatureLoaderService(NomenclatureLoaderService nomenclatureLoaderService) {
        this.nomenclatureLoaderService = nomenclatureLoaderService;
    }
    
    private EvidenceDataService evidenceDataService;
    public EvidenceDataService getEvidenceDataService() {
        return evidenceDataService;
    }

    @Autowired
    public void setEvidenceDataService(EvidenceDataService evidenceDataService) {
        this.evidenceDataService = evidenceDataService;
    }

    private EvidenceElementFactory evidenceElementFactory;
    public EvidenceElementFactory getEvidenceElementFactory() {
        return evidenceElementFactory;
    }

    @Autowired
    public void setEvidenceElementFactory(EvidenceElementFactory evidenceElementFactory) {
        this.evidenceElementFactory = evidenceElementFactory;
    }
    
    private ProcessRemarkFactory processRemarkFactory;
    public ProcessRemarkFactory getProcessRemarkFactory() {
        return processRemarkFactory;
    }
    
    @Autowired
    public void setProcessRemarkFactory(ProcessRemarkFactory processRemarkFactory) {
        this.processRemarkFactory = processRemarkFactory;
    }

    private SourceCodeRemarkFactory sourceCodeRemarkFactory;
    public SourceCodeRemarkFactory getSourceCodeRemarkFactory() {
        return sourceCodeRemarkFactory;
    }

    @Autowired
    public void setSourceCodeRemarkFactory(SourceCodeRemarkFactory sourceCodeRemarkFactory) {
        this.sourceCodeRemarkFactory = sourceCodeRemarkFactory;
    }

    private URLIdentifierFactory urlIdentifierFactory;
    public URLIdentifierFactory getUrlIdentifierFactory() {
        return urlIdentifierFactory;
    }
    
    @Autowired
    public void setUrlIdentifierFactory(URLIdentifierFactory urlIdentifierFactory) {
        this.urlIdentifierFactory = urlIdentifierFactory;
    }
    
    private PreProcessResultDataService preProcessResultDataService;
    public PreProcessResultDataService getPreProcessResultDataService() {
        return preProcessResultDataService;
    }

    @Autowired
    public void setPreProcessResultDataService(PreProcessResultDataService preProcessResultDataService) {
        this.preProcessResultDataService = preProcessResultDataService;
    }
    
    @Override
    public Processor create() {
        return new ProcessorImpl(
                SSPHandlerFactory.create(
                    ProcessRemarkServiceFactory.create(
                        processRemarkFactory, 
                        sourceCodeRemarkFactory,
                        evidenceElementFactory,
                        evidenceDataService),
                    nomenclatureLoaderService, 
                    urlIdentifierFactory.create(), 
                    preProcessResultDataService));
    }
}

@@ -978,31 +978,31 @@
 guru.entity.
-factory
+service
 .audit.Evide
@@ -1008,163 +1008,19 @@
 ence
-ElementFactory;%0Aimport org.opens.tanaguru.entity.factory.audit.ProcessRemarkFactory;%0Aimport org.opens.tanaguru.entity.factory.audit.SourceCodeRemarkFactory
+DataService
 ;%0Aim
@@ -1064,32 +1064,39 @@
 e.audit.Evidence
+Element
 DataService;%0Aimp
@@ -1160,32 +1160,105 @@
 ultDataService;%0A
+import org.opens.tanaguru.entity.service.audit.ProcessRemarkDataService;%0A
 import org.opens
@@ -2265,39 +2265,43 @@
  EvidenceElement
-Factory
+DataService
  evidenceElement
@@ -2296,31 +2296,35 @@
 denceElement
-Factory
+DataService
 ;%0A    public
@@ -2339,23 +2339,27 @@
 eElement
-Factory
+DataService
  getEvid
@@ -2369,23 +2369,27 @@
 eElement
-Factory
+DataService
 () %7B%0A   
@@ -2407,39 +2407,43 @@
  evidenceElement
-Factory
+DataService
 ;%0A    %7D%0A%0A    @Au
@@ -2484,23 +2484,27 @@
 eElement
-Factory
+DataService
 (Evidenc
@@ -2511,23 +2511,27 @@
 eElement
-Factory
+DataService
  evidenc
@@ -2538,23 +2538,27 @@
 eElement
-Factory
+DataService
 ) %7B%0A    
@@ -2581,23 +2581,27 @@
 eElement
-Factory
+DataService
  = evide
@@ -2610,23 +2610,27 @@
 eElement
-Factory
+DataService
 ;%0A    %7D%0A
@@ -2651,39 +2651,43 @@
 te ProcessRemark
-Factory
+DataService
  processRemarkFa
@@ -2680,31 +2680,35 @@
 rocessRemark
-Factory
+DataService
 ;%0A    public
@@ -2717,31 +2717,35 @@
 rocessRemark
-Factory
+DataService
  getProcessR
@@ -2745,31 +2745,35 @@
 rocessRemark
-Factory
+DataService
 () %7B%0A       
@@ -2785,39 +2785,43 @@
 rn processRemark
-Factory
+DataService
 ;%0A    %7D%0A    %0A   
@@ -2864,23 +2864,27 @@
 ssRemark
-Factory
+DataService
 (Process
@@ -2889,23 +2889,27 @@
 ssRemark
-Factory
+DataService
  process
@@ -2910,31 +2910,35 @@
 rocessRemark
-Factory
+DataService
 ) %7B%0A        
@@ -2959,392 +2959,46 @@
 mark
-Factory = processRemarkFactory;%0A    %7D%0A%0A    private SourceCodeRemarkFactory sourceCodeRemarkFactory;%0A    public SourceCodeRemarkFactory getSourceCodeRemarkFactory() %7B%0A        return sourceCodeRemarkFactory;%0A    %7D%0A%0A    @Autowired%0A    public void setSourceCodeRemarkFactory(SourceCodeRemarkFactory sourceCodeRemarkFactory) %7B%0A        this.sourceCodeRemarkFactory = sourceCodeRemarkFactory
+DataService = processRemarkDataService
 ;%0A  
@@ -3951,66 +3951,21 @@
 mark
-Factory, %0A                        sourceCodeRemarkFactory,
+DataService, 
 %0A   
@@ -4000,23 +4000,27 @@
 eElement
-Factory
+DataService
 ,%0A      

update processFactory to only uses DataService layer