
import at.dockwork.time.domain.AbsencePlanningDetail

import groovy.sql.Sql
import java.sql.Connection
import java.sql.DriverManager
import javax.sql.DataSource




class UpdateScriptService {

	def run(def connection, def dataSourceFields) {

		at.dockwork.system.service.DataSourceService.execute(
			connection,
			dataSourceFields,
			[
				mySQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'BY_THE_DAY' where time_type = 'BYTHEDAY'",
				msSQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'BY_THE_DAY' where time_type = 'BYTHEDAY'"
			]
		)

		at.dockwork.system.service.DataSourceService.execute(
			connection,
			dataSourceFields,
			[
				mySQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'BY_THE_HOUR' where time_type = 'BYTHEHOUR'",
				msSQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'BY_THE_HOUR' where time_type = 'BYTHEHOUR'"
			]
		)

		at.dockwork.system.service.DataSourceService.execute(
			connection,
			dataSourceFields,
			[
				mySQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'HALF_DAY' where time_type = 'HALFDAY'",
				msSQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'HALF_DAY' where time_type = 'HALFDAY'"
			]
		)

		at.dockwork.system.service.DataSourceService.execute(
			connection,
			dataSourceFields,
			[
				mySQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'ANTE_MERIDIEM' where time_type = 'ANTEMERIDIEM'",
				msSQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'ANTE_MERIDIEM' where time_type = 'ANTEMERIDIEM'"
			]
		)

		at.dockwork.system.service.DataSourceService.execute(
			connection,
			dataSourceFields,
			[
				mySQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'POST_MERIDIEM' where time_type = 'POSTMERIDIEM'",
				msSQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'POST_MERIDIEM' where time_type = 'POSTMERIDIEM'"
			]
		)

		at.dockwork.system.service.DataSourceService.execute(
			connection,
			dataSourceFields,
			[
				mySQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'START_END' where time_type = 'FROMTO'",
				msSQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'START_END' where time_type = 'FROMTO'"
			]
		)

		at.dockwork.system.service.DataSourceService.execute(
			connection,
			dataSourceFields,
			[
				mySQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'START_END' where time_type = 'STARTEND'",
				msSQLStatement:"update dw_absence_planning_detail set absence_time_type_enum = 'START_END' where time_type = 'STARTEND'"
			]
		)

		true
	}
}
