import at.dockwork.common.domain.GeneralValidation
import at.dockwork.common.generalValidation.domain.GeneralValidation2SystemConfiguration
import at.dockwork.system.domain.SystemConfiguration
import grails.util.Holders

class UpdateScriptService {

	def systemConfigurationWriteService = Holders.grailsApplication.mainContext.getBean 'systemConfigurationWriteService'

	def run(def connection, def dataSourceFields) {

		def gormCriteria = SystemConfiguration.createCriteria()
		def systemConfigurationList = gormCriteria {

			and {
				'in'("cwID", [601, 602, 603, 604, 605, 606, 607, 611, 612])
				eq("deleted", false)
			}

		}

		systemConfigurationList.each{ systemConfiguration ->

            systemConfiguration.rewritableInGeneralValidation = true
            systemConfigurationWriteService.save(systemConfiguration)

		}

		true
	}
}