193. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/13/2018 10:35:25 AM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

193.1 Files compared

# Location File Last Modified
1 v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\ccht\util SchedulerUtils.java Fri Dec 7 17:36:16 2018 UTC
2 v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\ccht\util SchedulerUtils.java Wed Dec 12 22:33:39 2018 UTC

193.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 256
Changed 1 2
Inserted 0 0
Removed 0 0

193.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

193.4 Active regular expressions

No regular expressions were active.

193.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.c cht.util;
  5  
  6   import jav a.util.Cal endar;
  7   import jav a.util.Set ;
  8   import jav a.util.Tim eZone;
  9  
  10   import gov .va.med.cc ht.model.S chedule;
  11   import gov .va.med.cc ht.model.t erminology .DayOfMont h;
  12   import gov .va.med.cc ht.model.t erminology .DayOfQuar ter;
  13   import gov .va.med.cc ht.model.t erminology .DayOfWeek ;
  14   import gov .va.med.cc ht.model.t erminology .RunFreque ncy;
  15   import gov .va.med.cc ht.model.t erminology .ScheduleT ype;
  16   import gov .va.med.cc ht.model.t erminology .WeekOfMon th;
  17  
  18   /**
  19    * @author   DNS
  20    *
  21    */
  22   public cla ss Schedul erUtils {
  23           
  24           /* *
  25            *  Constants  used to f orm a cron  expressio n
  26            * /
  27           pr ivate stat ic final S tring EMPT Y_SPACE =  " ";
  28           pr ivate stat ic final S tring QUES TION_MARK  = "?";
  29           
  30           pu blic stati c String g etCronExpr ession(Sch edule sche dule) {
  31  
  32                    // S tep 1: Per sist a rep ort set Al ready save d
  33                    // r eportDAO.s aveReportS etup(setup );
  34  
  35                    // S tep 2: Bui ld a cron  expression  is in thi s format
  36                    // s econds + m inutes + h ours + day  of month  + month +  day of
  37                    // w eek + year
  38                    Stri ng schedul e_type = s chedule.ge tScheduleT ype().getC ode();
  39                    Stri ng frequen cy = sched ule.getRun Frequency( ).getCode( );
  40  
  41                    Stri ng second  = "0";
  42                    Stri ng dayOfWe ek = null;
  43                    Stri ng dayOfMo nth = null ;
  44                    Stri ng month =  null;
  45                    Stri ng year =  "*";
  46  
  47                    int  hour_val =  schedule. getHour(). intValue() ;
  48                    Stri ng hour =  String.val ueOf(hour_ val == 24  ? 0 : hour _val);
  49                    Stri ng minute  = String.v alueOf(sch edule.getM inute().in tValue());
  50  
  51                    // U ser select s daily/we ekly
  52                    if ( RunFrequen cy.DAILY_W EEKLY.getC ode().equa ls(frequen cy)) {
  53                             Set<Da yOfWeek> d ays = sche dule.getDa ysOfWeek() ;
  54                             if (da ys != null )
  55                                      for (Day OfWeek dw  : days) {
  56                                               if (dayOfW eek == nul l) {
  57                                                       da yOfWeek =  DayOfWeek. Code.getBy Code(dw.ge tCode()).g etAlias();
  58                                               } else {
  59                                                       da yOfWeek +=  ("," + Da yOfWeek.Co de.getByCo de(dw.getC ode()).get Alias());
  60                                               }
  61                                      }
  62                    }
  63                    // U ser select s monthly
  64                    else  if (RunFr equency.MO NTHLY.getC ode().equa ls(frequen cy)) {
  65                             // and  last/firs t/15th dat e of a mon th
  66                             if (Sc heduleType .DAY_OF_MO NTH.getCod e().equals (schedule_ type)) {
  67                                      dayOfMon th = DayOf Month.Code .getByCode (schedule. getDayOfMo nth().getC ode())
  68                                                       .g etAlias();
  69                             } else  {
  70                                      // get w eek of mon th and day  of month
  71                                      dayOfWee k = DayOfW eek.Code.g etByCode(s chedule.ge tDayOfWeek ().getCode ()).getAli as()
  72                                                       +  WeekOfMont h.Code.get ByCode(sch edule.getW eekOfMonth ().getCode ())
  73                                                                         .getAl ias();
  74                             }
  75                    }
  76                    // U ser select s quarterl y
  77                    else  if (RunFr equency.QU ARTERLY.ge tCode().eq uals(frequ ency)) {
  78                             DayOfQ uarter dq  = schedule .getDayOfQ uarter();
  79                             if (Da yOfQuarter .CODE_FIRS T.getCode( ).equals(d q.getCode( ))) {
  80                                      // First  days of e very quart er are 10/ 1, 1/1, 4/ 1, 7/1
  81                                      // (mm/d d)
  82                                      month =  "1,4,7,10" ;
  83                                      dayOfMon th = "1";
  84                             } else  {
  85                                      // Last  days of ev ery quarte r are 12/3 1, 3/31, 6 /30,
  86                                      // 9/30  (mm/dd)
  87                                      month =  "3,6,9,12" ;
  88                                      dayOfMon th = "L";
  89                             }
  90                    }
  91                    // U ser select s yearly
  92                    else  if (RunFr equency.YE ARLY.getCo de().equal s(frequenc y)) {
  93                             // and  day of mo nth
  94                             if (Sc heduleType .WEEK_DAY_ MONTH.getC ode().equa ls(schedul e_type)) {
  95                                      // get w eek of mon th
  96                                      // get d ay of week
  97                                      // get m onth
  98                                      dayOfWee k = DayOfW eek.Code.g etByCode(s chedule.ge tDayOfWeek ().getCode ()).getAli as()
  99                                                       +  WeekOfMont h.Code.get ByCode(sch edule.getW eekOfMonth ().getCode ())
  100                                                                         .getAl ias();
  101                                      month =  schedule.g etMonth(). getCode();
  102                             } else  {
  103                                      month =  schedule.g etMonth(). getCode();
  104                                      dayOfMon th = sched ule.getNum ericDayOfM onth().toS tring();
  105                             }
  106                    }
  107                    // U ser select s other
  108                    else  if (RunFr equency.OT HER.getCod e().equals (frequency )) {
  109                             // get  day to ge nerate
  110                             Calend ar calenda r = Calend ar.getInst ance();
  111                             calend ar.setTime (schedule. getDateToG enerate(). getDate()) ;
  112                             calend ar.setTime Zone(TimeZ one.getDef ault()); / /??schedul e.getDateT oGenerate( ).getTimeZ one());
  113                             year =  String.va lueOf(cale ndar.get(C alendar.YE AR));
  114                             // Mon th starts  with 0.
  115                             month  = String.v alueOf(cal endar.get( Calendar.M ONTH) + 1) ;
  116                             dayOfM onth = Str ing.valueO f(calendar .get(Calen dar.DAY_OF _MONTH));
  117                    }
  118  
  119                    // s econds + m inutes + h ours + day  of month  + month +  day of
  120                    // w eek + year
  121                    Stri ngBuilder  cron = new  StringBui lder();
  122                    cron .append(se cond).appe nd(EMPTY_S PACE).appe nd(minute) .append(EM PTY_SPACE) .append(ho ur)
  123                                      .append( EMPTY_SPAC E).append( dayOfMonth  == null ?  QUESTION_ MARK : day OfMonth)
  124                                      .append( EMPTY_SPAC E).append( month == n ull ? "*"  : month).a ppend(EMPT Y_SPACE)
  125                                      .append( dayOfWeek  == null ?  QUESTION_M ARK : dayO fWeek).app end(EMPTY_ SPACE).app end(
  126                                                       ye ar);
  127                    retu rn cron.to String();
  128           }
  129   }