Produced by Araxis Merge on 3/25/2019 8:58:00 AM 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\IMAG_Source\VISA\Java\FederationCommon\main\src\java\gov\va\med\imaging\federation\rest\translator | FederationRestTranslator.java | Mon Mar 18 20:39:14 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\IMAG_Source\VISA\Java\FederationCommon\main\src\java\gov\va\med\imaging\federation\rest\translator | FederationRestTranslator.java | Tue Mar 19 12:03:34 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 5626 |
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 | * | |
3 | Package: MAG - Vis tA Imaging | |
4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
5 | Date Cre ated: May 15, 2010 | |
6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
7 | Developer: DNS werfej | |
8 | Descript ion: | |
9 | ||
10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
11 | ;; Property of the US Government . | |
12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
16 | ;; telephon e (301) 73 4-0100. | |
17 | ;; | |
18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
19 | ;; a Class I I medical device. A s such, it may not b e changed | |
20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
24 | ||
25 | */ | |
26 | package go v.va.med.i maging.fed eration.re st.transla tor; | |
27 | ||
28 | import gov .va.med.Gl obalArtifa ctIdentifi er; | |
29 | import gov .va.med.Gl obalArtifa ctIdentifi erFactory; | |
30 | import gov .va.med.He althSummar yURN; | |
31 | import gov .va.med.Me diaType; | |
32 | import gov .va.med.OI D; | |
33 | import gov .va.med.Pa tientArtif actIdentif ierImpl; | |
34 | import gov .va.med.Pa tientIdent ifier; | |
35 | import gov .va.med.Ro utingToken ; | |
36 | import gov .va.med.Ro utingToken Impl; | |
37 | import gov .va.med.SE RIALIZATIO N_FORMAT; | |
38 | import gov .va.med.UR N; | |
39 | import gov .va.med.UR NFactory; | |
40 | import gov .va.med.ex ceptions.G lobalArtif actIdentif ierFormatE xception; | |
41 | import gov .va.med.ex ceptions.R outingToke nFormatExc eption; | |
42 | import gov .va.med.im aging.Abst ractImagin gURN; | |
43 | import gov .va.med.im aging.Cprs Identifier ; | |
44 | import gov .va.med.im aging.Imag eAnnotatio nURN; | |
45 | import gov .va.med.im aging.Imag eURN; | |
46 | import gov .va.med.im aging.Stri ngUtil; | |
47 | import gov .va.med.im aging.Stud yURN; | |
48 | import gov .va.med.im aging.arti factsource .ResolvedA rtifactSou rce; | |
49 | import gov .va.med.im aging.chan nels.Check sumValue; | |
50 | import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception; | |
51 | import gov .va.med.im aging.exce ptions.OID FormatExce ption; | |
52 | import gov .va.med.im aging.exce ptions.URN FormatExce ption; | |
53 | import gov .va.med.im aging.exch ange.Image AccessLogE vent; | |
54 | import gov .va.med.im aging.exch ange.Image AccessLogE vent.Image AccessLogE ventType; | |
55 | import gov .va.med.im aging.exch ange.Imagi ngLogEvent ; | |
56 | import gov .va.med.im aging.exch ange.Proce dureFilter ; | |
57 | import gov .va.med.im aging.exch ange.busin ess.Artifa ctResultEr ror; | |
58 | import gov .va.med.im aging.exch ange.busin ess.Artifa ctResults; | |
59 | import gov .va.med.im aging.exch ange.busin ess.Divisi on; | |
60 | import gov .va.med.im aging.exch ange.busin ess.Docume ntFilter; | |
61 | import gov .va.med.im aging.exch ange.busin ess.Electr onicSignat ureResult; | |
62 | import gov .va.med.im aging.exch ange.busin ess.Health SummaryTyp e; | |
63 | import gov .va.med.im aging.exch ange.busin ess.Image; | |
64 | import gov .va.med.im aging.exch ange.busin ess.ImageA ccessReaso n; | |
65 | import gov .va.med.im aging.exch ange.busin ess.ImageF ormatQuali ty; | |
66 | import gov .va.med.im aging.exch ange.busin ess.ImageF ormatQuali tyList; | |
67 | import gov .va.med.im aging.exch ange.busin ess.Passth roughInput Method; | |
68 | import gov .va.med.im aging.exch ange.busin ess.Passth roughParam eter; | |
69 | import gov .va.med.im aging.exch ange.busin ess.Passth roughParam eterType; | |
70 | import gov .va.med.im aging.exch ange.busin ess.Patien t; | |
71 | import gov .va.med.im aging.exch ange.busin ess.Patien t.PatientS ex; | |
72 | import gov .va.med.im aging.exch ange.busin ess.Patien tMeansTest Result; | |
73 | import gov .va.med.im aging.exch ange.busin ess.Patien tSensitive Value; | |
74 | import gov .va.med.im aging.exch ange.busin ess.Series ; | |
75 | import gov .va.med.im aging.exch ange.busin ess.Study; | |
76 | import gov .va.med.im aging.exch ange.busin ess.StudyF ilter; | |
77 | import gov .va.med.im aging.exch ange.busin ess.StudyS etResult; | |
78 | import gov .va.med.im aging.exch ange.busin ess.User; | |
79 | import gov .va.med.im aging.exch ange.busin ess.UserIn formation; | |
80 | import gov .va.med.im aging.exch ange.busin ess.WorkIt em; | |
81 | import gov .va.med.im aging.exch ange.busin ess.WorkIt emTag; | |
82 | import gov .va.med.im aging.exch ange.busin ess.WorkIt emTags; | |
83 | import gov .va.med.im aging.exch ange.busin ess.annota tions.Imag eAnnotatio n; | |
84 | import gov .va.med.im aging.exch ange.busin ess.annota tions.Imag eAnnotatio nDetails; | |
85 | import gov .va.med.im aging.exch ange.busin ess.annota tions.Imag eAnnotatio nSource; | |
86 | import gov .va.med.im aging.exch ange.busin ess.annota tions.Imag eAnnotatio nUser; | |
87 | import gov .va.med.im aging.exch ange.busin ess.docume nts.Docume nt; | |
88 | import gov .va.med.im aging.exch ange.busin ess.docume nts.Docume ntSet; | |
89 | import gov .va.med.im aging.exch ange.busin ess.docume nts.Docume ntSetResul t; | |
90 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.ActiveE xam; | |
91 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.ActiveE xams; | |
92 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.Exam; | |
93 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.ExamIma ge; | |
94 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.ExamIma ges; | |
95 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.ExamLis tResult; | |
96 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.ExamSit e; | |
97 | import gov .va.med.im aging.exch ange.busin ess.vistar ad.Patient Registrati on; | |
98 | import gov .va.med.im aging.exch ange.enums .ArtifactR esultError Code; | |
99 | import gov .va.med.im aging.exch ange.enums .ArtifactR esultError Severity; | |
100 | import gov .va.med.im aging.exch ange.enums .ArtifactR esultStatu s; | |
101 | import gov .va.med.im aging.exch ange.enums .ImageAcce ssReasonTy pe; | |
102 | import gov .va.med.im aging.exch ange.enums .ImageForm at; | |
103 | import gov .va.med.im aging.exch ange.enums .ImageQual ity; | |
104 | import gov .va.med.im aging.exch ange.enums .ObjectOri gin; | |
105 | import gov .va.med.im aging.exch ange.enums .ObjectSta tus; | |
106 | import gov .va.med.im aging.exch ange.enums .PatientSe nsitivityL evel; | |
107 | import gov .va.med.im aging.exch ange.enums .Procedure FilterMatc hMode; | |
108 | import gov .va.med.im aging.exch ange.enums .StudyDele tedImageSt ate; | |
109 | import gov .va.med.im aging.exch ange.enums .StudyLoad Level; | |
110 | import gov .va.med.im aging.exch ange.enums .vistarad. ExamStatus ; | |
111 | import gov .va.med.im aging.exch ange.trans lation.Abs tractTrans lator; | |
112 | import gov .va.med.im aging.exch ange.trans lation.exc eptions.Tr anslationE xception; | |
113 | import gov .va.med.im aging.fede ration.Fed erationArt ifactResul tError; | |
114 | import gov .va.med.im aging.fede ration.Fed erationUse r; | |
115 | import gov .va.med.im aging.fede ration.res t.types.Fe derationAc tiveExamTy pe; | |
116 | import gov .va.med.im aging.fede ration.res t.types.Fe derationAc tiveExamsT ype; | |
117 | import gov .va.med.im aging.fede ration.res t.types.Fe derationAr tifactResu ltErrorCod eType; | |
118 | import gov .va.med.im aging.fede ration.res t.types.Fe derationAr tifactResu ltErrorSev erityType; | |
119 | import gov .va.med.im aging.fede ration.res t.types.Fe derationAr tifactResu ltErrorTyp e; | |
120 | import gov .va.med.im aging.fede ration.res t.types.Fe derationAr tifactResu ltStatusTy pe; | |
121 | import gov .va.med.im aging.fede ration.res t.types.Fe derationAr tifactResu ltsType; | |
122 | import gov .va.med.im aging.fede ration.res t.types.Fe derationCh ecksumType ; | |
123 | import gov .va.med.im aging.fede ration.res t.types.Fe derationCp rsIdentifi erType; | |
124 | import gov .va.med.im aging.fede ration.res t.types.Fe derationCp rsIdentifi ersType; | |
125 | import gov .va.med.im aging.fede ration.res t.types.Fe derationDi visionType ; | |
126 | import gov .va.med.im aging.fede ration.res t.types.Fe derationDo cumentFilt erType; | |
127 | import gov .va.med.im aging.fede ration.res t.types.Fe derationDo cumentSetR esultType; | |
128 | import gov .va.med.im aging.fede ration.res t.types.Fe derationDo cumentSetT ype; | |
129 | import gov .va.med.im aging.fede ration.res t.types.Fe derationDo cumentType ; | |
130 | import gov .va.med.im aging.fede ration.res t.types.Fe derationEl ectronicSi gnatureRes ultType; | |
131 | import gov .va.med.im aging.fede ration.res t.types.Fe derationEx amImageTyp e; | |
132 | import gov .va.med.im aging.fede ration.res t.types.Fe derationEx amImagesTy pe; | |
133 | import gov .va.med.im aging.fede ration.res t.types.Fe derationEx amResultTy pe; | |
134 | import gov .va.med.im aging.fede ration.res t.types.Fe derationEx amStatusTy pe; | |
135 | import gov .va.med.im aging.fede ration.res t.types.Fe derationEx amType; | |
136 | import gov .va.med.im aging.fede ration.res t.types.Fe derationFi lterType; | |
137 | import gov .va.med.im aging.fede ration.res t.types.Fe derationHe althSummar yType; | |
138 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageAccessL ogEventTyp e; | |
139 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageAccessL ogEventTyp eType; | |
140 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageAccessR easonType; | |
141 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageAccessR easonTypeH olderType; | |
142 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageAccessR easonTypeT ype; | |
143 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageAnnotat ionDetails Type; | |
144 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageAnnotat ionSourceT ype; | |
145 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageAnnotat ionType; | |
146 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageAnnotat ionUserTyp e; | |
147 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageFormatQ ualitiesTy pe; | |
148 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageFormatQ ualityType ; | |
149 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm ageType; | |
150 | import gov .va.med.im aging.fede ration.res t.types.Fe derationIm agingLogEv entType; | |
151 | import gov .va.med.im aging.fede ration.res t.types.Fe derationMe diaType; | |
152 | import gov .va.med.im aging.fede ration.res t.types.Fe derationOb jectStatus Type; | |
153 | import gov .va.med.im aging.fede ration.res t.types.Fe derationPa tientMeans TestResult Type; | |
154 | import gov .va.med.im aging.fede ration.res t.types.Fe derationPa tientRegis trationTyp e; | |
155 | import gov .va.med.im aging.fede ration.res t.types.Fe derationPa tientSensi tiveType; | |
156 | import gov .va.med.im aging.fede ration.res t.types.Fe derationPa tientSensi tivityLeve lType; | |
157 | import gov .va.med.im aging.fede ration.res t.types.Fe derationPa tientSexTy pe; | |
158 | import gov .va.med.im aging.fede ration.res t.types.Fe derationPa tientType; | |
159 | import gov .va.med.im aging.fede ration.res t.types.Fe derationRe moteMethod ParameterT ype; | |
160 | import gov .va.med.im aging.fede ration.res t.types.Fe derationRe moteMethod ParameterT ypeType; | |
161 | import gov .va.med.im aging.fede ration.res t.types.Fe derationRe moteMethod ParameterV alueType; | |
162 | import gov .va.med.im aging.fede ration.res t.types.Fe derationRe moteMethod Type; | |
163 | import gov .va.med.im aging.fede ration.res t.types.Fe derationSe riesType; | |
164 | import gov .va.med.im aging.fede ration.res t.types.Fe derationSt ringArrayT ype; | |
165 | import gov .va.med.im aging.fede ration.res t.types.Fe derationSt udyDeleted ImageState Type; | |
166 | import gov .va.med.im aging.fede ration.res t.types.Fe derationSt udyLoadLev elType; | |
167 | import gov .va.med.im aging.fede ration.res t.types.Fe derationSt udyResultT ype; | |
168 | import gov .va.med.im aging.fede ration.res t.types.Fe derationSt udyType; | |
169 | import gov .va.med.im aging.fede ration.res t.types.Fe derationUs erInformat ionType; | |
170 | import gov .va.med.im aging.fede ration.res t.types.Fe derationUs erType; | |
171 | import gov .va.med.im aging.fede ration.res t.types.Fe derationWo rkItemType ; | |
172 | ||
173 | import jav a.text.Par seExceptio n; | |
174 | import jav a.util.Arr ayList; | |
175 | import jav a.util.Col lection; | |
176 | import jav a.util.Has hMap; | |
177 | import jav a.util.Ite rator; | |
178 | import jav a.util.Lis t; | |
179 | import jav a.util.Map ; | |
180 | import jav a.util.Map .Entry; | |
181 | import jav a.util.Set ; | |
182 | import jav a.util.Sor tedSet; | |
183 | import jav a.util.Tre eSet; | |
184 | ||
185 | import org .apache.lo gging.log4 j.LogManag er; | |
186 | import org .apache.lo gging.log4 j.Logger; | |
187 | ||
188 | /** | |
189 | * @author DNS werfej | |
190 | * | |
191 | */ | |
192 | public cla ss Federat ionRestTra nslator | |
193 | extends Ab stractTran slator | |
194 | { | |
195 | pr ivate stat ic Map<Stu dyLoadLeve l, Federat ionStudyLo adLevelTyp e> loadLev elMap; | |
196 | pr ivate stat ic Map<Pas sthroughPa rameterTyp e, Federat ionRemoteM ethodParam eterTypeTy pe> parame terTypeMap ; | |
197 | pr ivate stat ic Map<Exa mStatus, F ederationE xamStatusT ype> examS tatusMap; | |
198 | pr ivate stat ic Map<Ima geAccessLo gEventType , Federati onImageAcc essLogEven tTypeType> imageAcce ssMap; | |
199 | pr ivate stat ic Map<Pat ientSensit ivityLevel , Federati onPatientS ensitivity LevelType> patientSe nsitiveLev elMap; | |
200 | pr ivate stat ic Map<Pat ientSex, F ederationP atientSexT ype> patie ntSexMap; | |
201 | pr ivate stat ic Map<Obj ectStatus, Federatio nObjectSta tusType> o bjectStatu sMap; | |
202 | pr ivate stat ic Map<Stu dyDeletedI mageState, Federatio nStudyDele tedImageSt ateType> s tudyDelete dImageStat eMap; | |
203 | pr ivate stat ic Map<Art ifactResul tStatus, F ederationA rtifactRes ultStatusT ype> artif actResultS tatusMap; | |
204 | pr ivate stat ic Map<Med iaType, Fe derationMe diaType> m ediaTypeMa p; | |
205 | pr ivate stat ic Map<Art ifactResul tErrorCode , Federati onArtifact ResultErro rCodeType> artifactR esultError CodeMap; | |
206 | pr ivate stat ic Map<Art ifactResul tErrorSeve rity, Fede rationArti factResult ErrorSever ityType> a rtifactRes ultErrorSe verityMap; | |
207 | pr ivate stat ic Map<Ima geAnnotati onSource, Federation ImageAnnot ationSourc eType> ima geAnnotati onSourceMa p; | |
208 | pr ivate stat ic Map<Ima geAccessRe asonType, Federation ImageAcces sReasonTyp eType> ima geAccessRe asonTypesM ap; | |
209 | ||
210 | st atic | |
211 | { | |
212 | load LevelMap = new HashM ap<StudyLo adLevel, F ederationS tudyLoadLe velType>() ; | |
213 | load LevelMap.p ut(StudyLo adLevel.FU LL, Federa tionStudyL oadLevelTy pe.FULL); | |
214 | load LevelMap.p ut(StudyLo adLevel.ST UDY_AND_RE PORT, Fede rationStud yLoadLevel Type.STUDY _AND_REPOR T); | |
215 | load LevelMap.p ut(StudyLo adLevel.ST UDY_AND_IM AGES, Fede rationStud yLoadLevel Type.STUDY _AND_IMAGE S); | |
216 | load LevelMap.p ut(StudyLo adLevel.ST UDY_ONLY, Federation StudyLoadL evelType.S TUDY_ONLY) ; | |
217 | load LevelMap.p ut(StudyLo adLevel.ST UDY_ONLY_N OSERIES, F ederationS tudyLoadLe velType.ST UDY_ONLY_N OSERIES); | |
218 | ||
219 | para meterTypeM ap = new H ashMap<Pas sthroughPa rameterTyp e, Federat ionRemoteM ethodParam eterTypeTy pe>(); | |
220 | para meterTypeM ap.put(Pas sthroughPa rameterTyp e.literal, Federatio nRemoteMet hodParamet erTypeType .LITERAL); | |
221 | para meterTypeM ap.put(Pas sthroughPa rameterTyp e.list, Fe derationRe moteMethod ParameterT ypeType.LI ST); | |
222 | para meterTypeM ap.put(Pas sthroughPa rameterTyp e.referenc e, Federat ionRemoteM ethodParam eterTypeTy pe.REFEREN CE); | |
223 | ||
224 | exam StatusMap = new Hash Map<ExamSt atus, Fede rationExam StatusType >(); | |
225 | exam StatusMap. put(ExamSt atus.INTER PRETED, Fe derationEx amStatusTy pe.INTERPR ETED); | |
226 | exam StatusMap. put(ExamSt atus.NOT_I NTERPRETED , Federati onExamStat usType.NOT _INTERPRET ED); | |
227 | ||
228 | imag eAccessMap = new Has hMap<Image AccessLogE ventType, Federation ImageAcces sLogEventT ypeType>() ; | |
229 | imag eAccessMap .put(Image AccessLogE ventType.I MAGE_COPY, Federatio nImageAcce ssLogEvent TypeType.I MAGE_COPY) ; | |
230 | imag eAccessMap .put(Image AccessLogE ventType.I MAGE_PRINT , Federati onImageAcc essLogEven tTypeType. IMAGE_PRIN T); | |
231 | imag eAccessMap .put(Image AccessLogE ventType.P ATIENT_ID_ MISMATCH, Federation ImageAcces sLogEventT ypeType.PA TIENT_ID_M ISMATCH); | |
232 | imag eAccessMap .put(Image AccessLogE ventType.R ESTRICTED_ ACCESS, Fe derationIm ageAccessL ogEventTyp eType.REST RICTED_ACC ESS); | |
233 | imag eAccessMap .put(Image AccessLogE ventType.I MAGE_ACCES S, Federa tionImageA ccessLogEv entTypeTyp e.IMAGE_AC CESS); | |
234 | ||
235 | pati entSensiti veLevelMap = new Has hMap<Patie ntSensitiv ityLevel, Federation PatientSen sitivityLe velType>() ; | |
236 | pati entSensiti veLevelMap .put(Patie ntSensitiv ityLevel.A CCESS_DENI ED, Federa tionPatien tSensitivi tyLevelTyp e.ACCESS_D ENIED); | |
237 | pati entSensiti veLevelMap .put(Patie ntSensitiv ityLevel.D ATASOURCE_ FAILURE, F ederationP atientSens itivityLev elType.DAT ASOURCE_FA ILURE); | |
238 | pati entSensiti veLevelMap .put(Patie ntSensitiv ityLevel.D ISPLAY_WAR NING, Fede rationPati entSensiti vityLevelT ype.DISPLA Y_WARNING) ; | |
239 | pati entSensiti veLevelMap .put(Patie ntSensitiv ityLevel.D ISPLAY_WAR NING_CANNO T_CONTINUE , | |
240 | Federati onPatientS ensitivity LevelType. DISPLAY_WA RNING_CANN OT_CONTINU E); | |
241 | pati entSensiti veLevelMap .put(Patie ntSensitiv ityLevel.D ISPLAY_WAR NING_REQUI RE_OK, Fed erationPat ientSensit ivityLevel Type.DISPL AY_WARNING _REQUIRE_O K); | |
242 | pati entSensiti veLevelMap .put(Patie ntSensitiv ityLevel.N O_ACTION_R EQUIRED, F ederationP atientSens itivityLev elType.NO_ ACTION_REQ UIRED); | |
243 | ||
244 | pati entSexMap = new Hash Map<Patien tSex, Fede rationPati entSexType >(); | |
245 | pati entSexMap. put(Patien tSex.Male, Federatio nPatientSe xType.Male ); | |
246 | pati entSexMap. put(Patien tSex.Femal e, Federat ionPatient SexType.Fe male); | |
247 | pati entSexMap. put(Patien tSex.Unkno wn, Federa tionPatien tSexType.U nknown); | |
248 | ||
249 | obje ctStatusMa p = new Ha shMap<Obje ctStatus, Federation ObjectStat usType>(); | |
250 | obje ctStatusMa p.put(Obje ctStatus.C ONTROLLED, Federatio nObjectSta tusType.CO NTROLLED); | |
251 | obje ctStatusMa p.put(Obje ctStatus.D ELETED, Fe derationOb jectStatus Type.DELET ED); | |
252 | obje ctStatusMa p.put(Obje ctStatus.I MAGE_GROUP , Federati onObjectSt atusType.I MAGE_GROUP ); | |
253 | obje ctStatusMa p.put(Obje ctStatus.I N_PROGRESS , Federati onObjectSt atusType.I N_PROGRESS ); | |
254 | obje ctStatusMa p.put(Obje ctStatus.N EEDS_REFRE SH, Federa tionObject StatusType .NEEDS_REF RESH); | |
255 | obje ctStatusMa p.put(Obje ctStatus.N EEDS_REVIE W, Federat ionObjectS tatusType. NEEDS_REVI EW); | |
256 | obje ctStatusMa p.put(Obje ctStatus.N O_STATUS, Federation ObjectStat usType.NO_ STATUS); | |
257 | obje ctStatusMa p.put(Obje ctStatus.Q A_REVIEWED , Federati onObjectSt atusType.Q A_REVIEWED ); | |
258 | obje ctStatusMa p.put(Obje ctStatus.Q UESTIONABL E_INTEGRIT Y, Federat ionObjectS tatusType. QUESTIONAB LE_INTEGRI TY); | |
259 | obje ctStatusMa p.put(Obje ctStatus.R AD_EXAM_ST ATUS_BLOCK , Federati onObjectSt atusType.R AD_EXAM_ST ATUS_BLOCK ); | |
260 | obje ctStatusMa p.put(Obje ctStatus.T IU_AUTHORI ZATION_BLO CK, Federa tionObject StatusType .TIU_AUTHO RIZATION_B LOCK); | |
261 | obje ctStatusMa p.put(Obje ctStatus.U NKNOWN, Fe derationOb jectStatus Type.UNKNO WN); | |
262 | obje ctStatusMa p.put(Obje ctStatus.V IEWABLE, F ederationO bjectStatu sType.VIEW ABLE); | |
263 | ||
264 | stud yDeletedIm ageStateMa p = new Ha shMap<Stud yDeletedIm ageState, Federation StudyDelet edImageSta teType>(); | |
265 | stud yDeletedIm ageStateMa p.put(Stud yDeletedIm ageState.c annotInclu deDeletedI mages, Fed erationStu dyDeletedI mageStateT ype.cannot IncludeDel etedImages ); | |
266 | stud yDeletedIm ageStateMa p.put(Stud yDeletedIm ageState.d oesNotIncl udeDeleted Images, Fe derationSt udyDeleted ImageState Type.doesN otIncludeD eletedImag es); | |
267 | stud yDeletedIm ageStateMa p.put(Stud yDeletedIm ageState.i ncludesDel etedImages , Federati onStudyDel etedImageS tateType.i ncludesDel etedImages ); | |
268 | ||
269 | arti factResult StatusMap = new Hash Map<Artifa ctResultSt atus, Fede rationArti factResult StatusType >(); | |
270 | arti factResult StatusMap. put(Artifa ctResultSt atus.fullR esult, Fed erationArt ifactResul tStatusTyp e.fullResu lt); | |
271 | arti factResult StatusMap. put(Artifa ctResultSt atus.parti alResult, Federation ArtifactRe sultStatus Type.parti alResult); | |
272 | arti factResult StatusMap. put(Artifa ctResultSt atus.error Result, Fe derationAr tifactResu ltStatusTy pe.errorRe sult); | |
273 | ||
274 | medi aTypeMap = new HashM ap<MediaTy pe, Federa tionMediaT ype>(); | |
275 | medi aTypeMap.p ut(MediaTy pe.APPLICA TION_DICOM , Federati onMediaTyp e.APPLICAT ION_DICOM) ; | |
276 | medi aTypeMap.p ut(MediaTy pe.APPLICA TION_DOC, Federation MediaType. APPLICATIO N_DOC); | |
277 | medi aTypeMap.p ut(MediaTy pe.APPLICA TION_OCTET STREAM, Fe derationMe diaType.AP PLICATION_ OCTETSTREA M); | |
278 | medi aTypeMap.p ut(MediaTy pe.APPLICA TION_PDF, Federation MediaType. APPLICATIO N_PDF); | |
279 | medi aTypeMap.p ut(MediaTy pe.APPLICA TION_EXCEL , Federati onMediaTyp e.APPLICAT ION_EXCEL) ; | |
280 | medi aTypeMap.p ut(MediaTy pe.APPLICA TION_PPT, Federation MediaType. APPLICATIO N_PPT); | |
281 | medi aTypeMap.p ut(MediaTy pe.APPLICA TION_RTF, Federation MediaType. APPLICATIO N_RTF); | |
282 | medi aTypeMap.p ut(MediaTy pe.APPLICA TION_DOCX, Federatio nMediaType .APPLICATI ON_DOCX); | |
283 | medi aTypeMap.p ut(MediaTy pe.AUDIO_M P4, Federa tionMediaT ype.AUDIO_ MP4); | |
284 | medi aTypeMap.p ut(MediaTy pe.AUDIO_M PEG, Feder ationMedia Type.AUDIO _MPEG); | |
285 | medi aTypeMap.p ut(MediaTy pe.AUDIO_W AV, Federa tionMediaT ype.AUDIO_ WAV); | |
286 | medi aTypeMap.p ut(MediaTy pe.IMAGE_B MP, Federa tionMediaT ype.IMAGE_ BMP); | |
287 | medi aTypeMap.p ut(MediaTy pe.IMAGE_X BMP, Feder ationMedia Type.IMAGE _XBMP); | |
288 | medi aTypeMap.p ut(MediaTy pe.IMAGE_J 2K, Federa tionMediaT ype.IMAGE_ J2K); | |
289 | medi aTypeMap.p ut(MediaTy pe.IMAGE_J P2, Federa tionMediaT ype.IMAGE_ JP2); | |
290 | medi aTypeMap.p ut(MediaTy pe.IMAGE_J PEG, Feder ationMedia Type.IMAGE _JPEG); | |
291 | medi aTypeMap.p ut(MediaTy pe.IMAGE_P NG, Federa tionMediaT ype.IMAGE_ PNG); | |
292 | medi aTypeMap.p ut(MediaTy pe.IMAGE_T GA, Federa tionMediaT ype.IMAGE_ TGA); | |
293 | medi aTypeMap.p ut(MediaTy pe.IMAGE_T IFF, Feder ationMedia Type.IMAGE _TIFF); | |
294 | medi aTypeMap.p ut(MediaTy pe.MULTIPA RT_FORM_DA TA, Federa tionMediaT ype.MULTIP ART_FORM_D ATA); | |
295 | medi aTypeMap.p ut(MediaTy pe.MULTIPA RT_MIXED, Federation MediaType. MULTIPART_ MIXED); | |
296 | medi aTypeMap.p ut(MediaTy pe.TEXT_CS S, Federat ionMediaTy pe.TEXT_CS S); | |
297 | medi aTypeMap.p ut(MediaTy pe.TEXT_CS V, Federat ionMediaTy pe.TEXT_CS V); | |
298 | medi aTypeMap.p ut(MediaTy pe.TEXT_EN RICHED, Fe derationMe diaType.TE XT_ENRICHE D); | |
299 | medi aTypeMap.p ut(MediaTy pe.TEXT_HT ML, Federa tionMediaT ype.TEXT_H TML); | |
300 | medi aTypeMap.p ut(MediaTy pe.TEXT_PL AIN, Feder ationMedia Type.TEXT_ PLAIN); | |
301 | medi aTypeMap.p ut(MediaTy pe.TEXT_RT F, Federat ionMediaTy pe.TEXT_RT F); | |
302 | medi aTypeMap.p ut(MediaTy pe.TEXT_TS V, Federat ionMediaTy pe.TEXT_TS V); | |
303 | medi aTypeMap.p ut(MediaTy pe.TEXT_UR I_LIST, Fe derationMe diaType.TE XT_URI_LIS T); | |
304 | medi aTypeMap.p ut(MediaTy pe.TEXT_XM L, Federat ionMediaTy pe.TEXT_XM L); | |
305 | medi aTypeMap.p ut(MediaTy pe.TEXT_XM L_EXTERNAL _PARSED_EN TITY, Fede rationMedi aType.TEXT _XML_EXTER NAL_PARSED _ENTITY); | |
306 | medi aTypeMap.p ut(MediaTy pe.VIDEO_A VI, Federa tionMediaT ype.VIDEO_ AVI); | |
307 | medi aTypeMap.p ut(MediaTy pe.VIDEO_B MPEG, Fede rationMedi aType.VIDE O_BMPEG); | |
308 | medi aTypeMap.p ut(MediaTy pe.VIDEO_J PEG, Feder ationMedia Type.VIDEO _JPEG); | |
309 | medi aTypeMap.p ut(MediaTy pe.VIDEO_J PEG2000, F ederationM ediaType.V IDEO_JPEG2 000); | |
310 | medi aTypeMap.p ut(MediaTy pe.VIDEO_M P4, Federa tionMediaT ype.VIDEO_ MP4); | |
311 | medi aTypeMap.p ut(MediaTy pe.VIDEO_M PEG, Feder ationMedia Type.VIDEO _MPEG); | |
312 | medi aTypeMap.p ut(MediaTy pe.VIDEO_M PEG4_GENER IC, Federa tionMediaT ype.VIDEO_ MPEG4_GENE RIC); | |
313 | medi aTypeMap.p ut(MediaTy pe.VIDEO_O GG, Federa tionMediaT ype.VIDEO_ OGG); | |
314 | medi aTypeMap.p ut(MediaTy pe.VIDEO_Q UICKTIME, Federation MediaType. VIDEO_QUIC KTIME); | |
315 | ||
316 | arti factResult ErrorCodeM ap = new H ashMap<Art ifactResul tErrorCode , Federati onArtifact ResultErro rCodeType> (); | |
317 | arti factResult ErrorCodeM ap.put(Art ifactResul tErrorCode .authoriza tionExcept ion, Feder ationArtif actResultE rrorCodeTy pe.authori zationExce ption); | |
318 | arti factResult ErrorCodeM ap.put(Art ifactResul tErrorCode .internalE xception, Federation ArtifactRe sultErrorC odeType.in ternalExce ption); | |
319 | arti factResult ErrorCodeM ap.put(Art ifactResul tErrorCode .invalidRe questExcep tion, Fede rationArti factResult ErrorCodeT ype.invali dRequestEx ception); | |
320 | arti factResult ErrorCodeM ap.put(Art ifactResul tErrorCode .timeoutEx ception, F ederationA rtifactRes ultErrorCo deType.tim eoutExcept ion); | |
321 | arti factResult ErrorCodeM ap.put(Art ifactResul tErrorCode .unknownPa tientId, F ederationA rtifactRes ultErrorCo deType.unk nownPatien tId); | |
322 | ||
323 | arti factResult ErrorSever ityMap = n ew HashMap <ArtifactR esultError Severity, Federation ArtifactRe sultErrorS everityTyp e>(); | |
324 | arti factResult ErrorSever ityMap.put (ArtifactR esultError Severity.e rror, Fede rationArti factResult ErrorSever ityType.er ror); | |
325 | arti factResult ErrorSever ityMap.put (ArtifactR esultError Severity.w arning, Fe derationAr tifactResu ltErrorSev erityType. warning); | |
326 | ||
327 | imag eAnnotatio nSourceMap = new Has hMap<Image Annotation Source, Fe derationIm ageAnnotat ionSourceT ype>(); | |
328 | imag eAnnotatio nSourceMap .put(Image Annotation Source.cli nicalDispl ay, Federa tionImageA nnotationS ourceType. clinicalDi splay); | |
329 | imag eAnnotatio nSourceMap .put(Image Annotation Source.vis taRad, Fed erationIma geAnnotati onSourceTy pe.vistaRa d); | |
330 | imag eAnnotatio nSourceMap .put(Image Annotation Source.cli nicalCaptu re, Federa tionImageA nnotationS ourceType. clinicalCa pture); | |
331 | ||
332 | imag eAccessRea sonTypesMa p = new Ha shMap<Imag eAccessRea sonType, F ederationI mageAccess ReasonType Type>(); | |
333 | imag eAccessRea sonTypesMa p.put(Imag eAccessRea sonType.ch angingImag eStatus, F ederationI mageAccess ReasonType Type.chang ingImageSt atus); | |
334 | imag eAccessRea sonTypesMa p.put(Imag eAccessRea sonType.co pyImage, F ederationI mageAccess ReasonType Type.copyI mage); | |
335 | imag eAccessRea sonTypesMa p.put(Imag eAccessRea sonType.de leteImage, Federatio nImageAcce ssReasonTy peType.del eteImage); | |
336 | imag eAccessRea sonTypesMa p.put(Imag eAccessRea sonType.pr intImage, Federation ImageAcces sReasonTyp eType.prin tImage); | |
337 | ||
338 | } | |
339 | ||
340 | pu blic stati c Federati onCprsIden tifierType translate (CprsIdent ifier cprs Identifier ) | |
341 | { | |
342 | Fede rationCprs Identifier Type resul t = | |
343 | new Fe derationCp rsIdentifi erType(); | |
344 | ||
345 | resu lt.setCprs Identifier (cprsIdent ifier.getC prsIdentif ier()); | |
346 | ||
347 | retu rn result; | |
348 | } | |
349 | ||
350 | ||
351 | pu blic stati c Federati onCprsIden tifiersTyp e translat eCprsIdent ifierList( List<CprsI dentifier> cprsIdent ifiers) | |
352 | { | |
353 | if(c prsIdentif iers == nu ll) | |
354 | return null; | |
355 | ||
356 | Stri ng[] list = new Stri ng[cprsIde ntifiers.s ize()]; | |
357 | for( int i=0; i <cprsIdent ifiers.siz e(); i++){ | |
358 | list[i ] = cprsId entifiers. get(i).get CprsIdenti fier(); | |
359 | } | |
360 | Fede rationCprs Identifier sType resu lt = | |
361 | new Fe derationCp rsIdentifi ersType(); | |
362 | ||
363 | resu lt.setCprs Identifier s(list); | |
364 | ||
365 | retu rn result; | |
366 | } | |
367 | ||
368 | pu blic stati c List<Cpr sIdentifie r> transla te(Federat ionCprsIde ntifiersTy pe cprsIde ntifiers){ | |
369 | if(c prsIdentif iers == nu ll){ | |
370 | return null; | |
371 | } | |
372 | ||
373 | Stri ng[] list = cprsIden tifiers.ge tCprsIdent ifiers(); | |
374 | List <CprsIdent ifier> res ult = new ArrayList< CprsIdenti fier>(list .length); | |
375 | for( int i=0; i <list.leng th; i++){ | |
376 | result .add(new C prsIdentif ier(list[i ])); | |
377 | } | |
378 | retu rn result; | |
379 | } | |
380 | ||
381 | pu blic stati c ImageAcc essLogEven t translat e(Federati onImageAcc essLogEven tType logE ventType) | |
382 | { | |
383 | if(l ogEventTyp e == null) | |
384 | return null; | |
385 | ||
386 | Imag eAccessLog EventType imageAcces sLogEventT ype = | |
387 | transl ate(logEve ntType.get EventType( )); | |
388 | ||
389 | Imag eAccessLog Event resu lt = | |
390 | new Im ageAccessL ogEvent(lo gEventType .getImageI d(), "", l ogEventTyp e.getPatie ntIcn(), | |
391 | logEventTy pe.getSite Number(), System.cur rentTimeMi llis(), | |
392 | logEventTy pe.getReas onCode(), logEventTy pe.getReas onDescript ion(), | |
393 | imageAcces sLogEventT ype, logEv entType.ge tUserSiteN umber()); | |
394 | ||
395 | retu rn result; | |
396 | } | |
397 | ||
398 | pu blic stati c Federati onImageAcc essLogEven tType tran slate( | |
399 | ImageA ccessLogEv ent logEve nt) | |
400 | { | |
401 | Fede rationImag eAccessLog EventType result = n ew Federat ionImageAc cessLogEve ntType(); | |
402 | resu lt.setImag eId(logEve nt.getImag eIen()); | |
403 | resu lt.setPati entIcn(log Event.getP atientIcn( )); | |
404 | resu lt.setReas onCode(log Event.getR easonCode( )); | |
405 | resu lt.setReas onDescript ion(logEve nt.getReas onDescript ion()); | |
406 | resu lt.setSite Number(log Event.getS iteNumber( )); | |
407 | resu lt.setEven tType(tran slate(logE vent.getEv entType()) ); | |
408 | resu lt.setUser SiteNumber (logEvent. getUserSit eNumber()) ; | |
409 | retu rn result; | |
410 | } | |
411 | ||
412 | pu blic stati c ImageAcc essLogEven tType tran slate(Fede rationImag eAccessLog EventTypeT ype eventT ype) | |
413 | { | |
414 | for( Entry<Ima geAccessLo gEventType , Federati onImageAcc essLogEven tTypeType> entry : F ederationR estTransla tor.imageA ccessMap.e ntrySet() ) | |
415 | if( en try.getVal ue() == ev entType ) | |
416 | return e ntry.getKe y(); | |
417 | ||
418 | retu rn ImageAc cessLogEve ntType.IMA GE_ACCESS; | |
419 | } | |
420 | ||
421 | pu blic stati c Federati onImageAcc essLogEven tTypeType translate( ImageAcces sLogEventT ype eventT ype) | |
422 | { | |
423 | for( Entry<Ima geAccessLo gEventType , Federati onImageAcc essLogEven tTypeType> entry : F ederationR estTransla tor.imageA ccessMap.e ntrySet() ) | |
424 | if( en try.getKey () == even tType ) | |
425 | return e ntry.getVa lue(); | |
426 | ||
427 | retu rn Federat ionImageAc cessLogEve ntTypeType .IMAGE_ACC ESS; | |
428 | } | |
429 | ||
430 | pu blic stati c String [ ] translat eStringArr ay(Federat ionStringA rrayType v alues) | |
431 | { | |
432 | if(v alues == n ull) | |
433 | return null; | |
434 | // J ersey seem s to conve rt empty s tring arra ys into nu ll respons es | |
435 | // w hen reques ting treat ing sites for a pati ent, the r esult is e xpected to be an emp ty array i f no sites for the p atient | |
436 | if(v alues.getV alues() == null) | |
437 | return new Strin g[0]; | |
438 | retu rn values. getValues( ); | |
439 | } | |
440 | ||
441 | pu blic stati c Federati onStringAr rayType tr anslateStr ingList(Li st<String> values) | |
442 | { | |
443 | if(v alues == n ull) | |
444 | return null; | |
445 | Fede rationStri ngArrayTyp e result = new Feder ationStrin gArrayType (); | |
446 | Stri ng [] arra y = new St ring[value s.size()]; | |
447 | for( int i = 0; i < value s.size(); i++) | |
448 | { | |
449 | array[ i] = value s.get(i); | |
450 | } | |
451 | resu lt.setValu es(array); | |
452 | ||
453 | retu rn result; | |
454 | } | |
455 | ||
456 | pu blic stati c Federati onStringAr rayType tr anslateStr ingArray(S tring [] v alues) | |
457 | { | |
458 | Fede rationStri ngArrayTyp e result = new Feder ationStrin gArrayType (); | |
459 | resu lt.setValu es(values) ; | |
460 | ||
461 | retu rn result; | |
462 | } | |
463 | ||
464 | pu blic stati c PatientR egistratio n translat e( | |
465 | Fede rationPati entRegistr ationType patientReg istration) | |
466 | { | |
467 | Pati entRegistr ation resu lt = new P atientRegi stration() ; | |
468 | resu lt.setCptC ode(patien tRegistrat ion.getCpt Code()); | |
469 | resu lt.setPati entIcn(pat ientRegist ration.get PatientIcn ()); | |
470 | retu rn result; | |
471 | } | |
472 | ||
473 | pu blic stati c Federati onPatientR egistratio nType tran slate( | |
474 | Pati entRegistr ation pati entRegistr ation) | |
475 | { | |
476 | Fede rationPati entRegistr ationType result = n ew Federat ionPatient Registrati onType(); | |
477 | resu lt.setCptC ode(patien tRegistrat ion.getCpt Code()); | |
478 | resu lt.setPati entIcn(pat ientRegist ration.get PatientIcn ()); | |
479 | retu rn result; | |
480 | } | |
481 | ||
482 | pu blic stati c ExamList Result tra nslate(Fed erationExa mResultTyp e examResu lt) | |
483 | th rows URNFo rmatExcept ion | |
484 | { | |
485 | if(e xamResult == null) | |
486 | { | |
487 | getLog ger().erro r("Null Fe derationEx amResultTy pe, return ing empty ExamListRe sult"); | |
488 | return ExamListR esult.crea teFullResu lt(null); | |
489 | } | |
490 | List <Exam> exa ms = trans late(examR esult.getE xams()); | |
491 | Arti factResult Status art ifactResul tStatus = translate( examResult .getArtifa ctResultSt atus()); | |
492 | List <ArtifactR esultError > artifact ResultErro rs = trans late(examR esult.getE rrors()); | |
493 | retu rn ExamLis tResult.cr eate(exams , artifact ResultStat us, artifa ctResultEr rors); | |
494 | } | |
495 | ||
496 | pr ivate stat ic List<Ex am> transl ate(Federa tionExamTy pe [] exam s) | |
497 | th rows URNFo rmatExcept ion | |
498 | { | |
499 | if(e xams == nu ll) | |
500 | { | |
501 | getLog ger().warn ("Received null exam s, returni ng empty a rray of ex ams."); | |
502 | return new Array List<Exam> (0); | |
503 | } | |
504 | List <Exam> res ult = new ArrayList< Exam>(exam s.length); | |
505 | ||
506 | for( Federation ExamType e xam : exam s) | |
507 | { | |
508 | result .add(trans late(exam) ); | |
509 | } | |
510 | retu rn result; | |
511 | } | |
512 | ||
513 | pu blic stati c Federati onExamResu ltType tra nslate( | |
514 | Exam Site examS ite) | |
515 | th rows Trans lationExce ption | |
516 | { | |
517 | Fede rationExam ResultType result = new Federa tionExamRe sultType() ; | |
518 | if(e xamSite == null) | |
519 | return result; | |
520 | Fede rationExam Type [] ex ams = new Federation ExamType[e xamSite.si ze()]; | |
521 | ||
522 | int i = 0; | |
523 | for( Exam exam : examSite ) | |
524 | exams[ i++] = tra nslate(exa m); | |
525 | ||
526 | resu lt.setExam s(exams); | |
527 | resu lt.setArti factResult Status(tra nslate(exa mSite.getA rtifactRes ultStatus( ))); | |
528 | resu lt.setErro rs(transla teArtifact ResultErro rList(exam Site.getAr tifactResu ltErrors() )); | |
529 | retu rn result; | |
530 | } | |
531 | ||
532 | pu blic stati c ActiveEx am transla te(Federat ionActiveE xamType ac tiveExam) | |
533 | { | |
534 | Acti veExam res ult = new ActiveExam ( | |
535 | active Exam.getSi teNumber() , | |
536 | active Exam.getEx amId(), | |
537 | active Exam.getPa tientIcn() ); | |
538 | resu lt.setRawV alue(activ eExam.getR awValue()) ; | |
539 | retu rn result; | |
540 | } | |
541 | ||
542 | pu blic stati c ActiveEx ams transl ate(Federa tionActive ExamsType activeExam s) | |
543 | { | |
544 | Stri ng rawHead er1 = (act iveExams.g etRawHeade r1() == nu ll ? "" : activeExam s.getRawHe ader1()); | |
545 | Stri ng rawHead er2 = (act iveExams.g etRawHeade r2() == nu ll ? "" : activeExam s.getRawHe ader2()); | |
546 | ||
547 | Acti veExams re sult = new ActiveExa ms( | |
548 | active Exams.getS iteNumber( ), | |
549 | rawHea der1, | |
550 | rawHea der2); | |
551 | // i f there ar e no activ e exams re turned fro m the web service ca ll, the ge tActiveExa ms appears to | |
552 | // t urn into n ull, so ne ed to chec k for null | |
553 | if(a ctiveExams .getActive Exams() != null) | |
554 | { | |
555 | for(Fe derationAc tiveExamTy pe activeE xam : acti veExams.ge tActiveExa ms()) | |
556 | result.a dd(transla te(activeE xam)); | |
557 | } | |
558 | ||
559 | retu rn result; | |
560 | } | |
561 | ||
562 | pu blic stati c Federati onActiveEx amType tra nslate( | |
563 | Active Exam activ eExam) | |
564 | { | |
565 | Fede rationActi veExamType result = new Federa tionActive ExamType() ; | |
566 | ||
567 | resu lt.setExam Id(activeE xam.getExa mId()); | |
568 | resu lt.setPati entIcn(act iveExam.ge tPatientIc n()); | |
569 | resu lt.setRawV alue(activ eExam.getR awValue()) ; | |
570 | resu lt.setSite Number(act iveExam.ge tSiteNumbe r()); | |
571 | ||
572 | retu rn result; | |
573 | } | |
574 | ||
575 | pu blic stati c Federati onActiveEx amsType tr anslate( | |
576 | Active Exams acti veExams) | |
577 | { | |
578 | Fede rationActi veExamsTyp e result = new Feder ationActiv eExamsType (); | |
579 | resu lt.setRawH eader1(act iveExams.g etRawHeade r1()); | |
580 | resu lt.setRawH eader2(act iveExams.g etRawHeade r2()); | |
581 | resu lt.setSite Number(act iveExams.g etSiteNumb er()); | |
582 | ||
583 | Fede rationActi veExamType [] active ExamArray = new Fede rationActi veExamType [activeExa ms.size()] ; | |
584 | int i = 0; | |
585 | for( ActiveExam activeExa m : active Exams) | |
586 | { | |
587 | active ExamArray[ i] = trans late(activ eExam); | |
588 | i++; | |
589 | } | |
590 | resu lt.setActi veExams(ac tiveExamAr ray); | |
591 | ||
592 | retu rn result; | |
593 | } | |
594 | ||
595 | pu blic stati c ExamImag e translat e(Federati onExamImag eType exam Image) | |
596 | th rows URNFo rmatExcept ion | |
597 | { | |
598 | if(e xamImage = = null) | |
599 | return null; | |
600 | Exam Image resu lt = ExamI mage.creat e( | |
601 | examIm age.getSit eNumber(), | |
602 | examIm age.getIma geId(), | |
603 | examIm age.getExa mId(), | |
604 | examIm age.getPat ientIcn()) ; | |
605 | resu lt.setDiag nosticFile Path(examI mage.getBi gImageFile name()); | |
606 | resu lt.setPati entName("" ); | |
607 | resu lt.setAlie nSiteNumbe r(examImag e.getAlien SiteNumber ()); | |
608 | retu rn result; | |
609 | } | |
610 | ||
611 | pu blic stati c ExamImag es transla te(Federat ionExamIma gesType ex amImages) | |
612 | th rows URNFo rmatExcept ion | |
613 | { | |
614 | Exam Images res ult = new ExamImages (examImage s.getRawHe ader(), fa lse); | |
615 | ||
616 | if(e xamImages. getImages( ) != null) | |
617 | { | |
618 | for(Fe derationEx amImageTyp e examImag e : examIm ages.getIm ages()) | |
619 | { | |
620 | ExamImag e img = tr anslate(ex amImage); | |
621 | if(img ! = null) | |
622 | result.add (img); | |
623 | } | |
624 | } | |
625 | retu rn result; | |
626 | } | |
627 | ||
628 | pu blic stati c Exam tra nslate(Fed erationExa mType exam ) | |
629 | th rows URNFo rmatExcept ion | |
630 | { | |
631 | Exam result = Exam.creat e( | |
632 | exam.g etSiteNumb er(), | |
633 | exam.g etExamId() , | |
634 | exam.g etPatientI cn()); | |
635 | resu lt.setCptC ode(exam.g etCptCode( )); // CTB 29M ar2010, nu ll was tra nsformed t o blank | |
636 | resu lt.setExam Report(exa m.getRadio logyReport ()); // wa nt it null if it is null | |
637 | resu lt.setExam Requisitio nReport(ex am.getRequ isitionRep ort());// want it nu ll if it i s null | |
638 | resu lt.setExam Status(tra nslate(exa m.getExamS tatus())); | |
639 | ||
640 | // t his indica tes the im ages were not includ ed (shallo w exam) | |
641 | if(e xam.getExa mImages() == null) | |
642 | result .setImages (null); | |
643 | else | |
644 | result .setImages (translate (exam.getE xamImages( ))); | |
645 | resu lt.setPres entationSt ateData(ex am.getPres entationSt ate()); // don't che ck for nul l, want nu ll if null value | |
646 | resu lt.setModa lity(exam. getModalit y()); | |
647 | resu lt.setPati entName(ex am.getPati entName()) ; | |
648 | resu lt.setRawH eaderLine1 (exam.getR awHeader1( )); | |
649 | resu lt.setRawH eaderLine2 (exam.getR awHeader2( )); | |
650 | resu lt.setRawO utput(exam .getRawVal ue()); | |
651 | resu lt.setSite Abbr(exam. getSiteAbb r()); | |
652 | resu lt.setSite Name(exam. getSiteNam e()); | |
653 | retu rn result; | |
654 | } | |
655 | ||
656 | pu blic stati c Federati onExamType translate (Exam exam ) | |
657 | { | |
658 | Fede rationExam Type resul t = new Fe derationEx amType(); | |
659 | ||
660 | resu lt.setCptC ode(exam.g etCptCode( )); | |
661 | resu lt.setExam Id(exam.ge tExamId()) ; | |
662 | resu lt.setExam Status( tr anslate(ex am.getExam Status()) ); | |
663 | resu lt.setModa lity(exam. getModalit y()); | |
664 | resu lt.setPati entIcn(exa m.getPatie ntIcn()); | |
665 | resu lt.setPati entName(ex am.getPati entName()) ; | |
666 | resu lt.setRadi ologyRepor t(exam.get ExamReport ()); | |
667 | resu lt.setRawH eader1(exa m.getRawHe aderLine1( )); | |
668 | resu lt.setRawH eader2(exa m.getRawHe aderLine2( )); | |
669 | resu lt.setRawV alue(exam. getRawOutp ut()); | |
670 | resu lt.setRequ isitionRep ort(exam.g etExamRequ isitionRep ort()); | |
671 | resu lt.setSite Abbr(exam. getSiteAbb r()); | |
672 | resu lt.setSite Name(exam. getSiteNam e()); | |
673 | resu lt.setSite Number(exa m.getSiteN umber()); | |
674 | resu lt.setPres entationSt ate(exam.g etPresenta tionStateD ata()); | |
675 | ||
676 | if(e xam.getIma ges() == n ull) | |
677 | { | |
678 | // thi s will hap pen if the examSite does not h ave images at all | |
679 | result .setExamIm ages(null) ; | |
680 | } | |
681 | else | |
682 | { | |
683 | // if the images were atte mpted to l oad, they might be o n jukebox so not con sidered fu lly loaded , but stll need to c all transl ate so the header is set | |
684 | Federa tionExamIm agesType e xamImages = translat e(exam.get Images()); | |
685 | result .setExamIm ages(examI mages); | |
686 | } | |
687 | retu rn result; | |
688 | } | |
689 | ||
690 | pu blic stati c Federati onExamImag eType tran slate(Exam Image exam Image) | |
691 | { | |
692 | Fede rationExam ImageType result = n ew Federat ionExamIma geType(); | |
693 | ||
694 | resu lt.setBigI mageFilena me(examIma ge.getDiag nosticFile Path()); | |
695 | resu lt.setExam Id(examIma ge.getExam Id()); | |
696 | resu lt.setImag eId(examIm age.getIma geId()) ; | |
697 | resu lt.setPati entIcn(exa mImage.get PatientIcn ()); | |
698 | resu lt.setSite Number(exa mImage.get SiteNumber ()); | |
699 | resu lt.setAlie nSiteNumbe r(examImag e.getAlien SiteNumber ()); | |
700 | ||
701 | retu rn result; | |
702 | } | |
703 | ||
704 | pu blic stati c Federati onExamImag esType tra nslate(Exa mImages ex amImages) | |
705 | { | |
706 | Fede rationExam ImagesType result = new Federa tionExamIm agesType() ; | |
707 | resu lt.setRawH eader(exam Images.get RawHeader( )); | |
708 | Fede rationExam ImageType [] images = new Fede rationExam ImageType[ examImages .size()]; | |
709 | int i = 0; | |
710 | for( ExamImage image : ex amImages) | |
711 | { | |
712 | images [i] = tran slate(imag e); | |
713 | i++; | |
714 | } | |
715 | resu lt.setImag es(images) ; | |
716 | ||
717 | retu rn result; | |
718 | } | |
719 | ||
720 | pu blic stati c Federati onExamStat usType tra nslate( | |
721 | ExamSt atus examS tatus) | |
722 | { | |
723 | for( E ntry<ExamS tatus, Fed erationExa mStatusTyp e> entry : Federatio nRestTrans lator.exam StatusMap. entrySet() ) | |
724 | if( entr y.getKey() == examSt atus ) | |
725 | return ent ry.getValu e(); | |
726 | ||
727 | return Federatio nExamStatu sType.INTE RPRETED; | |
728 | } | |
729 | ||
730 | ||
731 | publ ic static ExamStatus translate ( | |
732 | Federati onExamStat usType sta tusType) | |
733 | { | |
734 | for( E ntry<ExamS tatus, Fed erationExa mStatusTyp e> entry : Federatio nRestTrans lator.exam StatusMap. entrySet() ) | |
735 | if( entr y.getValue () == stat usType ) | |
736 | return ent ry.getKey( ); | |
737 | ||
738 | return ExamStatu s.INTERPRE TED; | |
739 | } | |
740 | ||
741 | pu blic stati c Federati onRemoteMe thodType t ranslate(P assthrough InputMetho d inputMet hod, Strin g imagingS ecurityCon text) | |
742 | { | |
743 | Sort edSet<Pass throughPar ameter> pa rameters = inputMeth od.getPara meters(); | |
744 | Fede rationRemo teMethodTy pe result = new Fede rationRemo teMethodTy pe(); | |
745 | resu lt.setImag ingSecurit yContext(i magingSecu rityContex t); | |
746 | resu lt.setMeth odName(inp utMethod.g etMethodNa me()); | |
747 | Fede rationRemo teMethodPa rameterTyp e [] param eterTypes = new Fede rationRemo teMethodPa rameterTyp e[paramete rs.size()] ; | |
748 | int i = 0; | |
749 | for( Passthroug hParameter parameter : paramet ers) | |
750 | { | |
751 | parame terTypes[i ] = transl ate(parame ter); | |
752 | i++; | |
753 | } | |
754 | resu lt.setPara meters(par ameterType s); | |
755 | retu rn result; | |
756 | } | |
757 | ||
758 | pu blic stati c Passthro ughInputMe thod trans late(Feder ationRemot eMethodTyp e remoteMe thodType) | |
759 | { | |
760 | Pass throughInp utMethod r esult = ne w Passthro ughInputMe thod(remot eMethodTyp e.getMetho dName()); | |
761 | ||
762 | if(r emoteMetho dType.getP arameters( ) != null) | |
763 | for(Fe derationRe moteMethod ParameterT ype parame ter : remo teMethodTy pe.getPara meters()) | |
764 | result.g etParamete rs().add(t ranslate(p arameter)) ; | |
765 | ||
766 | retu rn result; | |
767 | } | |
768 | ||
769 | pu blic stati c Federati onRemoteMe thodParame terType tr anslate(Pa ssthroughP arameter p arameter) | |
770 | { | |
771 | Fede rationRemo teMethodPa rameterTyp e result = | |
772 | new Fe derationRe moteMethod ParameterT ype(); | |
773 | resu lt.setPara meterIndex (parameter .getIndex( )); | |
774 | ||
775 | resu lt.setPara meterType( translate( parameter. getParamet erType())) ; | |
776 | ||
777 | Fede rationRemo teMethodPa rameterVal ueType val ue = | |
778 | new Fe derationRe moteMethod ParameterV alueType() ; | |
779 | ||
780 | // o k if null | |
781 | valu e.setValue (parameter .getValue( )); | |
782 | valu e.setMulti pleValues( parameter. getMultipl eValues()) ; | |
783 | resu lt.setPara meterValue (value); | |
784 | ||
785 | retu rn result; | |
786 | } | |
787 | ||
788 | pu blic stati c Federati onRemoteMe thodParame terTypeTyp e translat e( | |
789 | Passth roughParam eterType p arameterTy pe) | |
790 | { | |
791 | for( Entry<Pas sthroughPa rameterTyp e, Federat ionRemoteM ethodParam eterTypeTy pe> entry : Federati onRestTran slator.par ameterType Map.entryS et() ) | |
792 | if( en try.getKey () == para meterType ) | |
793 | return e ntry.getVa lue(); | |
794 | ||
795 | retu rn Federat ionRemoteM ethodParam eterTypeTy pe.LITERAL ; | |
796 | } | |
797 | ||
798 | /* | |
799 | pu blic stati c Passthro ughInputMe thod trans late(Strin g methodNa me, Federa tionRemote MethodPara meterType [] paramet ers) | |
800 | { | |
801 | if(m ethodName == null) | |
802 | return null; | |
803 | Pass throughInp utMethod r esult = ne w Passthro ughInputMe thod(metho dName); | |
804 | if(p arameters != null) | |
805 | for(Fe derationRe moteMethod ParameterT ype parame ter : para meters) | |
806 | result.g etParamete rs().add(t ranslate(p arameter)) ; | |
807 | ||
808 | retu rn result; | |
809 | }* / | |
810 | ||
811 | pu blic stati c Passthro ughParamet er transla te(Federat ionRemoteM ethodParam eterType p arameter) | |
812 | { | |
813 | Pass throughPar ameter res ult = new Passthroug hParameter (); | |
814 | resu lt.setInde x(paramete r.getParam eterIndex( )); | |
815 | ||
816 | resu lt.setPara meterType( translate( parameter. getParamet erType())) ; | |
817 | Fede rationRemo teMethodPa rameterVal ueType par ameterValu e = parame ter.getPar ameterValu e(); | |
818 | if(p arameterVa lue == nul l) | |
819 | { | |
820 | result .setValue( null); | |
821 | result .setMultip leValues(n ull); | |
822 | } | |
823 | else | |
824 | { | |
825 | String value = p arameterVa lue.getVal ue(); | |
826 | result .setValue( value); | |
827 | String [] multip leValues = parameter Value.getM ultipleVal ues(); | |
828 | result .setMultip leValues(m ultipleVal ues); | |
829 | } | |
830 | ||
831 | retu rn result; | |
832 | } | |
833 | ||
834 | pu blic stati c Passthro ughParamet erType tra nslate(Fed erationRem oteMethodP arameterTy peType par ameterType ) | |
835 | { | |
836 | Pass throughPar ameterType result = Passthroug hParameter Type.liter al; | |
837 | if(p arameterTy pe == Fede rationRemo teMethodPa rameterTyp eType.LIST ) | |
838 | result = Passthr oughParame terType.li st; | |
839 | else if(parame terType == Federatio nRemoteMet hodParamet erTypeType .REFERENCE ) | |
840 | result = Passthr oughParame terType.re ference; | |
841 | retu rn result; | |
842 | } | |
843 | ||
844 | pu blic stati c Document Filter tra nslate(Fed erationDoc umentFilte rType filt erType) | |
845 | th rows Trans lationExce ption | |
846 | { | |
847 | Docu mentFilter result = new Docume ntFilter(f ilterType. getPatient Id(), filt erType.get ClassCode( ), | |
848 | filterTy pe.getPrac ticeSettin gCode(), f ilterType. getCreatio nTimeFrom( ), filterT ype.getCre ationTimeT o(), | |
849 | filterTy pe.getServ iceStartTi meFrom(), filterType .getServic eStartTime To(), | |
850 | filterTy pe.getServ iceStopTim eFrom(), f ilterType. getService StopTimeTo (), filter Type.getHe althcareFa cilityType Code(), | |
851 | filterTy pe.getEven tCodes(), filterType .getConfid entialityC odes(), fi lterType.g etAuthor() , filterTy pe.getForm atCode(), | |
852 | filterTy pe.getEntr yStatus(), filterTyp e.getMaxRe sultsCount (), filter Type.getSi teNumber() , | |
853 | filterTy pe.isUseAl ternatePat ientId() | |
854 | ); | |
855 | ||
856 | resu lt.setStud y_class(fi lterType.g et_class() ); | |
857 | resu lt.setStud y_package( filterType .get_packa ge()); | |
858 | resu lt.setStud y_event(fi lterType.g etEvent()) ; | |
859 | resu lt.setFrom Date(filte rType.getF romDate()) ; | |
860 | resu lt.setIncl udeDeleted (filterTyp e.isInclud eDeletedIm ages()); | |
861 | resu lt.setOrig in(filterT ype.getOri gin()); | |
862 | resu lt.setStud y_specialt y(filterTy pe.getSpec ialty()); | |
863 | if(( filterType .getStudyI d() != nul l) && (fil terType.ge tStudyId() .length() > 0)) | |
864 | { | |
865 | try | |
866 | { | |
867 | URN gai = URNFacto ry.create( filterType .getStudyI d()); | |
868 | if(gai i nstanceof GlobalArti factIdenti fier) | |
869 | result.set StudyId((G lobalArtif actIdentif ier)gai); | |
870 | } | |
871 | catch (URNFormat Exception x) | |
872 | { | |
873 | throw ne w Translat ionExcepti on(filterT ype.getStu dyId() + | |
874 | " cannot b e transfor med into a GlobalArt ifactIdent ifier real ization." | |
875 | ); | |
876 | } | |
877 | } | |
878 | resu lt.setToDa te(filterT ype.getToD ate()); | |
879 | resu lt.setStud y_type(fil terType.ge tTypes()); | |
880 | ||
881 | retu rn result; | |
882 | } | |
883 | ||
884 | pu blic stati c Federati onDocument FilterType translate (DocumentF ilter filt er) | |
885 | { | |
886 | Fede rationDocu mentFilter Type docum entFilterT ype = new Federation DocumentFi lterType() ; | |
887 | docu mentFilter Type.set_c lass(filte r.getStudy _class()); | |
888 | docu mentFilter Type.set_p ackage(fil ter.getStu dy_package ()); | |
889 | docu mentFilter Type.setEv ent(filter .getStudy_ event()); | |
890 | docu mentFilter Type.setFr omDate(fil ter.getFro mDate()); | |
891 | docu mentFilter Type.setIn cludeDelet edImages(f ilter.isIn cludeDelet ed()); | |
892 | docu mentFilter Type.setOr igin(filte r.getOrigi n()); | |
893 | docu mentFilter Type.setSp ecialty(fi lter.getSt udy_specia lty()); | |
894 | docu mentFilter Type.setSt udyId(filt er.getStud yId() == n ull ? "" : filter.ge tStudyId() .toString( )); | |
895 | docu mentFilter Type.setTo Date(filte r.getToDat e()); | |
896 | docu mentFilter Type.setTy pes(filter .getStudy_ type()); | |
897 | ||
898 | docu mentFilter Type.setPa tientId(fi lter.getPa tientId()) ; | |
899 | docu mentFilter Type.setCl assCode(fi lter.getCl assCode()) ; | |
900 | docu mentFilter Type.setPr acticeSett ingCode(fi lter.getPr acticeSett ingCode()) ; | |
901 | docu mentFilter Type.setCr eationTime From(filte r.getCreat ionTimeFro m()); | |
902 | docu mentFilter Type.setCr eationTime To(filter. getCreatio nTimeTo()) ; | |
903 | docu mentFilter Type.setSe rviceStart TimeFrom(f ilter.getS erviceStar tTimeFrom( )); | |
904 | docu mentFilter Type.setSe rviceStart TimeTo(fil ter.getSer viceStartT imeTo()); | |
905 | docu mentFilter Type.setSe rviceStopT imeFrom(fi lter.getSe rviceStopT imeFrom()) ; | |
906 | docu mentFilter Type.setSe rviceStopT imeTo(filt er.getServ iceStopTim eTo()); | |
907 | docu mentFilter Type.setHe althcareFa cilityType Code(filte r.getHealt hcareFacil ityTypeCod e()); | |
908 | docu mentFilter Type.setEv entCodes(f ilter.getE ventCodes( )); | |
909 | docu mentFilter Type.setCo nfidential ityCodes(f ilter.getC onfidentia lityCodes( )); | |
910 | docu mentFilter Type.setAu thor(filte r.getAutho r()); | |
911 | docu mentFilter Type.setFo rmatCode(f ilter.getF ormatCode( )); | |
912 | docu mentFilter Type.setEn tryStatus( filter.get EntryStatu s()); | |
913 | docu mentFilter Type.setMa xResultsCo unt(filter .getMaximu mResults() ); | |
914 | docu mentFilter Type.setSi teNumber(f ilter.getS iteNumber( )); | |
915 | docu mentFilter Type.setUs eAlternate PatientId( filter.isU seAlternat ePatientId ()); | |
916 | ||
917 | retu rn documen tFilterTyp e; | |
918 | } | |
919 | ||
920 | pu blic stati c Federati onFilterTy pe transla te(StudyFi lter filte rType) | |
921 | { | |
922 | Fede rationFilt erType fil ter = new Federation FilterType (); | |
923 | if(f ilterType != null) | |
924 | { | |
925 | filter .setFromDa te(filterT ype.getFro mDate()); | |
926 | filter .setToDate (filterTyp e.getToDat e()); | |
927 | filter .set_class (filterTyp e.getStudy _class()== null ? "" : filterT ype.getStu dy_class() ); | |
928 | filter .setEvent( filterType .getStudy_ event() == null ? "" : filterT ype.getStu dy_event() ); | |
929 | filter .set_packa ge(filterT ype.getStu dy_package () == null ? "" : fi lterType.g etStudy_pa ckage()); | |
930 | filter .setSpecia lty(filter Type.getSt udy_specia lty() == n ull ? "" : filterTyp e.getStudy _specialty ()); | |
931 | filter .setTypes( filterType .getStudy_ type() == null ? "" : filterTy pe.getStud y_type()); | |
932 | Global ArtifactId entifier s tudyIdenti fier = fil terType.ge tStudyId() ; | |
933 | if(stu dyIdentifi er != null ) | |
934 | { | |
935 | filter.s etStudyId( studyIdent ifier.toSt ring()); | |
936 | } | |
937 | else | |
938 | filter.s etStudyId( null); | |
939 | filter .setOrigin (filterTyp e.getOrigi n() == nul l ? "" : f ilterType. getOrigin( )); | |
940 | filter .setInclud eDeletedIm ages(filte rType.isIn cludeDelet ed()); | |
941 | filter .setInclud eAllObject s(filterTy pe.isInclu deAllObjec ts()); | |
942 | filter .setInclud ePatientOr ders(filte rType.isIn cludePatie ntOrders() ); | |
943 | filter .setInclud eEncounter Orders(fil terType.is IncludeEnc ounterOrde rs()); | |
944 | filter .setInclud eMuseOrder s(filterTy pe.isInclu deMuseOrde rs()); | |
945 | } | |
946 | retu rn filter; | |
947 | } | |
948 | ||
949 | pu blic stati c StudyFil ter transl ate(Federa tionFilter Type filte rType, | |
950 | int au thorizedSe nsitiveLev el, boolea n filterPr ocedures) | |
951 | th rows Globa lArtifactI dentifierF ormatExcep tion | |
952 | { | |
953 | Stud yFilter fi lter = nul l; | |
954 | if(f ilterProce dures) | |
955 | filter = new Pro cedureFilt er(Procedu reFilterMa tchMode.ex istInProce dureList); | |
956 | else | |
957 | filter = new Stu dyFilter() ; | |
958 | filt er.setMaxi mumAllowed Level(Pati entSensiti vityLevel. getPatient Sensitivit yLevel(aut horizedSen sitiveLeve l)); | |
959 | if(f ilterType != null) | |
960 | { | |
961 | filter .setFromDa te(filterT ype.getFro mDate()); | |
962 | filter .setToDate (filterTyp e.getToDat e()); | |
963 | filter .setStudy_ class(filt erType.get _class() = = null ? " " : filter Type.get_c lass()); | |
964 | filter .setStudy_ event(filt erType.get Event() == null ? "" : filterT ype.getEve nt()); | |
965 | filter .setStudy_ package(fi lterType.g et_package () == null ? "" : fi lterType.g et_package ()); | |
966 | filter .setStudy_ specialty( filterType .getSpecia lty() == n ull ? "" : filterTyp e.getSpeci alty()); | |
967 | filter .setStudy_ type(filte rType.getT ypes() == null ? "" : filterTy pe.getType s()); | |
968 | String requested StudyIdAsS tring = fi lterType.g etStudyId( ); | |
969 | if(req uestedStud yIdAsStrin g != null) | |
970 | { | |
971 | try | |
972 | { | |
973 | URN studyU rn = URNFa ctory.crea te(request edStudyIdA sString); | |
974 | if(studyUr n instance of GlobalA rtifactIde ntifier) | |
975 | fi lter.setSt udyId( (Gl obalArtifa ctIdentifi er)studyUr n ); | |
976 | } | |
977 | catch (U RNFormatEx ception x) | |
978 | { | |
979 | throw new GlobalArti factIdenti fierFormat Exception( requestedS tudyIdAsSt ring + | |
980 | " cannot be transforme d into a G lobalArtif actIdentif ier realiz ation." | |
981 | ); | |
982 | } | |
983 | } | |
984 | else | |
985 | filter.s etStudyId( null); | |
986 | filter .setOrigin (filterTyp e.getOrigi n() == nul l ? "" : f ilterType. getOrigin( )); | |
987 | filter .setInclud eDeleted(f ilterType. isIncludeD eletedImag es()); | |
988 | filter .setInclud eAllObject s(filterTy pe.isInclu deAllObjec ts()); | |
989 | filter .setInclud ePatientOr ders(filte rType.isIn cludePatie ntOrders() ); | |
990 | filter .setInclud eEncounter Orders(fil terType.is IncludeEnc ounterOrde rs()); | |
991 | filter .setInclud eMuseOrder s(filterTy pe.isInclu deMuseOrde rs()); | |
992 | } | |
993 | retu rn filter; | |
994 | } | |
995 | ||
996 | ||
997 | ||
998 | // WFP-Need t o fix this with resp ect to Fed erationFil terType an d MaximumA llowedLeve l. The cur rent | |
999 | // solu tion will not go thr u the Fede ration bec ause it's not a prim itive. | |
1000 | pu blic stati c StudyFil ter transl ate(Federa tionFilter Type filte rType) | |
1001 | th rows Globa lArtifactI dentifierF ormatExcep tion | |
1002 | { | |
1003 | Stud yFilter fi lter = new StudyFilt er(); | |
1004 | filt er.setMaxi mumAllowed Level(filt erType.get MaximumAll owedLevel( )); | |
1005 | filt er.setFrom Date(filte rType.getF romDate()) ; | |
1006 | filt er.setToDa te(filterT ype.getToD ate()); | |
1007 | filt er.setStud y_class(fi lterType.g et_class() == null ? "" : filt erType.get _class()); | |
1008 | filt er.setStud y_event(fi lterType.g etEvent() == null ? "" : filte rType.getE vent()); | |
1009 | filt er.setStud y_package( filterType .get_packa ge() == nu ll ? "" : filterType .get_packa ge()); | |
1010 | filt er.setStud y_specialt y(filterTy pe.getSpec ialty() == null ? "" : filterT ype.getSpe cialty()); | |
1011 | filt er.setStud y_type(fil terType.ge tTypes() = = null ? " " : filter Type.getTy pes()); | |
1012 | Stri ng request edStudyIdA sString = filterType .getStudyI d(); | |
1013 | if(r equestedSt udyIdAsStr ing != nul l) | |
1014 | { | |
1015 | try | |
1016 | { | |
1017 | URN stud yUrn = URN Factory.cr eate(reque stedStudyI dAsString) ; | |
1018 | if(study Urn instan ceof Globa lArtifactI dentifier) | |
1019 | filter.set StudyId( ( GlobalArti factIdenti fier)study Urn ); | |
1020 | } | |
1021 | catch (URNFormat Exception x) | |
1022 | { | |
1023 | throw ne w GlobalAr tifactIden tifierForm atExceptio n(requeste dStudyIdAs String + | |
1024 | " cannot b e transfor med into a GlobalArt ifactIdent ifier real ization." | |
1025 | ); | |
1026 | } | |
1027 | } | |
1028 | else | |
1029 | filter .setStudyI d(null); | |
1030 | filt er.setOrig in(filterT ype.getOri gin() == n ull ? "" : filterTyp e.getOrigi n()); | |
1031 | filt er.setIncl udeDeleted (filterTyp e.isInclud eDeletedIm ages()); | |
1032 | filt er.setIncl udeAllObje cts(filter Type.isInc ludeAllObj ects()); | |
1033 | filt er.setIncl udePatient Orders(fil terType.is IncludePat ientOrders ()); | |
1034 | filt er.setIncl udeEncount erOrders(f ilterType. isIncludeE ncounterOr ders()); | |
1035 | filt er.setIncl udeMuseOrd ers(filter Type.isInc ludeMuseOr ders()); | |
1036 | retu rn filter; | |
1037 | } | |
1038 | ||
1039 | ||
1040 | pu blic stati c SortedSe t<Study> t ranslate(F ederationS tudyType [ ] studies) | |
1041 | th rows Trans lationExce ption | |
1042 | { | |
1043 | retu rn transla te(studies , null); | |
1044 | } | |
1045 | ||
1046 | pu blic stati c Federati onDocument SetResultT ype transl ate(Docume ntSetResul t document SetResult) | |
1047 | { | |
1048 | if(d ocumentSet Result == null) | |
1049 | return null; | |
1050 | Fede rationDocu mentSetRes ultType re sult = new Federatio nDocumentS etResultTy pe(); | |
1051 | ||
1052 | Fede rationDocu mentSetTyp e[] docume ntSets = t ranslate(d ocumentSet Result.get Artifacts( )); | |
1053 | ||
1054 | Fede rationArti factResult StatusType artifactR esultStatu s = | |
1055 | transl ate(docume ntSetResul t.getArtif actResultS tatus()); | |
1056 | ||
1057 | resu lt.setDocu mentSets(d ocumentSet s); | |
1058 | resu lt.setArti factResult Status(art ifactResul tStatus); | |
1059 | resu lt.setErro rs(transla teArtifact ResultErro rList(docu mentSetRes ult.getArt ifactResul tErrors()) ); | |
1060 | ||
1061 | retu rn result; | |
1062 | } | |
1063 | ||
1064 | pr ivate stat ic Federat ionDocumen tSetType[] translate (SortedSet <DocumentS et> docume ntSets) | |
1065 | { | |
1066 | if(d ocumentSet s == null) | |
1067 | return null; | |
1068 | Fede rationDocu mentSetTyp e[] result = new Fed erationDoc umentSetTy pe[documen tSets.size ()]; | |
1069 | int i = 0; | |
1070 | for( DocumentSe t document Set : docu mentSets) | |
1071 | { | |
1072 | result [i] = tran slate(docu mentSet); | |
1073 | i++; | |
1074 | } | |
1075 | ||
1076 | retu rn result; | |
1077 | } | |
1078 | ||
1079 | pr ivate stat ic Federat ionDocumen tSetType t ranslate(D ocumentSet documentS et) | |
1080 | { | |
1081 | if(d ocumentSet == null) | |
1082 | return null; | |
1083 | Fede rationDocu mentSetTyp e result = new Feder ationDocum entSetType (); | |
1084 | resu lt.setAcqu isitionDat e(document Set.getAcq uisitionDa te()); | |
1085 | resu lt.setAlie nSiteNumbe r(document Set.getAli enSiteNumb er()); | |
1086 | resu lt.setClin icalType(d ocumentSet .getClinic alType()); | |
1087 | resu lt.setErro rMessage(d ocumentSet .getErrorM essage()); | |
1088 | resu lt.setFirs tImageIen( documentSe t.getFirst ImageIen() ); | |
1089 | resu lt.setHome CommunityI d(document Set.getHom eCommunity Id().toStr ing()); | |
1090 | resu lt.setIden tifier(doc umentSet.g etIdentifi er()); | |
1091 | resu lt.setPati entIcn(doc umentSet.g etPatientI cn()); | |
1092 | resu lt.setPati entName(do cumentSet. getPatient Name()); | |
1093 | resu lt.setProc edureDate( documentSe t.getProce dureDate() ); | |
1094 | resu lt.setRepo sitoryId(d ocumentSet .getReposi toryId()); | |
1095 | resu lt.setRpcR esponseMsg (documentS et.getRpcR esponseMsg ()); | |
1096 | resu lt.setSite Abbr(docum entSet.get SiteAbbr() ); | |
1097 | resu lt.setSite Name(docum entSet.get SiteName() ); | |
1098 | resu lt.setCons olidatedSi teNumber(d ocumentSet .getConsol idatedSite Number()); | |
1099 | ||
1100 | Fede rationDocu mentType [ ] document s = new Fe derationDo cumentType [documentS et.size()] ; | |
1101 | int i = 0; | |
1102 | for( Document d ocument : documentSe t) | |
1103 | { | |
1104 | docume nts[i] = t ranslate(d ocument); | |
1105 | i++; | |
1106 | } | |
1107 | resu lt.setDocu ments(docu ments); | |
1108 | ||
1109 | retu rn result; | |
1110 | } | |
1111 | ||
1112 | pr ivate stat ic Federat ionDocumen tType tran slate(Docu ment docum ent) | |
1113 | { | |
1114 | if(d ocument == null) | |
1115 | return null; | |
1116 | ||
1117 | Fede rationDocu mentType r esult = ne w Federati onDocument Type(); | |
1118 | resu lt.setChec ksum(trans late(docum ent.getChe cksumValue ())); | |
1119 | resu lt.setClin icalType(d ocument.ge tClinicalT ype()); | |
1120 | resu lt.setConf identialit yCode(docu ment.getCo nfidential ityCode()) ; | |
1121 | resu lt.setCont entLenth(d ocument.ge tContentLe ngth()); | |
1122 | resu lt.setCrea tionDate(d ocument.ge tCreationD ate()); | |
1123 | resu lt.setDesc ription(do cument.get Descriptio n()); | |
1124 | resu lt.setDocu mentSetIen (document. getDocumen tSetIen()) ; | |
1125 | resu lt.setIden tifier(doc ument.getG lobalArtif actIdentif ier().toSt ring()); | |
1126 | resu lt.setLang uageCode(d ocument.ge tLanguageC ode()); | |
1127 | resu lt.setMedi aType(tran slate(docu ment.getMe diaType()) ); | |
1128 | resu lt.setName (document. getName()) ; | |
1129 | resu lt.setVist aImageType (document. getVistaIm ageType()) ; | |
1130 | resu lt.setCons olidatedSi teNumber(d ocument.ge tConsolida tedSiteNum ber()); | |
1131 | retu rn result; | |
1132 | } | |
1133 | ||
1134 | pu blic stati c Document SetResult translate( Federation DocumentSe tResultTyp e document SetResultT ype) | |
1135 | th rows Trans lationExce ption | |
1136 | { | |
1137 | if(d ocumentSet ResultType == null) | |
1138 | { | |
1139 | getLog ger().erro r("Cannot translate null Feder ationDocum entSetResu ltType"); | |
1140 | return DocumentS etResult.c reateFullR esult(null ); | |
1141 | } | |
1142 | Sort edSet<Docu mentSet> d ocumentSet s = transl ate(docume ntSetResul tType.getD ocumentSet s()); | |
1143 | Arti factResult Status art ifactResul tStatus = translate( documentSe tResultTyp e.getArtif actResultS tatus()); | |
1144 | List <ArtifactR esultError > artifact ResultErro rs = trans late(docum entSetResu ltType.get Errors()); | |
1145 | retu rn Documen tSetResult .create(do cumentSets , artifact ResultStat us, artifa ctResultEr rors); | |
1146 | } | |
1147 | ||
1148 | pr ivate stat ic SortedS et<Documen tSet> tran slate(Fede rationDocu mentSetTyp e [] docum entSets) | |
1149 | th rows Trans lationExce ption | |
1150 | { | |
1151 | Sort edSet<Docu mentSet> r esult = ne w TreeSet< DocumentSe t>(); | |
1152 | if(d ocumentSet s == null) | |
1153 | return result; | |
1154 | for( Federation DocumentSe tType docu mentSet : documentSe ts) | |
1155 | { | |
1156 | result .add(trans late(docum entSet)); | |
1157 | } | |
1158 | retu rn result; | |
1159 | } | |
1160 | ||
1161 | pr ivate stat ic Documen tSet trans late(Feder ationDocum entSetType documentS et) | |
1162 | th rows Trans lationExce ption | |
1163 | { | |
1164 | try | |
1165 | { | |
1166 | Docume ntSet resu lt = new D ocumentSet (OID.creat e(document Set.getHom eCommunity Id()), | |
1167 | documentSe t.getRepos itoryId(), documentS et.getIden tifier()); | |
1168 | ||
1169 | result .setAcquis itionDate( documentSe t.getAcqui sitionDate ()); | |
1170 | result .setAlienS iteNumber( documentSe t.getAlien SiteNumber ()); | |
1171 | result .setClinic alType(doc umentSet.g etClinical Type()); | |
1172 | result .setErrorM essage(doc umentSet.g etErrorMes sage()); | |
1173 | result .setFirstI mageIen(do cumentSet. getFirstIm ageIen()); | |
1174 | result .setPatien tIcn(docum entSet.get PatientIcn ()); | |
1175 | result .setPatien tName(docu mentSet.ge tPatientNa me()); | |
1176 | result .setProced ureDate(do cumentSet. getProcedu reDate()); | |
1177 | result .setRpcRes ponseMsg(d ocumentSet .getRpcRes ponseMsg() ); | |
1178 | result .setSiteAb br(documen tSet.getSi teAbbr()); | |
1179 | result .setSiteNa me(documen tSet.getSi teName()); | |
1180 | result .setConsol idatedSite Number(doc umentSet.g etConsolid atedSiteNu mber()); | |
1181 | for(Fe derationDo cumentType document : document Set.getDoc uments()) | |
1182 | { | |
1183 | result.a dd(transla te(documen t, result) ); | |
1184 | } | |
1185 | return result; | |
1186 | } | |
1187 | catc h(OIDForma tException oidfX) | |
1188 | { | |
1189 | throw new Transl ationExcep tion("Unab le to crea te OID fro m Id '" + documentSe t.getHomeC ommunityId () + "', " + oidfX.g etMessage( ), oidfX); | |
1190 | } | |
1191 | } | |
1192 | ||
1193 | pr ivate stat ic Documen t translat e(Federati onDocument Type docum ent, Docum entSet doc umentSet) | |
1194 | th rows Trans lationExce ption | |
1195 | { | |
1196 | try | |
1197 | { | |
1198 | @Suppr essWarning s("uncheck ed") | |
1199 | Global ArtifactId entifier g ai = | |
1200 | GlobalAr tifactIden tifierFact ory.create (document. getIdentif ier(), Glo balArtifac tIdentifie r.class); | |
1201 | if(gai instanceo f ImageURN ) | |
1202 | { | |
1203 | // the i dentifier is a URN c ontaining the patien t ICN alre ady in it so don't d o anything | |
1204 | // to it | |
1205 | } | |
1206 | else | |
1207 | { | |
1208 | // JMW 1 2/10/2010 P104 | |
1209 | // The p atient ICN must come from the documentSe t, not the document since it i s not | |
1210 | // consi stently se t - the pa tientICN c omes from the URN of the docum ent, if it s not a UR N | |
1211 | // then the ICN wi ll be null from the Document o bject. | |
1212 | gai = Pa tientArtif actIdentif ierImpl.cr eate(gai, documentSe t.getPatie ntIcn()); | |
1213 | } | |
1214 | ||
1215 | ||
1216 | Checks umValue ch ecksum = t ranslate(d ocument.ge tChecksum( )); | |
1217 | Docume nt result = new Docu ment(docum entSet, ga i, documen t.getCreat ionDate(), | |
1218 | document.g etVistaIma geType(), document.g etClinical Type(), do cument.get ContentLen th(), chec ksum); | |
1219 | result .setConfid entialityC ode(docume nt.getConf identialit yCode()); | |
1220 | result .setDescri ption(docu ment.getDe scription( )); | |
1221 | result .setLangua geCode(doc ument.getL anguageCod e()); | |
1222 | result .setMediaT ype(transl ate(docume nt.getMedi aType())); | |
1223 | result .setName(d ocument.ge tName()); | |
1224 | result .setConsol idatedSite Number(doc ument.getC onsolidate dSiteNumbe r()); | |
1225 | ||
1226 | return result; | |
1227 | } | |
1228 | catc h(GlobalAr tifactIden tifierForm atExceptio n urnfX) | |
1229 | { | |
1230 | throw new Transl ationExcep tion("Unab le to crea te GlobalA rtifactIde ntifier fr om identif ier '" + d ocument.ge tIdentifie r() + "', " + urnfX. getMessage (), urnfX) ; | |
1231 | } | |
1232 | catc h(URNForma tException urnfX) | |
1233 | { | |
1234 | throw new Transl ationExcep tion("URNF ormatExcep tion, unab le to crea te Patient ArtifactId entifier f rom identi fier '" + document.g etIdentifi er() + "' and ICN '" + documen tSet.getPa tientIcn() + "', " + urnfX.get Message(), urnfX); | |
1235 | } | |
1236 | } | |
1237 | ||
1238 | pu blic stati c MediaTyp e translat e(Federati onMediaTyp e mediaTyp e) | |
1239 | { | |
1240 | for( Entry<Med iaType, Fe derationMe diaType> e ntry : Fed erationRes tTranslato r.mediaTyp eMap.entry Set() ) | |
1241 | if( en try.getVal ue() == me diaType ) | |
1242 | return e ntry.getKe y(); | |
1243 | ||
1244 | retu rn MediaTy pe.APPLICA TION_OCTET STREAM; | |
1245 | } | |
1246 | ||
1247 | pu blic stati c Federati onMediaTyp e translat e(MediaTyp e mediaTyp e) | |
1248 | { | |
1249 | for( Entry<Med iaType, Fe derationMe diaType> e ntry : Fed erationRes tTranslato r.mediaTyp eMap.entry Set() ) | |
1250 | if( en try.getKey () == medi aType ) | |
1251 | return e ntry.getVa lue(); | |
1252 | ||
1253 | retu rn Federat ionMediaTy pe.APPLICA TION_OCTET STREAM; | |
1254 | } | |
1255 | ||
1256 | pr ivate stat ic Checksu mValue tra nslate(Fed erationChe cksumType checksum) | |
1257 | { | |
1258 | if(c hecksum == null) | |
1259 | return null; | |
1260 | retu rn new Che cksumValue (checksum. getAlgorit hm(), chec ksum.getVa lue()); | |
1261 | } | |
1262 | ||
1263 | pr ivate stat ic Federat ionChecksu mType tran slate(Chec ksumValue checksum) | |
1264 | { | |
1265 | if(c hecksum == null) | |
1266 | return null; | |
1267 | Fede rationChec ksumType r esult = ne w Federati onChecksum Type(); | |
1268 | resu lt.setAlgo rithm(chec ksum.getAl gorithm()) ; | |
1269 | resu lt.setValu e(checksum .getValue( )); | |
1270 | retu rn result; | |
1271 | } | |
1272 | ||
1273 | pu blic stati c Federati onArtifact ResultsTyp e translat e(Artifact Results ar tifactResu lts) | |
1274 | th rows Trans lationExce ption | |
1275 | { | |
1276 | if(a rtifactRes ults == nu ll) | |
1277 | return null; | |
1278 | Fede rationArti factResult sType resu lt = new F ederationA rtifactRes ultsType() ; | |
1279 | ||
1280 | resu lt.setDocu mentSetRes ult(transl ate(artifa ctResults. getDocumen tSetResult ())); | |
1281 | resu lt.setStud ySetResult (translate (artifactR esults.get StudySetRe sult())); | |
1282 | ||
1283 | retu rn result; | |
1284 | } | |
1285 | ||
1286 | pu blic stati c Artifact Results tr anslate(Fe derationAr tifactResu ltsType ar tifactResu ltsType, S tudyFilter studyFilt er) | |
1287 | th rows Trans lationExce ption | |
1288 | { | |
1289 | if(a rtifactRes ultsType = = null) | |
1290 | return null; | |
1291 | Stud ySetResult studySetR esult = nu ll; | |
1292 | if(a rtifactRes ultsType.g etStudySet Result() ! = null) | |
1293 | { | |
1294 | studyS etResult = translate (artifactR esultsType .getStudyS etResult() , studyFil ter); | |
1295 | } | |
1296 | Docu mentSetRes ult docume ntSetResul t = null; | |
1297 | if(a rtifactRes ultsType.g etDocument SetResult( ) != null) | |
1298 | { | |
1299 | docume ntSetResul t = transl ate(artifa ctResultsT ype.getDoc umentSetRe sult()); | |
1300 | } | |
1301 | retu rn Artifac tResults.c reate(stud ySetResult , document SetResult) ; | |
1302 | } | |
1303 | ||
1304 | pu blic stati c StudySet Result tra nslate(Fed erationStu dyResultTy pe studyRe sultType, StudyFilte r studyFil ter) | |
1305 | th rows Trans lationExce ption | |
1306 | { | |
1307 | if(s tudyResult Type == nu ll) | |
1308 | { | |
1309 | getLog ger().erro r("Cannot translate null Feder ationStudy ResultType "); | |
1310 | return StudySetR esult.crea teFullResu lt(null); | |
1311 | } | |
1312 | Sort edSet<Stud y> studies = transla te(studyRe sultType.g etStudies( ), studyFi lter); | |
1313 | Arti factResult Status art ifactResul tStatus = translate( studyResul tType.getA rtifactRes ultStatus( )); | |
1314 | List <ArtifactR esultError > artifact ResultErro rs = trans late(study ResultType .getErrors ()); | |
1315 | ||
1316 | retu rn StudySe tResult.cr eate(studi es, artifa ctResultSt atus, arti factResult Errors); | |
1317 | } | |
1318 | ||
1319 | pr ivate stat ic SortedS et<Study> translate( Federation StudyType [] studies , StudyFil ter studyF ilter) | |
1320 | th rows Trans lationExce ption | |
1321 | { | |
1322 | Sort edSet<Stud y> result = new Tree Set<Study> (); | |
1323 | if(s tudies == null) | |
1324 | return result; | |
1325 | for( int i = 0; i < studi es.length; i++) | |
1326 | { | |
1327 | Federa tionStudyT ype studyT ype = stud ies[i]; | |
1328 | // CTB 29March20 10 | |
1329 | // eit her the st udy filter has no st udy ID spe cified or the study IDs match | |
1330 | // the study ID from the f ederation call will be base 32 encoded | |
1331 | ||
1332 | // JMW 6/1/2010 - need to translate first to g et the pro per URN to determine if allowe d to inclu de in resu lt | |
1333 | Study study = tr anslate(st udyType); | |
1334 | boolea n useStudy = true; | |
1335 | if(stu dyFilter ! = null) | |
1336 | { | |
1337 | useStudy = !studyF ilter.isSt udyIenSpec ified() || | |
1338 | studyFilte r.isAllowa bleStudyId ( study.ge tGlobalArt ifactIdent ifier()) | | | |
1339 | st udyFilter. isAllowabl eStudyId(s tudy.getAl ternateArt ifactIdent ifier()); | |
1340 | } | |
1341 | if(use Study) | |
1342 | result.a dd(study); | |
1343 | } | |
1344 | // J MW 1/5/200 9 - if the study IEN is not sp ecified th en the res ults need to be filt ered. | |
1345 | // c all the pr e and post filter si nce the pr e filter c annot run on the Fed eration Da tasource b efore call ing the DS | |
1346 | // b oth need t o be run d epending o n the crea tor - migh t have dif ferent fun ctionality on the fi lter funct ions | |
1347 | if(( studyFilte r != null) && (!stud yFilter.is StudyIenSp ecified()) ) | |
1348 | { | |
1349 | studyF ilter.preF ilter(resu lt); | |
1350 | studyF ilter.post Filter(res ult); | |
1351 | } | |
1352 | retu rn result; | |
1353 | } | |
1354 | ||
1355 | @S uppressWar nings({ "d eprecation ", "unchec ked" }) | |
1356 | pu blic stati c Study tr anslate(Fe derationSt udyType st udyType) | |
1357 | th rows Trans lationExce ption | |
1358 | { | |
1359 | Stud y study = null; | |
1360 | Stri ng studyId = studyTy pe.getStud yId(); | |
1361 | Stud yLoadLevel studyLoad Level = tr anslate(st udyType.ge tStudyLoad Level()); | |
1362 | try | |
1363 | { | |
1364 | study = Study.cr eate(Objec tOrigin.UN KNOWN, stu dyType.get SiteNumber (), | |
1365 | studyId, P atientIden tifier.icn PatientIde ntifier(st udyType.ge tPatientIc n()), | |
1366 | studyLoadL evel, | |
1367 | translate( studyType. getStudyDe letedImage State()), studyType. isStudyInN ewDataStru cture()); | |
1368 | } | |
1369 | catc h (URNForm atExceptio n x) | |
1370 | { | |
1371 | getLog ger().erro r("Unable to create a Study fr om the giv en key ele ments"); | |
1372 | throw new Transl ationExcep tion("Unab le to crea te a Study from the given key elements") ; | |
1373 | } | |
1374 | if(( studyType. getAlterna teArtifact Id() != nu ll) && (st udyType.ge tAlternate ArtifactId ().length( ) > 0)) | |
1375 | { | |
1376 | try | |
1377 | { | |
1378 | study.se tAlternate ArtifactId entifier(G lobalArtif actIdentif ierFactory .create(st udyType.ge tAlternate ArtifactId (), StudyU RN.class)) ; | |
1379 | } | |
1380 | catch( GlobalArti factIdenti fierFormat Exception gaifX) | |
1381 | { | |
1382 | getLogge r().error( "GlobalArt ifactIdent ifierForma tException creating alternate artifact I D for stud y from val ue '" + st udyType.ge tAlternate ArtifactId () + "', " + gaifX.g etMessage( ), gaifX); | |
1383 | } | |
1384 | } | |
1385 | ||
1386 | // if ( studyType. getDescrip tion() != null) | |
1387 | // { | |
1388 | // String [] parts = StringUti l.split(st udyType.ge tDescripti on(), Stri ngUtil.RIG HT_BRACKET ); | |
1389 | // String altExamNu mber = par ts[0]; | |
1390 | // altExa mNumber = altExamNum ber.substr ing(1).tri m(); | |
1391 | // study. setAlterna teExamNumb er(altExam Number); | |
1392 | // logger .debug("WF P: Exam#: "+altExamN umber); | |
1393 | // study. setDescrip tion(study Type.getDe scription( )); | |
1394 | // } | |
1395 | // else | |
1396 | // { | |
1397 | // study. setDescrip tion(""); | |
1398 | // } | |
1399 | ||
1400 | if ( studyType. getDescrip tion() != null) | |
1401 | { | |
1402 | study. setDescrip tion(study Type.getDe scription( )); | |
1403 | } | |
1404 | else | |
1405 | { | |
1406 | study. setDescrip tion(""); | |
1407 | } | |
1408 | ||
1409 | if(s tudyType.g etAlternat eExamNumbe r() != nul l) | |
1410 | { | |
1411 | study. setAlterna teExamNumb er(studyTy pe.getAlte rnateExamN umber()); | |
1412 | } | |
1413 | else | |
1414 | { | |
1415 | study. setAlterna teExamNumb er(""); | |
1416 | } | |
1417 | ||
1418 | stud y.setStudy Uid(studyT ype.getDic omUid()); | |
1419 | stud y.setImage Count(stud yType.getI mageCount( )); | |
1420 | //st udy.setPat ientIcn(st udyType.ge tPatientIc n()); | |
1421 | if ( studyType. getPatient Name() == null) | |
1422 | { | |
1423 | studyT ype.setPat ientName(" "); | |
1424 | } | |
1425 | stud y.setPatie ntName(stu dyType.get PatientNam e().replac eAll("\\^" , " ")); | |
1426 | ||
1427 | stud y.setProce dureDate( studyType. getProcedu reDate() ) ; | |
1428 | stud y.setProce dure(study Type.getPr ocedureDes cription() == null ? "" : stud yType.getP rocedureDe scription( )); | |
1429 | //st udy.setRad iologyRepo rt((studyT ype.getRad iologyRepo rt() == nu ll ? "" : studyType. getRadiolo gyReport() )); | |
1430 | // J MW 10/12/2 010 - chec k the stud y load lev el to see if the rep ort should have been included. If not th en | |
1431 | // d on't use t he report value beca use it mig ht be an e mpty strin g which do esn't alwa ys mean th e report i s there | |
1432 | // t his is a b it sad but necessary for some reason | |
1433 | if(s tudyLoadLe vel.isIncl udeReport( )) | |
1434 | study. setRadiolo gyReport(s tudyType.g etRadiolog yReport()) ; // even if its nul l, thats o k, means s tudy not l oaded | |
1435 | ||
1436 | stud y.setSiteN ame(studyT ype.getSit eName() == null ? "" : studyTy pe.getSite Name()); | |
1437 | stud y.setSpeci alty(study Type.getSp ecialtyDes cription() == null ? "" : stud yType.getS pecialtyDe scription( )); | |
1438 | ||
1439 | stud y.setOrigi n(studyTyp e.getOrigi n()); | |
1440 | stud y.setSiteA bbr(studyT ype.getSit eAbbreviat ion()); | |
1441 | if(s tudyType.g etStudyMod alities() != null) | |
1442 | { | |
1443 | String [] modalit ies = stud yType.getS tudyModali ties(); | |
1444 | if(mod alities != null) | |
1445 | { | |
1446 | for(int i = 0; i < modalitie s.length; i++) | |
1447 | { | |
1448 | study.addM odality(mo dalities[i ]); | |
1449 | } | |
1450 | } | |
1451 | } | |
1452 | ||
1453 | // D isplay spe cific fiel ds | |
1454 | stud y.setNoteT itle(study Type.getNo teTitle()) ; | |
1455 | stud y.setImage Package(st udyType.ge tImagePack age()); | |
1456 | stud y.setImage Type(study Type.getIm ageType()) ; | |
1457 | stud y.setEvent (studyType .getEvent( )); | |
1458 | stud y.setOrigi n(studyTyp e.getOrigi n()); | |
1459 | stud y.setImage Package(st udyType.ge tImagePack age()); | |
1460 | stud y.setStudy Class(stud yType.getS tudyClass( )); | |
1461 | stud y.setCaptu reDate(stu dyType.get CaptureDat e()); | |
1462 | stud y.setCaptu reBy(study Type.getCa pturedBy() ); | |
1463 | stud y.setRpcRe sponseMsg( studyType. getRpcResp onseMsg()) ; | |
1464 | stud y.setError Message(st udyType.ge tErrorMess age() == n ull ? "" : studyType .getErrorM essage()); | |
1465 | stud y.setDocum entDate(st udyType.ge tDocumentD ate()); | |
1466 | stud y.setSensi tive(study Type.isSen sitive()); | |
1467 | stud y.setStudy Status(tra nslate(stu dyType.get StudyStatu s())); | |
1468 | stud y.setStudy ViewStatus (translate (studyType .getStudyV iewStatus( ))); | |
1469 | stud y.setCptCo de(studyTy pe.getCptC ode()); | |
1470 | stud y.setConso lidatedSit eNumber(st udyType.ge tConsolida tedSiteNum ber()); | |
1471 | stud y.setAlien SiteNumber (studyType .getAlienS iteNumber( )); | |
1472 | stud y.setStudy ImagesHave Annotation s(studyTyp e.isStudyI magesHaveA nnotations ()); | |
1473 | stud y.setGroup Ien(studyT ype.getGro upIen()); | |
1474 | //st udy.setAlt ernateExam Number(stu dyType.get AlternateE xamNumber( )); | |
1475 | stud y.setConte xtId(study Type.getCo ntextId()) ; | |
1476 | stud y.setStudy InNewDataS tructure(s tudyType.i sStudyInNe wDataStruc ture()); | |
1477 | Imag e firstIma ge = null; | |
1478 | ||
1479 | firs tImage = t ranslate(s tudyType.g etFirstIma ge()); | |
1480 | if(s tudyType.g etSeries() != null) | |
1481 | { | |
1482 | for(Fe derationSe riesType s eries : st udyType.ge tSeries()) | |
1483 | { | |
1484 | Series s er = trans late(serie s); | |
1485 | study.ad dSeries(se r); | |
1486 | if(first Image == n ull) | |
1487 | { | |
1488 | Iterator<I mage> iter = ser.ite rator(); | |
1489 | if(iter.ha sNext()) | |
1490 | fi rstImage = iter.next (); | |
1491 | } | |
1492 | } | |
1493 | } | |
1494 | ||
1495 | if(f irstImage != null) | |
1496 | { | |
1497 | study. setFirstIm age(firstI mage); | |
1498 | study. setFirstIm ageIen(fir stImage.ge tIen()); | |
1499 | } | |
1500 | stud y.setNumbe rOfDicomIm ages(study Type.getNu mberOfDico mImages()) ; | |
1501 | retu rn study; | |
1502 | } | |
1503 | ||
1504 | pu blic stati c ObjectSt atus trans late(Feder ationObjec tStatusTyp e objectSt atus) | |
1505 | { | |
1506 | for( Entry<Obje ctStatus, Federation ObjectStat usType> en try : obje ctStatusMa p.entrySet ()) | |
1507 | { | |
1508 | if(ent ry.getValu e() == obj ectStatus) | |
1509 | return e ntry.getKe y(); | |
1510 | } | |
1511 | retu rn ObjectS tatus.UNKN OWN; | |
1512 | } | |
1513 | ||
1514 | pu blic stati c Federati onObjectSt atusType t ranslate(O bjectStatu s objectSt atus) | |
1515 | { | |
1516 | for( Entry<Obje ctStatus, Federation ObjectStat usType> en try : obje ctStatusMa p.entrySet ()) | |
1517 | { | |
1518 | if(ent ry.getKey( ) == objec tStatus) | |
1519 | return e ntry.getVa lue(); | |
1520 | } | |
1521 | retu rn Federat ionObjectS tatusType. UNKNOWN; | |
1522 | } | |
1523 | ||
1524 | pu blic stati c Federati onStudyRes ultType tr anslate(St udySetResu lt studySe t) | |
1525 | th rows Trans lationExce ption | |
1526 | { | |
1527 | if(s tudySet == null) | |
1528 | return null; | |
1529 | ||
1530 | Fede rationStud yResultTyp e result = new Feder ationStudy ResultType (); | |
1531 | resu lt.setStud ies(transl ate(studyS et.getArti facts())); | |
1532 | resu lt.setArti factResult Status(tra nslate(stu dySet.getA rtifactRes ultStatus( ))); | |
1533 | resu lt.setErro rs(transla teArtifact ResultErro rList(stud ySet.getAr tifactResu ltErrors() )); | |
1534 | retu rn result; | |
1535 | } | |
1536 | ||
1537 | pr ivate stat ic List<Ar tifactResu ltError> t ranslate(F ederationA rtifactRes ultErrorTy pe [] erro rs) | |
1538 | { | |
1539 | if(e rrors == n ull) | |
1540 | return null; | |
1541 | ||
1542 | List <ArtifactR esultError > result = new Array List<Artif actResultE rror>(erro rs.length) ; | |
1543 | for( Federation ArtifactRe sultErrorT ype error : errors) | |
1544 | { | |
1545 | result .add(trans late(error )); | |
1546 | } | |
1547 | ||
1548 | retu rn result; | |
1549 | } | |
1550 | ||
1551 | pr ivate stat ic Artifac tResultErr or transla te(Federat ionArtifac tResultErr orType err or) | |
1552 | { | |
1553 | Stri ng context = error.g etCodeCont ext(); | |
1554 | Stri ng locatio n = error. getLocatio n(); | |
1555 | Arti factResult ErrorCode errorCode = translat e(error.ge tErrorCode ()); | |
1556 | Arti factResult ErrorSever ity severi ty = trans late(error .getSeveri ty()); | |
1557 | retu rn new Fed erationArt ifactResul tError(con text, loca tion, erro rCode, sev erity); | |
1558 | } | |
1559 | ||
1560 | pr ivate stat ic Federat ionArtifac tResultErr orType [] translateA rtifactRes ultErrorLi st(List<Ar tifactResu ltError> e rrors) | |
1561 | { | |
1562 | if(e rrors == n ull) | |
1563 | return null; | |
1564 | ||
1565 | Fede rationArti factResult ErrorType [] result = new Fede rationArti factResult ErrorType [errors.si ze()]; | |
1566 | int i = 0; | |
1567 | for( ArtifactRe sultError error : er rors) | |
1568 | { | |
1569 | result [i] = tran slate(erro r); | |
1570 | i++; | |
1571 | } | |
1572 | ||
1573 | retu rn result; | |
1574 | } | |
1575 | ||
1576 | pr ivate stat ic Federat ionArtifac tResultErr orType tra nslate(Art ifactResul tError err or) | |
1577 | { | |
1578 | Fede rationArti factResult ErrorType result = n ew Federat ionArtifac tResultErr orType(); | |
1579 | ||
1580 | resu lt.setCode Context(er ror.getCod eContext() ); | |
1581 | resu lt.setLoca tion(error .getLocati on()); | |
1582 | resu lt.setErro rCode(tran slate(erro r.getError Code())); | |
1583 | resu lt.setSeve rity(trans late(error .getSeveri ty())); | |
1584 | retu rn result; | |
1585 | } | |
1586 | ||
1587 | pu blic stati c Federati onArtifact ResultErro rSeverityT ype transl ate(Artifa ctResultEr rorSeverit y artifact ResultErro rSeverity) | |
1588 | { | |
1589 | for( Entry<Arti factResult ErrorSever ity, Feder ationArtif actResultE rrorSeveri tyType> en try : Fede rationRest Translator .artifactR esultError SeverityMa p.entrySet ()) | |
1590 | { | |
1591 | if(ent ry.getKey( ) == artif actResultE rrorSeveri ty) | |
1592 | { | |
1593 | return e ntry.getVa lue(); | |
1594 | } | |
1595 | } | |
1596 | retu rn Federat ionArtifac tResultErr orSeverity Type.error ; | |
1597 | } | |
1598 | ||
1599 | pu blic stati c Artifact ResultErro rSeverity translate( Federation ArtifactRe sultErrorS everityTyp e artifact ResultErro rSeverityT ype) | |
1600 | { | |
1601 | for( Entry<Arti factResult ErrorSever ity, Feder ationArtif actResultE rrorSeveri tyType> en try : Fede rationRest Translator .artifactR esultError SeverityMa p.entrySet ()) | |
1602 | { | |
1603 | if(ent ry.getValu e() == art ifactResul tErrorSeve rityType) | |
1604 | { | |
1605 | return e ntry.getKe y(); | |
1606 | } | |
1607 | } | |
1608 | retu rn Artifac tResultErr orSeverity .error; | |
1609 | } | |
1610 | ||
1611 | pu blic stati c Federati onArtifact ResultErro rCodeType translate( ArtifactRe sultErrorC ode artifa ctResultEr rorCode) | |
1612 | { | |
1613 | for( Entry<Arti factResult ErrorCode, Federatio nArtifactR esultError CodeType> entry : Fe derationRe stTranslat or.artifac tResultErr orCodeMap. entrySet() ) | |
1614 | { | |
1615 | if(ent ry.getKey( ) == artif actResultE rrorCode) | |
1616 | { | |
1617 | return e ntry.getVa lue(); | |
1618 | } | |
1619 | } | |
1620 | retu rn Federat ionArtifac tResultErr orCodeType .internalE xception; | |
1621 | } | |
1622 | ||
1623 | pu blic stati c Artifact ResultErro rCode tran slate(Fede rationArti factResult ErrorCodeT ype artifa ctResultEr rorCodeTyp e) | |
1624 | { | |
1625 | for( Entry<Arti factResult ErrorCode, Federatio nArtifactR esultError CodeType> entry : Fe derationRe stTranslat or.artifac tResultErr orCodeMap. entrySet() ) | |
1626 | { | |
1627 | if(ent ry.getValu e() == art ifactResul tErrorCode Type) | |
1628 | { | |
1629 | return e ntry.getKe y(); | |
1630 | } | |
1631 | } | |
1632 | retu rn Artifac tResultErr orCode.int ernalExcep tion; | |
1633 | } | |
1634 | ||
1635 | pu blic stati c Federati onStudyTyp e [] trans late(Colle ction<Stud y> studies ) | |
1636 | th rows Trans lationExce ption | |
1637 | { | |
1638 | if(s tudies == null) | |
1639 | return null; | |
1640 | ||
1641 | Fede rationStud yType [] r esult = ne w Federati onStudyTyp e [studies .size()]; | |
1642 | int i = 0; | |
1643 | for( Study stud y : studie s) | |
1644 | { | |
1645 | result [i] = tran slate(stud y); | |
1646 | i++; | |
1647 | } | |
1648 | ||
1649 | retu rn result; | |
1650 | } | |
1651 | ||
1652 | pu blic stati c Federati onStudyTyp e translat e(Study st udy) | |
1653 | th rows Trans lationExce ption | |
1654 | { | |
1655 | if(s tudy == nu ll) | |
1656 | return null; | |
1657 | Fede rationStud yType resu lt = | |
1658 | new Fe derationSt udyType(); | |
1659 | Fede rationStud yLoadLevel Type loadL evel = tra nslate(stu dy.getStud yLoadLevel ()); | |
1660 | resu lt.setStud yLoadLevel ( loadLeve l ); | |
1661 | resu lt.setStud yDeletedIm ageState(t ranslate(s tudy.getSt udyDeleted ImageState ())); | |
1662 | //re sult.setDe scription( study.getD escription ()); | |
1663 | ||
1664 | resu lt.setEven t(study.ge tEvent()); | |
1665 | resu lt.setImag eCount(stu dy.getImag eCount()); | |
1666 | resu lt.setImag ePackage(s tudy.getIm agePackage ()); | |
1667 | resu lt.setImag eType(stud y.getImage Type()); | |
1668 | resu lt.setNote Title(stud y.getNoteT itle()); | |
1669 | resu lt.setOrig in(study.g etOrigin() ); | |
1670 | resu lt.setPati entIcn(stu dy.getPati entId()); | |
1671 | resu lt.setPati entName(st udy.getPat ientName() ); | |
1672 | resu lt.setProc edureDescr iption(stu dy.getProc edure()); | |
1673 | resu lt.setRadi ologyRepor t(study.ge tRadiology Report()); | |
1674 | resu lt.setSite Number(stu dy.getSite Number()); | |
1675 | resu lt.setSite Name(study .getSiteNa me()); | |
1676 | resu lt.setSite Abbreviati on(study.g etSiteAbbr ()); | |
1677 | resu lt.setSpec ialtyDescr iption(stu dy.getSpec ialty()); | |
1678 | resu lt.setProc edureDate( study.getP rocedureDa te()); | |
1679 | ||
1680 | resu lt.setStud yPackage(s tudy.getIm agePackage ()); | |
1681 | resu lt.setStud yClass(stu dy.getStud yClass() = = null ? " " : study. getStudyCl ass()); | |
1682 | resu lt.setStud yType(stud y.getImage Type()); | |
1683 | resu lt.setCapt ureDate(st udy.getCap tureDate() ); | |
1684 | resu lt.setCapt uredBy(stu dy.getCapt ureBy()); | |
1685 | resu lt.setRpcR esponseMsg (study.get RpcRespons eMsg()); | |
1686 | ||
1687 | resu lt.setDocu mentDate(s tudy.getDo cumentDate ()); | |
1688 | resu lt.setSens itive(stud y.isSensit ive()); | |
1689 | resu lt.setStud yStatus(tr anslate(st udy.getStu dyStatus() )); | |
1690 | resu lt.setStud yViewStatu s(translat e(study.ge tStudyView Status())) ; | |
1691 | resu lt.setCptC ode(study. getCptCode ()); | |
1692 | resu lt.setCons olidatedSi teNumber(s tudy.getCo nsolidated SiteNumber ()); | |
1693 | resu lt.setAlie nSiteNumbe r(study.ge tAlienSite Number()); | |
1694 | resu lt.setAlte rnateExamN umber(stud y.getAlter nateExamNu mber()); | |
1695 | resu lt.setGrou pIen(study .getGroupI en()); | |
1696 | resu lt.setCont extId(stud y.getConte xtId()); | |
1697 | resu lt.setStud yInNewData Structure( study.isSt udyInNewDa taStructur e()); | |
1698 | if(s tudy.getAl ternateArt ifactIdent ifier() != null) | |
1699 | { | |
1700 | result .setAltern ateArtifac tId(study. getAlterna teArtifact Identifier ().toStrin g()); | |
1701 | } | |
1702 | ||
1703 | resu lt.setDesc ription(st udy.getDes cription() == null ? "" : stud y.getDescr iption()); | |
1704 | ||
1705 | resu lt.setErro rMessage(s tudy.getEr rorMessage () == null ? "" : st udy.getErr orMessage( )); | |
1706 | // r eturn null for the U ID instead of the em pty string to be con sistent wi th the WSD L - DKB | |
1707 | if ( study.getS tudyUid() != null && study.get StudyUid() .trim().le ngth() > 0 ) | |
1708 | result .setDicomU id(study.g etStudyUid ()); | |
1709 | else | |
1710 | result .setDicomU id(null); | |
1711 | ||
1712 | resu lt.setStud yId(study. getStudyIe n()); | |
1713 | ||
1714 | if(s tudy.getSe ries() != null) | |
1715 | { | |
1716 | Federa tionSeries Type [] se riesSet = new Federa tionSeries Type[study .getSeries Count()]; | |
1717 | int i = 0; | |
1718 | for(Se ries serie s : study) | |
1719 | { | |
1720 | seriesSe t[i] = tra nslate(ser ies); | |
1721 | i++; | |
1722 | } | |
1723 | result .setSeries (seriesSet ); | |
1724 | } | |
1725 | ||
1726 | //WF P-I want t o know why this now works corr ectly when I removed the excep tion. | |
1727 | // The st udy still contains t he firstIm age Image object. | |
1728 | // Yet at this poin t it is nu ll. | |
1729 | if(s tudy.getFi rstImage() == null) | |
1730 | // throw new Transl ationExcep tion("Stud y.firstIma ge is null , translat ion of stu dy '" + st udy.getStu dyUrn() + "' cannot continue." ); | |
1731 | getLog ger().warn ("First Im age is nul l."); | |
1732 | ||
1733 | Fede rationImag eType firs tImage = t ranslate(s tudy.getFi rstImage() ); | |
1734 | resu lt.setFirs tImage(fir stImage); | |
1735 | if(f irstImage != null) | |
1736 | result .setFirstI mageIen(fi rstImage.g etImageId( )); | |
1737 | ||
1738 | if(s tudy.getMo dalities() != null) | |
1739 | result .setStudyM odalities( study.getM odalities( ).toArray( new String [study.ge tModalitie s().size() ])); | |
1740 | resu lt.setStud yImagesHav eAnnotatio ns(study.i sStudyImag esHaveAnno tations()) ; | |
1741 | resu lt.setNumb erOfDicomI mages(stud y.getNumbe rOfDicomIm ages()); | |
1742 | retu rn result; | |
1743 | } | |
1744 | ||
1745 | pu blic stati c Federati onSeriesTy pe [] tran slate( | |
1746 | Set<Se ries> seri esSet) | |
1747 | thro ws ParseEx ception | |
1748 | { | |
1749 | if(ser iesSet == null)// || seriesSet .size() == 0) | |
1750 | return n ull; | |
1751 | ||
1752 | Federa tionSeries Type [] re sult = new Federatio nSeriesTyp e[seriesSe t.size()]; | |
1753 | int i = 0; | |
1754 | for(Se ries serie s : series Set) | |
1755 | { | |
1756 | result[i ] = transl ate(series ); | |
1757 | i++; | |
1758 | } | |
1759 | ||
1760 | return result; | |
1761 | } | |
1762 | ||
1763 | pu blic stati c Series t ranslate(F ederationS eriesType series) | |
1764 | { | |
1765 | if(s eries == n ull) | |
1766 | return null; | |
1767 | ||
1768 | Seri es result = | |
1769 | new Se ries(); | |
1770 | ||
1771 | // J MW 2/12/20 13 - if th e images a re empty t hen they m ight come across as a null arr ay | |
1772 | // c heck for n ull to avo id a NPE | |
1773 | Fede rationImag eType [] i mages = se ries.getIm ages(); | |
1774 | if(i mages != n ull) | |
1775 | { | |
1776 | for(Fe derationIm ageType im age : imag es) | |
1777 | result.a ddImage(tr anslate(im age)); | |
1778 | } | |
1779 | ||
1780 | resu lt.setSeri esUid(seri es.getSeri esUid()); | |
1781 | resu lt.setSeri esNumber(s eries.getS eriesNumbe r()); | |
1782 | resu lt.setSeri esIen(seri es.getSeri esIen()); | |
1783 | resu lt.setModa lity(serie s.getModal ity()); | |
1784 | ||
1785 | retu rn result; | |
1786 | } | |
1787 | ||
1788 | pu blic stati c Federati onSeriesTy pe transla te(Series series) | |
1789 | { | |
1790 | if(s eries == n ull) | |
1791 | return null; | |
1792 | ||
1793 | Fede rationSeri esType res ult = | |
1794 | new Fe derationSe riesType() ; | |
1795 | Fede rationImag eType [] i nstances = | |
1796 | new Fe derationIm ageType[se ries.getIm ageCount() ]; | |
1797 | ||
1798 | int index=0; | |
1799 | for( Image imag e : series ) | |
1800 | instan ces[index+ +] = trans late(image ); | |
1801 | resu lt.setImag es(instanc es); | |
1802 | ||
1803 | resu lt.setSeri esUid(seri es.getSeri esUid()); | |
1804 | resu lt.setSeri esNumber(s eries.getS eriesNumbe r()); | |
1805 | resu lt.setSeri esIen(seri es.getSeri esIen()); | |
1806 | resu lt.setModa lity(serie s.getModal ity()); | |
1807 | ||
1808 | retu rn result; | |
1809 | } | |
1810 | ||
1811 | pu blic stati c RoutingT oken trans lateRoutin gToken(Str ing serial izedRoutin gToken) | |
1812 | th rows Routi ngTokenFor matExcepti on | |
1813 | { | |
1814 | retu rn Routing TokenImpl. parse(seri alizedRout ingToken); | |
1815 | } | |
1816 | ||
1817 | pu blic stati c StudyLoa dLevel tra nslate( | |
1818 | Federa tionStudyL oadLevelTy pe loadLev elType) | |
1819 | { | |
1820 | for( E ntry<Study LoadLevel, Federatio nStudyLoad LevelType> entry : F ederationR estTransla tor.loadLe velMap.ent rySet() ) | |
1821 | if( entr y.getValue () == load LevelType ) | |
1822 | return ent ry.getKey( ); | |
1823 | ||
1824 | return StudyLoad Level.FULL ; | |
1825 | } | |
1826 | ||
1827 | pu blic stati c Federati onStudyLoa dLevelType translate ( | |
1828 | StudyL oadLevel l oadLevel) | |
1829 | { | |
1830 | for( E ntry<Study LoadLevel, Federatio nStudyLoad LevelType> entry : F ederationR estTransla tor.loadLe velMap.ent rySet() ) | |
1831 | if( entr y.getKey() == loadLe vel ) | |
1832 | return ent ry.getValu e(); | |
1833 | ||
1834 | return Federatio nStudyLoad LevelType. FULL; | |
1835 | } | |
1836 | ||
1837 | pu blic stati c Image tr anslate(Fe derationIm ageType in stanceType ) | |
1838 | // throws Tra nslationEx ception | |
1839 | { | |
1840 | if(i nstanceTyp e == null) | |
1841 | return null; | |
1842 | Imag e image = null; | |
1843 | try | |
1844 | { | |
1845 | if(ins tanceType. isImageInN ewDataStru cture()){ | |
1846 | image = Image.crea te( | |
1847 | in stanceType .getSiteNu mber(), | |
1848 | in stanceType .getImageI d(), | |
1849 | in stanceType .getStudyI d(), | |
1850 | Pa tientIdent ifier.icnP atientIden tifier(ins tanceType. getPatient Icn()), | |
1851 | in stanceType .getFullAr tifactIen( ), | |
1852 | in stanceType .getAbsArt ifactIen() , | |
1853 | in stanceType .getImageM odality(), | |
1854 | in stanceType .isImageIn NewDataStr ucture() | |
1855 | ); | |
1856 | } | |
1857 | else{ | |
1858 | image = Image.crea te( | |
1859 | instanceTy pe.getSite Number(), | |
1860 | instanceTy pe.getImag eId(), | |
1861 | instanceTy pe.getStud yId(), | |
1862 | PatientIde ntifier.ic nPatientId entifier(i nstanceTyp e.getPatie ntIcn()), | |
1863 | instanceTy pe.getImag eModality( ) | |
1864 | ); | |
1865 | } | |
1866 | } | |
1867 | catc h (URNForm atExceptio n x) | |
1868 | { | |
1869 | getLog ger().erro r("Unable to create an Image i nstance fr om the giv en key ele ments.", x ); | |
1870 | return null; | |
1871 | } | |
1872 | ||
1873 | imag e.setImage Number(ins tanceType. getImageNu mber() == null ? "" : instance Type.getIm ageNumber( ) + ""); | |
1874 | imag e.setImage Uid(instan ceType.get DicomUid() == null ? "" : inst anceType.g etDicomUid ()); | |
1875 | //im age.setDes cription(i nstanceTyp e.getDescr iption() = = null ? " " : instan ceType.get Descriptio n()); | |
1876 | ||
1877 | // if(i nstanceTyp e.getDescr iption() ! = null){ | |
1878 | // String descripti onElement = instance Type.getDe scription( ); | |
1879 | // | |
1880 | // image. setDescrip tion(descr iptionElem ent); | |
1881 | // | |
1882 | // String [] parts = StringUti l.split(de scriptionE lement, St ringUtil.R IGHT_BRACK ET); | |
1883 | // String altExamNu mber = par ts[0]; | |
1884 | // altExa mNumber = altExamNum ber.substr ing(1).tri m(); | |
1885 | // image. setAlterna teExamNumb er(altExam Number); | |
1886 | // logger .debug("WF P: Exam#: "+altExamN umber); | |
1887 | // } | |
1888 | // else { | |
1889 | // image. setDescrip tion(""); | |
1890 | // } | |
1891 | ||
1892 | imag e.setDescr iption("") ; | |
1893 | imag e.setAlter nateExamNu mber(""); | |
1894 | ||
1895 | if(i nstanceTyp e.getDescr iption() ! = null) | |
1896 | { | |
1897 | String descripti onElement = instance Type.getDe scription( ); | |
1898 | image. setDescrip tion(descr iptionElem ent); | |
1899 | ||
1900 | String [] parts = StringUti l.split(de scriptionE lement, St ringUtil.R IGHT_BRACK ET); | |
1901 | if (pa rts.length > 0) | |
1902 | { | |
1903 | String a ltExamNumb er = parts [0]; | |
1904 | altExamN umber = al tExamNumbe r.substrin g(1).trim( ); | |
1905 | image.se tAlternate ExamNumber (altExamNu mber); | |
1906 | getLogge r().debug( "WFP: Exam #: "+altEx amNumber); | |
1907 | } | |
1908 | } | |
1909 | ||
1910 | //im age.setPat ientICN(in stanceType .getPatien tIcn()); | |
1911 | imag e.setPatie ntName(ins tanceType. getPatient Name() == null ? "" : instance Type.getPa tientName( ).replaceA ll("\\^", " ")); | |
1912 | imag e.setProce dureDate(i nstanceTyp e.getProce dureDate() ); | |
1913 | imag e.setProce dure(insta nceType.ge tProcedure () == null ? "" : in stanceType .getProced ure()); | |
1914 | imag e.setSiteA bbr(instan ceType.get SiteAbbr() ); | |
1915 | imag e.setFullL ocation(in stanceType .getFullLo cation()); | |
1916 | imag e.setFullF ilename(in stanceType .getFullIm ageFilenam e()); | |
1917 | imag e.setAbsLo cation(ins tanceType. getAbsLoca tion()); | |
1918 | imag e.setAbsFi lename(ins tanceType. getAbsImag eFilename( )); | |
1919 | imag e.setDicom ImageNumbe rForDispla y(instance Type.getDi comImageNu mberForDis play() == null ? "" : instance Type.getDi comImageNu mberForDis play() + " "); | |
1920 | imag e.setDicom SequenceNu mberForDis play(insta nceType.ge tDicomSequ enceNumber ForDisplay () == null ? "" : in stanceType .getDicomS equenceNum berForDisp lay() + "" ); | |
1921 | imag e.setImgTy pe(instanc eType.getI mageType() ); | |
1922 | imag e.setImage Class(inst anceType.g etImageCla ss()); | |
1923 | imag e.setBigFi lename(ins tanceType. getBigImag eFilename( )); | |
1924 | imag e.setQaMes sage(insta nceType.ge tQaMessage ()); | |
1925 | //im age.setIma geModality (instanceT ype.getIma geModality () == null ? "" : in stanceType .getImageM odality()) ; | |
1926 | imag e.setError Message(in stanceType .getErrorM essage() = = null ? " " : instan ceType.get ErrorMessa ge()); | |
1927 | imag e.setAlien SiteNumber (instanceT ype.getAli enSiteNumb er()); | |
1928 | imag e.setConso lidatedSit eNumber(in stanceType .getConsol idatedSite Number()); | |
1929 | imag e.setImage Annotation Status(ins tanceType. getImageAn notationSt atus()); | |
1930 | imag e.setImage Annotation StatusDesc ription(in stanceType .getImageA nnotationS tatusDescr iption()); | |
1931 | imag e.setAssoc iatedNoteR esulted(in stanceType .getAssoci atedNoteRe sulted()); | |
1932 | imag e.setImage Package(in stanceType .getImageP ackage()); | |
1933 | imag e.setImage HasAnnotat ions(insta nceType.is ImageHasAn notations( )); | |
1934 | ||
1935 | imag e.setCaptu reDate(ins tanceType. getCapture Date()); | |
1936 | imag e.setDocum entDate(in stanceType .getDocume ntDate()); | |
1937 | imag e.setSensi tive(insta nceType.is Sensitive( )); | |
1938 | imag e.setImage ViewStatus (translate (instanceT ype.getIma geViewStat us())); | |
1939 | imag e.setImage Status(tra nslate(ins tanceType. getImageSt atus())); | |
1940 | imag e.setImage InNewDataS tructure(i nstanceTyp e.isImageI nNewDataSt ructure()) ; | |
1941 | imag e.setAbsAr tifactIen( instanceTy pe.getAbsA rtifactIen ()); | |
1942 | imag e.setFullA rtifactIen (instanceT ype.getFul lArtifactI en()); | |
1943 | imag e.setAbsDi skVolumeIe n(instance Type.getAb sDiskVolum eIen()); | |
1944 | imag e.setFullD iskVolumeI en(instanc eType.getF ullDiskVol umeIen()); | |
1945 | imag e.setFullF ilespec(in stanceType .getFullFi lespec()); | |
1946 | imag e.setAbsFi lespec(ins tanceType. getAbsFile spec()); | |
1947 | imag e.setFullF ilepath(in stanceType .getFullFi lepath()); | |
1948 | imag e.setAbsFi lepath(ins tanceType. getAbsFile path()); | |
1949 | ||
1950 | retu rn image; | |
1951 | } | |
1952 | ||
1953 | pu blic stati c Federati onImageTyp e translat e(Image im age) | |
1954 | { | |
1955 | if(i mage == nu ll) | |
1956 | return null; | |
1957 | Fede rationImag eType resu lt = new F ederationI mageType() ; | |
1958 | resu lt.setImag eId( image .getIen() ); | |
1959 | ||
1960 | // E xchange fi elds | |
1961 | // r eturn null for the U ID instead of the em pty string to be con sistent wi th the WSD L - DKB | |
1962 | if ( image.getI mageUid()! = null && image.getI mageUid(). trim().len gth() > 0) | |
1963 | { | |
1964 | result .setDicomU id(image.g etImageUid ().trim()) ; | |
1965 | } | |
1966 | ||
1967 | ||
1968 | if ( image.getI mageNumber () != null && image. getImageNu mber().tri m().length () > 0) | |
1969 | { | |
1970 | try | |
1971 | { | |
1972 | Integer imageNumbe r = new In teger(imag e.getImage Number()); | |
1973 | result.s etImageNum ber(imageN umber); | |
1974 | } | |
1975 | catch (NumberFor matExcepti on ex) | |
1976 | { | |
1977 | // not a number - return nul l | |
1978 | result.s etImageNum ber(null); | |
1979 | } | |
1980 | } | |
1981 | else | |
1982 | { | |
1983 | result .setImageN umber(null ); | |
1984 | } | |
1985 | ||
1986 | // C linical Di splay fiel ds | |
1987 | resu lt.setDesc ription(im age.getDes cription() ); | |
1988 | resu lt.setDico mImageNumb erForDispl ay(image.g etDicomIma geNumberFo rDisplay() ); | |
1989 | resu lt.setDico mSequenceN umberForDi splay(imag e.getDicom SequenceNu mberForDis play()); | |
1990 | resu lt.setPati entIcn(ima ge.getPati entId()); | |
1991 | resu lt.setPati entName(im age.getPat ientName() ); | |
1992 | resu lt.setProc edure(imag e.getProce dure()); | |
1993 | if(i mage.getPr ocedureDat e() == nul l) | |
1994 | { | |
1995 | getLog ger().warn ("Setting null proce dure date for image" ); | |
1996 | result .setProced ureDate(nu ll); | |
1997 | } | |
1998 | else | |
1999 | { | |
2000 | /* | |
2001 | // if the hour a nd minute are not 0, then like ly they co ntain real values fo r hour and minute (n ot 00:00) | |
2002 | // thi s leaves o pen the po ssibility of invalid data, if the real d ate was at 00:00 the n this wou ld not sho w that tim e. | |
2003 | // we would then omit data , not show invalid d ata | |
2004 | if((im age.getPro cedureDate ().getHour s() > 0) & & (image.g etProcedur eDate().ge tMinutes() > 0)) | |
2005 | { | |
2006 | instance Type.setPr ocedureDat e(getFeder ationWebse rviceLongD ateFormat( ).format(i mage.getPr ocedureDat e())); | |
2007 | } | |
2008 | else | |
2009 | { | |
2010 | instance Type.setPr ocedureDat e(getFeder ationWebse rviceShort DateFormat ().format( image.getP rocedureDa te())); | |
2011 | } | |
2012 | */ | |
2013 | result .setProced ureDate(im age.getPro cedureDate ()); | |
2014 | } | |
2015 | resu lt.setSite Number(ima ge.getSite Number()); | |
2016 | resu lt.setSite Abbr(image .getSiteAb br()); | |
2017 | resu lt.setImag eClass(ima ge.getImag eClass()); | |
2018 | resu lt.setAbsL ocation(im age.getAbs Location() ); | |
2019 | resu lt.setFull Location(i mage.getFu llLocation ()); | |
2020 | resu lt.setAbsA rtifactIen (image.get AbsArtifac tIen()); | |
2021 | resu lt.setFull ArtifactIe n(image.ge tFullArtif actIen()); | |
2022 | ||
2023 | resu lt.setQaMe ssage(imag e.getQaMes sage()); | |
2024 | resu lt.setImag eType(imag e.getImgTy pe()); | |
2025 | resu lt.setFull ImageFilen ame(image. getFullFil ename()); | |
2026 | resu lt.setAbsI mageFilena me(image.g etAbsFilen ame()); | |
2027 | resu lt.setBigI mageFilena me(image.g etBigFilen ame()); | |
2028 | ||
2029 | resu lt.setStud yId( image .getStudyI en() ); | |
2030 | resu lt.setImag eModality( image.getI mageModali ty()); | |
2031 | resu lt.setErro rMessage(i mage.getEr rorMessage () == null ? "" : im age.getErr orMessage( )); | |
2032 | resu lt.setCons olidatedSi teNumber(i mage.getCo nsolidated SiteNumber ()); | |
2033 | resu lt.setAlie nSiteNumbe r(image.ge tAlienSite Number()); | |
2034 | resu lt.setAsso ciatedNote Resulted(i mage.getAs sociatedNo teResulted ()); | |
2035 | resu lt.setImag eAnnotatio nStatus(im age.getIma geAnnotati onStatus() ); | |
2036 | resu lt.setImag eAnnotatio nStatusDes cription(i mage.getIm ageAnnotat ionStatusD escription ()); | |
2037 | resu lt.setImag eHasAnnota tions(imag e.isImageH asAnnotati ons()); | |
2038 | resu lt.setImag ePackage(i mage.getIm agePackage ()); | |
2039 | ||
2040 | resu lt.setCapt ureDate(im age.getCap tureDate() ); | |
2041 | resu lt.setDocu mentDate(i mage.getDo cumentDate ()); | |
2042 | resu lt.setSens itive(imag e.isSensit ive()); | |
2043 | resu lt.setImag eViewStatu s(translat e(image.ge tImageView Status())) ; | |
2044 | resu lt.setImag eStatus(tr anslate(im age.getIma geStatus() )); | |
2045 | resu lt.setImag eInNewData Structure( image.isIm ageInNewDa taStructur e()); | |
2046 | ||
2047 | ||
2048 | resu lt.setAbsD iskVolumeI en(image.g etAbsDiskV olumeIen() ); | |
2049 | resu lt.setFull DiskVolume Ien(image. getFullDis kVolumeIen ()); | |
2050 | resu lt.setFull Filespec(i mage.getFu llFilespec ()); | |
2051 | resu lt.setAbsF ilespec(im age.getAbs Filespec() ); | |
2052 | resu lt.setFull Filepath(i mage.getFu llFilepath ()); | |
2053 | resu lt.setAbsF ilepath(im age.getAbs Filepath() ); | |
2054 | ||
2055 | retu rn result; | |
2056 | ||
2057 | } | |
2058 | ||
2059 | pu blic stati c Federati onPatientS ensitiveTy pe transla te( | |
2060 | Patien tSensitive Value pati entSensiti veValue) | |
2061 | { | |
2062 | Fede rationPati entSensiti veType res ult = new Federation PatientSen sitiveType (); | |
2063 | resu lt.setWarn ingMessage (patientSe nsitiveVal ue.getWarn ingMessage ()); | |
2064 | resu lt.setSens itiveLevel (translate (patientSe nsitiveVal ue.getSens itiveLevel ())); | |
2065 | retu rn result; | |
2066 | } | |
2067 | ||
2068 | pu blic stati c List<Str ing> trans late(Strin g [] sites ) | |
2069 | { | |
2070 | List <String> r esult = ne w ArrayLis t<String>( sites.leng th); | |
2071 | for( String sit e : sites) | |
2072 | { | |
2073 | result .add(site) ; | |
2074 | } | |
2075 | retu rn result; | |
2076 | } | |
2077 | ||
2078 | pu blic stati c String [ ] translat eResolvedA rtifactSou rceList(Li st<Resolve dArtifactS ource> sit es) | |
2079 | { | |
2080 | Stri ng [] resu lt = new S tring[site s.size()]; | |
2081 | for( int i = 0; i < sites .size(); i ++) | |
2082 | { | |
2083 | result [i] = site s.get(i).g etArtifact Source().g etReposito ryId(); | |
2084 | } | |
2085 | retu rn result; | |
2086 | } | |
2087 | ||
2088 | pu blic stati c PatientS ensitiveVa lue transl ate( | |
2089 | Federa tionPatien tSensitive Type patie ntSensitiv eValue) | |
2090 | { | |
2091 | retu rn new Pat ientSensit iveValue(t ranslate(p atientSens itiveValue .getSensit iveLevel() ), | |
2092 | patientS ensitiveVa lue.getWar ningMessag e()); | |
2093 | } | |
2094 | ||
2095 | pr ivate stat ic Federat ionPatient Sensitivit yLevelType translate ( | |
2096 | Patien tSensitivi tyLevel pa tientSensi tivityLeve l) | |
2097 | { | |
2098 | for( Entry<Pat ientSensit ivityLevel , Federati onPatientS ensitivity LevelType> entry : F ederationR estTransla tor.patien tSensitive LevelMap.e ntrySet() ) | |
2099 | if( en try.getKey () == pati entSensiti vityLevel ) | |
2100 | return e ntry.getVa lue(); | |
2101 | ||
2102 | retu rn Federat ionPatient Sensitivit yLevelType .NO_ACTION _REQUIRED; | |
2103 | } | |
2104 | ||
2105 | pr ivate stat ic Patient Sensitivit yLevel tra nslate( | |
2106 | Federa tionPatien tSensitivi tyLevelTyp e patientS ensitivity Level) | |
2107 | { | |
2108 | for( Entry<Pat ientSensit ivityLevel , Federati onPatientS ensitivity LevelType> entry : F ederationR estTransla tor.patien tSensitive LevelMap.e ntrySet() ) | |
2109 | if( en try.getVal ue() == pa tientSensi tivityLeve l ) | |
2110 | return e ntry.getKe y(); | |
2111 | ||
2112 | retu rn Patient Sensitivit yLevel.NO_ ACTION_REQ UIRED; | |
2113 | } | |
2114 | ||
2115 | pu blic stati c Federati onPatientT ype[] tran slatePatie ntList(Lis t<Patient> patients) | |
2116 | { | |
2117 | Fede rationPati entType[] result = n ew Federat ionPatient Type[patie nts.size() ]; | |
2118 | for( int i = 0; i < patie nts.size() ; i++) | |
2119 | { | |
2120 | result [i] = tran slate(pati ents.get(i )); | |
2121 | } | |
2122 | retu rn result; | |
2123 | } | |
2124 | ||
2125 | pu blic stati c List<Pat ient> tran slate(Fede rationPati entType [] patients) | |
2126 | { | |
2127 | List <Patient> result = n ew ArrayLi st<Patient >(patients .length); | |
2128 | for( Federation PatientTyp e patient : patients ) | |
2129 | { | |
2130 | result .add(trans late(patie nt)); | |
2131 | } | |
2132 | retu rn result; | |
2133 | } | |
2134 | ||
2135 | pu blic stati c SortedSe t<Patient> translate ToSet(Fede rationPati entType [] patients) | |
2136 | { | |
2137 | Sort edSet<Pati ent> resul t = new Tr eeSet<Pati ent>(); | |
2138 | for( Federation PatientTyp e patient : patients ) | |
2139 | { | |
2140 | result .add(trans late(patie nt)); | |
2141 | } | |
2142 | retu rn result; | |
2143 | } | |
2144 | ||
2145 | pu blic stati c Federati onPatientT ype transl ate(Patien t patient) | |
2146 | { | |
2147 | retu rn new Fed erationPat ientType( | |
2148 | patient. getPatient Name(), | |
2149 | patient. getPatient Icn(), | |
2150 | patient. getVeteran Status(), | |
2151 | translat e(patient. getPatient Sex()), | |
2152 | patient. getDob(), | |
2153 | patient. getSsn(), | |
2154 | patient. getSensiti ve() | |
2155 | ); | |
2156 | } | |
2157 | ||
2158 | pu blic stati c Patient translate( Federation PatientTyp e patient) | |
2159 | { | |
2160 | retu rn new Pat ient( | |
2161 | patient. getPatient Name(), | |
2162 | patient. getPatient Icn(), | |
2163 | patient. getVeteran Status(), | |
2164 | translat e(patient. getPatient Sex()), | |
2165 | patient. getDob(), | |
2166 | patient. getSsn(), | |
2167 | null, | |
2168 | patient. getSensiti ve() | |
2169 | ); | |
2170 | } | |
2171 | ||
2172 | pu blic stati c Federati onPatientS exType tra nslate(Pat ientSex pa tientSex) | |
2173 | { | |
2174 | for( Entry<Pati entSex, Fe derationPa tientSexTy pe> entry : Federati onRestTran slator.pat ientSexMap .entrySet( )) | |
2175 | { | |
2176 | if(ent ry.getKey( ) == patie ntSex) | |
2177 | return e ntry.getVa lue(); | |
2178 | } | |
2179 | ||
2180 | retu rn Federat ionPatient SexType.Un known; | |
2181 | } | |
2182 | ||
2183 | pu blic stati c PatientS ex transla te(Federat ionPatient SexType pa tientSex) | |
2184 | { | |
2185 | for( Entry<Pati entSex, Fe derationPa tientSexTy pe> entry : Federati onRestTran slator.pat ientSexMap .entrySet( )) | |
2186 | { | |
2187 | if(ent ry.getValu e() == pat ientSex) | |
2188 | return e ntry.getKe y(); | |
2189 | } | |
2190 | retu rn Patient Sex.Unknow n; | |
2191 | } | |
2192 | ||
2193 | pu blic stati c StudyDel etedImageS tate trans late(Feder ationStudy DeletedIma geStateTyp e studyDel etedImageS tate) | |
2194 | { | |
2195 | for( Entry<Stud yDeletedIm ageState, Federation StudyDelet edImageSta teType> en try : Fede rationRest Translator .studyDele tedImageSt ateMap.ent rySet()) | |
2196 | { | |
2197 | if(ent ry.getValu e() == stu dyDeletedI mageState) | |
2198 | return e ntry.getKe y(); | |
2199 | } | |
2200 | retu rn StudyDe letedImage State.cann otIncludeD eletedImag es; | |
2201 | } | |
2202 | ||
2203 | pu blic stati c Federati onStudyDel etedImageS tateType t ranslate(S tudyDelete dImageStat e studyDel etedImageS tate) | |
2204 | { | |
2205 | for( Entry<Stud yDeletedIm ageState, Federation StudyDelet edImageSta teType> en try : Fede rationRest Translator .studyDele tedImageSt ateMap.ent rySet()) | |
2206 | { | |
2207 | if(ent ry.getKey( ) == study DeletedIma geState) | |
2208 | return e ntry.getVa lue(); | |
2209 | } | |
2210 | retu rn Federat ionStudyDe letedImage StateType. cannotIncl udeDeleted Images; | |
2211 | } | |
2212 | ||
2213 | pu blic stati c Artifact ResultStat us transla te(Federat ionArtifac tResultSta tusType ar tifactResu ltStatus) | |
2214 | { | |
2215 | for( Entry<Arti factResult Status, Fe derationAr tifactResu ltStatusTy pe> entry : Federati onRestTran slator.art ifactResul tStatusMap .entrySet( )) | |
2216 | { | |
2217 | if(ent ry.getValu e() == art ifactResul tStatus) | |
2218 | return e ntry.getKe y(); | |
2219 | } | |
2220 | retu rn Artifac tResultSta tus.fullRe sult; | |
2221 | } | |
2222 | ||
2223 | pu blic stati c Federati onArtifact ResultStat usType tra nslate(Art ifactResul tStatus ar tifactResu ltStatus) | |
2224 | { | |
2225 | for( Entry<Arti factResult Status, Fe derationAr tifactResu ltStatusTy pe> entry : Federati onRestTran slator.art ifactResul tStatusMap .entrySet( )) | |
2226 | { | |
2227 | if(ent ry.getKey( ) == artif actResultS tatus) | |
2228 | return e ntry.getVa lue(); | |
2229 | } | |
2230 | retu rn Federat ionArtifac tResultSta tusType.fu llResult; | |
2231 | } | |
2232 | ||
2233 | pu blic stati c Federati onImageFor matQualiti esType tra nslate(Ima geFormatQu alityList imageForma tQualityLi st) | |
2234 | { | |
2235 | if(i mageFormat QualityLis t == null) | |
2236 | return null; | |
2237 | Fede rationImag eFormatQua litiesType result = new Federa tionImageF ormatQuali tiesType() ; | |
2238 | List <Federatio nImageForm atQualityT ype> quali ties = new ArrayList <Federatio nImageForm atQualityT ype>(); | |
2239 | for( ImageForma tQuality i mageFormat Quality : imageForma tQualityLi st) | |
2240 | { | |
2241 | Federa tionImageF ormatQuali tyType qua lityType = translate (imageForm atQuality) ; | |
2242 | if(qua lityType ! = null) | |
2243 | qualitie s.add(qual ityType); | |
2244 | } | |
2245 | resu lt.setImag eFormatQua lities(qua lities.toA rray(new F ederationI mageFormat QualityTyp e[qualitie s.size()]) ); | |
2246 | retu rn result; | |
2247 | } | |
2248 | ||
2249 | pr ivate stat ic Federat ionImageFo rmatQualit yType tran slate(Imag eFormatQua lity image FormatQual ity) | |
2250 | { | |
2251 | if(i mageFormat Quality == null) | |
2252 | return null; | |
2253 | Fede rationImag eFormatQua lityType r esult = ne w Federati onImageFor matQuality Type(); | |
2254 | resu lt.setImag eFormat(im ageFormatQ uality.get ImageForma t().name() ); | |
2255 | resu lt.setImag eQuality(i mageFormat Quality.ge tImageQual ity().getC anonical() ); | |
2256 | retu rn result; | |
2257 | } | |
2258 | ||
2259 | pu blic stati c ImageFor matQuality List trans late(Feder ationImage FormatQual itiesType imageForma tQualities Type) | |
2260 | { | |
2261 | if(i mageFormat QualitiesT ype == nul l) | |
2262 | return null; | |
2263 | Imag eFormatQua lityList r esult = ne w ImageFor matQuality List(); | |
2264 | if(i mageFormat QualitiesT ype.getIma geFormatQu alities() != null) | |
2265 | { | |
2266 | for(Fe derationIm ageFormatQ ualityType imageForm atQualityT ype : imag eFormatQua litiesType .getImageF ormatQuali ties()) | |
2267 | { | |
2268 | ImageFor matQuality imageForm atQuality = translat e(imageFor matQuality Type); | |
2269 | if(image FormatQual ity != nul l) | |
2270 | result.add (imageForm atQuality) ; | |
2271 | } | |
2272 | } | |
2273 | ||
2274 | retu rn result; | |
2275 | } | |
2276 | ||
2277 | pr ivate stat ic ImageFo rmatQualit y translat e(Federati onImageFor matQuality Type image FormatQual ityType) | |
2278 | { | |
2279 | if(i mageFormat QualityTyp e == null) | |
2280 | return null; | |
2281 | Imag eFormat im ageFormat = ImageFor mat.valueO f(imageFor matQuality Type.getIm ageFormat( )); | |
2282 | ||
2283 | Imag eQuality i mageQualit y = ImageQ uality.get ImageQuali ty(imageFo rmatQualit yType.getI mageQualit y()); | |
2284 | if(( imageForma t == null) || (image Quality == null)) | |
2285 | return null; | |
2286 | ||
2287 | retu rn new Ima geFormatQu ality(imag eFormat, i mageQualit y); | |
2288 | } | |
2289 | ||
2290 | pu blic stati c List<Ima geAnnotati on> transl ate(Federa tionImageA nnotationT ype [] ima geAnnotati ons) | |
2291 | th rows URNFo rmatExcept ion | |
2292 | { | |
2293 | if(i mageAnnota tions == n ull) | |
2294 | return null; | |
2295 | List <ImageAnno tation> re sult = new ArrayList <ImageAnno tation>(); | |
2296 | ||
2297 | for( Federation ImageAnnot ationType imageAnnot ation : im ageAnnotat ions) | |
2298 | { | |
2299 | result .add(trans late(image Annotation )); | |
2300 | } | |
2301 | ||
2302 | retu rn result; | |
2303 | } | |
2304 | ||
2305 | pu blic stati c ImageAnn otation tr anslate(Fe derationIm ageAnnotat ionType im ageAnnotat ion) | |
2306 | th rows URNFo rmatExcept ion | |
2307 | { | |
2308 | Abst ractImagin gURN imagi ngUrn = | |
2309 | URNFac tory.creat e(imageAnn otation.ge tImagingUr n(), Abstr actImaging URN.class) ; | |
2310 | Imag eAnnotatio nURN image Annotation Urn = URNF actory.cre ate(imageA nnotation. getImageAn notationUr n(), Image Annotation URN.class) ; | |
2311 | Imag eAnnotatio nSource im ageAnnotat ionSource = translat e(imageAnn otation.ge tAnnotatio nSource()) ; | |
2312 | Imag eAnnotatio nUser imag eAnnotatio nUser = tr anslate(im ageAnnotat ion.getAnn otationSav edByUser() ); | |
2313 | Imag eAnnotatio n result = new Image Annotation (imagingUr n, imageAn notationUr n, | |
2314 | imageAnn otationUse r, imageAn notation.g etAnnotati onSavedDat e(), | |
2315 | imageAnn otationSou rce, image Annotation .isSavedAf terResult( ), | |
2316 | imageAnn otation.ge tAnnotatio nVersion() , | |
2317 | imageAnn otation.is Annotation Deleted()) ; | |
2318 | retu rn result; | |
2319 | } | |
2320 | ||
2321 | pr ivate stat ic ImageAn notationUs er transla te(Federat ionImageAn notationUs erType ima geAnnotati onUser) | |
2322 | { | |
2323 | retu rn new Ima geAnnotati onUser(ima geAnnotati onUser.get UserId(), imageAnnot ationUser. getName(), imageAnno tationUser .getServic e()); | |
2324 | } | |
2325 | ||
2326 | pu blic stati c ImageAnn otationSou rce transl ate(Federa tionImageA nnotationS ourceType imageAnnot ationSourc e) | |
2327 | { | |
2328 | for( Entry<Imag eAnnotatio nSource, F ederationI mageAnnota tionSource Type> entr y : Federa tionRestTr anslator.i mageAnnota tionSource Map.entryS et()) | |
2329 | { | |
2330 | if(ent ry.getValu e() == ima geAnnotati onSource) | |
2331 | { | |
2332 | return e ntry.getKe y(); | |
2333 | } | |
2334 | } | |
2335 | retu rn ImageAn notationSo urce.clini calDisplay ; | |
2336 | } | |
2337 | ||
2338 | pu blic stati c Federati onImageAnn otationSou rceType tr anslate(Im ageAnnotat ionSource imageAnnot ationSourc e) | |
2339 | { | |
2340 | for( Entry<Imag eAnnotatio nSource, F ederationI mageAnnota tionSource Type> entr y : Federa tionRestTr anslator.i mageAnnota tionSource Map.entryS et()) | |
2341 | { | |
2342 | if(ent ry.getKey( ) == image Annotation Source) | |
2343 | { | |
2344 | return e ntry.getVa lue(); | |
2345 | } | |
2346 | } | |
2347 | retu rn Federat ionImageAn notationSo urceType.c linicalDis play; | |
2348 | } | |
2349 | ||
2350 | pu blic stati c ImageAnn otationDet ails trans late(Feder ationImage Annotation DetailsTyp e imageAnn otationDet ails) | |
2351 | th rows URNFo rmatExcept ion | |
2352 | { | |
2353 | if(i mageAnnota tionDetail s == null) | |
2354 | return null; | |
2355 | Imag eAnnotatio n imageAnn otation = translate( imageAnnot ationDetai ls.getImag eAnnotatio n()); | |
2356 | retu rn new Ima geAnnotati onDetails( imageAnnot ation, ima geAnnotati onDetails. getAnnotat ionXml()); | |
2357 | } | |
2358 | ||
2359 | pu blic stati c Federati onImageAnn otationTyp e[] transl ate(List<I mageAnnota tion> imag eAnnotatio ns) | |
2360 | { | |
2361 | if(i mageAnnota tions == n ull) | |
2362 | return null; | |
2363 | Fede rationImag eAnnotatio nType [] r esult = | |
2364 | new Fe derationIm ageAnnotat ionType[im ageAnnotat ions.size( )]; | |
2365 | ||
2366 | for( int i = 0; i < image Annotation s.size(); i++) | |
2367 | { | |
2368 | result [i] = tran slate(imag eAnnotatio ns.get(i)) ; | |
2369 | } | |
2370 | ||
2371 | retu rn result; | |
2372 | } | |
2373 | ||
2374 | pu blic stati c Federati onImageAnn otationTyp e translat e(ImageAnn otation im ageAnnotat ion) | |
2375 | { | |
2376 | Fede rationImag eAnnotatio nType resu lt = | |
2377 | new Fe derationIm ageAnnotat ionType(); | |
2378 | ||
2379 | resu lt.setAnno tationSave dByUser(tr anslate(im ageAnnotat ion.getAnn otationSav edByUser() )); | |
2380 | resu lt.setAnno tationSave dDate(imag eAnnotatio n.getAnnot ationSaved Date()); | |
2381 | resu lt.setAnno tationSour ce(transla te(imageAn notation.g etAnnotati onSource() )); | |
2382 | resu lt.setAnno tationVers ion(imageA nnotation. getAnnotat ionVersion ()); | |
2383 | resu lt.setImag eAnnotatio nUrn(image Annotation .getAnnota tionUrn(). toString() ); | |
2384 | resu lt.setImag ingUrn(ima geAnnotati on.getImag ingUrn().t oString()) ; | |
2385 | resu lt.setSave dAfterResu lt(imageAn notation.i sSavedAfte rResult()) ; | |
2386 | resu lt.setAnno tationDele ted(imageA nnotation. isAnnotati onDeleted( )); | |
2387 | ||
2388 | retu rn result; | |
2389 | } | |
2390 | ||
2391 | pr ivate stat ic Federat ionImageAn notationUs erType tra nslate(Ima geAnnotati onUser ima geAnnotati onUser) | |
2392 | { | |
2393 | Fede rationImag eAnnotatio nUserType result = | |
2394 | new Fe derationIm ageAnnotat ionUserTyp e(); | |
2395 | ||
2396 | resu lt.setName (imageAnno tationUser .getName() ); | |
2397 | resu lt.setServ ice(imageA nnotationU ser.getSer vice()); | |
2398 | resu lt.setUser Id(imageAn notationUs er.getUser Id()); | |
2399 | ||
2400 | retu rn result; | |
2401 | } | |
2402 | ||
2403 | pu blic stati c Federati onImageAnn otationDet ailsType t ranslate(I mageAnnota tionDetail s imageAnn otationDet ails) | |
2404 | { | |
2405 | if(i mageAnnota tionDetail s == null) | |
2406 | return null; | |
2407 | Fede rationImag eAnnotatio nDetailsTy pe result = | |
2408 | new Fe derationIm ageAnnotat ionDetails Type(); | |
2409 | ||
2410 | resu lt.setAnno tationXml( imageAnnot ationDetai ls.getAnno tationXml( )); | |
2411 | resu lt.setImag eAnnotatio n(translat e(imageAnn otationDet ails.getIm ageAnnotat ion())); | |
2412 | ||
2413 | retu rn result; | |
2414 | } | |
2415 | ||
2416 | pu blic stati c List<Str ing> trans late(Feder ationStrin gArrayType values) | |
2417 | { | |
2418 | if(v alues == n ull) | |
2419 | return null; | |
2420 | // J ersey seem s to conve rt empty s tring arra ys into nu ll respons es | |
2421 | // w hen reques ting treat ing sites for a pati ent, the r esult is e xpected to be an emp ty array i f no sites for the p atient | |
2422 | if(v alues.getV alues() == null) | |
2423 | return new Array List<Strin g>(0); | |
2424 | List <String> r esult = ne w ArrayLis t<String>( values.get Values().l ength); | |
2425 | for( String val ue : value s.getValue s()) | |
2426 | { | |
2427 | result .add(value ); | |
2428 | } | |
2429 | retu rn result; | |
2430 | } | |
2431 | ||
2432 | pu blic stati c List<Div ision> tra nslate(Fed erationDiv isionType [] divisio ns) | |
2433 | { | |
2434 | if(d ivisions = = null) | |
2435 | return null; | |
2436 | List <Division> result = new ArrayL ist<Divisi on>(); | |
2437 | ||
2438 | for( Federation DivisionTy pe divisio n : divisi ons) | |
2439 | { | |
2440 | result .add(new D ivision(di vision.get DivisionIe n(), divis ion.getDiv isionName( ), divisio n.getDivis ionCode()) ); | |
2441 | } | |
2442 | ||
2443 | retu rn result; | |
2444 | } | |
2445 | ||
2446 | pu blic stati c Federati onDivision Type [] tr anslateDiv isionList( List<Divis ion> divis ions) | |
2447 | { | |
2448 | if(d ivisions = = null) | |
2449 | return null; | |
2450 | Fede rationDivi sionType [ ] result = new Feder ationDivis ionType[di visions.si ze()]; | |
2451 | for( int i = 0; i < divis ions.size( ); i++) | |
2452 | { | |
2453 | result [i] = tran slate(divi sions.get( i)); | |
2454 | } | |
2455 | ||
2456 | retu rn result; | |
2457 | } | |
2458 | ||
2459 | pr ivate stat ic Federat ionDivisio nType tran slate(Divi sion divis ion) | |
2460 | { | |
2461 | Fede rationDivi sionType r esult = ne w Federati onDivision Type(); | |
2462 | ||
2463 | resu lt.setDivi sionCode(d ivision.ge tDivisionC ode()); | |
2464 | resu lt.setDivi sionIen(di vision.get DivisionIe n()); | |
2465 | resu lt.setDivi sionName(d ivision.ge tDivisionN ame()); | |
2466 | ||
2467 | retu rn result; | |
2468 | } | |
2469 | ||
2470 | pu blic stati c UserInfo rmation tr anslate(Fe derationUs erInformat ionType us erInformat ion) | |
2471 | { | |
2472 | if(u serInforma tion == nu ll) | |
2473 | return null; | |
2474 | ||
2475 | List <String> k eys = tran slate(user Informatio n.getKeys( )); | |
2476 | User user = tr anslate(us erInformat ion.getUse r()); | |
2477 | retu rn new Use rInformati on(user, k eys, userI nformation .isCanUser Annotate() ); | |
2478 | } | |
2479 | ||
2480 | pr ivate stat ic User tr anslate(Fe derationUs erType use r) | |
2481 | { | |
2482 | if(u ser == nul l) | |
2483 | return null; | |
2484 | retu rn new Fed erationUse r(user.get UserId(), user.getNa me(), user .getTitle( ), user.ge tService() ); | |
2485 | } | |
2486 | ||
2487 | pu blic stati c Federati onUserInfo rmationTyp e translat e(UserInfo rmation us erInformat ion) | |
2488 | { | |
2489 | if(u serInforma tion == nu ll) | |
2490 | return null; | |
2491 | ||
2492 | Fede rationUser Informatio nType resu lt = new F ederationU serInforma tionType() ; | |
2493 | resu lt.setKeys (translate StringList (userInfor mation.get Keys())); | |
2494 | resu lt.setUser (translate (userInfor mation.get User())); | |
2495 | resu lt.setCanU serAnnotat e(userInfo rmation.is UserCanAnn otate()); | |
2496 | ||
2497 | retu rn result; | |
2498 | } | |
2499 | ||
2500 | pr ivate stat ic Federat ionUserTyp e translat e(User use r) | |
2501 | { | |
2502 | if(u ser == nul l) | |
2503 | return null; | |
2504 | Fede rationUser Type resul t = new Fe derationUs erType(); | |
2505 | resu lt.setName (user.getN ame()); | |
2506 | resu lt.setServ ice(user.g etService( )); | |
2507 | resu lt.setTitl e(user.get Title()); | |
2508 | resu lt.setUser Id(user.ge tUserId()) ; | |
2509 | retu rn result; | |
2510 | } | |
2511 | ||
2512 | pu blic stati c Federati onPatientM eansTestRe sultType t ranslate(P atientMean sTestResul t patientM eansTestRe sult) | |
2513 | { | |
2514 | if(p atientMean sTestResul t == null) | |
2515 | return null; | |
2516 | retu rn new Fed erationPat ientMeansT estResultT ype(patien tMeansTest Result.get Code(), | |
2517 | patientM eansTestRe sult.getMe ssage()); | |
2518 | } | |
2519 | ||
2520 | pu blic stati c PatientM eansTestRe sult trans late(Feder ationPatie ntMeansTes tResultTyp e patientM eansTestRe sult) | |
2521 | { | |
2522 | if(p atientMean sTestResul t == null) | |
2523 | return null; | |
2524 | retu rn new Pat ientMeansT estResult( patientMea nsTestResu lt.getCode (), | |
2525 | patientM eansTestRe sult.getMe ssage()); | |
2526 | } | |
2527 | ||
2528 | pu blic stati c Electron icSignatur eResult tr anslate(Fe derationEl ectronicSi gnatureRes ultType el ectronicSi gnature) | |
2529 | { | |
2530 | if(e lectronicS ignature = = null) | |
2531 | return null; | |
2532 | retu rn new Ele ctronicSig natureResu lt(electro nicSignatu re.isSucce ss(), | |
2533 | electron icSignatur e.getMessa ge()); | |
2534 | } | |
2535 | ||
2536 | pu blic stati c Federati onElectron icSignatur eResultTyp e translat e(Electron icSignatur eResult el ectronicSi gnature) | |
2537 | { | |
2538 | if(e lectronicS ignature = = null) | |
2539 | return null; | |
2540 | retu rn new Fed erationEle ctronicSig natureResu ltType(ele ctronicSig nature.isS uccess(), | |
2541 | electron icSignatur e.getMessa ge()); | |
2542 | } | |
2543 | ||
2544 | pu blic stati c Federati onImageAcc essReasonT ypeHolderT ype transl ateReasonT ypesToHold er(List<Im ageAccessR easonType> reasonTyp es) | |
2545 | { | |
2546 | if(r easonTypes == null) | |
2547 | return new Feder ationImage AccessReas onTypeHold erType(); | |
2548 | retu rn new Fed erationIma geAccessRe asonTypeHo lderType(t ranslateRe asonTypes( reasonType s)); | |
2549 | } | |
2550 | ||
2551 | pr ivate stat ic Federat ionImageAc cessReason TypeType[] translate ReasonType s(List<Ima geAccessRe asonType> reasonType s) | |
2552 | { | |
2553 | if(r easonTypes == null) | |
2554 | return null; | |
2555 | ||
2556 | Fede rationImag eAccessRea sonTypeTyp e [] resul t = new Fe derationIm ageAccessR easonTypeT ype [reaso nTypes.siz e()]; | |
2557 | for( int i = 0; i < reaso nTypes.siz e(); i++) | |
2558 | { | |
2559 | result [i] = tran slate(reas onTypes.ge t(i)); | |
2560 | } | |
2561 | retu rn result; | |
2562 | } | |
2563 | ||
2564 | pu blic stati c List<Ima geAccessRe asonType> translate( Federation ImageAcces sReasonTyp eHolderTyp e reasonTy pesHolder) | |
2565 | { | |
2566 | List <ImageAcce ssReasonTy pe> result = new Arr ayList<Ima geAccessRe asonType>( ); | |
2567 | if(r easonTypes Holder != null) | |
2568 | { | |
2569 | result .addAll(tr anslate(re asonTypesH older.getR easons())) ; | |
2570 | } | |
2571 | ||
2572 | retu rn result; | |
2573 | } | |
2574 | ||
2575 | pr ivate stat ic List<Im ageAccessR easonType> translate (Federatio nImageAcce ssReasonTy peType [] reasonType s) | |
2576 | { | |
2577 | if(r easonTypes == null) | |
2578 | return null; | |
2579 | List <ImageAcce ssReasonTy pe> result = new Arr ayList<Ima geAccessRe asonType>( ); | |
2580 | for( Federation ImageAcces sReasonTyp eType reas onType : r easonTypes ) | |
2581 | { | |
2582 | result .add(trans late(reaso nType)); | |
2583 | } | |
2584 | ||
2585 | retu rn result; | |
2586 | } | |
2587 | ||
2588 | pr ivate stat ic Federat ionImageAc cessReason TypeType t ranslate(I mageAccess ReasonType reasonTyp e) | |
2589 | { | |
2590 | for( Entry<Imag eAccessRea sonType, F ederationI mageAccess ReasonType Type> entr y : imageA ccessReaso nTypesMap. entrySet() ) | |
2591 | { | |
2592 | if(ent ry.getKey( ) == reaso nType) | |
2593 | return e ntry.getVa lue(); | |
2594 | } | |
2595 | retu rn null; | |
2596 | } | |
2597 | ||
2598 | pr ivate stat ic ImageAc cessReason Type trans late(Feder ationImage AccessReas onTypeType reasonTyp e) | |
2599 | { | |
2600 | for( Entry<Imag eAccessRea sonType, F ederationI mageAccess ReasonType Type> entr y : imageA ccessReaso nTypesMap. entrySet() ) | |
2601 | { | |
2602 | if(ent ry.getValu e() == rea sonType) | |
2603 | return e ntry.getKe y(); | |
2604 | } | |
2605 | retu rn null; | |
2606 | } | |
2607 | ||
2608 | pu blic stati c List<Ima geAccessRe ason> tran slate( Fed erationIma geAccessRe asonType [ ] reasons) | |
2609 | th rows Routi ngTokenFor matExcepti on | |
2610 | { | |
2611 | if(r easons == null) | |
2612 | return null; | |
2613 | List <ImageAcce ssReason> result = n ew ArrayLi st<ImageAc cessReason >(); | |
2614 | for( Federation ImageAcces sReasonTyp e reason : reasons) | |
2615 | { | |
2616 | result .add(trans late(reaso n)); | |
2617 | } | |
2618 | ||
2619 | retu rn result; | |
2620 | } | |
2621 | ||
2622 | pu blic stati c Federati onImageAcc essReasonT ype [] tra nslateImag eAccessRea sons(List< ImageAcces sReason> r easons) | |
2623 | { | |
2624 | if(r easons == null) | |
2625 | return null; | |
2626 | Fede rationImag eAccessRea sonType [] result = new Federa tionImageA ccessReaso nType [rea sons.size( )]; | |
2627 | for( int i = 0; i < reaso ns.size(); i++) | |
2628 | { | |
2629 | result [i] = tran slate(reas ons.get(i) ); | |
2630 | } | |
2631 | retu rn result; | |
2632 | } | |
2633 | ||
2634 | pr ivate stat ic Federat ionImageAc cessReason Type trans late(Image AccessReas on reason) | |
2635 | { | |
2636 | retu rn new Fed erationIma geAccessRe asonType(r eason.getR outingToke n().toRout ingTokenSt ring(), | |
2637 | reason.g etReasonCo de(), reas on.getDesc ription(), translate ReasonType s(reason.g etReasonTy pes()), | |
2638 | reason.g etGlobalRe asonCode() ); | |
2639 | } | |
2640 | ||
2641 | pr ivate stat ic ImageAc cessReason translate (Federatio nImageAcce ssReasonTy pe reason) | |
2642 | th rows Routi ngTokenFor matExcepti on | |
2643 | { | |
2644 | retu rn new Ima geAccessRe ason(trans lateRoutin gToken(rea son.getRou tingTokenS tring()), | |
2645 | reason.g etReasonCo de(), reas on.getDesc ription(), translate (reason.ge tReasonTyp es()), | |
2646 | reason.g etGlobalRe asonCode() ); | |
2647 | } | |
2648 | ||
2649 | pu blic stati c Federati onImagingL ogEventTyp e translat e(ImagingL ogEvent im agingLogEv ent) | |
2650 | { | |
2651 | retu rn new Fed erationIma gingLogEve ntType(ima gingLogEve nt.getRout ingTokenTo LogTo().to RoutingTok enString() , | |
2652 | imagingL ogEvent.ge tImagingUr n() == nul l ? null : imagingLo gEvent.get ImagingUrn ().toStrin gCDTP(), | |
2653 | imagingL ogEvent.ge tPatientIc n(), imagi ngLogEvent .getAccess Type(), im agingLogEv ent.getUse rInterface (), | |
2654 | imagingL ogEvent.ge tImageCoun t(), imagi ngLogEvent .getAdditi onalData() ); | |
2655 | } | |
2656 | ||
2657 | pu blic stati c ImagingL ogEvent tr anslate(Fe derationIm agingLogEv entType im agingLogEv ent) | |
2658 | th rows Trans lationExce ption | |
2659 | { | |
2660 | try | |
2661 | { | |
2662 | Routin gToken rou tingToken = | |
2663 | translat eRoutingTo ken(imagin gLogEvent. getRouting TokenToLog ToString() ); | |
2664 | Abstra ctImagingU RN imaging Urn = null ; | |
2665 | String imagingUr nString = imagingLog Event.getI magingUrnS tring(); | |
2666 | if(ima gingUrnStr ing != nul l && imagi ngUrnStrin g.length() > 0) | |
2667 | { | |
2668 | imagingU rn = | |
2669 | URNFactory .create(im agingUrnSt ring, SERI ALIZATION_ FORMAT.CDT P, Abstrac tImagingUR N.class); | |
2670 | ||
2671 | } | |
2672 | return new Imagi ngLogEvent (routingTo ken, imagi ngUrn, ima gingLogEve nt.getPati entIcn(), | |
2673 | imagingLog Event.getA ccessType( ), imaging LogEvent.g etUserInte rface(), | |
2674 | imagingLog Event.getI mageCount( ), imaging LogEvent.g etAddition alData()); | |
2675 | ||
2676 | } | |
2677 | catc h (Routing TokenForma tException rtfX) | |
2678 | { | |
2679 | throw new Transl ationExcep tion(rtfX) ; | |
2680 | } | |
2681 | catc h(URNForma tException urnfX) | |
2682 | { | |
2683 | throw new Transl ationExcep tion(urnfX ); | |
2684 | } | |
2685 | } | |
2686 | ||
2687 | pu blic stati c Federati onHealthSu mmaryType [] transla teHealthSu mmaries(Li st<HealthS ummaryType > healthSu mmaries) | |
2688 | { | |
2689 | if(h ealthSumma ries == nu ll) | |
2690 | return null; | |
2691 | Fede rationHeal thSummaryT ype [] res ult = new Federation HealthSumm aryType[he althSummar ies.size() ]; | |
2692 | for( int i = 0; i < healt hSummaries .size(); i ++) | |
2693 | { | |
2694 | result [i] = tran slate(heal thSummarie s.get(i)); | |
2695 | } | |
2696 | retu rn result; | |
2697 | } | |
2698 | ||
2699 | pr ivate stat ic Federat ionHealthS ummaryType translate (HealthSum maryType h ealthSumma ry) | |
2700 | { | |
2701 | retu rn new Fed erationHea lthSummary Type(healt hSummary.g etHealthSu mmaryUrn() .toString( ), healthS ummary.get Name()); | |
2702 | } | |
2703 | ||
2704 | pu blic stati c List<Hea lthSummary Type> tran slate(Fede rationHeal thSummaryT ype [] hea lthSummari es) | |
2705 | th rows Metho dException | |
2706 | { | |
2707 | if(h ealthSumma ries == nu ll) | |
2708 | return null; | |
2709 | ||
2710 | List <HealthSum maryType> result = n ew ArrayLi st<HealthS ummaryType >(); | |
2711 | for( Federation HealthSumm aryType he althSummar y : health Summaries) | |
2712 | { | |
2713 | result .add(trans late(healt hSummary)) ; | |
2714 | } | |
2715 | retu rn result; | |
2716 | } | |
2717 | ||
2718 | pr ivate stat ic HealthS ummaryType translate (Federatio nHealthSum maryType h ealthSumma ry) | |
2719 | th rows Metho dException | |
2720 | { | |
2721 | try | |
2722 | { | |
2723 | Health SummaryURN healthSum maryUrn = URNFactory .create(he althSummar y.getHealt hSummaryId (), Health SummaryURN .class); | |
2724 | return new Healt hSummaryTy pe(healthS ummaryUrn, healthSum mary.getNa me()); | |
2725 | } | |
2726 | catc h(URNForma tException urnfX) | |
2727 | { | |
2728 | throw new Method Exception( urnfX); | |
2729 | } | |
2730 | } | |
2731 | ||
2732 | ||
2733 | pu blic stati c List<Wor kItem> tra nslate( | |
2734 | Federa tionWorkIt emType[] w orkItems) | |
2735 | { | |
2736 | if(w orkItems = = null) | |
2737 | return null; | |
2738 | ||
2739 | List <WorkItem> result = new ArrayL ist<WorkIt em>(); | |
2740 | for( Federation WorkItemTy pe workIte mType : wo rkItems) | |
2741 | { | |
2742 | result .add(trans late(workI temType)); | |
2743 | } | |
2744 | retu rn result; | |
2745 | } | |
2746 | ||
2747 | ||
2748 | pr ivate stat ic WorkIte m translat e(Federati onWorkItem Type workI temType) | |
2749 | { | |
2750 | Work Item item = new Work Item( | |
2751 | workItem Type.getTy pe(), | |
2752 | workItem Type.getSu btype(), | |
2753 | workItem Type.getSt atus(), | |
2754 | workItem Type.getPl aceId(), | |
2755 | workItem Type.getCr eatingUser (), | |
2756 | workItem Type.getCr eatingAppl ication()) ; | |
2757 | ||
2758 | item .addTag("p atienticn" , workItem Type.getPa tientIcn() ); | |
2759 | item .addTag("c ontextid", workItemT ype.getCon textId()); | |
2760 | retu rn item; | |
2761 | } | |
2762 | ||
2763 | ||
2764 | pu blic stati c Federati onWorkItem Type[] tra nslateWork Items(List <WorkItem> workItems ) | |
2765 | { | |
2766 | if(w orkItems = = null) | |
2767 | return null; | |
2768 | ||
2769 | Fede rationWork ItemType[] result = new Federa tionWorkIt emType[wor kItems.siz e()]; | |
2770 | int i = 0; | |
2771 | for( WorkItem w orkItem : workItems) | |
2772 | { | |
2773 | result [i] = tran slate(work Item); | |
2774 | i++; | |
2775 | } | |
2776 | retu rn result; | |
2777 | } | |
2778 | ||
2779 | pr ivate stat ic Federat ionWorkIte mType tran slate(Work Item workI tem) | |
2780 | { | |
2781 | if ( workItem = = null) | |
2782 | return null; | |
2783 | ||
2784 | Stri ng patient Icn = ""; | |
2785 | Stri ng context Id = ""; | |
2786 | ||
2787 | if ( (workItem. getTags() != null) & & (workIte m.getTags( ).getTags( ) != null) ) | |
2788 | { | |
2789 | for (W orkItemTag tag: work Item.getTa gs().getTa gs()) | |
2790 | { | |
2791 | if (tag. getKey().e quals("pat ienticn")) | |
2792 | { | |
2793 | patientIcn = tag.get Value(); | |
2794 | } | |
2795 | else if (tag.getKe y().equals ("contexti d")) | |
2796 | { | |
2797 | ||
2798 | contextId = tag.getV alue(); | |
2799 | } | |
2800 | } | |
2801 | } | |
2802 | ||
2803 | Fede rationWork ItemType i tem = new Federation WorkItemTy pe( | |
2804 | workItem .getType() , | |
2805 | workItem .getSubtyp e(), | |
2806 | workItem .getStatus (), | |
2807 | workItem .getPlaceI d(), | |
2808 | workItem .getCreati ngUser(), | |
2809 | workItem .getCreati ngApplicat ion(), | |
2810 | patientI cn, contex tId); | |
2811 | ||
2812 | retu rn item; | |
2813 | } | |
2814 | ||
2815 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.