Guest User

Untitled

a guest
May 29th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. class DagAConfV1{
  2.     String person_id:
  3. }
  4.  
  5. class DagBConfV1{
  6.     String name:
  7. }
  8.  
  9. MIGRATION_DATE LocalDate = LocalDate.parse("2016-06-12").atStartOfDay();
  10. class DagBConfV2{
  11.     String first_name:
  12. }
  13.  
  14. Gson gson = new GsonBuilder().setPrettyPrinting().create();
  15. JSONParser parse = new JSONParser();
  16.        
  17. dagruns_collection: DagRunCollection = client.getDagRuns()
  18.  
  19. for(DagRun nazwa_obiektu : dagruns_collection.getDagRuns()) {
  20.     // Java idiomatic types
  21.     if(dag_runs.dag_id == "DAG_ID") {
  22.         DagAConfV1 empObject = gson.fromJson(dag_run.getConf(), DagAConfV1.class);
  23.         // Do somethings
  24.     } else (dag_runs.dag_id == "DAG_ID") {
  25.         if(MIGRATION_DATE.isBefore(dag_run.getExecutionDate()))
  26.             DagAConfV1 empObject = gson.fromJson(dag_run.getConf(), DagBConfV1.class);
  27.             // Do somethings
  28.         }else{
  29.             DagAConfV1 empObject = gson.fromJson(dag_run.getConf(), DagBConfV2.class);
  30.         }
  31.     }else{
  32.         // Dynamic typed object - Dynamic lnaguage idiomatic
  33.          JSONObject jobj = (JSONObject) parse.parse(dag_run.getConf());
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment