Produced by Araxis Merge on 12/5/2017 12:06:39 PM 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 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DicomServiceProvider\main\src\java\gov\va\med\imaging\dicom\parser\impl | RawValueParser.java | Mon Dec 4 21:35:22 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\DicomServiceProvider\main\src\java\gov\va\med\imaging\dicom\parser\impl | RawValueParser.java | Mon Dec 4 21:59:33 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 242 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /** | |
| 2 | * | |
| 3 | */ | |
| 4 | package go v.va.med.i maging.dic om.parser. impl; | |
| 5 | ||
| 6 | import gov .va.med.im aging.dico m.dataset. elements.D ataElement ; | |
| 7 | import gov .va.med.im aging.dico m.exceptio ns.DicomFo rmatExcept ion; | |
| 8 | import gov .va.med.im aging.dico m.exceptio ns.ValueRe presentati onInterpre tationExce ption; | |
| 9 | import gov .va.med.im aging.dico m.exceptio ns.ValueRe presentati onValueLen gthExceede dException ; | |
| 10 | import gov .va.med.im aging.dico m.exceptio ns.ValueRe presentati onValueLen gthInsuffi cientExcep tion; | |
| 11 | ||
| 12 | import org .apache.lo gging.log4 j.LogManag er; | |
| 13 | import org .apache.lo gging.log4 j.Logger; | |
| 14 | ||
| 15 | /** | |
| 16 | * @author
|
|
| 17 | * | |
| 18 | */ | |
| 19 | public abs tract clas s RawValue Parser<T, E extends DataElemen t<T>> | |
| 20 | { | |
| 21 | privat e Logger l ogger = Lo gManager.g etLogger(R awValuePar ser.class. getName()) ; | |
| 22 | privat e final Da taElementF actory fac tory; | |
| 23 | privat e final E dataElemen t; | |
| 24 | ||
| 25 | public RawValueP arser(Data ElementFac tory facto ry, E data Element) | |
| 26 | { | |
| 27 | th is.factory = factory ; | |
| 28 | th is.dataEle ment = dat aElement; | |
| 29 | } | |
| 30 | ||
| 31 | public DataEleme ntFactory getFactory () | |
| 32 | { | |
| 33 | re turn facto ry; | |
| 34 | } | |
| 35 | ||
| 36 | public E getData Element() | |
| 37 | { | |
| 38 | re turn dataE lement; | |
| 39 | } | |
| 40 | ||
| 41 | protec ted Logger getLogger () | |
| 42 | { | |
| 43 | re turn logge r; | |
| 44 | } | |
| 45 | ||
| 46 | /** | |
| 47 | * Par se the raw value (by te array) and setVal ue() with the result . | |
| 48 | * | |
| 49 | * @pa ram elemen t | |
| 50 | * @th rows Value Representa tionInterp retationEx ception | |
| 51 | */ | |
| 52 | public abstract void parse RawValue() | |
| 53 | throws DicomForm atExceptio n; | |
| 54 | ||
| 55 | ||
| 56 | /** | |
| 57 | * Do basic vali dation of the length field and the lengt h of the v alue again st the | |
| 58 | * spe cified val ues. | |
| 59 | * | |
| 60 | * @th rows Value Representa tionInterp retationEx ception | |
| 61 | */ | |
| 62 | protec ted void v alidateLen gthValues( DataElemen t<?> dataE lement) | |
| 63 | throws ValueRepr esentation Interpreta tionExcept ion | |
| 64 | { | |
| 65 | if (dataEleme nt.getValu eLength() < dataElem ent.getVal ueRepresen tation()[0 ].getMinLe ngthOfValu e() && | |
| 66 | !dat aElement.g etValueRep resentatio n()[0].isA llowUndefi nedLength( )) | |
| 67 | throw ne w ValueRep resentatio nValueLeng thInsuffic ientExcept ion( | |
| 68 | "Ele ment '" + dataElemen t.getDataE lementTag( ) + "' " + dataEleme nt.getValu eRepresent ation()[0] .toString( ) + | |
| 69 | " le ngth of " + dataElem ent.getVal ueLength() + " is ou tside rang e of [" + | |
| 70 | data Element.ge tValueRepr esentation ()[0].getM inLengthOf Value() + "-" + | |
| 71 | data Element.ge tValueRepr esentation ()[0].getM axLengthOf Value() + "]."); | |
| 72 | ||
| 73 | if (dataEleme nt.getValu eLength() > dataElem ent.getVal ueRepresen tation()[0 ].getMaxLe ngthOfValu e() && | |
| 74 | !dat aElement.g etValueRep resentatio n()[0].isA llowUndefi nedLength( )) | |
| 75 | throw ne w ValueRep resentatio nValueLeng thExceeded Exception( | |
| 76 | "Ele ment '" + dataElemen t.getDataE lementTag( ) + "' " + dataEleme nt.getValu eRepresent ation()[0] .toString( ) + | |
| 77 | " le ngth of " + dataElem ent.getVal ueLength() + " is ou tside rang e of [" + | |
| 78 | data Element.ge tValueRepr esentation ()[0].getM inLengthOf Value() + "-" + | |
| 79 | data Element.ge tValueRepr esentation ()[0].getM axLengthOf Value() + "]."); | |
| 80 | ||
| 81 | if (dataEleme nt.getRawV alue() == null) | |
| 82 | return; | |
| 83 | ||
| 84 | if (dataEleme nt.getRawV alue().len gth < data Element.ge tValueRepr esentation ()[0].getM inLengthOf Value() && | |
| 85 | !dat aElement.g etValueRep resentatio n()[0].isA llowUndefi nedLength( )) | |
| 86 | throw ne w ValueRep resentatio nValueLeng thInsuffic ientExcept ion( | |
| 87 | "Ele ment '" + dataElemen t.getDataE lementTag( ) + "' " + dataEleme nt.getValu eRepresent ation()[0] .toString( ) + | |
| 88 | " ra w value le ngth of " + dataElem ent.getRaw Value().le ngth + " i s outside range of [ " + | |
| 89 | data Element.ge tValueRepr esentation ()[0].getM inLengthOf Value() + "-" + | |
| 90 | data Element.ge tValueRepr esentation ()[0].getM axLengthOf Value() + "]."); | |
| 91 | ||
| 92 | if (dataEleme nt.getValu eLength() > dataElem ent.getRaw Value().le ngth && | |
| 93 | !dat aElement.g etValueRep resentatio n()[0].isA llowUndefi nedLength( )) | |
| 94 | throw ne w ValueRep resentatio nValueLeng thExceeded Exception( | |
| 95 | "Ele ment '" + dataElemen t.getDataE lementTag( ) + "' " + dataEleme nt.getValu eRepresent ation()[0] .toString( ) + | |
| 96 | " ra w value le ngth of " + dataElem ent.getRaw Value().le ngth + " i s outside range of [ " + | |
| 97 | data Element.ge tValueRepr esentation ()[0].getM inLengthOf Value() + "-" + | |
| 98 | data Element.ge tValueRepr esentation ()[0].getM axLengthOf Value() + "]."); | |
| 99 | } | |
| 100 | ||
| 101 | // === ========== ========== ========== ========== ========== ========== ========== ========== ===== | |
| 102 | // Hel per Method s to do va rious, usu ally bit o r byte lev el, manipu lations | |
| 103 | // === ========== ========== ========== ========== ========== ========== ========== ========== ===== | |
| 104 | protec ted static String tr ansformVal ueToString RemoveNull s(byte[] r awValue, l ong valueL ength) | |
| 105 | { | |
| 106 | fo r (int j = 0; j < va lueLength; j++) | |
| 107 | if (rawV alue[j] == 0) rawVal ue[j] = 20 ; | |
| 108 | re turn new S tring(rawV alue); | |
| 109 | } | |
| 110 | ||
| 111 | protec ted static String ge tRawValueC haracterRe presentati on(DataEle ment<?> da taElement) | |
| 112 | { | |
| 113 | St ringBuffer sb = new StringBuff er(); | |
| 114 | ||
| 115 | by te[] raw = dataEleme nt.getRawV alue(); | |
| 116 | if (raw != nu ll) | |
| 117 | for(byte c : dataE lement.get RawValue() ) | |
| 118 | sb.a ppend("0x" + Integer .toHexStri ng(c) + " "); | |
| 119 | re turn sb.to String(); | |
| 120 | } | |
| 121 | ||
| 122 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.