package io.vertigo.orchestra.plugins.services;


import java.time.format.DateTimeFormatter;
import java.util.Map;

public class JobRunnerUtil {
	
	public static final MapCodec MAP_CODEC = new MapCodec();
	private static final DateTimeFormatter DTF = DateTimeFormatter.ofPattern("yyyy_MM_dd_HH_mm_ss");
	
	public static String generateJobId(Instant dateTime, String typeSchedule, long scheduleId) {
		return DTF.format(dateTime) + '_' + typeSchedule + '_' + scheduleId;
	}
	
	public static String generateFormattedDate(Instant dateTime) {
		return DTF.format(dateTime);
	}	
	
	
	public static String mapToJson(Map<String, String> map) {
		return MAP_CODEC.encode(map);
	}
	
	public static Map<String, String> jsonToMap(String json) {
		return MAP_CODEC.decode(json);
	}
}


@@ -41,16 +41,41 @@
 vices;%0A%0A
+import java.time.Instant;
 %0Aimport 
@@ -162,17 +162,16 @@
 rUtil %7B%0A
-%09
 %0A%09public
@@ -319,17 +319,16 @@
 m_ss%22);%0A
-%09
 %0A%09public
@@ -356,16 +356,22 @@
 teJobId(
+final 
 Instant 
@@ -379,16 +379,22 @@
 ateTime,
+ final
  String 
@@ -406,16 +406,22 @@
 chedule,
+ final
  long sc
@@ -502,25 +502,24 @@
 eduleId;%0A%09%7D%0A
-%09
 %0A%09public sta
@@ -551,16 +551,22 @@
 tedDate(
+final 
 Instant 
@@ -610,21 +610,17 @@
 ime);%0A%09%7D
-%09%0A%09%0A%09
+%0A
 %0A%09public
@@ -644,16 +644,22 @@
 pToJson(
+final 
 Map%3CStri
@@ -712,17 +712,16 @@
 ap);%0A%09%7D%0A
-%09
 %0A%09public
@@ -758,16 +758,22 @@
 onToMap(
+final 
 String j
@@ -817,9 +817,8 @@
 );%0A%09%7D%0A%7D%0A
-%0A

fix import