All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertigo.orchestra.services.planification.processPlanificationDAO.ksp Maven / Gradle / Ivy

The newest version!
package io.vertigo.orchestra.dao.planification


create Task TkGetProcessToExecute {
	storeName : "orchestra"
    className : "io.vertigo.basics.task.TaskEngineSelect"
        request : "
        	select prp.*
        	from o_process_planification prp
        	where prp.SST_CD = 'RESERVED'
        	and prp.NOD_ID = #nodId#
			"
	in nodId	 	{domain : DoOIdentifiant 		cardinality: "1" 	}
	out dtcOProcessPlanification	 	{domain : DoDtOProcessPlanification		cardinality: "*" 	}
}


create Task TkReserveProcessToExecute {
	storeName : "orchestra"
    className : "io.vertigo.basics.task.TaskEngineProc"
        request : "
        	update o_process_planification
        	set SST_CD = 'RESERVED', NOD_ID = #nodId#
        	where (SST_CD = 'WAITING' and expected_time >= #lowerLimit# and expected_time <= #upperLimit#) 
        			or (SST_CD = 'RESCUED')
			"
	 in lowerLimit	 	{domain : DoOTimestamp 		cardinality: "1" 	}
	 in upperLimit	 	{domain : DoOTimestamp 		cardinality: "1" 	}
	 in nodId	 	{domain : DoOIdentifiant 		cardinality: "1" 	}
}

create Task TkGetLastPlanificationByProId {
	storeName : "orchestra"
    className : "io.vertigo.basics.task.TaskEngineSelect"
        request : "
        	select prp.* from  o_process_planification prp
        	where prp.PRO_ID = (select pro.PRO_ID from o_process pro where pro.PRO_ID = #proId# for update) and prp.SST_CD = 'WAITING'
        	order by prp.expected_time desc
        	limit 1
			"
		in proId	 	{domain : DoOIdentifiant 		cardinality: "1" 	}
		out dtOProcessPlanification	 	{domain : DoDtOProcessPlanification		cardinality: "?" 	}
}


create Task TkGetAllLastPastPlanifications {
	storeName : "orchestra"
    className : "io.vertigo.basics.task.TaskEngineSelect"
        request : "
        	select prp.* from  o_process_planification prp
			where prp.expected_time < #currentDate# and prp.SST_CD = 'WAITING'
			for update
			
			"
		in currentDate 	{domain : DoOTimestamp 			cardinality: "1" 	}
		out processPlanifications	 	{domain : DoDtOProcessPlanification		cardinality: "*" 	}
}


create Task TkCleanPlanificationsOnBoot {
	storeName : "orchestra"
    className : "io.vertigo.basics.task.TaskEngineProc"
        request : "
        	update o_process_planification set 
			SST_CD = 'MISFIRED'
			where SST_CD = 'WAITING' and expected_time < #currentDate# and prp_id not in (select prp.PRP_ID from  o_process_planification prp
        	inner join (
				    select pro_id, max(expected_time) as MaxDate
				    from o_process_planification
				    group by pro_id
				) pp on pp.pro_id = prp.pro_id and pp.MaxDate = prp.expected_time)
			"
		in currentDate 	{domain : DoOTimestamp 			cardinality: "1" 	}
}


create Task TkCleanFuturePlanifications {
	storeName : "orchestra"
    className : "io.vertigo.basics.task.TaskEngineProc"
        request : "
        	delete from o_process_planification prp
        	where prp.PRO_ID in (select pro.PRO_ID from o_process pro where pro.NAME = #processName#) and prp.SST_CD = 'WAITING' and prp.expected_time > current_timestamp
			"
	 in processName	 	{domain : DoOLibelle 		cardinality: "1" 	}
}













© 2015 - 2025 Weber Informatics LLC | Privacy Policy