Produced by Araxis Merge on 7/10/2017 1:01:42 PM Central 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 | C:\AraxisMergeCompare\Pri_un\IV-ehmp_cif\BaseWebFacade\main\src\java\gov\va\med\imaging\exchange\business\taglib | AbstractBusinessObjectPropertyTag.java | Thu Jun 29 17:22:11 2017 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\IV-ehmp_cif\BaseWebFacade\main\src\java\gov\va\med\imaging\exchange\business\taglib | AbstractBusinessObjectPropertyTag.java | Fri Jul 7 16:35:14 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 478 |
| Changed | 2 | 4 |
| 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 | * Package : MAG - Vi stA Imagin g | |
| 3 | * WARNING : Per VHA Directive 2004-038, this routi ne should not be mod ified. | |
| 4 | * Date Cr eated: Jan 30, 2008 | |
| 5 | * Site Na me: Washi ngton OI F ield Offic e, Silver Spring, MD | |
| 6 | * @author R E DA C T E D | |
| 7 | * @versio n 1.0 | |
| 8 | * | |
| 9 | * ------- ---------- ---------- ---------- ---------- ---------- ------- | |
| 10 | * Propert y of the U S Governme nt. | |
| 11 | * No perm ission to copy or re distribute this soft ware is gi ven. | |
| 12 | * Use of unreleased versions of this so ftware req uires the user | |
| 13 | * to exec ute a writ ten test a greement w ith the Vi stA Imagin g | |
| 14 | * Develop ment Offic e of the D epartment of Veteran s Affairs, | |
| 15 | * telepho ne (301) 7 34-0100. | |
| 16 | * | |
| 17 | * The Foo d and Drug Administr ation clas sifies thi s software as | |
| 18 | * a Class II medica l device. As such, it may not be change d | |
| 19 | * in any way. Modi fications to this so ftware may result in an | |
| 20 | * adulter ated medic al device under 21CF R820, the use of whi ch | |
| 21 | * is cons idered to be a viola tion of US Federal S tatutes. | |
| 22 | * ------- ---------- ---------- ---------- ---------- ---------- ------- | |
| 23 | */ | |
| 24 | package go v.va.med.i maging.exc hange.busi ness.tagli b; | |
| 25 | ||
| 26 | import jav a.io.IOExc eption; | |
| 27 | import jav a.io.Write r; | |
| 28 | import jav a.lang.ref lect.Metho d; | |
| 29 | import jav a.text.Dat eFormat; | |
| 30 | ||
| 31 | import jav ax.servlet .jsp.JspEx ception; | |
| 32 | import jav ax.servlet .jsp.tagex t.Tag; | |
| 33 | import jav ax.servlet .jsp.tagex t.TagSuppo rt; | |
| 34 | ||
| 35 | /** | |
| 36 | * The par ent class of tags th at display business object pro perties. | |
| 37 | * Derivat ions of th is class M UST reside within an AbstractB usinessObj ectTag | |
| 38 | * element . | |
| 39 | * T is th e type of the busine ss object (Image, St udy, Docum ent, etc . ..) | |
| 40 | * P is th e type of the parent (surround ing) tag t hat this t ag gets it s context | |
| 41 | * busines s object f rom. | |
| 42 | * e.g. | |
| 43 | * <series :SeriesIma geCollecti on> | |
| 44 | * <image: ImageColle ctionEleme nt> - a deriva tion of Ab stractBusi nessObject Tag | |
| 45 | * <image: ImageDescr iption /> - a deriva tion of Ab stractBusi nessObject PropertyTa g | |
| 46 | * | |
| 47 | * @author R E DA C T E D | |
| 48 | * | |
| 49 | */ | |
| 50 | public abs tract clas s Abstract BusinessOb jectProper tyTag<T, P extends A bstractBus inessObjec tTag<T>> | |
| 51 | extends Ab stractAppl icationCon textTagSup port | |
| 52 | { | |
| 53 | pr ivate stat ic final l ong serial VersionUID = 1L; | |
| 54 | ||
| 55 | @S uppressWar nings("unc hecked") | |
| 56 | pu blic stati c <T exten ds Tag> T findAncest orWithClaz z(Tag tag, Class<T> clazz) | |
| 57 | { | |
| 58 | retu rn (T) Tag Support.fi ndAncestor WithClass( tag, clazz ); | |
| 59 | } | |
| 60 | ||
| 61 | pr ivate fina l Class<T> businessO bjectType; | |
| 62 | pr ivate fina l Method[] fieldGett ers; | |
| 63 | ||
| 64 | pr otected Ab stractBusi nessObject PropertyTa g(Class<T> businessO bjectType) | |
| 65 | { | |
| 66 | this (businessO bjectType, (Method)n ull); | |
| 67 | } | |
| 68 | ||
| 69 | pr otected Ab stractBusi nessObject PropertyTa g(Class<T> businessO bjectType, String... fieldName s) | |
| 70 | th rows Secur ityExcepti on, NoSuch MethodExce ption | |
| 71 | { | |
| 72 | this .businessO bjectType = business ObjectType ; | |
| 73 | if(f ieldNames != null && fieldName s.length > 0) | |
| 74 | { | |
| 75 | fieldG etters = n ew Method[ fieldNames .length]; | |
| 76 | int fi eldNameInd ex = 0; | |
| 77 | for(St ring field Name : fie ldNames) | |
| 78 | if(field Name != nu ll && fiel dName.leng th() > 0) | |
| 79 | { | |
| 80 | String get terMethodN ame = | |
| 81 | "g et" + Char acter.toUp perCase(fi eldName.ch arAt(0)) + | |
| 82 | (f ieldName.l ength() > 1 ? fieldN ame.substr ing(1) : " "); | |
| 83 | this.field Getters[fi eldNameInd ex++] = bu sinessObje ctType.get DeclaredMe thod(gette rMethodNam e, new Cla ss<?>[]{}) ; | |
| 84 | } | |
| 85 | else | |
| 86 | this.field Getters[fi eldNameInd ex++] = nu ll; | |
| 87 | } | |
| 88 | else | |
| 89 | fieldG etters = n ull; | |
| 90 | } | |
| 91 | ||
| 92 | pr otected Ab stractBusi nessObject PropertyTa g(Class<T> businessO bjectType, Method fi eldGetter) | |
| 93 | { | |
| 94 | this .businessO bjectType = business ObjectType ; | |
| 95 | this .fieldGett ers = new Method[1]; | |
| 96 | this .fieldGett ers[0] = f ieldGetter ; | |
| 97 | } | |
| 98 | ||
| 99 | @S uppressWar nings("unc hecked") | |
| 100 | pr ivate Clas s<T> getBu sinessObje ctType() | |
| 101 | { | |
| 102 | if(b usinessObj ectType != null) | |
| 103 | return businessO bjectType; | |
| 104 | else | |
| 105 | { | |
| 106 | String typeMsg = "<Error G etting Bus iness Obje ct>"; | |
| 107 | try | |
| 108 | { | |
| 109 | T busine ssObject = getBusine ssObject() ; | |
| 110 | typeMsg = business Object == null ? "<n ull busine ss object> " : busine ssObject.g etClass(). getName(); | |
| 111 | return ( Class<T>)( businessO bject == n ull ? null : busines sObject.ge tClass() ) ; | |
| 112 | } | |
| 113 | catch (ClassCast Exception ccX) | |
| 114 | { | |
| 115 | getLogge r().error( | |
| 116 | "PANIC: bu siness obj ect to be displayed is not wha t is expec ted. " + | |
| 117 | "Expected type is Cl ass<T>, ty pe is actu ally '" + typeMsg + "'." + | |
| 118 | "Following NullPoint erExceptio ns may be tracable t o this err or.", | |
| 119 | ccX); | |
| 120 | return n ull; | |
| 121 | } | |
| 122 | catch (Throwable t) | |
| 123 | { | |
| 124 | getLogge r().error( | |
| 125 | "Error get ting busin ess object to be dis played. " + | |
| 126 | "Expected type is Cl ass<T>, ty pe is actu ally '" + typeMsg + "'." + | |
| 127 | "A followi ng NullPoi nterExcept ion may be tracable to this er ror.", | |
| 128 | t); | |
| 129 | return n ull; | |
| 130 | } | |
| 131 | } | |
| 132 | } | |
| 133 | ||
| 134 | pu blic Metho d getField Getter() | |
| 135 | { | |
| 136 | retu rn this.fi eldGetters [0]; | |
| 137 | } | |
| 138 | ||
| 139 | pu blic Metho d[] getFie ldGetters( ) | |
| 140 | { | |
| 141 | retu rn this.fi eldGetters ; | |
| 142 | } | |
| 143 | ||
| 144 | pu blic Metho d getField Getters(in t index) | |
| 145 | { | |
| 146 | retu rn this.fi eldGetters [index]; | |
| 147 | } | |
| 148 | ||
| 149 | pr otected T getBusines sObject() | |
| 150 | th rows JspEx ception | |
| 151 | { | |
| 152 | retu rn (T)( ge tParentTag ().getBusi nessObject () ); | |
| 153 | } | |
| 154 | ||
| 155 | @S uppressWar nings("unc hecked") | |
| 156 | pr ivate P ge tParentTag () | |
| 157 | th rows JspEx ception | |
| 158 | { | |
| 159 | try | |
| 160 | { | |
| 161 | Abstra ctBusiness ObjectTag< T> parentT ag = null; | |
| 162 | for( | |
| 163 | parentTa g = (Abstr actBusines sObjectTag )TagSuppor t.findAnce storWithCl ass(this, AbstractBu sinessObje ctTag.clas s); | |
| 164 | parentTa g != null && ! busin essObjectT ype.equals (parentTag .getBusine ssObjectTy pe()); | |
| 165 | parentTa g = (Abstr actBusines sObjectTag )TagSuppor t.findAnce storWithCl ass(parent Tag, Abstr actBusines sObjectTag .class) ); | |
| 166 | ||
| 167 | return (P)parent Tag; | |
| 168 | } | |
| 169 | catc h (ClassCa stExceptio n e) | |
| 170 | { | |
| 171 | throw new JspExc eption("Pa rent tag o f this '" + this.get Class().ge tName() + "' must pr esent busi ness objec t of type '" + getBu sinessObje ctType().g etName() + "'."); | |
| 172 | } | |
| 173 | } | |
| 174 | ||
| 175 | pr otected Da teFormat g etDateForm at() | |
| 176 | { | |
| 177 | retu rn DateFor mat.getDat eInstance( ); | |
| 178 | } | |
| 179 | ||
| 180 | pr otected Wr iter getWr iter() | |
| 181 | th rows IOExc eption | |
| 182 | { | |
| 183 | retu rn pageCon text.getOu t(); | |
| 184 | } | |
| 185 | ||
| 186 | /* * | |
| 187 | * Derived c lasses may return th e value of their ele ment by ov erriding | |
| 188 | * this meth od. | |
| 189 | * By defaul t, this me thod will make a str ing repres entation o f the fiel d to be | |
| 190 | * displayed using the toString( ) method o f the fiel d getter. | |
| 191 | * | |
| 192 | * @return | |
| 193 | * @throws J spExceptio n | |
| 194 | * / | |
| 195 | pr otected St ring getEl ementValue () | |
| 196 | th rows JspEx ception | |
| 197 | { | |
| 198 | if(g etFieldGet ter() == n ull) | |
| 199 | throw new JspExc eption("Th is instanc e of '" + this.getCl ass().getS impleName( ) + | |
| 200 | "' must specify ei ther a fie ld name, g etter meth od or over ride getEl ementValue () and it does not." ); | |
| 201 | else | |
| 202 | { | |
| 203 | Object fieldValu e; | |
| 204 | try | |
| 205 | { | |
| 206 | for(Meth od fieldGe tter : thi s.getField Getters()) | |
| 207 | { | |
| 208 | fieldValue = fieldGe tter.invok e( getBusi nessObject (), new Ob ject[]{} ) ; | |
| 209 | if(fieldVa lue != nul l && field Value.toSt ring().len gth() > 0) | |
| 210 | re turn field Value.toSt ring(); | |
| 211 | } | |
| 212 | return " "; | |
| 213 | } | |
| 214 | catch (Exception x) | |
| 215 | { | |
| 216 | throw ne w JspExcep tion(x); | |
| 217 | } | |
| 218 | } | |
| 219 | } | |
| 220 | ||
| 221 | /* * | |
| 222 | * @se e javax.se rvlet.jsp. tagext.Tag Support#do EndTag() | |
| 223 | */ | |
| 224 | @Overr ide | |
| 225 | public int doEnd Tag() | |
| 226 | throws JspExcept ion | |
| 227 | { | |
| 228 | tr y | |
| 229 | { | |
| 230 | getW riter().wr ite(getEle mentValue( )); | |
| 231 | } | |
| 232 | ca tch (IOExc eption e) | |
| 233 | { | |
| 234 | thro w new JspE xception(e ); | |
| 235 | } | |
| 236 | ||
| 237 | re turn Tag.E VAL_PAGE; | |
| 238 | } | |
| 239 | ||
| 240 | ||
| 241 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.