Produced by Araxis Merge on 6/11/2019 10:54:08 AM Eastern Daylight 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | HTRE_P3_v14.5_iter_4_build_14.zip\java\gov\va\med\ccht\model | Schedule.java | Wed May 29 15:26:00 2019 UTC |
| 2 | HTRE_P3_v14.5_iter_4_build_14.zip\java\gov\va\med\ccht\model | Schedule.java | Mon Jun 10 19:19:44 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 504 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | /********* ********** ********** ********** ********** ********** ********* | |
| 2 | * Copyrig ht 2010 VH A. All rig hts reserv ed | |
| 3 | ********* ********** ********** ********** ********** ********** *********/ | |
| 4 | package go v.va.med.c cht.model; | |
| 5 | ||
| 6 | import jav a.io.Seria lizable; | |
| 7 | import jav a.text.Dat eFormat; | |
| 8 | import jav a.text.Dec imalFormat ; | |
| 9 | import jav a.text.Num berFormat; | |
| 10 | import jav a.text.Sim pleDateFor mat; | |
| 11 | import jav a.util.Dat e; | |
| 12 | import jav a.util.Loc ale; | |
| 13 | import jav a.util.Set ; | |
| 14 | import jav a.util.Sor tedSet; | |
| 15 | import jav a.util.Tim eZone; | |
| 16 | import jav a.util.Tre eSet; | |
| 17 | ||
| 18 | import org .apache.co mmons.lang 3.builder. ToStringBu ilder; | |
| 19 | import org .quartz.Cr onSchedule Builder; | |
| 20 | import org .quartz.Cr onTrigger; | |
| 21 | import org .quartz.Tr iggerBuild er; | |
| 22 | ||
| 23 | import gov .va.med.cc ht.model.t erminology .DayOfMont h; | |
| 24 | import gov .va.med.cc ht.model.t erminology .DayOfQuar ter; | |
| 25 | import gov .va.med.cc ht.model.t erminology .DayOfWeek ; | |
| 26 | import gov .va.med.cc ht.model.t erminology .Month; | |
| 27 | import gov .va.med.cc ht.model.t erminology .RunFreque ncy; | |
| 28 | import gov .va.med.cc ht.model.t erminology .ScheduleT ype; | |
| 29 | import gov .va.med.cc ht.model.t erminology .WeekOfMon th; | |
| 30 | import gov .va.med.cc ht.util.Sc hedulerUti ls; | |
| 31 | import gov .va.med.fw .util.date .DateWithT imeZone; | |
| 32 | import gov .va.med.fw .util.date .TimeZoneU tils; | |
| 33 | ||
| 34 | /** | |
| 35 | * | |
| 36 | * @author DNS | |
| 37 | */ | |
| 38 | public cla ss Schedul e implemen ts Seriali zable { | |
| 39 | ||
| 40 | pr ivate stat ic final l ong serial VersionUID = -378035 0573837478 688L; | |
| 41 | ||
| 42 | // --------- ---------- ---------- ----- Fiel ds | |
| 43 | ||
| 44 | pr ivate RunF requency r unFrequenc y; | |
| 45 | pr ivate Sche duleType s cheduleTyp e; | |
| 46 | pr ivate DayO fMonth day OfMonth; | |
| 47 | pr ivate Week OfMonth we ekOfMonth; | |
| 48 | pr ivate DayO fWeek dayO fWeek; | |
| 49 | pr ivate DayO fQuarter d ayOfQuarte r; | |
| 50 | pr ivate Mont h month; | |
| 51 | pr ivate Inte ger numeri cDayOfMont h; | |
| 52 | pr ivate Date internalD ateToGener ate; | |
| 53 | pr ivate Time Zone inter nalDateToG enerateTim eZone = Ti meZone.get Default(); | |
| 54 | pr ivate Inte ger hour; | |
| 55 | pr ivate Inte ger minute ; | |
| 56 | pr ivate Set< DayOfWeek> daysOfWee k; | |
| 57 | ||
| 58 | // --------- ---------- ---------- ----- Busi ness Metho ds | |
| 59 | ||
| 60 | pu blic Strin g getFrien dlyDescrip tion() { | |
| 61 | if ( scheduleTy pe == null ) | |
| 62 | return "Unknown" ; | |
| 63 | Stri ngBuilder sb = new S tringBuild er(); | |
| 64 | ||
| 65 | if ( ScheduleTy pe.DAY_OF_ WEEK.getCo de().equal s(schedule Type.getCo de())) { | |
| 66 | sb.app end("Every week on " ); | |
| 67 | Sorted Set<DayOfW eek> sorte dDays = ne w TreeSet< DayOfWeek> (daysOfWee k); | |
| 68 | ||
| 69 | int i = 0; | |
| 70 | for (D ayOfWeek d ow : sorte dDays) { | |
| 71 | i++; | |
| 72 | sb.appen d(dow.getN ame()); | |
| 73 | if (i < daysOfWeek .size() - 1) { | |
| 74 | sb.append( ", "); | |
| 75 | } else i f (i == da ysOfWeek.s ize() - 1) { | |
| 76 | sb.append( " and "); | |
| 77 | } | |
| 78 | } | |
| 79 | } el se if (Sch eduleType. DAY_OF_MON TH.getCode ().equals( scheduleTy pe.getCode ())) { | |
| 80 | sb.app end("The " ).append(d ayOfMonth. getName(). toLowerCas e()).appen d( | |
| 81 | " day of e very month "); | |
| 82 | } el se if (Sch eduleType. WEEK_DAY.g etCode().e quals(sche duleType.g etCode())) { | |
| 83 | sb.app end("The " ).append(w eekOfMonth .getName() .toLowerCa se()).appe nd(" ").ap pend( | |
| 84 | dayOfWeek. getName()) .append(" of every m onth"); | |
| 85 | } el se if (Sch eduleType. DAY_OF_QUA RTER.getCo de().equal s(schedule Type.getCo de())) { | |
| 86 | sb.app end("The " ).append(d ayOfQuarte r.getName( ).toLowerC ase()).app end( | |
| 87 | " day of e very quart er"); | |
| 88 | } el se if (Sch eduleType. WEEK_DAY_M ONTH.getCo de().equal s(schedule Type.getCo de())) { | |
| 89 | sb.app end("Yearl y on the " ).append(w eekOfMonth .getName() .toLowerCa se()).appe nd(" ") | |
| 90 | .append(da yOfWeek.ge tName()).a ppend(" in ").append (month.get Name()); | |
| 91 | } el se if (Sch eduleType. MONTH_DAY. getCode(). equals(sch eduleType. getCode()) ) { | |
| 92 | sb.app end("Every ").append (month.get Name()).ap pend(" on day ") | |
| 93 | .append(nu mericDayOf Month).app end(" of t he month") ; | |
| 94 | } el se if (Sch eduleType. DATE.getCo de().equal s(schedule Type.getCo de())) { | |
| 95 | DateFo rmat df = SimpleDate Format.get DateInstan ce(DateFor mat.MEDIUM , Locale.U S); | |
| 96 | df.set TimeZone(i nternalDat eToGenerat eTimeZone) ; | |
| 97 | sb.app end("Only on ").appe nd(df.form at(interna lDateToGen erate)); | |
| 98 | } | |
| 99 | ||
| 100 | Numb erFormat n f = Decima lFormat.ge tIntegerIn stance(); | |
| 101 | nf.s etMinimumI ntegerDigi ts(2); | |
| 102 | sb.a ppend(" at "); | |
| 103 | if ( hour == 0 && minute == 0) { | |
| 104 | sb.app end("midni ght"); | |
| 105 | } el se { | |
| 106 | sb.app end(nf.for mat(hour)) .append(": ").append( nf.format( minute)); | |
| 107 | } | |
| 108 | ||
| 109 | retu rn sb.toSt ring(); | |
| 110 | } | |
| 111 | ||
| 112 | pr otected vo id buildTo String(ToS tringBuild er builder ) { } | |
| 113 | ||
| 114 | pr otected vo id finaliz e() throws Throwable { | |
| 115 | supe r.finalize (); | |
| 116 | days OfWeek = n ull; | |
| 117 | } | |
| 118 | ||
| 119 | pu blic RunFr equency ge tRunFreque ncy() { | |
| 120 | retu rn runFreq uency; | |
| 121 | } | |
| 122 | ||
| 123 | pu blic void setRunFreq uency(RunF requency r unFrequenc y) { | |
| 124 | this .runFreque ncy = runF requency; | |
| 125 | } | |
| 126 | ||
| 127 | pu blic Sched uleType ge tScheduleT ype() { | |
| 128 | retu rn schedul eType; | |
| 129 | } | |
| 130 | ||
| 131 | pu blic void setSchedul eType(Sche duleType s cheduleTyp e) { | |
| 132 | this .scheduleT ype = sche duleType; | |
| 133 | } | |
| 134 | ||
| 135 | pu blic DayOf Month getD ayOfMonth( ) { | |
| 136 | retu rn dayOfMo nth; | |
| 137 | } | |
| 138 | ||
| 139 | pu blic void setDayOfMo nth(DayOfM onth dayOf Month) { | |
| 140 | this .dayOfMont h = dayOfM onth; | |
| 141 | } | |
| 142 | ||
| 143 | pu blic WeekO fMonth get WeekOfMont h() { | |
| 144 | retu rn weekOfM onth; | |
| 145 | } | |
| 146 | ||
| 147 | pu blic void setWeekOfM onth(WeekO fMonth wee kOfMonth) { | |
| 148 | this .weekOfMon th = weekO fMonth; | |
| 149 | } | |
| 150 | ||
| 151 | pu blic DayOf Week getDa yOfWeek() { | |
| 152 | retu rn dayOfWe ek; | |
| 153 | } | |
| 154 | ||
| 155 | pu blic void setDayOfWe ek(DayOfWe ek dayOfWe ek) { | |
| 156 | this .dayOfWeek = dayOfWe ek; | |
| 157 | } | |
| 158 | ||
| 159 | pu blic DayOf Quarter ge tDayOfQuar ter() { | |
| 160 | retu rn dayOfQu arter; | |
| 161 | } | |
| 162 | ||
| 163 | pu blic void setDayOfQu arter(DayO fQuarter d ayOfQuarte r) { | |
| 164 | this .dayOfQuar ter = dayO fQuarter; | |
| 165 | } | |
| 166 | ||
| 167 | pu blic Month getMonth( ) { | |
| 168 | retu rn month; | |
| 169 | } | |
| 170 | ||
| 171 | pu blic void setMonth(M onth month ) { | |
| 172 | this .month = m onth; | |
| 173 | } | |
| 174 | ||
| 175 | pu blic Integ er getNume ricDayOfMo nth() { | |
| 176 | retu rn numeric DayOfMonth ; | |
| 177 | } | |
| 178 | ||
| 179 | pu blic void setNumeric DayOfMonth (Integer n umericDayO fMonth) { | |
| 180 | this .numericDa yOfMonth = numericDa yOfMonth; | |
| 181 | } | |
| 182 | ||
| 183 | pu blic Integ er getHour () { | |
| 184 | retu rn hour; | |
| 185 | } | |
| 186 | ||
| 187 | pu blic void setHour(In teger hour ) { | |
| 188 | this .hour = ho ur; | |
| 189 | } | |
| 190 | ||
| 191 | pu blic Integ er getMinu te() { | |
| 192 | retu rn minute; | |
| 193 | } | |
| 194 | ||
| 195 | pu blic void setMinute( Integer mi nute) { | |
| 196 | this .minute = minute; | |
| 197 | } | |
| 198 | ||
| 199 | pu blic Set<D ayOfWeek> getDaysOfW eek() { | |
| 200 | retu rn daysOfW eek; | |
| 201 | } | |
| 202 | ||
| 203 | pu blic void setDaysOfW eek(Set<Da yOfWeek> d aysOfWeek) { | |
| 204 | this .daysOfWee k = daysOf Week; | |
| 205 | } | |
| 206 | ||
| 207 | pu blic DateW ithTimeZon e getDateT oGenerate( ) { | |
| 208 | retu rn interna lDateToGen erate != n ull ? new DateWithTi meZone(get InternalDa teToGenera te(), | |
| 209 | getInter nalDateToG enerateTim eZone()) : null; | |
| 210 | } | |
| 211 | ||
| 212 | pu blic void setDateToG enerate(Da teWithTime Zone dateT oGenerate) { | |
| 213 | setI nternalDat eToGenerat e(dateToGe nerate == null ? nul l : dateTo Generate.g etDate()); | |
| 214 | setI nternalDat eToGenerat eTimeZone( dateToGene rate == nu ll ? null : dateToGe nerate | |
| 215 | .getTime Zone()); | |
| 216 | } | |
| 217 | ||
| 218 | pu blic Date getInterna lDateToGen erate() { | |
| 219 | retu rn interna lDateToGen erate; | |
| 220 | } | |
| 221 | ||
| 222 | pu blic void setInterna lDateToGen erate(Date internalD ateToGener ate) { | |
| 223 | this .internalD ateToGener ate = inte rnalDateTo Generate; | |
| 224 | } | |
| 225 | ||
| 226 | pu blic TimeZ one getInt ernalDateT oGenerateT imeZone() { | |
| 227 | retu rn interna lDateToGen erateTimeZ one; | |
| 228 | } | |
| 229 | ||
| 230 | pu blic void setInterna lDateToGen erateTimeZ one( | |
| 231 | TimeZo ne interna lDateToGen erateTimeZ one) { | |
| 232 | this .internalD ateToGener ateTimeZon e = intern alDateToGe nerateTime Zone; | |
| 233 | } | |
| 234 | ||
| 235 | pu blic Strin g getCronE xpression( ) { | |
| 236 | retu rn Schedul erUtils.ge tCronExpre ssion(this ); | |
| 237 | } | |
| 238 | ||
| 239 | pu blic Date getNextSch eduledDate () { | |
| 240 | Stri ng cron = getCronExp ression(); | |
| 241 | Time Zone timez one = Time ZoneUtils. getTimeZon e(); | |
| 242 | ||
| 243 | Cron Trigger cr onTrigger = TriggerB uilder | |
| 244 | .newTrig ger() | |
| 245 | .withSch edule(Cron ScheduleBu ilder.cron Schedule(c ron).inTim eZone(time zone)) | |
| 246 | .startNo w() | |
| 247 | .build() ; | |
| 248 | ||
| 249 | retu rn cronTri gger.getNe xtFireTime (); | |
| 250 | ||
| 251 | } | |
| 252 | ||
| 253 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.