Produced by Araxis Merge on 1/17/2019 10:54:18 AM Central 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | v1_iter_1_VIP_Build_4_Dec_2018_CG.zip\v1_iter_1_VIP_Build_4\portlets\caret-portlet\docroot\WEB-INF\src\gov\va\caret\util | CaretUtil.java | Wed Jan 16 16:07:30 2019 UTC |
| 2 | v1_iter_1_VIP_Build_4_Dec_2018_CG.zip\v1_iter_1_VIP_Build_4\portlets\caret-portlet\docroot\WEB-INF\src\gov\va\caret\util | CaretUtil.java | Wed Jan 16 20:13:26 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1532 |
| 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 | package go v.va.caret .util; | |
| 2 | ||
| 3 | import jav a.io.Unsup portedEnco dingExcept ion; | |
| 4 | import jav a.net.URI; | |
| 5 | import jav a.net.URL; | |
| 6 | import jav a.util.Arr ayList; | |
| 7 | import jav a.util.Cal endar; | |
| 8 | import jav a.util.Dat e; | |
| 9 | import jav a.util.Has hMap; | |
| 10 | import jav a.util.Has hSet; | |
| 11 | import jav a.util.Lin kedHashMap ; | |
| 12 | import jav a.util.Lis t; | |
| 13 | import jav a.util.Map ; | |
| 14 | import jav a.util.Set ; | |
| 15 | import jav a.util.Tre eMap; | |
| 16 | ||
| 17 | import jav ax.mail.in ternet.Add ressExcept ion; | |
| 18 | import jav ax.mail.in ternet.Int ernetAddre ss; | |
| 19 | import jav ax.portlet .PortletRe quest; | |
| 20 | import jav ax.portlet .PortletSe ssion; | |
| 21 | import jav ax.xml.par sers.Docum entBuilder ; | |
| 22 | import jav ax.xml.par sers.Docum entBuilder Factory; | |
| 23 | ||
| 24 | import org .w3c.dom.D ocument; | |
| 25 | import org .w3c.dom.N odeList; | |
| 26 | ||
| 27 | import com .liferay.m ail.servic e.MailServ iceUtil; | |
| 28 | import com .liferay.p ortal.kern el.excepti on.PortalE xception; | |
| 29 | import com .liferay.p ortal.kern el.excepti on.SystemE xception; | |
| 30 | import com .liferay.p ortal.kern el.log.Log ; | |
| 31 | import com .liferay.p ortal.kern el.log.Log FactoryUti l; | |
| 32 | import com .liferay.p ortal.kern el.mail.Ma ilMessage; | |
| 33 | import com .liferay.p ortal.kern el.util.Li stUtil; | |
| 34 | import com .liferay.p ortal.kern el.util.Pr opsUtil; | |
| 35 | import com .liferay.p ortal.kern el.util.St ringPool; | |
| 36 | import com .liferay.p ortal.kern el.util.Va lidator; | |
| 37 | import com .liferay.p ortal.mode l.BaseMode l; | |
| 38 | import com .liferay.p ortal.mode l.Country; | |
| 39 | import com .liferay.p ortal.mode l.Organiza tion; | |
| 40 | import com .liferay.p ortal.mode l.Role; | |
| 41 | import com .liferay.p ortal.mode l.User; | |
| 42 | import com .liferay.p ortal.serv ice.Organi zationLoca lServiceUt il; | |
| 43 | import com .liferay.p ortal.serv ice.RoleLo calService Util; | |
| 44 | import com .liferay.p ortal.serv ice.Servic eContext; | |
| 45 | import com .liferay.p ortal.serv ice.Servic eContextTh readLocal; | |
| 46 | import com .liferay.p ortal.serv ice.UserLo calService Util; | |
| 47 | import com .liferay.p ortal.util .PortalUti l; | |
| 48 | import com .liferay.p ortlet.exp ando.model .ExpandoBr idge; | |
| 49 | import com .liferay.p ortlet.exp ando.model .ExpandoCo lumn; | |
| 50 | import com .liferay.p ortlet.exp ando.model .ExpandoTa ble; | |
| 51 | import com .liferay.p ortlet.exp ando.model .ExpandoVa lue; | |
| 52 | import com .liferay.p ortlet.exp ando.servi ce.Expando ColumnLoca lServiceUt il; | |
| 53 | import com .liferay.p ortlet.exp ando.servi ce.Expando TableLocal ServiceUti l; | |
| 54 | import com .liferay.p ortlet.exp ando.servi ce.Expando ValueLocal ServiceUti l; | |
| 55 | import com .liferay.u til.portle t.PortletP rops; | |
| 56 | ||
| 57 | import gov .va.caret. Applicatio nWorkFlowE xception; | |
| 58 | import gov .va.caret. controller .dashboard .config.Da shboardCon fig; | |
| 59 | import gov .va.caret. controller .dashboard .config.Fa cilityDash boardConfi g; | |
| 60 | import gov .va.caret. model.BoxG p; | |
| 61 | import gov .va.caret. model.Faci l; | |
| 62 | import gov .va.caret. model.Note ; | |
| 63 | import gov .va.caret. model.Pers n; | |
| 64 | import gov .va.caret. model.VcgA n; | |
| 65 | import gov .va.caret. model.WorI m; | |
| 66 | import gov .va.caret. model.impl .BoxGpImpl ; | |
| 67 | import gov .va.caret. model.impl .NoteImpl; | |
| 68 | import gov .va.caret. model.impl .WorImImpl ; | |
| 69 | import gov .va.caret. model.supp ort.NoteSu pport; | |
| 70 | import gov .va.caret. model.supp ort.Person ; | |
| 71 | import gov .va.caret. model.supp ort.VcgSup port; | |
| 72 | import gov .va.caret. model.supp ort.Vendor ; | |
| 73 | import gov .va.caret. model.supp ort.WorkIt emSupport; | |
| 74 | import gov .va.caret. model.supp ort.WorkTy pe; | |
| 75 | import gov .va.caret. security.C Action; | |
| 76 | import gov .va.caret. security.C Action.Car etCan; | |
| 77 | import gov .va.caret. service.Bo xGpLocalSe rviceUtil; | |
| 78 | import gov .va.caret. service.Ca retLocalSe rviceUtil; | |
| 79 | import gov .va.caret. service.Do cumLocalSe rviceUtil; | |
| 80 | import gov .va.caret. service.Fa cilLocalSe rviceUtil; | |
| 81 | import gov .va.caret. service.Pe rsnLocalSe rviceUtil; | |
| 82 | import gov .va.caret. view.Caret Param; | |
| 83 | import gov .va.caret. workflow.Q ueAction; | |
| 84 | ||
| 85 | public cla ss CaretUt il { | |
| 86 | ||
| 87 | pr ivate stat ic Log _lo g = LogFac toryUtil.g etLog( Car etUtil.cla ss ); | |
| 88 | ||
| 89 | st atic Map<S tring,Long > _visnMap = new Tre eMap<Strin g,Long>(); | |
| 90 | st atic List< Country> _ countryLis t = null; | |
| 91 | st atic Map<S tring,Map< String,Lon g>> visnMa p = null; | |
| 92 | st atic Map<S tring,Map< String,Map <String,Lo ng>>> dist rictMap = null; | |
| 93 | pu blic stati c boolean isMviEnabl ed() { | |
| 94 | retu rn StringP ool.TRUE.e quals( Pro psUtil.get ( "search. mvi.attend ed.enabled " ) ); | |
| 95 | } | |
| 96 | ||
| 97 | pu blic stati c boolean isEmailEna bled() { | |
| 98 | retu rn StringP ool.TRUE.e quals( Pro psUtil.get ( "email.e nabled" ) ); | |
| 99 | } | |
| 100 | ||
| 101 | pu blic stati c boolean isTiuEnabl ed() { | |
| 102 | retu rn StringP ool.TRUE.e quals( Pro psUtil.get ( "tiu.wri te.service .enabled" ) ); | |
| 103 | } | |
| 104 | ||
| 105 | pu blic stati c String g etWsdlDire ctory(){ | |
| 106 | retu rn PropsUt il.get("ws dl.locatio n"); | |
| 107 | } | |
| 108 | ||
| 109 | pu blic stati c String g etEEWsdloc ation(){ | |
| 110 | retu rn PropsUt il.get("EE .wsdl.loca tion"); | |
| 111 | } | |
| 112 | ||
| 113 | pu blic stati c String g etEEUserNa me(){ | |
| 114 | retu rn PropsUt il.get("EE .username" ); | |
| 115 | } | |
| 116 | ||
| 117 | pu blic stati c String g etEEPasswo rd(){ | |
| 118 | try { | |
| 119 | Servic eContext s c = Servic eContextTh readLocal. getService Context(); | |
| 120 | Dashbo ardConfig dashboardC onfig = (D ashboardCo nfig) sc.g etLiferayP ortletRequ est().getP ortletSess ion().getA ttribute(C aretStrPoo l.DASHBOAR D_CONFIG); | |
| 121 | Role r ole = Role LocalServi ceUtil.get Role( dash boardConfi g.getRoleI d() ); | |
| 122 | return gov.va.ca ret.util.C aretUtil.g etExpandoV alue(role. getExpando Bridge(), "E_AND_E_S ERVICE"); | |
| 123 | } ca tch (Porta lException | SystemE xception e ) { | |
| 124 | e.prin tStackTrac e(); | |
| 125 | } | |
| 126 | retu rn null; | |
| 127 | } | |
| 128 | ||
| 129 | pu blic stati c String g etBlsYear( ){ | |
| 130 | retu rn PropsUt il.get("bl s.year"); | |
| 131 | } | |
| 132 | ||
| 133 | pu blic stati c boolean isTrackerE nabled() { | |
| 134 | retu rn StringP ool.TRUE.e quals( Pro psUtil.get ( "form.su bmit.track er.enabled " ) ); | |
| 135 | } | |
| 136 | ||
| 137 | pu blic stati c String g etMviProce ssingCode( ) { | |
| 138 | Stri ng process ingCode = PropsUtil. get("mvi.p rocessingC ode"); | |
| 139 | if ( Toolbox.i sEmpty(pro cessingCod e) ) { | |
| 140 | return "T"; | |
| 141 | } | |
| 142 | retu rn process ingCode; | |
| 143 | } | |
| 144 | ||
| 145 | ||
| 146 | pu blic stati c void sen dPaymentNo tification Mail( Map< String,Obj ect> other Info ) { | |
| 147 | Inte rnetAddres s fromAddr ess = null ; | |
| 148 | Inte rnetAddres s[] toAddr ess = null ; | |
| 149 | try { | |
| 150 | _log.inf o("Sending mail:" + String.val ueOf( othe rInfo.get( "subject") ) ); | |
| 151 | try { | |
| 152 | String fro mEmail = T oolbox.nul lSafe( oth erInfo.get ("fromEmai l" ) ).isE mpty()? "
|
|
| 153 | fromAddres s = new In ternetAddr ess( fromE mail, Stri ng.valueOf ( otherInf o.get("fro m") ) ); | |
| 154 | } catch (Unsupport edEncoding Exception e) { | |
| 155 | e.printSta ckTrace(); | |
| 156 | } | |
| 157 | String[] tos = Str ing.valueO f( otherIn fo.get("to ") ).split (";"); | |
| 158 | toAddres s = new In ternetAddr ess[tos.le ngth]; | |
| 159 | for ( in t i = 0; i < tos.len gth; i++ ) { | |
| 160 | toAddress[ i] = new I nternetAdd ress( tos[ i].trim() ); | |
| 161 | } | |
| 162 | MailMess age mailMe ssage = ne w MailMess age(); | |
| 163 | mailMess age.setTo( toAddress ); | |
| 164 | mailMess age.setFro m( fromAdd ress ); | |
| 165 | mailMess age.setSub ject( Stri ng.valueOf ( otherInf o.get("sub ject") ) ) ; | |
| 166 | mailMess age.setBod y( String. valueOf( o therInfo.g et("body") ) ); | |
| 167 | MailServ iceUtil.se ndEmail(ma ilMessage) ; | |
| 168 | } ca tch (Addre ssExceptio n e) { | |
| 169 | e.prin tStackTrac e(); | |
| 170 | } | |
| 171 | } | |
| 172 | ||
| 173 | ||
| 174 | pu blic stati c boolean isValidate UspsAddres s ( String userAddre ss, String userCity, String us erState, S tring user Zip, Strin g apt ){ | |
| 175 | if ( _log.isIn foEnabled( ) ) { | |
| 176 | _log.i nfo("makin g USPS cal l with " + userAddre ss + Strin gPool.SPAC E + userC ity + Stri ngPool.SPA CE + user State + St ringPool.S PACE + use rZip ); | |
| 177 | } | |
| 178 | Stri ng apt0; | |
| 179 | bool ean isEmpt yApt = Too lbox.isEmp ty( apt ); | |
| 180 | if ( isEmptyAp t ) { | |
| 181 | apt0 = "<Address 1 />"; | |
| 182 | } el se { | |
| 183 | apt0 = "<Address 1>" + apt + "</Addre ss1>"; | |
| 184 | } | |
| 185 | String u rlQuery = "API=Verif y&XML=<Add ressValida teRequest USERID=\"4 02VA000055 0\"><Inclu deOptional Elements>t rue</Inclu deOptional Elements>< ReturnCarr ierRoute>t rue</Retur nCarrierRo ute><Addre ss ID=\"0\ "><FirmNam e />"+ apt 0 +"<Addre ss2>"+user Address+"< /Address2> <City>"+us erCity+"</ City><Stat e>"+userSt ate+"</Sta te><Zip5>" +userZip+" </Zip5><Zi p4></Zip4> </Address> </AddressV alidateReq uest>"; | |
| 186 | ||
| 187 | try{ | |
| 188 | URI uri = new URI( | |
| 189 | "http", | |
| 190 | "product ion.shippi ngapis.com ", | |
| 191 | "/Shippi ngAPI.dll" , | |
| 192 | urlQuery , | |
| 193 | null); | |
| 194 | URL url = uri. toURL(); | |
| 195 | Docu mentBuilde rFactory f actory = D ocumentBui lderFactor y.newInsta nce(); | |
| 196 | fact ory.setFea ture("http ://apache. org/xml/fe atures/dis allow-doct ype-decl", true); | |
| 197 | Docu mentBuilde r db = fac tory.newDo cumentBuil der(); | |
| 198 | Docu ment doc = db.parse( url.openSt ream()); | |
| 199 | doc. getDocumen tElement() .normalize (); | |
| 200 | ||
| 201 | Node List nodeL ist = doc. getElement sByTagName ("Error"); | |
| 202 | if ( nodeList ! = null && nodeList.g etLength() > 0) { | |
| 203 | return false; | |
| 204 | }els e{ | |
| 205 | String address2 = doc.getE lementsByT agName("Ad dress2").i tem(0).get TextConten t(); | |
| 206 | String address1 = StringPo ol.BLANK; | |
| 207 | if ( d oc.getElem entsByTagN ame("Addre ss1").item (0) != nul l ) { | |
| 208 | address1 = doc.get ElementsBy TagName("A ddress1"). item(0).ge tTextConte nt(); | |
| 209 | } | |
| 210 | String city = do c.getEleme ntsByTagNa me("City") .item(0).g etTextCont ent(); | |
| 211 | String state = d oc.getElem entsByTagN ame("State ").item(0) .getTextCo ntent(); | |
| 212 | String zip = doc .getElemen tsByTagNam e("Zip5"). item(0).ge tTextConte nt(); | |
| 213 | ||
| 214 | if(!(( userAddres s.toUpperC ase()).equ als(addres s2)) | |
| 215 | || ( !is EmptyApt & & !(apt.to UpperCase( )).equals( address1) ) | |
| 216 | || !((userCit y.toUpperC ase()).equ als(city)) | |
| 217 | || !((us erState.to UpperCase( )).equals( state)) | |
| 218 | || !(use rZip.equal s(zip))) | |
| 219 | { | |
| 220 | return f alse; | |
| 221 | }else{ | |
| 222 | re turn true; | |
| 223 | } | |
| 224 | } | |
| 225 | } catch (Exception e) { | |
| 226 | Appl icationWor kFlowExcep tion.handl eException (e); | |
| 227 | } | |
| 228 | return f alse; | |
| 229 | } | |
| 230 | ||
| 231 | pu blic stati c Note cre ateNote(Da te now, lo ng chainId , long gro upId, long userId, | |
| 232 | String messageSt ring) { | |
| 233 | ||
| 234 | Note note; | |
| 235 | if ( messageSt ring == nu ll ){ | |
| 236 | note = null; | |
| 237 | Applic ationWorkF lowExcepti on.handleE xception(" CREATE NOT E on EMPTY "); | |
| 238 | } el se { | |
| 239 | note = new NoteS upport ( n ew NoteImp l() ); | |
| 240 | note.s etCreation Date(now); | |
| 241 | note.s etValue( m essageStri ng ); | |
| 242 | note.s etChainId( chainId); | |
| 243 | note.s etGroupId( groupId); | |
| 244 | note.s etUserId(u serId); | |
| 245 | } | |
| 246 | retu rn note; | |
| 247 | } | |
| 248 | ||
| 249 | pu blic stati c List<Wor Im> create WorkItems ( PortletR equest req uest, long groupId, BaseModel< ?> src, bo olean[] ch anges, lon g veteranP ersnId, lo ng caregiv erPersnId ){ | |
| 250 | List <WorIm> wo rkItems = new ArrayL ist<WorIm> (); | |
| 251 | Map< WorkType,W orIm> work ItemMap = (Map)reque st.getAttr ibute("wor kItemMap") ; | |
| 252 | if ( workItemM ap == null ){ | |
| 253 | workIt emMap = ne w HashMap< WorkType,W orIm>(); | |
| 254 | reques t.setAttri bute("work ItemMap", workItemMa p); | |
| 255 | } | |
| 256 | Serv iceContext sc = Care tParam.set CaretServi ceContext( request); | |
| 257 | WorI m workItem ; | |
| 258 | for ( int ndx = 0; ndx < changes.l ength; ndx ++ ){ | |
| 259 | if ( c hanges[ndx ] ){ | |
| 260 | switch ( ndx ){ | |
| 261 | case (0) : | |
| 262 | if ( workI temMap.con tainsKey( WorkType.P II_CHANGE) ) continu e; | |
| 263 | workItem = CaretUt il.createW orkItem(sc , groupId, src, Work Type.PII_C HANGE, vet eranPersnI d, caregiv erPersnId) ; | |
| 264 | workItem Map.put( W orkType.PI I_CHANGE, workItem); | |
| 265 | workItems. add ( work Item ); | |
| 266 | break; | |
| 267 | case (1) : | |
| 268 | if ( workI temMap.con tainsKey( WorkType.N AME_CHANGE ) ) contin ue; | |
| 269 | workItem = CaretUt il.createW orkItem(sc , groupId, src, Work Type.NAME_ CHANGE, ve teranPersn Id, caregi verPersnId ); | |
| 270 | workItem Map.put( W orkType.NA ME_CHANGE, workItem) ; | |
| 271 | workItems. add ( work Item ); | |
| 272 | break; | |
| 273 | case (2) : | |
| 274 | if ( workI temMap.con tainsKey( WorkType.I NSURANCE_C HANGE) ) c ontinue; | |
| 275 | workItem = CaretUt il.createW orkItem(sc , groupId, src, Work Type.INSUR ANCE_CHANG E, veteran PersnId, c aregiverPe rsnId); | |
| 276 | workItem Map.put( W orkType.IN SURANCE_CH ANGE, work Item); | |
| 277 | workItems. add ( work Item ); | |
| 278 | break; | |
| 279 | case (3) : | |
| 280 | if ( workI temMap.con tainsKey( WorkType.A DDRESS_CHA NGE) ) con tinue; | |
| 281 | workItem = CaretUt il.createW orkItem(sc , groupId, src, Work Type.ADDRE SS_CHANGE, veteranPe rsnId, car egiverPers nId); | |
| 282 | workItem Map.put( W orkType.AD DRESS_CHAN GE, workIt em); | |
| 283 | workItems. add ( work Item ); | |
| 284 | break; | |
| 285 | case (4) : | |
| 286 | if ( workI temMap.con tainsKey( WorkType.F ACILITY_CH ANGE) ) co ntinue; | |
| 287 | workItem = CaretUt il.createW orkItem(sc , groupId, src, Work Type.FACIL ITY_CHANGE , veteranP ersnId, ca regiverPer snId); | |
| 288 | workItem Map.put( W orkType.FA CILITY_CHA NGE, workI tem); | |
| 289 | workItems. add ( work Item ); | |
| 290 | break; | |
| 291 | default: | |
| 292 | } | |
| 293 | } | |
| 294 | } | |
| 295 | retu rn workIte ms; | |
| 296 | } | |
| 297 | ||
| 298 | pu blic stati c WorIm cr eateWorkIt em ( Servi ceContext sc, long g roupId, Ba seModel<?> src, Work Type type, long vete ranPersnId , long car egiverPers nId ){ | |
| 299 | retu rn CaretUt il.createW orkItem(sc , groupId, src, vete ranPersnId , type.na me(), care giverPersn Id, type.g etDueDate( sc.getCre ateDate() ) ); | |
| 300 | } | |
| 301 | ||
| 302 | pu blic stati c WorIm cr eateWorkIt em ( Servi ceContext sc, long g roupId, Ba seModel<?> src, long veteranPe rsnId, Str ing name, long careg iverPersnI d, Date du eDate ){ | |
| 303 | retu rn CaretUt il.createW orkItem(sc , groupId, PortalUti l.getClass NameId( sr c.getModel Class() ), (Long)src .getPrimar yKeyObj(), veteranPe rsnId, na me, caregi verPersnId , dueDate ); | |
| 304 | } | |
| 305 | ||
| 306 | pu blic stati c WorIm cr eateWorkIt em ( Servi ceContext sc, long g roupId, lo ng srcClas sId, long srcPrimary Key, long veteranPer snId, Stri ng name, l ong caregi verPersnId , Date due Date ){ | |
| 307 | WorI m workItem = new Wor ImImpl(); | |
| 308 | if ( groupId < 1200 ) { | |
| 309 | workIt em.setStat us( CaretS trPool.PEN DING ); | |
| 310 | } el se { | |
| 311 | workIt em.setStat us( CaretS trPool.NEW ); | |
| 312 | } | |
| 313 | work Item.setCr eationDate ( sc.getCr eateDate() ); | |
| 314 | work Item.setGr oupId( gro upId ); | |
| 315 | work Item.setCl assPk( src PrimaryKey ); | |
| 316 | work Item.setPe rsnId(vete ranPersnId ); | |
| 317 | work Item.setCa regiverId( caregiverP ersnId); | |
| 318 | work Item.setTy pe( name ) ; | |
| 319 | if ( _log.isIn foEnabled( ) ){ | |
| 320 | _log.i nfo("using DueDate=" + dueDate ); | |
| 321 | } | |
| 322 | work Item.setDu eDate( due Date ); | |
| 323 | if ( _log.isIn foEnabled( ) ){ | |
| 324 | _log.i nfo("using src.getMo delClass() =" + srcCl assId ); | |
| 325 | } | |
| 326 | work Item.setCl assId( src ClassId ); | |
| 327 | retu rn workIte m; | |
| 328 | } | |
| 329 | ||
| 330 | pu blic stati c WorIm cr eateHomeVi sitWorkIte m ( Servic eContext s c, long gr oupId, Bas eModel<?> src, WorkT ype type, long veter anPersnId, long care giverPersn Id, long v cgId, Date completio nDate){ | |
| 331 | WorI m workItem = new Wor ImImpl(); | |
| 332 | work Item.setSt atus( Care tStrPool.N EW ); | |
| 333 | work Item.setCr eationDate ( sc.getCr eateDate() ); | |
| 334 | work Item.setGr oupId( gro upId ); | |
| 335 | work Item.setTy pe( type.n ame() ); | |
| 336 | work Item.setCl assPk( (Lo ng)src.get PrimaryKey Obj() ); | |
| 337 | work Item.setPe rsnId(vete ranPersnId ); | |
| 338 | work Item.setCa regiverId( caregiverP ersnId); | |
| 339 | if ( _log.isIn foEnabled( ) ){ | |
| 340 | _log.i nfo("using DueDate=" + type.ge tBusinessD ueDate( co mpletionDa te ) ); | |
| 341 | } | |
| 342 | work Item.setDu eDate( typ e.getBusin essDueDate ( completi onDate ) ) ; | |
| 343 | if ( _log.isIn foEnabled( ) ){ | |
| 344 | _log.i nfo("using src.getMo delClass() =" + src.g etModelCla ss()); | |
| 345 | } | |
| 346 | work Item.setCl assId( Por talUtil.ge tClassName Id( src.ge tModelClas s() ) ); | |
| 347 | work Item.setVc gId(vcgId) ; | |
| 348 | retu rn workIte m; | |
| 349 | } | |
| 350 | ||
| 351 | pu blic stati c Map<Stri ng,Map<Str ing,Long>> getVhaOrg TreeNoDist rict ( lon g companyI d, boolean includeNu mber ) thr ows Applic ationWorkF lowExcepti on { | |
| 352 | ||
| 353 | if ( CaretUtil .visnMap = = null ){ | |
| 354 | try { | |
| 355 | Organiza tion head = Organiza tionLocalS erviceUtil .getOrgani zation( co mpanyId, P ortletProp s.get(Care tStrPool.H EAD_ORG_NA ME) ); | |
| 356 | java.uti l.Comparat or<String> c = new j ava.util.C omparator< String>() { | |
| 357 | @Override | |
| 358 | public int compare(S tring o1, String o2) { | |
| 359 | if ( o1.leng th() < 5 | | !Validat or.isNumbe r( o1.subs tring(5) ) ) { | |
| 360 | retu rn -1; | |
| 361 | } | |
| 362 | if ( o2.leng th() < 5 | | !Validat or.isNumbe r( o2.subs tring(5) ) ) { | |
| 363 | retu rn 1; | |
| 364 | } | |
| 365 | re turn Integ er.valueOf ( o1.subst ring(5) ). compareTo( Integer.v alueOf( o2 .substring (5) ) ); | |
| 366 | } | |
| 367 | }; | |
| 368 | visnMap = new Tree Map<String ,Map<Strin g,Long>>(c ); | |
| 369 | CaretUti l._visnMap = new Has hMap<Strin g,Long>(); | |
| 370 | for ( Or ganization district: Organizat ionLocalSe rviceUtil. getOrganiz ations( co mpanyId, h ead.getOrg anizationI d() ) ){ | |
| 371 | // CaretUtil. districtMa p.put(dist rict.getNa me(), visn Map ); | |
| 372 | for ( Orga nization v isn: Organ izationLoc alServiceU til.getOrg anizations ( companyI d, distric t.getOrgan izationId( ) ) ){ | |
| 373 | Ma p<String,L ong> facil ityMap = n ew TreeMap <String,Lo ng>(); | |
| 374 | vi snMap.put( visn.getNa me(), faci lityMap ); | |
| 375 | Ca retUtil._v isnMap.put ( visn.get Name(), vi sn.getOrga nizationId () ); | |
| 376 | fo r ( Organi zation fac ility : Or ganization LocalServi ceUtil.get Organizati ons( compa nyId, visn .getOrgani zationId() ) ){ | |
| 377 | Faci l facil = FacilLocal ServiceUti l.getByOrg Id( facili ty.getPrim aryKey() ) ; | |
| 378 | ||
| 379 | faci lityMap.pu t( include Number? fa cil.getFac ilityNumbe r() + Stri ngPool.COM MA_AND_SPA CE + facil ity.getNam e() + Stri ngPool.COM MA_AND_SPA CE + facil .getLocati on() : | |
| 380 | facili ty.getName (), | |
| 381 | facility .getOrgani zationId() ); | |
| 382 | } | |
| 383 | } | |
| 384 | } | |
| 385 | } catc h (PortalE xception e ) { | |
| 386 | throw ne w Applicat ionWorkFlo wException (e); | |
| 387 | } catc h (SystemE xception e ) { | |
| 388 | throw ne w Applicat ionWorkFlo wException (e); | |
| 389 | } | |
| 390 | ||
| 391 | } | |
| 392 | retu rn CaretUt il.visnMap ; | |
| 393 | } | |
| 394 | ||
| 395 | pu blic stati c Map<Stri ng,Map<Str ing,Map<St ring,Long> >> getVhaO rgTree( lo ng company Id, boolea n includeN umber ) th rows Appli cationWork FlowExcept ion { | |
| 396 | ||
| 397 | if ( CaretUtil .districtM ap == null ){ | |
| 398 | try { | |
| 399 | Organiza tion head = Organiza tionLocalS erviceUtil .getOrgani zation( co mpanyId, P ortletProp s.get(Care tStrPool.H EAD_ORG_NA ME) ); | |
| 400 | CaretUti l.district Map = new TreeMap<St ring,Map<S tring,Map< String,Lon g>>>(); | |
| 401 | for ( Or ganization district: Organizat ionLocalSe rviceUtil. getOrganiz ations( co mpanyId, h ead.getOrg anizationI d() ) ){ | |
| 402 | Map<String ,Map<Strin g,Long>> v isnMap = n ew TreeMap <String,Ma p<String,L ong>>(); | |
| 403 | CaretUtil. districtMa p.put(dist rict.getNa me(), visn Map ); | |
| 404 | for ( Orga nization v isn: Organ izationLoc alServiceU til.getOrg anizations ( companyI d, distric t.getOrgan izationId( ) ) ){ | |
| 405 | Ma p<String,L ong> facil ityMap = n ew TreeMap <String,Lo ng>(); | |
| 406 | vi snMap.put( visn.getNa me(), faci lityMap ); | |
| 407 | Ca retUtil._v isnMap.put ( visn.get Name(), vi sn.getOrga nizationId () ); | |
| 408 | fo r ( Organi zation fac ility : Or ganization LocalServi ceUtil.get Organizati ons( compa nyId, visn .getOrgani zationId() ) ){ | |
| 409 | Faci l facil = FacilLocal ServiceUti l.getByOrg Id( facili ty.getPrim aryKey() ) ; | |
| 410 | ||
| 411 | faci lityMap.pu t( include Number? fa cil.getFac ilityNumbe r() + Stri ngPool.COM MA_AND_SPA CE + facil ity.getNam e() + Stri ngPool.COM MA_AND_SPA CE + facil .getLocati on() : | |
| 412 | facili ty.getName (), | |
| 413 | facility .getOrgani zationId() ); | |
| 414 | } | |
| 415 | } | |
| 416 | } | |
| 417 | } catc h (PortalE xception e ) { | |
| 418 | throw ne w Applicat ionWorkFlo wException (e); | |
| 419 | } catc h (SystemE xception e ) { | |
| 420 | throw ne w Applicat ionWorkFlo wException (e); | |
| 421 | } | |
| 422 | ||
| 423 | } | |
| 424 | retu rn CaretUt il.distric tMap; | |
| 425 | } | |
| 426 | ||
| 427 | pu blic stati c Map<Long , String> getVhaOrgL ist(Portle tRequest a ctionReque st) throws Applicati onWorkFlow Exception { | |
| 428 | ||
| 429 | Port letSession psession = actionRe quest.getP ortletSess ion(); | |
| 430 | Map< Long, Stri ng> linked ; | |
| 431 | if ( psession. getAttribu te(CaretSt rPool.VHA_ MEMBER) == null ) { | |
| 432 | linked = new Lin kedHashMap <Long, Str ing>(); | |
| 433 | } el se { | |
| 434 | linked = (Map<Lo ng, String >)psession .getAttrib ute(CaretS trPool.VHA _MEMBER); | |
| 435 | } | |
| 436 | ||
| 437 | Faci lityDashbo ardConfig config = ( FacilityDa shboardCon fig)psessi on.getAttr ibute(Care tStrPool.D ASHBOARD_C ONFIG); | |
| 438 | try { | |
| 439 | Set<Lo ng> groupI ds = new H ashSet<Lon g>( config .getGroupI d() ); | |
| 440 | groupI ds.addAll( config.ge tVisnId() ); | |
| 441 | for ( Long group Id : group Ids ){ | |
| 442 | Organiza tion org = Organizat ionLocalSe rviceUtil. getOrganiz ation( gro upId ); | |
| 443 | Facil fa cil = null ; | |
| 444 | if ( !or g.getName( ).toLowerC ase().star tsWith("vi sn")) { | |
| 445 | facil = Fa cilLocalSe rviceUtil. getByOrgId ( org.getO rganizatio nId() ); | |
| 446 | } | |
| 447 | if ( fac il == null ){ | |
| 448 | // linked. put( 1l, o rg.getName () ); | |
| 449 | for ( Orga nization s ubOrg : or g.getSubor ganization s()){ | |
| 450 | fa cil = Faci lLocalServ iceUtil.ge tByOrgId( subOrg.get Organizati onId() ); | |
| 451 | li nked.put( subOrg.get Organizati onId(), fa cil.getFac ilityNumbe r() + Stri ngPool.COM MA_AND_SPA CE + subOr g.getName( ) ); | |
| 452 | } | |
| 453 | } else { | |
| 454 | // linked.put ( facil.ge tGroupId() , facil.ge tFacilityN umber() + StringPool .COMMA_AND _SPACE + o rg.getName () + Strin gPool.COMM A_AND_SPAC E + facil. getLocatio n() ); | |
| 455 | linked.put ( facil.ge tGroupId() , facil.ge tFacilityN umber() + StringPool .COMMA_AND _SPACE + o rg.getName () ); | |
| 456 | } | |
| 457 | } | |
| 458 | } ca tch (Porta lException e) { | |
| 459 | Applic ationWorkF lowExcepti on.handleE xception(e ); | |
| 460 | } ca tch (Syste mException e) { | |
| 461 | Applic ationWorkF lowExcepti on.handleE xception(e ); | |
| 462 | } | |
| 463 | pses sion.setAt tribute(Ca retStrPool .VHA_MEMBE R, linked) ; | |
| 464 | retu rn linked; | |
| 465 | } | |
| 466 | ||
| 467 | pu blic stati c Map<Stri ng,Long> g etVisnMap( ){ | |
| 468 | retu rn _visnMa p; | |
| 469 | } | |
| 470 | ||
| 471 | pu blic stati c List<Cou ntry> getC ountryMap( ) throws S ystemExcep tion{ | |
| 472 | if ( CaretUtil ._countryL ist == nul l || Caret Util._coun tryList.is Empty() ) { | |
| 473 | CaretU til._count ryList = n ew ArrayLi st<Country >(); | |
| 474 | for ( Country co untry: com .liferay.p ortal.serv ice.Countr yServiceUt il.getCoun tries(true ) ) { | |
| 475 | if ( "AS M".equals( country.ge tA3() ) || "GUM".equ als(countr y.getA3() ) || "MNP" .equals(co untry.getA 3() ) || " PRI".equal s(country. getA3() ) || | |
| 476 | "V IR".equals (country.g etA3() ) | | "UMI".eq uals(count ry.getA3() ) || "USA ".equals(c ountry.get A3() ) ) { | |
| 477 | country.se tNumber("u s"); | |
| 478 | } else { | |
| 479 | country.se tNumber("n ot-us"); | |
| 480 | } | |
| 481 | CaretUti l._country List.add( country ); | |
| 482 | } | |
| 483 | } | |
| 484 | ||
| 485 | retu rn _countr yList; | |
| 486 | } | |
| 487 | ||
| 488 | pu blic stati c String g etUserFull Name(long userId) { | |
| 489 | try { | |
| 490 | User u ser = User LocalServi ceUtil.get User( user Id ); | |
| 491 | return user.getL astName() + StringPo ol.COMMA_A ND_SPACE + user.getF irstName() ; | |
| 492 | } ca tch (Porta lException e) { | |
| 493 | Applic ationWorkF lowExcepti on.handleE xception(e ); | |
| 494 | } ca tch (Syste mException e) { | |
| 495 | Applic ationWorkF lowExcepti on.handleE xception(e ); | |
| 496 | } | |
| 497 | retu rn StringP ool.BLANK; | |
| 498 | } | |
| 499 | ||
| 500 | pu blic stati c String g etPersnFul lName(long persnId) { | |
| 501 | try { | |
| 502 | Persn persn = Pe rsnLocalSe rviceUtil. getPersn( persnId ); | |
| 503 | if ( C aretStrPoo l.UNKNOWN_ IDENTITY.e quals( per sn.getStat us() ) ){ | |
| 504 | return C aretStrPoo l.UNKNOWN_ IDENTITY; | |
| 505 | } else { | |
| 506 | return p ersn.getLa stName() + StringPoo l.COMMA_AN D_SPACE + persn.getF irstName() ; | |
| 507 | } | |
| 508 | } ca tch (Porta lException e) { | |
| 509 | Applic ationWorkF lowExcepti on.handleE xception(e ); | |
| 510 | } ca tch (Syste mException e) { | |
| 511 | Applic ationWorkF lowExcepti on.handleE xception(e ); | |
| 512 | } | |
| 513 | retu rn StringP ool.BLANK; | |
| 514 | } | |
| 515 | ||
| 516 | pu blic stati c String g etClinicSi te() { | |
| 517 | retu rn PropsUt il.get( "c aret.clini c.site" ); | |
| 518 | } | |
| 519 | ||
| 520 | pu blic stati c String g etOnlineSi te() { | |
| 521 | retu rn PropsUt il.get( "c aret.onlin e.site" ); | |
| 522 | } | |
| 523 | ||
| 524 | pu blic stati c void ini tYesNoBoxG p ( String subgroup, String ye sNoGroup, List<BoxGp > list, in t sequence ) throws Applicatio nWorkFlowE xception{ | |
| 525 | BoxG p yesAnswe r = new Bo xGpImpl(); | |
| 526 | yesA nswer.setB oxGroup(ye sNoGroup); | |
| 527 | yesA nswer.setB oxSubGroup (subgroup) ; | |
| 528 | yesA nswer.setL abel(Caret StrPool.YE S); | |
| 529 | yesA nswer.setV iewSequenc e(sequence ); | |
| 530 | ||
| 531 | BoxG p noAnswer = new Box GpImpl(); | |
| 532 | noAn swer.setBo xGroup(yes NoGroup); | |
| 533 | noAn swer.setBo xSubGroup( subgroup); | |
| 534 | noAn swer.setLa bel(CaretS trPool.NO) ; | |
| 535 | noAn swer.setVi ewSequence (sequence+ 1); | |
| 536 | try { | |
| 537 | list.a dd( BoxGpL ocalServic eUtil.addB oxGp(yesAn swer) ); | |
| 538 | list.a dd( BoxGpL ocalServic eUtil.addB oxGp(noAns wer) ); | |
| 539 | } ca tch (Syste mException e) { | |
| 540 | throw new Applic ationWorkF lowExcepti on(e); | |
| 541 | } | |
| 542 | } | |
| 543 | ||
| 544 | pu blic stati c Vendor v endorUpdat e ( Portle tRequest r equest, Ve ndor vendo r ){ //Wor kItemSuppo rt work | |
| 545 | try{ | |
| 546 | Servic eContext s c = CaretP aram.setCa retService Context(re quest); | |
| 547 | String data = re quest.getP arameter(" data"); | |
| 548 | Map<St ring,Strin g> map = T oolbox.get UrlQuery(d ata); | |
| 549 | vendor .setLastNa me(map.get ("_lastNam e")); | |
| 550 | vendor .setFirstN ame(map.ge t("_firstN ame")); | |
| 551 | vendor .setAddres s(map.get( "_address" )); | |
| 552 | vendor .setCity(m ap.get("_u _city")); | |
| 553 | vendor .setZip(ma p.get("_u_ zip")); | |
| 554 | vendor .setState( map.get("_ u_state")) ; | |
| 555 | vendor .setTaxId( map.get("_ TAXID")); | |
| 556 | vendor .setUserId (sc.getUse rId()); | |
| 557 | WorkTy pe workTyp e = vendor .getWorkTy pe(); | |
| 558 | CaretL ocalServic eUtil.save (vendor); | |
| 559 | if ( w orkType != null ){ | |
| 560 | WorIm wo rIm = ((Wo rkItemSupp ort)reques t.getAttri bute("work Item")); | |
| 561 | WorIm wi s = create WorkItem( sc, 0, ven dor, workT ype, worIm .getPersnI d(), worIm .getCaregi verId() ) ; | |
| 562 | wis.setV cgId(worIm .getVcgId( )); | |
| 563 | if ( wor Im.getUser Id() == sc .getUserId () && CAct ion.canDoC aret(reque st, CaretC an.CBOPC_V ENDOR_Q) ) { | |
| 564 | wis.setUse rId( sc.ge tUserId() ); | |
| 565 | } | |
| 566 | wis.setC lassId( Po rtalUtil.g etClassNam eId( VcgAn .class ) ) ; | |
| 567 | wis.setC lassPk( wo rIm.getCla ssPk() ); | |
| 568 | if ( Wor kType.VEND OR_CREATE == workTyp e ) { | |
| 569 | wis.setCom pletionBy( sc.getUse rId() ); | |
| 570 | wis.setCom pletionDat e( sc.getC reateDate( ) ); | |
| 571 | wis.setQue ueId( 1100 ); | |
| 572 | wis.setSta tus( QueAc tion.REVIE W_VENDOR_C OMPLETE.na me() ); | |
| 573 | } else { | |
| 574 | wis.setQue ueId(workT ype.workNa me.getQueu eId()); | |
| 575 | } | |
| 576 | CaretLoc alServiceU til.save( wis ); | |
| 577 | } | |
| 578 | return vendor; | |
| 579 | } ca tch (Porta lException e) { | |
| 580 | Applic ationWorkF lowExcepti on.handleE xception(e ); | |
| 581 | } ca tch (Unsup portedEnco dingExcept ion e) { | |
| 582 | Applic ationWorkF lowExcepti on.handleE xception(e ); | |
| 583 | } | |
| 584 | retu rn null; | |
| 585 | } | |
| 586 | ||
| 587 | st atic List< BoxGp> ini tBoxGroup( String na me, String subName ) throws Ap plicationW orkFlowExc eption { | |
| 588 | Stri ng boxGrou pValues = PortletPro ps.get(sub Name); | |
| 589 | List <BoxGp> gr oups = Box GpLocalSer viceUtil.g etBoxGroup s(name, su bName); | |
| 590 | Stri ng[] label s = boxGr oupValues. split( Str ingPool.SE MICOLON ); | |
| 591 | grou ps = new A rrayList<B oxGp>(); | |
| 592 | int i = 0; | |
| 593 | for ( String l abel: labe ls ){ | |
| 594 | BoxGp grp = new BoxGpImpl( ); | |
| 595 | grp.se tBoxGroup( name); | |
| 596 | grp.se tBoxSubGro up(subName ); | |
| 597 | grp.se tLabel(lab el); | |
| 598 | grp.se tViewSeque nce(i++); | |
| 599 | try { | |
| 600 | groups.a dd( BoxGpL ocalServic eUtil.addB oxGp(grp) ); | |
| 601 | } catc h (SystemE xception e ) { | |
| 602 | throw ne w Applicat ionWorkFlo wException (e); | |
| 603 | } | |
| 604 | } | |
| 605 | retu rn groups; | |
| 606 | } | |
| 607 | ||
| 608 | pu blic stati c List<Box Gp> loadBo xGroup ( S tring name , String s ubName ) t hrows Appl icationWor kFlowExcep tion { | |
| 609 | ||
| 610 | List<B oxGp> grou ps = BoxGp LocalServi ceUtil.get BoxGroups( name, subN ame); | |
| 611 | if ( g roups.isEm pty() ){ | |
| 612 | groups = initBoxGr oup(name, subName); | |
| 613 | } | |
| 614 | return groups; | |
| 615 | // Result Map.getFor m(request) .put( subN ame, group s ); | |
| 616 | } | |
| 617 | ||
| 618 | pu blic stati c boolean setExpando Value( Bas eModel<?> baseModel, String at tributeNam e, String value ) th rows Syste mException { | |
| 619 | try { | |
| 620 | if ( V alidator.i sNotNull( attributeN ame ) ){ | |
| 621 | if ( bas eModel.get ExpandoBri dge().hasA ttribute( attributeN ame ) ) { | |
| 622 | // baseModel. getExpando Bridge().s etAttribut e( attribu teName, va lue, false ); | |
| 623 | setUserCus tomFieldVa lue( (User )baseModel , attribut eName, val ue ); | |
| 624 | } else { | |
| 625 | throw new Applicatio nWorkFlowE xception(C aretStrPoo l.METADATA + " not i nitialized " ); | |
| 626 | } | |
| 627 | } | |
| 628 | return true; | |
| 629 | }cat ch (Portal Exception e) { | |
| 630 | Applic ationWorkF lowExcepti on.handleE xception(e ); | |
| 631 | } | |
| 632 | retu rn false; | |
| 633 | } | |
| 634 | ||
| 635 | pu blic stati c String g etExpandoV alue( Expa ndoBridge expandoBri dge, String att ributeName ) { | |
| 636 | retu rn CaretUt il.getExpa ndoValue(e xpandoBrid ge, attrib uteName, f alse); | |
| 637 | } | |
| 638 | ||
| 639 | pu blic stati c String g etExpandoV alue( Expa ndoBridge expandoBri dge, | |
| 640 | String attribute Name, | |
| 641 | Boolea n isSecure ) { | |
| 642 | if ( Validator .isNotNull ( attribut eName ) && expandoBr idge.hasAt tribute( a ttributeNa me ) ) { | |
| 643 | return (String) expandoBri dge.getAtt ribute( at tributeNam e, isSecur e ); | |
| 644 | } | |
| 645 | retu rn StringP ool.BLANK; | |
| 646 | } | |
| 647 | ||
| 648 | pr ivate stat ic void se tUserCusto mFieldValu e ( User u ser, Strin g field, S tring valu e ) throws PortalExc eption, Sy stemExcept ion{ | |
| 649 | Expa ndoTable t able = Exp andoTableL ocalServic eUtil.getD efaultTabl e( user.ge tCompanyId (), User.c lass.getNa me() ); | |
| 650 | Expa ndoColumn column = E xpandoColu mnLocalSer viceUtil.g etColumn( table.getT ableId(), field ); | |
| 651 | Expa ndoValue e xpandoValu e = Expand oValueLoca lServiceUt il.getValu e(table.ge tTableId() , column.g etColumnId (), user.g etPrimaryK ey()); | |
| 652 | if ( expandoVa lue == nul l ) { | |
| 653 | Expand oValueLoca lServiceUt il.addValu e(user.get CompanyId( ), table.g etTableId( ), column. getColumnI d(), user. getPrimary Key(), val ue); | |
| 654 | } el se { | |
| 655 | expand oValue.set Data(value ); | |
| 656 | Expand oValueLoca lServiceUt il.updateE xpandoValu e(expandoV alue); | |
| 657 | } | |
| 658 | } | |
| 659 | ||
| 660 | st atic List< String> re lationship Family = | |
| 661 | Li stUtil.toL ist( Portl etProps.ge t(CaretStr Pool.RELAT IONSHIP_FA MILY).spli t(StringPo ol.COMMA)) ; | |
| 662 | pu blic stati c boolean isFamily(S tring indi vidual) { | |
| 663 | retu rn relatio nshipFamil y.contains (individua l); | |
| 664 | } | |
| 665 | ||
| 666 | pu blic stati c boolean isMockFmsI nitEnabled () { | |
| 667 | retu rn StringP ool.TRUE.e quals( Pro psUtil.get ( "mock.fm s.init.ena bled" ) ); | |
| 668 | } | |
| 669 | ||
| 670 | pu blic stati c boolean isMockFmsE nabled() { | |
| 671 | retu rn StringP ool.TRUE.e quals( Pro psUtil.get ( "mock.fm s.enabled" ) ); | |
| 672 | } | |
| 673 | ||
| 674 | pu blic stati c boolean isVistaGro upValidate () { | |
| 675 | retu rn StringP ool.TRUE.e quals( Pro psUtil.get ( "vista.v alidate.en abled" ) ) ; | |
| 676 | } | |
| 677 | ||
| 678 | pu blic stati c String e xtDays(Str ing dispos itionReaso n, int[] e xtensionDa ys) { | |
| 679 | int ndx = disp ositionRea son.indexO f("["); | |
| 680 | Stri ng temp = dispositio nReason; | |
| 681 | //TO DO: do add itional va lidation | |
| 682 | if ( ndx > 0 ) { | |
| 683 | temp = dispositi onReason.s ubstring(0 ,ndx); | |
| 684 | String number = dispositio nReason.su bstring(nd x+1, dispo sitionReas on.indexOf ("]")); | |
| 685 | if ( V alidator.i sNumber( n umber ) ) { | |
| 686 | extensio nDays[0] = Integer.v alueOf( nu mber ); | |
| 687 | } else { | |
| 688 | extensio nDays[0] = 0; | |
| 689 | } | |
| 690 | } | |
| 691 | retu rn temp; | |
| 692 | } | |
| 693 | ||
| 694 | pu blic stati c String e xtDays2(St ring dispo sitionReas on, int[] extensionD ays) { | |
| 695 | int ndx = disp ositionRea son.indexO f("["); | |
| 696 | if ( ndx > 0 ) { | |
| 697 | try { | |
| 698 | extensio nDays[0] = Integer.v alueOf( di spositionR eason.subs tring(ndx+ 1, disposi tionReason .indexOf(" ]")) ); | |
| 699 | } catc h( java.la ng.NumberF ormatExcep tion nfe ) { | |
| 700 | extensio nDays[0] = 0; | |
| 701 | } | |
| 702 | return dispositi onReason.s ubstring(n dx+1, disp ositionRea son.indexO f("]")); | |
| 703 | } | |
| 704 | retu rn "0"; | |
| 705 | } | |
| 706 | ||
| 707 | pu blic stati c String p arseDispos itionReaso n(String d isposition Reason) { | |
| 708 | int ndx = disp ositionRea son.indexO f("["); | |
| 709 | Stri ng temp = dispositio nReason; | |
| 710 | //TO DO: do add itional va lidation | |
| 711 | if ( ndx > 0 ) { | |
| 712 | temp = dispositi onReason.s ubstring(0 ,ndx); | |
| 713 | } | |
| 714 | retu rn temp; | |
| 715 | } | |
| 716 | ||
| 717 | pu blic boole an isLastT hursdayOfM onth () { | |
| 718 | Cale ndar cal = Calendar. getInstanc e(); | |
| 719 | if ( cal.get( Calendar.D AY_OF_WEEK ) == Cale ndar.THURS DAY ) { | |
| 720 | int mo nth = cal. get( Calen dar.MONTH ); | |
| 721 | cal.ad d( Calenda r.DAY_OF_M ONTH, 7 ); | |
| 722 | return cal.get( Calendar.M ONTH ) != month; | |
| 723 | } | |
| 724 | retu rn false; | |
| 725 | } | |
| 726 | ||
| 727 | pu blic stati c Date isV alidReciev edDate(Vcg Support vc g, VcgAn v cgAn, Pers on vcgAnPr imary, Per son previo usVcgPrima ry, String Builder wa rnSb ) { | |
| 728 | ||
| 729 | Cale ndar earli estCal = C alendar.ge tInstance( ); | |
| 730 | earl iestCal.se tTime( vcg An.getRece ivedDate() ); | |
| 731 | earl iestCal.ad d(Calendar .DATE, -1) ; | |
| 732 | ||
| 733 | if ( vcg.getPr imaryRevoc ationDate( ) != null && earlies tCal.getTi me().befor e( vcg.get PrimaryRev ocationDat e() ) && p reviousVcg Primary != null ) { | |
| 734 | Calend ar allowed Cal = Cale ndar.getIn stance(); | |
| 735 | allowe dCal.setTi me( vcg.ge tPrimaryRe vocationDa te() ); | |
| 736 | allowe dCal.add(C alendar.DA TE, 1); | |
| 737 | if ( v cgAnPrimar y != null && vcgAnPr imary.getS sn() != nu ll && | |
| 738 | vcgAnPrima ry.getSsn( ).equals( previousVc gPrimary.g etSsn() ) && | |
| 739 | ( vcgAnPri mary.getLa stName() ! = null && vcgAnPrima ry.getLast Name().equ als(previo usVcgPrima ry.getLast Name() ) | |
| 740 | || vcgAnPrim ary.getFir stName() ! = null && vcgAnPrima ry.getFirs tName().eq uals(previ ousVcgPrim ary.getFir stName() ) ) ) { | |
| 741 | int[] ex tensionDay s = new in t[1]; | |
| 742 | CaretUti l.extDays( vcg.getPri maryDispRe ason(), ex tensionDay s); | |
| 743 | allowedC al.add(Cal endar.DATE , extensio nDays[0]); | |
| 744 | if ( vcg An.getRece ivedDate() .before( a llowedCal. getTime() ) ){ | |
| 745 | if ( warnS b != null ) { | |
| 746 | wa rnSb.appen d("<li sty le='font-w eight: bol d' >This P rimay care giver was previously revoked w ith effect ive date " ).append(T oolbox.for matDate(vc g.getPrima ryRevocati onDate())) .append(". With ").a ppend(exte nsionDays[ 0]).append (" entitle ment days for the ca regiver, S ubmit will REPLACE t he current Applicati on-Receive d-Date wit h ").appen d( Toolbox .formatDat e( allowed Cal.getTim e() ) ).ap pend("</li >"); | |
| 747 | } else { | |
| 748 | _l og.warn("T his Primay caregiver was previ ously revo ked, Submi t will REP LACE the c urrent App lication-R eceived-Da te with " + Toolbox. formatDate ( allowedC al.getTime () ) ); | |
| 749 | } | |
| 750 | } | |
| 751 | } else { | |
| 752 | if ( war nSb != nul l ) { | |
| 753 | warnSb.app end("<li s tyle='font -weight: b old' >The VCG had a revoked Pr imay careg iver effec tive ").ap pend(Toolb ox.formatD ate(vcg.ge tPrimaryRe vocationDa te())).app end(", Sub mit will R EPLACE the current A pplication -Received- Date with ").append( Toolbox.f ormatDate( allowedCa l.getTime( ) ) ).appe nd("</li>" ); | |
| 754 | } else { | |
| 755 | _log.warn( "The VCG h ad a revok ed Primay CG, Submit will REPL ACE the cu rrent Appl ication-Re ceived-Dat e with " + Toolbox.f ormatDate( allowedCa l.getTime( ) ) ); | |
| 756 | } | |
| 757 | } | |
| 758 | return allowedCa l.getTime( ); | |
| 759 | } | |
| 760 | retu rn vcgAn.g etReceived Date(); | |
| 761 | } | |
| 762 | ||
| 763 | pu blic stati c String g etTraining Document(R ole role) { | |
| 764 | retu rn gov.va. caret.util .CaretUtil .getExpand oValue(rol e.getExpan doBridge() , CaretStr Pool.ROLE_ TRAINING_D OCUMENT ); | |
| 765 | } | |
| 766 | ||
| 767 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.