Produced by Araxis Merge on 4/5/2017 4:22:07 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:\working_scrub\Unredacted\eHX Code Base\eHX_Bld2_Source Code_CIF_2017-02-14\NHIN_adapter\SpecProcessor\src\main\java\gov\va\ccd\service\util | Utils.java | Fri Feb 10 15:41:44 2017 UTC |
| 2 | eHX-CIF.zip\eHX-CIF\eHX Code Base\eHX_Bld2_Source Code_CIF_2017-02-14\NHIN_adapter\SpecProcessor\src\main\java\gov\va\ccd\service\util | Utils.java | Mon Apr 3 14:39:13 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 2322 |
| 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.ccd.s ervice.uti l; | |
| 2 | ||
| 3 | import gov .va.ccd.co mponents.t ransform.T ransformer ; | |
| 4 | import gov .va.ccd.se rvice.valu e.object.U nitValue; | |
| 5 | import gov .va.ccd.se rvice.valu e.objects. impl.ItemO bject; | |
| 6 | ||
| 7 | import jav a.io.IOExc eption; | |
| 8 | import jav a.math.Big Decimal; | |
| 9 | import jav a.util.Arr ayList; | |
| 10 | import jav a.util.Col lections; | |
| 11 | import jav a.util.Has hMap; | |
| 12 | import jav a.util.Lis t; | |
| 13 | import jav a.util.Loc ale; | |
| 14 | import jav a.util.Map ; | |
| 15 | import jav a.util.Sta ck; | |
| 16 | ||
| 17 | import org .apache.co mmons.coll ections.Co llectionUt ils; | |
| 18 | import org .apache.co mmons.lang 3.StringEs capeUtils; | |
| 19 | import org .apache.co mmons.lang 3.StringUt ils; | |
| 20 | import org .eclipse.e mf.common. util.EList ; | |
| 21 | import org .eclipse.e mf.ecore.E Reference; | |
| 22 | import org .eclipse.e mf.ecore.r esource.Re source; | |
| 23 | import org .eclipse.e mf.ecore.r esource.UR IConverter ; | |
| 24 | import org .eclipse.e mf.ecore.u til.Featur eMap; | |
| 25 | import org .eclipse.e mf.ecore.u til.Featur eMap.Entry ; | |
| 26 | import org .eclipse.e mf.ecore.x mi.XMLReso urce; | |
| 27 | import org .eclipse.e mf.ecore.x mi.impl.Ge nericXMLRe sourceFact oryImpl; | |
| 28 | import org .eclipse.e mf.ecore.x ml.type.An yType; | |
| 29 | import org .eclipse.e mf.ecore.x ml.type.XM LTypeDocum entRoot; | |
| 30 | import org .joda.time .DateTime; | |
| 31 | import org .joda.time .format.Da teTimeForm at; | |
| 32 | import org .joda.time .format.Da teTimeForm atter; | |
| 33 | import org .openhealt htools.mdh t.uml.cda. Act; | |
| 34 | import org .openhealt htools.mdh t.uml.cda. AssignedAu thor; | |
| 35 | import org .openhealt htools.mdh t.uml.cda. AssignedEn tity; | |
| 36 | import org .openhealt htools.mdh t.uml.cda. Author; | |
| 37 | import org .openhealt htools.mdh t.uml.cda. CDAFactory ; | |
| 38 | import org .openhealt htools.mdh t.uml.cda. Entity; | |
| 39 | import org .openhealt htools.mdh t.uml.cda. EntryRelat ionship; | |
| 40 | import org .openhealt htools.mdh t.uml.cda. Informant1 2; | |
| 41 | import org .openhealt htools.mdh t.uml.cda. Observatio n; | |
| 42 | import org .openhealt htools.mdh t.uml.cda. Organizati on; | |
| 43 | import org .openhealt htools.mdh t.uml.cda. Organizer; | |
| 44 | import org .openhealt htools.mdh t.uml.cda. Participan t2; | |
| 45 | import org .openhealt htools.mdh t.uml.cda. Participan tRole; | |
| 46 | import org .openhealt htools.mdh t.uml.cda. Performer2 ; | |
| 47 | import org .openhealt htools.mdh t.uml.cda. PlayingEnt ity; | |
| 48 | import org .openhealt htools.mdh t.uml.cda. Procedure; | |
| 49 | import org .openhealt htools.mdh t.uml.cda. StrucDocTe xt; | |
| 50 | import org .openhealt htools.mdh t.uml.cda. SubstanceA dministrat ion; | |
| 51 | import org .openhealt htools.mdh t.uml.cda. ccd.Contin uityOfCare Document; | |
| 52 | import org .openhealt htools.mdh t.uml.hl7. datatypes. ANY; | |
| 53 | import org .openhealt htools.mdh t.uml.hl7. datatypes. CD; | |
| 54 | import org .openhealt htools.mdh t.uml.hl7. datatypes. ED; | |
| 55 | import org .openhealt htools.mdh t.uml.hl7. datatypes. II; | |
| 56 | import org .openhealt htools.mdh t.uml.hl7. datatypes. IVL_TS; | |
| 57 | import org .openhealt htools.mdh t.uml.hl7. datatypes. PQ; | |
| 58 | import org .openhealt htools.mdh t.uml.hl7. datatypes. TEL; | |
| 59 | import org .slf4j.Log ger; | |
| 60 | import org .slf4j.Log gerFactory ; | |
| 61 | ||
| 62 | public cla ss Utils | |
| 63 | { | |
| 64 | pr ivate stat ic final L ogger logg er = Logge rFactory.g etLogger(U tils.class ); | |
| 65 | ||
| 66 | /* * | |
| 67 | * prepare n arrative t ext value | |
| 68 | * | |
| 69 | * @param na rrativeBlo ck | |
| 70 | * @return | |
| 71 | * / | |
| 72 | pu blic stati c StrucDoc Text setVa lueToNarra tiveBlock( String nar rativeBloc k) throws IOExceptio n { | |
| 73 | Stru cDocText t ext = null ; | |
| 74 | URIC onverter.R eadableInp utStream i s = null; | |
| 75 | try | |
| 76 | { | |
| 77 | ||
| 78 | Resour ce.Factory factory = new Gener icXMLResou rceFactory Impl(); | |
| 79 | XMLRes ource reso urce = (XM LResource) factory.c reateResou rce(null); | |
| 80 | is = n ew URIConv erter.Read ableInputS tream(narr ativeBlock ); | |
| 81 | resour ce.load(is , null); | |
| 82 | XMLTyp eDocumentR oot root = (XMLTypeD ocumentRoo t) resourc e.getConte nts().get( 0); | |
| 83 | AnyTyp e value = (AnyType) root.getMi xed().getV alue(0); | |
| 84 | text = CDAFactor y.eINSTANC E.createSt rucDocText (); | |
| 85 | text.g etMixed(). addAll(val ue.getMixe d()); | |
| 86 | ||
| 87 | } | |
| 88 | catc h(Exceptio n e) | |
| 89 | { | |
| 90 | e.prin tStackTrac e(); | |
| 91 | } | |
| 92 | fina lly | |
| 93 | { | |
| 94 | if(is != null) | |
| 95 | { | |
| 96 | is.close (); | |
| 97 | } | |
| 98 | } | |
| 99 | ||
| 100 | retu rn text; | |
| 101 | ||
| 102 | } | |
| 103 | ||
| 104 | /* * | |
| 105 | * Special p arser for Vitals but may be ne eded elsew here. If a value has | |
| 106 | * more than one row, it will re turn a tab le instead of the Va lue Unit. | |
| 107 | * | |
| 108 | * @param va lues | |
| 109 | * @return | |
| 110 | * / | |
| 111 | pu blic stati c String v alueOrDefa ult(final List<UnitV alue> valu es) | |
| 112 | { | |
| 113 | if(C ollectionU tils.isNot Empty(valu es)) | |
| 114 | { | |
| 115 | if(val ues.size() > 1) | |
| 116 | { | |
| 117 | StringBu ilder ret = new Stri ngBuilder( ); | |
| 118 | // ret.a ppend("<ta ble>"); | |
| 119 | for(Unit Value uv : values) | |
| 120 | { | |
| 121 | // ret.app end("<tr>< td>"); | |
| 122 | if(ret.len gth() > 1) | |
| 123 | { | |
| 124 | re t.append(" //"); | |
| 125 | } | |
| 126 | ret.append (uv.getVal ue()); | |
| 127 | ||
| 128 | if(StringU tils.isNot Blank(uv.g etUnit())) | |
| 129 | { | |
| 130 | re t.append(" ").appen d(uv.getUn it()); | |
| 131 | } | |
| 132 | ||
| 133 | if(StringU tils.isNot Blank(uv.g etTime())) | |
| 134 | { | |
| 135 | Da teTime dt = EffTimeU tils.conve rtDate(uv. getTime()) ; | |
| 136 | St ring forma t = "h:mm a"; | |
| 137 | Da teTimeForm atter dtf = DateTime Format.for Pattern(fo rmat).with Locale(Loc ale.US); | |
| 138 | St ring time = dtf.prin t(dt); | |
| 139 | if (StringUti ls.isNotBl ank(time)) | |
| 140 | { | |
| 141 | ret. append(" (").append (time).app end(")"); | |
| 142 | } | |
| 143 | } | |
| 144 | ||
| 145 | // ret.app end("</td> </tr>"); | |
| 146 | } | |
| 147 | // ret.a ppend("</t able>"); | |
| 148 | if(ret.l ength() > 1) | |
| 149 | { | |
| 150 | return ret .toString( ); | |
| 151 | } | |
| 152 | } | |
| 153 | else | |
| 154 | { | |
| 155 | UnitValu e uv = val ues.get(0) ; | |
| 156 | return u v.getValue () + " " + uv.getUni t(); | |
| 157 | } | |
| 158 | } | |
| 159 | retu rn "--"; | |
| 160 | } | |
| 161 | ||
| 162 | pu blic stati c String v alueOrDefa ult(final String val ue) | |
| 163 | { | |
| 164 | if(S tringUtils .isNotBlan k(value)) | |
| 165 | { | |
| 166 | return value; | |
| 167 | } | |
| 168 | ||
| 169 | retu rn "--"; | |
| 170 | } | |
| 171 | ||
| 172 | pu blic stati c String g etNonNullV alue(Strin g dn, Stri ng rn, Str ing ot) | |
| 173 | { | |
| 174 | if(S tringUtils .isNotBlan k(dn)) | |
| 175 | { | |
| 176 | return dn; | |
| 177 | } | |
| 178 | else if(String Utils.isNo tBlank(rn) ) | |
| 179 | { | |
| 180 | return rn; | |
| 181 | } | |
| 182 | else if(String Utils.isNo tBlank(ot) ) | |
| 183 | { | |
| 184 | return ot; | |
| 185 | } | |
| 186 | retu rn "--"; | |
| 187 | } | |
| 188 | ||
| 189 | /* * | |
| 190 | * Return no n Null Val ue. | |
| 191 | * | |
| 192 | * @param dn | |
| 193 | * @param rn | |
| 194 | * @return | |
| 195 | * / | |
| 196 | pu blic stati c String g etNonNullV alue(Strin g dn, Stri ng rn) | |
| 197 | { | |
| 198 | if(S tringUtils .isNotBlan k(dn) && ! "null".equ alsIgnoreC ase(dn)) | |
| 199 | { | |
| 200 | return dn; | |
| 201 | } | |
| 202 | else | |
| 203 | { | |
| 204 | if(Str ingUtils.i sNotBlank( rn)) | |
| 205 | { | |
| 206 | return r n; | |
| 207 | } | |
| 208 | else | |
| 209 | { | |
| 210 | return " --"; | |
| 211 | } | |
| 212 | } | |
| 213 | } | |
| 214 | ||
| 215 | pu blic stati c boolean containsTe mplateId(L ist<II> te mplates, f inal Strin g id) | |
| 216 | { | |
| 217 | if(C ollectionU tils.isNot Empty(temp lates) && StringUtil s.isNotBla nk(id)) | |
| 218 | { | |
| 219 | for(II ii : temp lates) | |
| 220 | { | |
| 221 | if(id.eq ualsIgnore Case(ii.ge tRoot())) | |
| 222 | { | |
| 223 | return tru e; | |
| 224 | } | |
| 225 | } | |
| 226 | } | |
| 227 | retu rn false; | |
| 228 | } | |
| 229 | ||
| 230 | /* * | |
| 231 | * return th e value of the first available effective time. Fir st value, | |
| 232 | * Second lo w, Third H igh | |
| 233 | * | |
| 234 | * @param ti me | |
| 235 | * @return | |
| 236 | * / | |
| 237 | pu blic stati c String g etEffectiv eTime(fina l IVL_TS t ime) | |
| 238 | { | |
| 239 | if(t ime != nul l) | |
| 240 | { | |
| 241 | if(Str ingUtils.i sNotBlank( time.getVa lue())) | |
| 242 | { | |
| 243 | return t ime.getVal ue(); | |
| 244 | } | |
| 245 | ||
| 246 | if(tim e.getLow() != null) | |
| 247 | { | |
| 248 | if(Strin gUtils.isN otBlank(ti me.getLow( ).getValue ())) | |
| 249 | { | |
| 250 | return tim e.getLow() .getValue( ); | |
| 251 | } | |
| 252 | } | |
| 253 | ||
| 254 | if(tim e.getHigh( ) != null) | |
| 255 | { | |
| 256 | if(Strin gUtils.isN otBlank(ti me.getHigh ().getValu e())) | |
| 257 | { | |
| 258 | return tim e.getHigh( ).getValue (); | |
| 259 | } | |
| 260 | } | |
| 261 | } | |
| 262 | retu rn StringU tils.EMPTY ; | |
| 263 | } | |
| 264 | ||
| 265 | /* * | |
| 266 | * For BR ru le purpose s return c ode in the following manner: 1 ) displayN ame | |
| 267 | * 2) Transl ation disp layName 3) Original Text 4) Co de | |
| 268 | * | |
| 269 | * @param co de | |
| 270 | * @return | |
| 271 | * / | |
| 272 | pu blic stati c ItemObje ct getFrom Code(final CD code, final Stru cDocText n arrative) | |
| 273 | { | |
| 274 | if(c ode == nul l) | |
| 275 | { | |
| 276 | return new ItemO bject(); | |
| 277 | } | |
| 278 | ||
| 279 | // F irst get d isplayname | |
| 280 | if(S tringUtils .isNotBlan k(code.get DisplayNam e())) | |
| 281 | { | |
| 282 | return new ItemO bject(code .getDispla yName()); | |
| 283 | } | |
| 284 | ||
| 285 | Item Object ret = null; | |
| 286 | // S econd, get translati on display Name. | |
| 287 | ||
| 288 | ret = getFromT ranslation s(code.get Translatio ns(), narr ative); | |
| 289 | if(r et != null ) | |
| 290 | { | |
| 291 | return ret; | |
| 292 | } | |
| 293 | // T hird, see if there i s Original Text to p rocess. | |
| 294 | ret = getFromO riginalTex t(code.get OriginalTe xt(), narr ative); | |
| 295 | ||
| 296 | if(r et != null ) | |
| 297 | { | |
| 298 | return ret; | |
| 299 | } | |
| 300 | ||
| 301 | if(S tringUtils .isNotBlan k(code.get Code())) | |
| 302 | { | |
| 303 | return new ItemO bject(code .getCode() ); | |
| 304 | } | |
| 305 | retu rn new Ite mObject(); | |
| 306 | } | |
| 307 | ||
| 308 | pu blic stati c ItemObje ct getFrom Translatio ns(final L ist<CD> tr ans, final StrucDocT ext narrat ive) | |
| 309 | { | |
| 310 | if(C ollectionU tils.isEmp ty(trans)) | |
| 311 | { | |
| 312 | return null; | |
| 313 | } | |
| 314 | ||
| 315 | Stri ngBuilder sb = new S tringBuild er(); | |
| 316 | ||
| 317 | for( CD tran : trans) | |
| 318 | { | |
| 319 | if(Str ingUtils.i sNotBlank( tran.getDi splayName( ))) | |
| 320 | { | |
| 321 | sb.appen d(tran.get DisplayNam e()).appen d(","); | |
| 322 | } | |
| 323 | } | |
| 324 | ||
| 325 | if(s b.length() > 0) | |
| 326 | { | |
| 327 | return new ItemO bject(sb.s ubstring(0 , sb.lengt h() - 1)); | |
| 328 | } | |
| 329 | ||
| 330 | retu rn null; | |
| 331 | } | |
| 332 | ||
| 333 | pu blic stati c ItemObje ct getFrom OriginalTe xt(final E D oText, f inal Struc DocText na rrative) | |
| 334 | { | |
| 335 | if(o Text == nu ll) | |
| 336 | return null; | |
| 337 | ||
| 338 | Stri ng text = oText.getT ext(); | |
| 339 | ||
| 340 | if(S tringUtils .isNotBlan k(text)) | |
| 341 | return new ItemO bject(text ); | |
| 342 | ||
| 343 | TEL ref = oTex t.getRefer ence(); | |
| 344 | if(r ef != null ) | |
| 345 | { | |
| 346 | String val = get ReferenceV alue(narra tive, ref. getValue() ); | |
| 347 | if(val != null) | |
| 348 | { | |
| 349 | return n ew ItemObj ect(val, r ef.getValu e()); | |
| 350 | } | |
| 351 | } | |
| 352 | retu rn null; | |
| 353 | } | |
| 354 | ||
| 355 | /* * | |
| 356 | * Looks for a compone nt where I D="{id}" r eturns a m ap contain ing the | |
| 357 | * element n ame a list of Attrib utes store d in ItemO bjects and the value . | |
| 358 | * | |
| 359 | * @param na rrative | |
| 360 | * @param id | |
| 361 | * @return | |
| 362 | * / | |
| 363 | pu blic stati c Map<Stri ng, Object > getTagMa pFromId(fi nal StrucD ocText nar rative, fi nal String id) | |
| 364 | { | |
| 365 | if(S tringUtils .isNotBlan k(id)) | |
| 366 | { | |
| 367 | String tid = id. startsWith ("#") ? id .substring (1) : id; | |
| 368 | if(nar rative != null) | |
| 369 | { | |
| 370 | FeatureM ap mixed = narrative .getMixed( ); | |
| 371 | Map<Stri ng, Object > map = tr averseForT ag(mixed, tid); | |
| 372 | if(!map. isEmpty()) | |
| 373 | { | |
| 374 | return map ; | |
| 375 | } | |
| 376 | } | |
| 377 | } | |
| 378 | retu rn Collect ions.empty Map(); | |
| 379 | } | |
| 380 | ||
| 381 | // To extrac t the refe rence valu e from the narrative block | |
| 382 | pu blic stati c String g etReferenc eValue(Str ucDocText narrativeT ext, Strin g id) | |
| 383 | { | |
| 384 | if(S tringUtils .isNotBlan k(id) && n arrativeTe xt != null ) | |
| 385 | { | |
| 386 | String tid = id. startsWith ("#") ? id .substring (1) : id; | |
| 387 | return getAllRef ernceValue (narrative Text.getMi xed(), tid ); | |
| 388 | } | |
| 389 | retu rn StringU tils.EMPTY ; | |
| 390 | } | |
| 391 | ||
| 392 | pu blic stati c void wal kFeatureMa p(FeatureM ap map, St ring id) | |
| 393 | { | |
| 394 | if(m ap != null && String Utils.isNo tBlank(id) ) | |
| 395 | { | |
| 396 | for(En try entry : map) | |
| 397 | { | |
| 398 | logger.d ebug(entry .getValue( ).toString ()); | |
| 399 | if(entry .getEStruc turalFeatu re() != nu ll) | |
| 400 | { | |
| 401 | logger.deb ug(entry.g etEStructu ralFeature ().getName () + ": " + entry.ge tValue()); | |
| 402 | if(entry i nstanceof AnyType) | |
| 403 | { | |
| 404 | An yType any = (AnyType ) entry; | |
| 405 | wa lkFeatureM ap(any.get Any(), id) ; | |
| 406 | wa lkFeatureM ap(any.get Mixed(), i d); | |
| 407 | } | |
| 408 | else | |
| 409 | { | |
| 410 | lo gger.debug ("Not AnyT ype: " + e ntry.getCl ass().toSt ring()); | |
| 411 | } | |
| 412 | } | |
| 413 | } | |
| 414 | } | |
| 415 | } | |
| 416 | ||
| 417 | pu blic stati c String l istToStrin g(List<Str ing> list) | |
| 418 | { | |
| 419 | Stri ngBuffer s b = new St ringBuffer (); | |
| 420 | try | |
| 421 | { | |
| 422 | ||
| 423 | if(Col lectionUti ls.isNotEm pty(list)) | |
| 424 | { | |
| 425 | int i = 1; | |
| 426 | ||
| 427 | for(Stri ng s : lis t) | |
| 428 | { | |
| 429 | if(StringU tils.isNot Blank(s)) | |
| 430 | { | |
| 431 | if (i < list. size()) | |
| 432 | sb.a ppend(s + ", "); | |
| 433 | el se | |
| 434 | sb.a ppend(s); | |
| 435 | } | |
| 436 | i = i + 1; | |
| 437 | } | |
| 438 | ||
| 439 | return s b.toString (); | |
| 440 | } | |
| 441 | } | |
| 442 | catc h(Exceptio n e) | |
| 443 | { | |
| 444 | return ""; | |
| 445 | } | |
| 446 | retu rn sb.toSt ring(); | |
| 447 | } | |
| 448 | ||
| 449 | pu blic stati c String g etSource(C ontinuityO fCareDocum ent ccdDoc ument) | |
| 450 | { | |
| 451 | Stri ng source = null; | |
| 452 | if(c cdDocument != null) | |
| 453 | { | |
| 454 | if(ccd Document.g etAuthors( ) != null && ccdDocu ment.getAu thors().si ze() > 0) | |
| 455 | { | |
| 456 | ||
| 457 | if(ccdDo cument.get Authors(). get(0).get AssignedAu thor() != null) | |
| 458 | { | |
| 459 | if(ccdDocu ment.getAu thors().ge t(0).getAs signedAuth or().getRe presentedO rganizatio n() != nul l) | |
| 460 | { | |
| 461 | so urce = ccd Document.g etAuthors( ).get(0).g etAssigned Author().g etRepresen tedOrganiz ation().ge tNames().g et(0).getT ext(); | |
| 462 | re turn sourc e; | |
| 463 | } | |
| 464 | } | |
| 465 | } | |
| 466 | ||
| 467 | } | |
| 468 | retu rn null; | |
| 469 | ||
| 470 | } | |
| 471 | ||
| 472 | pu blic stati c String r emoveLastC har(String str) | |
| 473 | { | |
| 474 | retu rn str.sub string(0, str.length () - 2); | |
| 475 | } | |
| 476 | ||
| 477 | pu blic stati c String g etCommaSep erateStrin g(List<Str ing> list) | |
| 478 | { | |
| 479 | Stri ngBuffer s b = new St ringBuffer (); | |
| 480 | if(C ollectionU tils.isNot Empty(list )) | |
| 481 | { | |
| 482 | for(St ring value : list) | |
| 483 | { | |
| 484 | if(Strin gUtils.isN otBlank(va lue)) | |
| 485 | { | |
| 486 | if(sb.leng th() > 0) | |
| 487 | { | |
| 488 | sb .append(", "); | |
| 489 | } | |
| 490 | sb.append( value); | |
| 491 | } | |
| 492 | } | |
| 493 | return sb.toStri ng(); | |
| 494 | } | |
| 495 | retu rn "--"; | |
| 496 | } | |
| 497 | ||
| 498 | pu blic stati c String g etNotNullV alue(Strin g value1, String val ue2) | |
| 499 | { | |
| 500 | ||
| 501 | if(S tringUtils .isNotBlan k(value1)) | |
| 502 | { | |
| 503 | return value1.tr im(); | |
| 504 | } | |
| 505 | else if(String Utils.isNo tBlank(val ue2)) | |
| 506 | { | |
| 507 | return value2.tr im(); | |
| 508 | } | |
| 509 | else | |
| 510 | { | |
| 511 | return "--"; | |
| 512 | } | |
| 513 | } | |
| 514 | ||
| 515 | pu blic stati c String g etNotNullV alue(Strin g value1, String val ue2, Strin g value3) | |
| 516 | { | |
| 517 | ||
| 518 | if(S tringUtils .isNotBlan k(value1)) | |
| 519 | { | |
| 520 | return value1; | |
| 521 | } | |
| 522 | else if(String Utils.isNo tBlank(val ue2)) | |
| 523 | { | |
| 524 | ||
| 525 | return value2; | |
| 526 | } | |
| 527 | else if(String Utils.isNo tBlank(val ue3)) | |
| 528 | { | |
| 529 | ||
| 530 | return value3; | |
| 531 | } | |
| 532 | else | |
| 533 | { | |
| 534 | return "--"; | |
| 535 | } | |
| 536 | } | |
| 537 | ||
| 538 | pu blic stati c String g etRefList( Map<String , String> mp) | |
| 539 | { | |
| 540 | Stri ngBuffer s b = new St ringBuffer (); | |
| 541 | sb.a ppend("<li st>"); | |
| 542 | ||
| 543 | for( Map.Entry< String, St ring> pair s : mp.ent rySet()) | |
| 544 | { | |
| 545 | sb.app end("<item >"); | |
| 546 | sb.app end("<cont ent ID=\"" + pairs.g etKey() + "\">" + pa irs.getVal ue() + "</ content>") ; | |
| 547 | sb.app end("</ite m>"); | |
| 548 | } | |
| 549 | ||
| 550 | sb.a ppend("</l ist>"); | |
| 551 | ||
| 552 | retu rn sb.toSt ring(); | |
| 553 | ||
| 554 | } | |
| 555 | ||
| 556 | pu blic stati c String g etCommaSep erateStrin g(Map<Stri ng, String > map) | |
| 557 | { | |
| 558 | Stri ngBuffer s b = new St ringBuffer (); | |
| 559 | for( Map.Entry< String, St ring> pair s : map.en trySet()) | |
| 560 | { | |
| 561 | sb.app end(pairs. getValue() + ", "); | |
| 562 | } | |
| 563 | if(s b.length() > 0) | |
| 564 | { | |
| 565 | return removeLas tChar(sb.t oString()) ; | |
| 566 | } | |
| 567 | retu rn "--"; | |
| 568 | } | |
| 569 | ||
| 570 | pr ivate stat ic Map<Str ing, Objec t> travers eForTag(fi nal Featur eMap root, final Str ing id) | |
| 571 | { | |
| 572 | Stac k<FeatureM ap> stack = new Stac k<FeatureM ap>(); | |
| 573 | Map< String, Ob ject> ret = new Hash Map<String , Object>( ); | |
| 574 | stac k.push(roo t); | |
| 575 | whil e(!stack.i sEmpty()) | |
| 576 | { | |
| 577 | Featur eMap featu reMap = st ack.pop(); | |
| 578 | for(En try entry : featureM ap) | |
| 579 | { | |
| 580 | if(entry .getEStruc turalFeatu re() insta nceof ERef erence) | |
| 581 | { | |
| 582 | AnyType an yType = (A nyType) en try.getVal ue(); | |
| 583 | if(travers eForID(any Type.getAn yAttribute (), id)) | |
| 584 | { | |
| 585 | re t.put("nam e", entry. getEStruct uralFeatur e().getNam e()); | |
| 586 | Li st<ItemObj ect> attrs = travers eMyAttribu tes(anyTyp e.getAnyAt tribute()) ; | |
| 587 | if (Collectio nUtils.isN otEmpty(at trs)) | |
| 588 | { | |
| 589 | ret. put("attri butes", at trs); | |
| 590 | } | |
| 591 | St ringBuilde r sb = new StringBui lder(); | |
| 592 | fo r(Entry fo undEntry : anyType.g etMixed()) | |
| 593 | { | |
| 594 | sb.a ppend(rebu ildEntry(f oundEntry) ); // getV aluesFromM ixed(anyTy pe.getMixe d()); | |
| 595 | } | |
| 596 | if (StringUti ls.isNotBl ank(sb.toS tring())) | |
| 597 | { | |
| 598 | ret. put("value ", sb.toSt ring()); | |
| 599 | } | |
| 600 | re turn ret; | |
| 601 | } | |
| 602 | else | |
| 603 | { | |
| 604 | st ack.push(a nyType.get Mixed()); | |
| 605 | } | |
| 606 | } | |
| 607 | } | |
| 608 | } | |
| 609 | retu rn Collect ions.empty Map(); | |
| 610 | } | |
| 611 | ||
| 612 | pr ivate stat ic boolean traverseF orID(final FeatureMa p attribut es, final String id) | |
| 613 | { | |
| 614 | if(S tringUtils .isEmpty(i d)) | |
| 615 | { | |
| 616 | return false; | |
| 617 | } | |
| 618 | ||
| 619 | for( Entry entr y : attrib utes) | |
| 620 | { | |
| 621 | if("ID ".equals(e ntry.getES tructuralF eature().g etName()) && id.equa ls(entry.g etValue(). toString() )) | |
| 622 | { | |
| 623 | return t rue; | |
| 624 | } | |
| 625 | } | |
| 626 | ||
| 627 | retu rn false; | |
| 628 | } | |
| 629 | ||
| 630 | pr ivate stat ic List<It emObject> traverseMy Attributes (FeatureMa p anyAttri bute) | |
| 631 | { | |
| 632 | List <ItemObjec t> ret = n ew ArrayLi st<ItemObj ect>(); | |
| 633 | for( Entry entr y : anyAtt ribute) | |
| 634 | { | |
| 635 | ret.ad d(new Item Object(ent ry.getValu e().toStri ng(), entr y.getEStru cturalFeat ure().getN ame())); | |
| 636 | } | |
| 637 | retu rn ret; | |
| 638 | } | |
| 639 | ||
| 640 | /* * | |
| 641 | * Quick che ck to see if the val ue should be returne d or if th e default | |
| 642 | * should be returned. | |
| 643 | * | |
| 644 | * @param va lue | |
| 645 | * @param de faultValue | |
| 646 | * @return | |
| 647 | * / | |
| 648 | pu blic stati c String r eturnDefau ltOrBlank( final Stri ng value, final Stri ng default Value) | |
| 649 | { | |
| 650 | if(S tringUtils .isNotBlan k(value)) | |
| 651 | { | |
| 652 | return value; | |
| 653 | } | |
| 654 | ||
| 655 | retu rn returnD efaultOrBl ank(defaul tValue); | |
| 656 | } | |
| 657 | ||
| 658 | /* * | |
| 659 | * if defaul t value ex ists retur n it, else return em pty string . | |
| 660 | * | |
| 661 | * @param de faultValue | |
| 662 | * @return | |
| 663 | * / | |
| 664 | pu blic stati c String r eturnDefau ltOrBlank( final Stri ng default Value) | |
| 665 | { | |
| 666 | if(S tringUtils .isNotBlan k(defaultV alue)) | |
| 667 | { | |
| 668 | return defaultVa lue; | |
| 669 | } | |
| 670 | retu rn StringU tils.EMPTY ; | |
| 671 | } | |
| 672 | ||
| 673 | /* * | |
| 674 | * For legac y code to check if t here is a reference. If there is a refer ence | |
| 675 | * return it in a cont ent tag. I f not retu rn the def ault value . | |
| 676 | * | |
| 677 | * @param re ference | |
| 678 | * @param va lue | |
| 679 | * @param de faultValue | |
| 680 | * @return | |
| 681 | * / | |
| 682 | pu blic stati c String c reateRefer enceWDefau lt(final S tring refe rence, fin al List<St ring> valu e, final S tring defa ultValue) | |
| 683 | { | |
| 684 | ||
| 685 | if(S tringUtils .isBlank(r eference)) | |
| 686 | { | |
| 687 | return returnDef aultOrBlan k(listToSt ring(value ), default Value); | |
| 688 | } | |
| 689 | ||
| 690 | retu rn "<conte nt ID=\"" + referenc e + "\">" + returnDe faultOrBla nk(listToS tring(valu e), defaul tValue) + "</content >"; | |
| 691 | } | |
| 692 | ||
| 693 | /* * | |
| 694 | * For legac y code to check if t here is a reference. If there is a refer ence | |
| 695 | * return it in a cont ent tag. I f not retu rn the def ault value . | |
| 696 | * | |
| 697 | * @param re ference | |
| 698 | * @param va lue | |
| 699 | * @param de faultValue | |
| 700 | * @return | |
| 701 | * / | |
| 702 | pu blic stati c String c reateRefer enceWDefau lt(final S tring refe rence, fin al String value, fin al String defaultVal ue) | |
| 703 | { | |
| 704 | ||
| 705 | if(S tringUtils .isBlank(r eference)) | |
| 706 | { | |
| 707 | return returnDef aultOrBlan k(value, d efaultValu e); | |
| 708 | } | |
| 709 | ||
| 710 | retu rn "<conte nt ID=\"" + referenc e + "\">" + returnDe faultOrBla nk(value, defaultVal ue) + "</c ontent>"; | |
| 711 | } | |
| 712 | ||
| 713 | pu blic stati c List<Str ing> getAl lRefernces FromNarr(f inal Featu reMap map) | |
| 714 | { | |
| 715 | List <String> r et = new A rrayList<S tring>(); | |
| 716 | ||
| 717 | for( Entry entr y : map) | |
| 718 | { | |
| 719 | if(ent ry.getEStr ucturalFea ture() ins tanceof ER eference) | |
| 720 | { | |
| 721 | AnyType anyType = (AnyType) entry.getV alue(); | |
| 722 | if(hasId (anyType.g etAnyAttri bute()) && !"table". equalsIgno reCase(ent ry.getEStr ucturalFea ture().get Name())) | |
| 723 | { | |
| 724 | // Found a reference , now buil d it. | |
| 725 | String com ponent = r ebuildEntr y(entry); | |
| 726 | if(StringU tils.isNot Blank(comp onent)) | |
| 727 | { | |
| 728 | re t.add(comp onent); | |
| 729 | } | |
| 730 | } | |
| 731 | else | |
| 732 | { | |
| 733 | ret.addAll (getAllRef erncesFrom Narr(anyTy pe.getMixe d())); | |
| 734 | } | |
| 735 | } | |
| 736 | } | |
| 737 | ||
| 738 | retu rn ret; | |
| 739 | } | |
| 740 | ||
| 741 | pu blic stati c String g etAllRefer nceValue(f inal Featu reMap map, final Str ing id) | |
| 742 | { | |
| 743 | Stri ngBuilder ret = new StringBuil der(); | |
| 744 | ||
| 745 | for( Entry entr y : map) | |
| 746 | { | |
| 747 | if(ent ry.getEStr ucturalFea ture() ins tanceof ER eference) | |
| 748 | { | |
| 749 | AnyType anyType = (AnyType) entry.getV alue(); | |
| 750 | if(hasId (anyType.g etAnyAttri bute(), id ) && !"tab le".equals IgnoreCase (entry.get EStructura lFeature() .getName() )) | |
| 751 | { | |
| 752 | // Found a reference , now buil d it. | |
| 753 | String com ponent = r ebuildItem (anyType.g etMixed()) ; | |
| 754 | if(StringU tils.isNot Blank(comp onent)) | |
| 755 | { | |
| 756 | re t.append(c omponent); | |
| 757 | } | |
| 758 | } | |
| 759 | else | |
| 760 | { | |
| 761 | ret.append (getAllRef ernceValue (anyType.g etMixed(), id)); | |
| 762 | } | |
| 763 | } | |
| 764 | } | |
| 765 | ||
| 766 | retu rn ret.toS tring(); | |
| 767 | } | |
| 768 | ||
| 769 | pu blic stati c boolean hasId(fina l FeatureM ap attribu tes, final String id ) | |
| 770 | { | |
| 771 | if(S tringUtils .isEmpty(i d)) | |
| 772 | { | |
| 773 | return false; | |
| 774 | } | |
| 775 | ||
| 776 | for( Entry entr y : attrib utes) | |
| 777 | { | |
| 778 | if("ID ".equals(e ntry.getES tructuralF eature().g etName()) && id.equa lsIgnoreCa se(entry.g etValue(). toString() )) | |
| 779 | { | |
| 780 | return t rue; | |
| 781 | } | |
| 782 | } | |
| 783 | ||
| 784 | retu rn false; | |
| 785 | } | |
| 786 | ||
| 787 | pu blic stati c boolean hasId(fina l FeatureM ap attribu tes) | |
| 788 | { | |
| 789 | for( Entry entr y : attrib utes) | |
| 790 | { | |
| 791 | if("ID ".equals(e ntry.getES tructuralF eature().g etName())) | |
| 792 | { | |
| 793 | return t rue; | |
| 794 | } | |
| 795 | } | |
| 796 | ||
| 797 | retu rn false; | |
| 798 | } | |
| 799 | ||
| 800 | pr ivate stat ic String rebuildIte m(final Fe atureMap m ap) | |
| 801 | { | |
| 802 | fina l StringBu ilder sb = new Strin gBuilder() ; | |
| 803 | ||
| 804 | for( Entry entr y : map) | |
| 805 | { | |
| 806 | sb.app end(rebuil dEntry(ent ry)); | |
| 807 | } | |
| 808 | retu rn sb.toSt ring(); | |
| 809 | } | |
| 810 | ||
| 811 | pr ivate stat ic String rebuildEnt ry(final E ntry entry ) | |
| 812 | { | |
| 813 | Stri ngBuilder sb = new S tringBuild er(); | |
| 814 | ||
| 815 | if(e ntry.getES tructuralF eature() i nstanceof EReference ) | |
| 816 | { | |
| 817 | String tag = ent ry.getEStr ucturalFea ture().get Name(); | |
| 818 | sb.app end("<").a ppend(tag) .append(" "); | |
| 819 | AnyTyp e any = (A nyType) en try.getVal ue(); | |
| 820 | sb.app end(recrea teAttribut es(any.get AnyAttribu te())); | |
| 821 | sb.app end(">"); | |
| 822 | if(any .getMixed( ) != null) | |
| 823 | { | |
| 824 | sb.appen d(rebuildI tem(any.ge tMixed())) ; | |
| 825 | } | |
| 826 | sb.app end("</"). append(tag ).append(" >"); | |
| 827 | } | |
| 828 | else | |
| 829 | { | |
| 830 | if(ent ry.getValu e() != nul l) | |
| 831 | { | |
| 832 | String v alue = Str ingUtils.t rimToEmpty (entry.get Value().to String()); | |
| 833 | if(Strin gUtils.isN otBlank(va lue)) | |
| 834 | { | |
| 835 | sb.append( StringEsca peUtils.es capeXml(va lue)); | |
| 836 | } | |
| 837 | } | |
| 838 | else | |
| 839 | { | |
| 840 | sb.appen d(">"); | |
| 841 | } | |
| 842 | } | |
| 843 | ||
| 844 | retu rn sb.toSt ring(); | |
| 845 | } | |
| 846 | ||
| 847 | pr ivate stat ic String recreateAt tributes(f inal Featu reMap anyA ttribute) | |
| 848 | { | |
| 849 | fina l StringBu ilder sb = new Strin gBuilder() ; | |
| 850 | for( Entry entr y : anyAtt ribute) | |
| 851 | { | |
| 852 | sb.app end(entry. getEStruct uralFeatur e().getNam e()).appen d("="); | |
| 853 | sb.app end("\""). append(ent ry.getValu e().toStri ng()).appe nd("\"").a ppend(" ") ; | |
| 854 | } | |
| 855 | ||
| 856 | retu rn sb.toSt ring(); | |
| 857 | } | |
| 858 | ||
| 859 | /* * | |
| 860 | * Will conv ert the un it abbrevi ation to a n actual d isplay nam e. | |
| 861 | * | |
| 862 | * This only process t he 2.16.84 0.1.113883 .11.20.9.2 1 (AgePQ_U CUM) | |
| 863 | * 2012-06-0 2 value se t. | |
| 864 | * | |
| 865 | * @param va lue | |
| 866 | * @return | |
| 867 | * / | |
| 868 | pu blic stati c String c onvertPQUn it(final P Q value) | |
| 869 | { | |
| 870 | Stri ngBuilder ret = new StringBuil der(); | |
| 871 | ||
| 872 | if(v alue != nu ll) | |
| 873 | { | |
| 874 | if(Str ingUtils.i sNotBlank( value.getU nit())) | |
| 875 | { | |
| 876 | if("a".e qualsIgnor eCase(valu e.getUnit( ))) | |
| 877 | { | |
| 878 | ret.append ("Year"); | |
| 879 | } | |
| 880 | else if( "wk".equal sIgnoreCas e(value.ge tUnit())) | |
| 881 | { | |
| 882 | ret.append ("Week"); | |
| 883 | } | |
| 884 | else if( "mo".equal sIgnoreCas e(value.ge tUnit())) | |
| 885 | { | |
| 886 | ret.append ("Month"); | |
| 887 | } | |
| 888 | else if( "min".equa lsIgnoreCa se(value.g etUnit())) | |
| 889 | { | |
| 890 | ret.append ("Minute") ; | |
| 891 | } | |
| 892 | else if( "h".equals IgnoreCase (value.get Unit())) | |
| 893 | { | |
| 894 | ret.append ("Hour"); | |
| 895 | } | |
| 896 | else if( "d".equals IgnoreCase (value.get Unit())) | |
| 897 | { | |
| 898 | ret.append ("Day"); | |
| 899 | } | |
| 900 | } | |
| 901 | } | |
| 902 | ||
| 903 | if(v alue.getVa lue() != n ull && val ue.getValu e().compar eTo(BigDec imal.ONE) > 0) | |
| 904 | { | |
| 905 | ret.ap pend("s"); | |
| 906 | } | |
| 907 | ||
| 908 | retu rn ret.toS tring(); | |
| 909 | } | |
| 910 | ||
| 911 | pu blic stati c PQ getAg e(final En tryRelatio nship rel) | |
| 912 | { | |
| 913 | if(r el != null ) | |
| 914 | { | |
| 915 | Observ ation obs = rel.getO bservation (); | |
| 916 | if(obs != null && co ntainsTemp lateId(obs .getTempla teIds(), " 2.16.840.1 .113883. IP ")) | |
| 917 | { | |
| 918 | // Retur n the firs t value. | |
| 919 | for(ANY any : obs. getValues( )) | |
| 920 | { | |
| 921 | if(any ins tanceof PQ ) | |
| 922 | { | |
| 923 | re turn (PQ) any; | |
| 924 | } | |
| 925 | } | |
| 926 | } | |
| 927 | } | |
| 928 | retu rn null; | |
| 929 | } | |
| 930 | ||
| 931 | pu blic stati c String g etSourceFr omAct(fina l Act act) | |
| 932 | { | |
| 933 | if(a ct != null ) | |
| 934 | { | |
| 935 | return getSource (act.getAu thors(), a ct.getPerf ormers(), act.getPar ticipants( ), act.get Informants ()); | |
| 936 | } | |
| 937 | retu rn StringU tils.EMPTY ; | |
| 938 | } | |
| 939 | ||
| 940 | pu blic stati c String g etSourceFr omObservat ion(final Observatio n obs) | |
| 941 | { | |
| 942 | if(o bs != null ) | |
| 943 | { | |
| 944 | return getSource (obs.getAu thors(), o bs.getPerf ormers(), obs.getPar ticipants( ), obs.get Informants ()); | |
| 945 | } | |
| 946 | retu rn StringU tils.EMPTY ; | |
| 947 | } | |
| 948 | ||
| 949 | pu blic stati c String g etSourceFr omOrganize r(final Or ganizer or g) | |
| 950 | { | |
| 951 | if(o rg != null ) | |
| 952 | { | |
| 953 | return getSource (org.getAu thors(), o rg.getPerf ormers(), org.getPar ticipants( ), org.get Informants ()); | |
| 954 | } | |
| 955 | retu rn StringU tils.EMPTY ; | |
| 956 | } | |
| 957 | ||
| 958 | pu blic stati c String g etSourceFr omSubstanc eAdmin(fin al Substan ceAdminist ration sub stance) | |
| 959 | { | |
| 960 | if(s ubstance ! = null) | |
| 961 | { | |
| 962 | return getSource (substance .getAuthor s(), subst ance.getPe rformers() , substanc e.getParti cipants(), substance .getInform ants()); | |
| 963 | } | |
| 964 | retu rn StringU tils.EMPTY ; | |
| 965 | } | |
| 966 | ||
| 967 | pu blic stati c String g etSourceFr omProcedur es(final P rocedure p roc) | |
| 968 | { | |
| 969 | if(p roc != nul l) | |
| 970 | { | |
| 971 | return getSource (proc.getA uthors(), proc.getPe rformers() , proc.get Participan ts(), proc .getInform ants()); | |
| 972 | } | |
| 973 | retu rn StringU tils.EMPTY ; | |
| 974 | } | |
| 975 | ||
| 976 | pu blic stati c String g etSource(f inal EList <Author> a uthors) | |
| 977 | { | |
| 978 | retu rn getSour ce(authors , null); | |
| 979 | } | |
| 980 | ||
| 981 | pu blic stati c String g etSource(f inal EList <Author> a uthors, fi nal EList< Performer2 > performe rs) | |
| 982 | { | |
| 983 | retu rn getSour ce(authors , performe rs, null); | |
| 984 | } | |
| 985 | ||
| 986 | pu blic stati c String g etSource(f inal EList <Author> a uthors, fi nal EList< Performer2 > performe rs, final EList<Part icipant2> participan ts) | |
| 987 | { | |
| 988 | retu rn getSour ce(authors , performe rs, partic ipants, nu ll); | |
| 989 | } | |
| 990 | ||
| 991 | pu blic stati c String g etSource(f inal EList <Author> a uthors, fi nal EList< Performer2 > performe rs, final EList<Part icipant2> participan ts, final EList<Info rmant12> i nformants) | |
| 992 | { | |
| 993 | Stri ng source = Utils.ge tSourceFro mAuthors(a uthors); | |
| 994 | if(S tringUtils .isBlank(s ource)) | |
| 995 | { | |
| 996 | source = Utils.g etSourceFr omPerforme r(performe rs); | |
| 997 | if(Str ingUtils.i sBlank(sou rce)) | |
| 998 | { | |
| 999 | source = Utils.get SourceFrom Scoping(pa rticipants ); | |
| 1000 | if(Strin gUtils.isB lank(sourc e)) | |
| 1001 | { | |
| 1002 | source = U tils.getSo urceFromPl ayingEntit y(particip ants); | |
| 1003 | if(StringU tils.isBla nk(source) ) | |
| 1004 | { | |
| 1005 | so urce = Uti ls.getSour ceFromInfo rmants(inf ormants); | |
| 1006 | } | |
| 1007 | } | |
| 1008 | } | |
| 1009 | } | |
| 1010 | retu rn source; | |
| 1011 | } | |
| 1012 | ||
| 1013 | pu blic stati c String g etSourceFr omAuthors( final ELis t<Author> authors) | |
| 1014 | { | |
| 1015 | if(C ollectionU tils.isNot Empty(auth ors)) | |
| 1016 | { | |
| 1017 | String Builder sb = new Str ingBuilder (); | |
| 1018 | for(Au thor autho r : author s) | |
| 1019 | { | |
| 1020 | Assigned Author aAu thor = aut hor.getAss ignedAutho r(); | |
| 1021 | if(aAuth or != null ) | |
| 1022 | { | |
| 1023 | Organizati on org = a Author.get Represente dOrganizat ion(); | |
| 1024 | if(org != null) | |
| 1025 | { | |
| 1026 | sb .append(Tr ansformer. createName sON(org.ge tNames())) ; | |
| 1027 | } | |
| 1028 | } | |
| 1029 | } | |
| 1030 | if(sb. length() > 0) | |
| 1031 | { | |
| 1032 | return s b.toString (); | |
| 1033 | } | |
| 1034 | } | |
| 1035 | retu rn StringU tils.EMPTY ; | |
| 1036 | } | |
| 1037 | ||
| 1038 | pu blic stati c String g etSourceFr omInforman ts(final E List<Infor mant12> in formants) | |
| 1039 | { | |
| 1040 | if(C ollectionU tils.isNot Empty(info rmants)) | |
| 1041 | { | |
| 1042 | String Builder sb = new Str ingBuilder (); | |
| 1043 | for(In formant12 informant : informan ts) | |
| 1044 | { | |
| 1045 | Assigned Entity ent ity = info rmant.getA ssignedEnt ity(); | |
| 1046 | if(entit y != null) | |
| 1047 | { | |
| 1048 | ||
| 1049 | EList<Orga nization> orgs = ent ity.getRep resentedOr ganization s(); | |
| 1050 | if(Collect ionUtils.i sNotEmpty( orgs)) | |
| 1051 | { | |
| 1052 | fo r(Organiza tion org : orgs) | |
| 1053 | { | |
| 1054 | if(s b.length() > 0) | |
| 1055 | { | |
| 1056 | sb.app end(", "); | |
| 1057 | } | |
| 1058 | sb.a ppend(Tran sformer.cr eateNamesO N(org.getN ames())); | |
| 1059 | } | |
| 1060 | } | |
| 1061 | } | |
| 1062 | } | |
| 1063 | if(sb. length() > 0) | |
| 1064 | { | |
| 1065 | return s b.toString (); | |
| 1066 | } | |
| 1067 | } | |
| 1068 | retu rn StringU tils.EMPTY ; | |
| 1069 | } | |
| 1070 | ||
| 1071 | pu blic stati c String g etSourceFr omPerforme r(final EL ist<Perfor mer2> perf ormers) | |
| 1072 | { | |
| 1073 | if(C ollectionU tils.isNot Empty(perf ormers)) | |
| 1074 | { | |
| 1075 | String Builder sb = new Str ingBuilder (); | |
| 1076 | for(Pe rformer2 p erformer : performer s) | |
| 1077 | { | |
| 1078 | Assigned Entity ass ignedEntit y = perfor mer.getAss ignedEntit y(); | |
| 1079 | if(assig nedEntity != null) | |
| 1080 | { | |
| 1081 | if(Collect ionUtils.i sNotEmpty( assignedEn tity.getRe presentedO rganizatio ns())) | |
| 1082 | { | |
| 1083 | fo r(Organiza tion org : assignedE ntity.getR epresented Organizati ons()) | |
| 1084 | { | |
| 1085 | if(o rg != null ) | |
| 1086 | { | |
| 1087 | if(sb. length() > 0) | |
| 1088 | { | |
| 1089 | sb.appen d(", "); | |
| 1090 | } | |
| 1091 | sb.app end(Transf ormer.crea teNamesON( org.getNam es())); | |
| 1092 | } | |
| 1093 | } | |
| 1094 | } | |
| 1095 | } | |
| 1096 | } | |
| 1097 | if(sb. length() > 0) | |
| 1098 | { | |
| 1099 | return s b.toString (); | |
| 1100 | } | |
| 1101 | } | |
| 1102 | retu rn StringU tils.EMPTY ; | |
| 1103 | } | |
| 1104 | ||
| 1105 | pu blic stati c String g etSourceFr omScoping( final ELis t<Particip ant2> part icipants) | |
| 1106 | { | |
| 1107 | if(C ollectionU tils.isNot Empty(part icipants)) | |
| 1108 | { | |
| 1109 | String Builder sb = new Str ingBuilder (); | |
| 1110 | for(Pa rticipant2 part : pa rticipants ) | |
| 1111 | { | |
| 1112 | Particip antRole ro le = part. getPartici pantRole() ; | |
| 1113 | if(role != null) | |
| 1114 | { | |
| 1115 | Entity sco pe = role. getScoping Entity(); | |
| 1116 | if(scope ! = null && scope.getD esc() != n ull && Str ingUtils.i sNotBlank( scope.getD esc().getT ext())) | |
| 1117 | { | |
| 1118 | if (sb.length () > 1) | |
| 1119 | { | |
| 1120 | sb.a ppend(", " ); | |
| 1121 | } | |
| 1122 | sb .append(sc ope.getDes c().getTex t()); | |
| 1123 | } | |
| 1124 | } | |
| 1125 | } | |
| 1126 | if(sb. length() > 0) | |
| 1127 | { | |
| 1128 | return s b.toString (); | |
| 1129 | } | |
| 1130 | } | |
| 1131 | retu rn StringU tils.EMPTY ; | |
| 1132 | } | |
| 1133 | ||
| 1134 | pu blic stati c String g etSourceFr omPlayingE ntity(fina l EList<Pa rticipant2 > particip ants) | |
| 1135 | { | |
| 1136 | if(C ollectionU tils.isNot Empty(part icipants)) | |
| 1137 | { | |
| 1138 | String Builder sb = new Str ingBuilder (); | |
| 1139 | for(Pa rticipant2 part : pa rticipants ) | |
| 1140 | { | |
| 1141 | Particip antRole ro le = part. getPartici pantRole() ; | |
| 1142 | if(role != null) | |
| 1143 | { | |
| 1144 | PlayingEnt ity entity = role.ge tPlayingEn tity(); | |
| 1145 | if(entity != null && entity.ge tDesc() != null && S tringUtils .isNotBlan k(entity.g etDesc().g etText())) | |
| 1146 | { | |
| 1147 | if (sb.length () > 1) | |
| 1148 | { | |
| 1149 | sb.a ppend(", " ); | |
| 1150 | } | |
| 1151 | sb .append(en tity.getDe sc().getTe xt()); | |
| 1152 | } | |
| 1153 | } | |
| 1154 | } | |
| 1155 | if(sb. length() > 0) | |
| 1156 | { | |
| 1157 | return s b.toString (); | |
| 1158 | } | |
| 1159 | } | |
| 1160 | retu rn StringU tils.EMPTY ; | |
| 1161 | } | |
| 1162 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.