import grails.util.Holders

class UpdateScriptService {

    /*
        at.clockwork.common.service.ToolsService wurde zu at.clockwork.common.service.GrailsToolsService
        ------------------------------------------------------------------------------------------------

        1) ToolsService eventuell aendern auf GrailsToolsService
        2) import at.clockwork.common.service.GrailsToolsService

    */

	def scriptNotTransactionalService = Holders.grailsApplication.mainContext.getBean 'scriptNotTransactionalService'
	def informationTransactionalService = Holders.grailsApplication.mainContext.getBean 'informationTransactionalService'

	def run(def connection, def dataSourceFields) {

		scriptNotTransactionalService.searchTextWithinScriptCode("ToolsService").each { Map map ->

			informationTransactionalService.add( map.text ?: "text", map.date ?: (new Date()), map.comment )

		}

		true

	}

}