Produced by Araxis Merge on 12/21/2017 6:15:12 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Genisis_2.0_v7_bld7.zip\TS\Client\src\app\services | concept-services.ts | Thu Dec 14 19:56:21 2017 UTC |
| 2 | Genisis_2.0_v7_bld7.zip\TS\Client\src\app\services | concept-services.ts | Thu Dec 21 21:12:13 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 9 | 1228 |
| Changed | 8 | 16 |
| 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 | import { I njectable } from '@a ngular/cor e'; | |
| 2 | import { H ttp, Respo nse, Heade rs, Reques tOptions } from '@an gular/http '; | |
| 3 | import { e nvironment } from '. ./../envir onments/en vironment' ; | |
| 4 | import {Ob servable} from 'rxjs /Observabl e'; | |
| 5 | import { N gRedux } f rom 'ng2-r edux'; | |
| 6 | import { A piServices } from '. /api-servi ces'; | |
| 7 | import { B ookmarkSer vices } fr om './book mark-servi ces'; | |
| 8 | import { T emplatingS ervices } from './te mplating-s ervices'; | |
| 9 | import { S ystemServi ces } from './system -services' ; | |
| 10 | ||
| 11 | import { | |
| 12 | FETCH_CO NCEPTS, | |
| 13 | FETCHING _CONCEPTS, | |
| 14 | CLEAR_CO NCEPTS, | |
| 15 | INITIALI ZE_CONCEPT _SEARCH_ME TA_DATA, | |
| 16 | UPDATE_C ONCEPT_SEA RCH_META_D ATA, | |
| 17 | DISPLAY_ CONCEPT_CA RD_DETAIL, | |
| 18 | SET_CARD _DATA, | |
| 19 | UPDATE_C ONCEPT_CAR D_TAB_SELE CTION, | |
| 20 | SET_CURR ENT_CONCEP T_SELECTED , | |
| 21 | NEW_CONC EPT_HISTOR Y, | |
| 22 | ENABLE_C ONCEPT_CAR D_VIEW, | |
| 23 | CONCEPT_ CARD_POPUL ATING, | |
| 24 | CONCEPT_ CARD_POPUL ATED, | |
| 25 | RESET_AD D_MVP_STAT E, | |
| 26 | PREVIOUS _CONCEPT_H ISTORY, | |
| 27 | CLEAR_CO NCEPT_CARD _STATE, | |
| 28 | FOCUS_ON , | |
| 29 | DISABLE_ CONCEPT_CA RD_VIEW, | |
| 30 | REMOVE_B OOKMARK, | |
| 31 | SET_CURR ENT_BOOKMA RK_SELECTE D, | |
| 32 | UPDATE_F ILTERED_LI ST, | |
| 33 | ADD_BOOK MARK, | |
| 34 | UPDATE_C ONCEPT_CAR D_BOOKMARK _MESSAGE | |
| 35 | } from '.. /actions'; | |
| 36 | import { I AppState } from '../ store'; | |
| 37 | ||
| 38 | @Injectabl e() | |
| 39 | export cla ss Concept Services { | |
| 40 | baseUri; | |
| 41 | private data: Obse rvable<Arr ay<any>>; | |
| 42 | construc tor ( | |
| 43 | privat e bookmark Services: BookmarkSe rvices, | |
| 44 | privat e templati ngServices : Templati ngServices , | |
| 45 | privat e apiServi ces: ApiSe rvices, | |
| 46 | privat e systemSe rvices: Sy stemServic es, | |
| 47 | privat e http: Ht tp, | |
| 48 | privat e ngRedux: NgRedux<I AppState>) { | |
| 49 | ||
| 50 | // let data : [{ | |
| 51 | // r esponse: { | |
| 52 | // name: 'mv pConceptNa me', | |
| 53 | // uri: 'http :// URL /mvp-schem a#conceptU ri', | |
| 54 | // descripti on: { | |
| 55 | // definition : 'http:// URL /mvp-schem a#definiti on testing ', | |
| 56 | // altDefi nition: [] , | |
| 57 | // synonym s: [] | |
| 58 | // }, | |
| 59 | // relations hips: { | |
| 60 | // superCl asses: [ | |
| 61 | // {name: 'su perClass1' , uri: 'ht tp:// URL /mvp-schem a#superCla ss1Uri'} | |
| 62 | // ], | |
| 63 | // subClas ses: [ | |
| 64 | // {name: 'su bclass1', uri: 'http :// URL /mvp-schem a#subclass 1uri' | |
| 65 | // } | |
| 66 | // ] | |
| 67 | // }, | |
| 68 | // meta: { | |
| 69 | // interOn tologyLink s: [], | |
| 70 | // propert ies: [], | |
| 71 | // relatio nships: [] | |
| 72 | // } | |
| 73 | // } | |
| 74 | // }]; | |
| 75 | } | |
| 76 | ||
| 77 | getState () { | |
| 78 | return this.ngRe dux.getSta te(); | |
| 79 | } | |
| 80 | ||
| 81 | isBookma rked() { | |
| 82 | // thi s needs to change in mvp add | |
| 83 | const bookmarks = this.get State().bo okmark.boo kmarks; | |
| 84 | if (bo okmarks.le ngth > 0) { | |
| 85 | for (let bookm ark of boo kmarks) { | |
| 86 | if (bookmark .conceptUr i === this .getCurren tConcept() .uri) { | |
| 87 | return tru e; | |
| 88 | } | |
| 89 | } | |
| 90 | } else { | |
| 91 | retu rn false; | |
| 92 | } | |
| 93 | return false; | |
| 94 | } | |
| 95 | ||
| 96 | conceptC ardPopulat ed() { | |
| 97 | const state = th is.getStat e().concep tCard; | |
| 98 | if ( | |
| 99 | stat e.cardPopu lated && | |
| 100 | stat e.conceptH istory.len gth > 0 && | |
| 101 | !sta te.mvpRemo ving && | |
| 102 | !sta te.mvpAddi ng) { | |
| 103 | retu rn true; | |
| 104 | } else { | |
| 105 | retu rn false; | |
| 106 | } | |
| 107 | } | |
| 108 | ||
| 109 | canPrevi ousConcept () { | |
| 110 | const conceptHis tory = thi s.getState ().concept Card.conce ptHistory; | |
| 111 | return conceptHi story.leng th > 1; | |
| 112 | } | |
| 113 | ||
| 114 | getCurre ntConcept( ) { | |
| 115 | return this.getS tate().con ceptSearch .selectedC oncept; | |
| 116 | } | |
| 117 | ||
| 118 | getCurre ntPageObje cts(object s, current IndexSelec ted) { | |
| 119 | const defaultMax Pages = 10 ; | |
| 120 | const yieldPageN umber = 99 9; | |
| 121 | const state = th is.getStat e(); | |
| 122 | let ma xPages = s tate.conce ptSearch.m axConceptS earchPages ; | |
| 123 | if (cu rrentIndex Selected > yieldPage Number) { | |
| 124 | maxP ages = 5; | |
| 125 | } else { | |
| 126 | maxP ages = def aultMaxPag es; | |
| 127 | } | |
| 128 | let ne wObjects = []; | |
| 129 | if (ob jects === null) { | |
| 130 | obje cts = stat e.conceptS earch.conc eptSearchD ata.pageOb jects; | |
| 131 | } | |
| 132 | const maxIndex = objects.l ength - 1; | |
| 133 | const projectedI ndexLength = current IndexSelec ted + maxP ages; | |
| 134 | // we need to se t these tw o variable s based on informati on provide d above | |
| 135 | let ma xIteration = 0; | |
| 136 | let ne wIndex = 0 ; | |
| 137 | // Sce narios | |
| 138 | // 1. if project ions excee d max leng th | |
| 139 | // 2. if project ions do no t exceed m ax length | |
| 140 | // 3. when adjus ted does t he delta e xceed nega tive of 0? | |
| 141 | // 4. when adjus ted does d elta do no t exceed n egative of 0? | |
| 142 | if (pr ojectedInd exLength > maxIndex) { | |
| 143 | // i f projecti on exceeds max lengt h | |
| 144 | maxI teration = maxIndex + 1; | |
| 145 | cons t delta = projectedI ndexLength - maxInde x; | |
| 146 | if ( currentInd exSelected - delta > = 0) { | |
| 147 | ne wIndex = ( currentInd exSelected - delta) + 1; | |
| 148 | } el se { | |
| 149 | ne wIndex = 0 ; | |
| 150 | } | |
| 151 | } else { | |
| 152 | // i f maxlengt h exceeds projection | |
| 153 | maxI teration = projected IndexLengt h; | |
| 154 | newI ndex = cur rentIndexS elected; | |
| 155 | } | |
| 156 | for (l et i=newIn dex; i<max Iteration; i++) { | |
| 157 | newO bjects.pus h(objects[ i]); | |
| 158 | } | |
| 159 | return newObject s; | |
| 160 | } | |
| 161 | ||
| 162 | getPageO bjects(num Pages) { | |
| 163 | const objects = []; | |
| 164 | for(le t i = 0; i < numPage s; i++) { | |
| 165 | if ( i === 0) { | |
| 166 | ob jects.push ({ | |
| 167 | pageNum: i +1, | |
| 168 | active: tr ue | |
| 169 | }) ; | |
| 170 | } el se { | |
| 171 | ob jects.push ({ | |
| 172 | pageNum: i +1, | |
| 173 | active: fa lse | |
| 174 | }) ; | |
| 175 | } | |
| 176 | } | |
| 177 | return objects; | |
| 178 | } | |
| 179 | ||
| 180 | populate ConceptCar d(concept, uri?) { | |
| 181 | let co nceptUri = ''; | |
| 182 | if (co ncept !== null) { | |
| 183 | conc eptUri = c oncept.con ceptUri; | |
| 184 | } else { | |
| 185 | conc eptUri = u ri; | |
| 186 | } | |
| 187 | const headers = this.apiSe rvices.get Header(); | |
| 188 | ||
| 189 | const options = new Reques tOptions({ headers: h eaders}); | |
| 190 | return this.http .get( | |
| 191 | this .apiServic es.apiUrl( ) + | |
| 192 | '/co ncept-card s?conceptU ri=' + | |
| 193 | enco deURICompo nent(conce ptUri), op tions | |
| 194 | ); | |
| 195 | } | |
| 196 | ||
| 197 | fetchCon cepts(quer y?) { | |
| 198 | const headers = this.apiSe rvices.get Header(); | |
| 199 | const options = new Reques tOptions({ headers: h eaders}); | |
| 200 | if (qu ery === un defined) { | |
| 201 | quer y = this.g etState(). conceptSea rch.concep tSearchDat a.queryStr ing; | |
| 202 | } | |
| 203 | return this.http .get( | |
| 204 | this. apiService s.apiUrl() + '/searc hes?search Phrase=' + encodeURI Component( query), op tions | |
| 205 | ); | |
| 206 | } | |
| 207 | ||
| 208 | getDataE lementList () { | |
| 209 | const headers = this.apiSe rvices.get Header(); | |
| 210 | const options = new Reques tOptions({ headers: h eaders}); | |
| 211 | return this.http .get( | |
| 212 | this. apiService s.apiUrl() + '/dataE lements/', options | |
| 213 | ); | |
| 214 | } | |
| 215 | ||
| 216 | fetchCon ceptsUpdat e(options) { | |
| 217 | this.n gRedux.dis patch({ | |
| 218 | type : CLEAR_CO NCEPTS | |
| 219 | }) | |
| 220 | this.n gRedux.dis patch({ | |
| 221 | type : FETCHING _CONCEPTS | |
| 222 | }) | |
| 223 | const headers = this.apiSe rvices.get Header(); | |
| 224 | const HeaderOpti ons = new RequestOpt ions({head ers: heade rs}); | |
| 225 | if (op tions.quer y === unde fined) { | |
| 226 | opti ons.query = encodeUR IComponent (this.getS tate().con ceptSearch .conceptSe archData.q ueryString ); | |
| 227 | } | |
| 228 | return this.http .get( | |
| 229 | this. apiService s.apiUrl() + '/searc hes?search Phrase=' + options.q uery + '&s tart=' + o ptions.sta rt, Header Options | |
| 230 | ).subs cribe( | |
| 231 | (res ponse: Res ponse) => { | |
| 232 | if ( response.s tatus === 200) { | |
| 233 | le t rdata = JSON.parse (response. text()); | |
| 234 | if (rdata.me ssage && r data.messa ge.length > 0) { | |
| 235 | // return some messa ge | |
| 236 | } else { | |
| 237 | this.ngRed ux.dispatc h({ | |
| 238 | type: FE TCH_CONCEP TS, | |
| 239 | payload: rdata.res ponse.resp onse.docs | |
| 240 | }); | |
| 241 | // here I need to do something for initi alizing pa gination d ata | |
| 242 | // I get b ack numFou nd and sta rt - both are intege rs | |
| 243 | const numP ages = Mat h.ceil(rda ta.respons e.response .numFound / 20); | |
| 244 | let payloa d; | |
| 245 | if (option s.init) { | |
| 246 | const pa geObjects = this.get PageObject s(numPages ); | |
| 247 | const cu rrentPageO bjects = t his.getCur rentPageOb jects(page Objects, 0 ); | |
| 248 | payload = { | |
| 249 | queryS tring: opt ions.query , | |
| 250 | numFou nd: rdata. response.r esponse.nu mFound, | |
| 251 | start: rdata.res ponse.resp onse.start , | |
| 252 | numPag es: numPag es, | |
| 253 | curren tPageNum: 1, | |
| 254 | pageOb jects: pag eObjects, | |
| 255 | curren tPageObjec ts: curren tPageObjec ts | |
| 256 | } | |
| 257 | this.ngR edux.dispa tch({ | |
| 258 | type: INITIALIZE _CONCEPT_S EARCH_META _DATA, | |
| 259 | payloa d: payload | |
| 260 | }); | |
| 261 | } else { | |
| 262 | const cu rrentPageO bjects = t his.getCur rentPageOb jects( | |
| 263 | null, | |
| 264 | option s.currentP ageNum - 1 ); | |
| 265 | payload = { | |
| 266 | start: rdata.res ponse.resp onse.start , | |
| 267 | curren tPageNum: options.cu rrentPageN um, | |
| 268 | curren tPageObjec ts: curren tPageObjec ts | |
| 269 | } | |
| 270 | this.ngR edux.dispa tch({ | |
| 271 | type: UPDATE_CON CEPT_SEARC H_META_DAT A, | |
| 272 | payloa d: payload | |
| 273 | }); | |
| 274 | } | |
| 275 | } | |
| 276 | } | |
| 277 | }); | |
| 278 | } | |
| 279 | ||
| 280 | fetchCon ceptNodes( concept) { | |
| 281 | const headers = this.apiSe rvices.get Header(); | |
| 282 | let op tions = ne w RequestO ptions({he aders: hea ders}); | |
| 283 | return this.http .get( | |
| 284 | 'http:// IP /api/conce pts/nodes/ ' + concep t, options | |
| 285 | ) | |
| 286 | ||
| 287 | // Exp ected json body rspo nse would be along: | |
| 288 | // { | |
| 289 | // s uccess: tr ue || fals e, | |
| 290 | // m essage: 'i f success false - we need mesa ge of erro r here', | |
| 291 | // r esults: [ | |
| 292 | // { | |
| 293 | // // incl ude the ro ot node in this sele ction here | |
| 294 | // }, | |
| 295 | // ... | |
| 296 | // { | |
| 297 | // identif ier: 'this could ass ist in par ent and ch ild', | |
| 298 | // sub_cla ss_of: 'na me the ide ntifier', | |
| 299 | // data: { | |
| 300 | // prefe rred_name: 'blargh', | |
| 301 | // type: '????', | |
| 302 | // uri: 'uri blarg h', | |
| 303 | // defin itions: 'a jsd;fklajs df' | |
| 304 | // } | |
| 305 | // } | |
| 306 | // ] | |
| 307 | // } | |
| 308 | } | |
| 309 | ||
| 310 | fetchCon ceptCardDa ta(concept ) { | |
| 311 | // con cept could be an uri maybe? | |
| 312 | const options = {}; | |
| 313 | return this.http .get( | |
| 314 | 'http:// IP /api/conce pts/card/' + concept , options | |
| 315 | ) | |
| 316 | ||
| 317 | // Exc epted json body resp onse would be the fo llowing: | |
| 318 | // { | |
| 319 | // s uccess: tr ue || fals e, | |
| 320 | // m essage: 'i f success false - we need mesa ge of erro r here', | |
| 321 | // r esults: { | |
| 322 | // // This i s where we should ha ve the dis cussion of generaliz ed | |
| 323 | // // Card d ata that w ould be di splayed fo r each "fo cused" con cept | |
| 324 | // // e.g. w hen we cli ck on the search res ult concep t - it wil l (1) | |
| 325 | // // load t he concept nodes (2) it will l oad the pr imary node concept | |
| 326 | // // card d ata | |
| 327 | // // WE NEE D TO DEFIN E THESE PR OPERTIES H ERE AND GE T CLIENT S IGN OFF | |
| 328 | // preferred _name: 'as d;klf;jasd f', | |
| 329 | // primary_u ri: 'asfjk lasdf', | |
| 330 | // child_cou nts: 'over 9000', | |
| 331 | // definitio ns: ['asdk lfjlsd', ' aklsdfjkla sdf', 'ask dfjklasdjf '], | |
| 332 | // etc...... .. | |
| 333 | // } | |
| 334 | // } | |
| 335 | } | |
| 336 | ||
| 337 | removeMv pProperty( mvpObj) { | |
| 338 | const mvpP refix = 'h ttp:// URL /mvp-schem a#'; | |
| 339 | const rdfPrefix = 'http:// www.w3.org /2000/01/r df-schema# '; | |
| 340 | var ob ject; | |
| 341 | var pr edicate; | |
| 342 | var su bject; | |
| 343 | var ro otUri = '< ' + this.g etState(). conceptCar d.conceptC ardData.ur i + '>'; | |
| 344 | if (mv pObj.type == 'InterO ntologyLin k') { | |
| 345 | su bject = ro otUri; | |
| 346 | pr edicate = '<' + mvpP refix + 'I nterOntolo gyLink>'; | |
| 347 | ob ject = '< ' + mvpObj .uri + '>' ; | |
| 348 | } else if (mvpOb j.type == 'SubClass' ) { | |
| 349 | su bject = '< ' + mvpObj .uri + '>' ; | |
| 350 | // predicate = '<' + rd fPrefix + 'subClassO f>'; | |
| 351 | pr edicate = '<' + mvpP refix + 'S ubClassOf> '; | |
| 352 | ob ject = ro otUri; | |
| 353 | } else if (mvpOb j.type == 'SuperClas s') { | |
| 354 | su bject = ro otUri; | |
| 355 | pr edicate = '<' + mvpP refix + 'S ubClassOf> '; | |
| 356 | ob ject = '< ' + mvpObj .uri + '>' ; | |
| 357 | } else if (mvpOb j.type == 'Relations hip') { | |
| 358 | su bject = ro otUri; | |
| 359 | pr edicate = '<' + mvpO bj.uri + ' >'; | |
| 360 | ob ject = '< ' + mvpObj .value + ' >'; | |
| 361 | } els e if (mvpO bj.type == 'DataElem ent') { | |
| 362 | su bject = ro otUri; | |
| 363 | pr edicate = '<' + mvpP refix + 'M appingData Element>'; | |
| 364 | ob ject = '< ' + mvpObj .value + ' >'; | |
| 365 | } els e { | |
| 366 | su bject = ro otUri; | |
| 367 | pr edicate = '<' + mvpO bj.uri + ' >'; | |
| 368 | ob ject = mv pObj.value ; | |
| 369 | } | |
| 370 | let da ta = { | |
| 371 | pr operties: [{ | |
| 372 | s: subject, | |
| 373 | p: predicate , | |
| 374 | o: object | |
| 375 | }] | |
| 376 | }; | |
| 377 | const headers = this.apiSe rvices.get Header(); | |
| 378 | const options = new Reques tOptions({ headers: h eaders, bo dy: data}) ; | |
| 379 | return this.http .delete(th is.apiServ ices.apiUr l() + '/up date', opt ions); | |
| 380 | // let headers = new Heade rs(); | |
| 381 | // hea ders.appen d('Accept' , 'applica tion/json' ); | |
| 382 | // hea ders.appen d('Content -type', 'a pplication /json'); | |
| 383 | // con st options = new Req uestOption s({headers : headers, body: dat a}); | |
| 384 | // ret urn this.h ttp.delete (this.apiS ervices.ap iUrl() + ' /update', options); | |
| 385 | ||
| 386 | // ret urn new Ob servable(o bserver => { | |
| 387 | // s etTimeout( () => { | |
| 388 | // observer. next({resp onse: {suc cess: true }}); | |
| 389 | // } , 1000); | |
| 390 | ||
| 391 | // s etTimeout( () => { | |
| 392 | // observer. complete() ; | |
| 393 | // } , 1000); | |
| 394 | // }); | |
| 395 | } | |
| 396 | ||
| 397 | getCurre ntCard() { | |
| 398 | return this.getS tate().con ceptCard.c onceptCard Data; | |
| 399 | } | |
| 400 | ||
| 401 | reloadCo nceptCard( focusType) { | |
| 402 | const uri = this .getState( ).conceptC ard.concep tCardData. uri; | |
| 403 | return this.popu lateConcep tCard(null , uri) | |
| 404 | .subscri be((respon se: Respon se) => { | |
| 405 | if (re sponse.sta tus === 20 0) { | |
| 406 | cons t rdata = JSON.parse (response. text()); | |
| 407 | this .ngRedux.d ispatch({ | |
| 408 | ty pe: RESET_ ADD_MVP_ST ATE | |
| 409 | }); | |
| 410 | this .ngRedux.d ispatch({ | |
| 411 | ty pe: SET_CA RD_DATA, | |
| 412 | pa yload: rda ta.respons e | |
| 413 | }); | |
| 414 | this .ngRedux.d ispatch({ | |
| 415 | ty pe: SET_CU RRENT_CONC EPT_SELECT ED, | |
| 416 | pa yload: rda ta.respons e | |
| 417 | }); | |
| 418 | this .ngRedux.d ispatch({ | |
| 419 | ty pe: FOCUS_ ON, | |
| 420 | pa yload: foc usType | |
| 421 | }); | |
| 422 | this .ngRedux.d ispatch({ | |
| 423 | ty pe: DISPLA Y_CONCEPT_ CARD_DETAI L | |
| 424 | }); | |
| 425 | } | |
| 426 | }); | |
| 427 | } | |
| 428 | ||
| 429 | previous Concept() { | |
| 430 | if (th is.getStat e().concep tCard.conc eptHistory .length > 0) { | |
| 431 | this .ngRedux.d ispatch({ | |
| 432 | ty pe: PREVIO US_CONCEPT _HISTORY | |
| 433 | }); | |
| 434 | this .ngRedux.d ispatch({ | |
| 435 | ty pe: CONCEP T_CARD_POP ULATING | |
| 436 | }); | |
| 437 | cons t currentH istory = t his.getSta te().conce ptCard.con ceptHistor y; | |
| 438 | cons t previous = current History[cu rrentHisto ry.length - 1]; | |
| 439 | if ( currentHis tory.lengt h > 0) { | |
| 440 | se tTimeout(( ) => { | |
| 441 | this.ngRed ux.dispatc h({ | |
| 442 | type: SE T_CARD_DAT A, | |
| 443 | payload: previous | |
| 444 | }); | |
| 445 | this.ngRed ux.dispatc h({ | |
| 446 | type: SE T_CURRENT_ CONCEPT_SE LECTED, | |
| 447 | payload: previous | |
| 448 | }); | |
| 449 | this.templ atingServi ces.setTem plateState s(); | |
| 450 | this.ngRed ux.dispatc h({ | |
| 451 | type: CL EAR_CONCEP T_CARD_STA TE | |
| 452 | }); | |
| 453 | this.ngRed ux.dispatc h({ | |
| 454 | type: CO NCEPT_CARD _POPULATED | |
| 455 | }); | |
| 456 | this.syste mServices. focusOn('c onceptCard Title'); | |
| 457 | }, 1000); | |
| 458 | } el se { | |
| 459 | th is.ngRedux .dispatch( { | |
| 460 | type: CLEA R_CONCEPT_ CARD_STATE | |
| 461 | }) ; | |
| 462 | } | |
| 463 | } else { | |
| 464 | this .ngRedux.d ispatch({ | |
| 465 | ty pe: CLEAR_ CONCEPT_CA RD_STATE | |
| 466 | }); | |
| 467 | } | |
| 468 | } | |
| 469 | ||
| 470 | getConce pt(uri) { | |
| 471 | this.n gRedux.dis patch({ | |
| 472 | type : CONCEPT_ CARD_POPUL ATING | |
| 473 | }); | |
| 474 | // thi s.systemSe rvices.foc usOn('conc eptCardPop ulating'); | |
| 475 | // thi s.systemSe rvices.foc usOn('conc eptCardTit le'); | |
| 476 | /* Not e: change this metho d to call populateCo nceptCard( ) after AP I property for URI i s in sync */ | |
| 477 | this.p opulateCon ceptCard(n ull, uri) | |
| 478 | .subsc ribe( | |
| 479 | (res ponse: Res ponse) => { | |
| 480 | if (response .status == = 200) { | |
| 481 | let rdata = JSON.par se(respons e.text()); | |
| 482 | // rdata.r esponse.on tologyName = 'MDDVS' ; | |
| 483 | this.ngRed ux.dispatc h({ | |
| 484 | type: UP DATE_CONCE PT_CARD_TA B_SELECTIO N, | |
| 485 | payload: 'descript ion' | |
| 486 | }); | |
| 487 | this.ngRed ux.dispatc h({ | |
| 488 | type: SE T_CARD_DAT A, | |
| 489 | payload: rdata.res ponse | |
| 490 | }); | |
| 491 | this.ngRed ux.dispatc h({ | |
| 492 | type: SE T_CURRENT_ CONCEPT_SE LECTED, | |
| 493 | payload: rdata.res ponse | |
| 494 | }); | |
| 495 | this.ngRed ux.dispatc h({ | |
| 496 | type: NE W_CONCEPT_ HISTORY, | |
| 497 | payload: rdata.res ponse | |
| 498 | }); | |
| 499 | this.ngRed ux.dispatc h({ | |
| 500 | type: RE SET_ADD_MV P_STATE | |
| 501 | }); | |
| 502 | // if (thi s.templati ngServices .currentCo nceptHasOv erride()) { | |
| 503 | // build tab data into conce ptCard red ux state | |
| 504 | this.tem platingSer vices.setT emplateSta tes(); | |
| 505 | // } | |
| 506 | this.ngRed ux.dispatc h({ | |
| 507 | type: CO NCEPT_CARD _POPULATED | |
| 508 | }); | |
| 509 | this.ngRed ux.dispatc h({ | |
| 510 | type: EN ABLE_CONCE PT_CARD_VI EW | |
| 511 | }); | |
| 512 | this.syste mServices. focusOn('c onceptCard Title', 20 00); | |
| 513 | this.setBo okmarkMess age(rdata. response.n ameWithOnt ologyName) ; | |
| 514 | } | |
| 515 | }); | |
| 516 | } | |
| 517 | ||
| 518 | isActive Link(uri) { | |
| 519 | return uri != nu ll && uri. indexOf('h ttp://') > -1; | |
| 520 | } | |
| 521 | ||
| 522 | setBookm arkMessage (bookmarkN ame) { | |
| 523 | const state = th is.getStat e(); | |
| 524 | const bookmarkCo unt = stat e.bookmark .bookmarks .length; | |
| 525 | const message = ` ${bookma rkName} ${ this.isBoo kmarkedMes sage()} an d bookmark list has ${bookmark Count}` | |
| 526 | this.n gRedux.dis patch({ | |
| 527 | type : UPDATE_C ONCEPT_CAR D_BOOKMARK _MESSAGE, | |
| 528 | payl oad: messa ge | |
| 529 | }); | |
| 530 | } | |
| 531 | ||
| 532 | isBookma rkedMessag e() { | |
| 533 | return this.isBo okmarked() ? 'is boo kmarked' : 'is not b ookmarked' ; | |
| 534 | } | |
| 535 | ||
| 536 | bookmark Concept() { | |
| 537 | this.b ookmarkSer vices | |
| 538 | .addBo okmark() | |
| 539 | .subsc ribe((resp onse: Resp onse) => { | |
| 540 | if ( response.s tatus === 201) { //c hanged che ck to look for 201 r esponse in stead of a 200 | |
| 541 | se tTimeout(( ) => { | |
| 542 | const rdat a = JSON.p arse(respo nse.text() ); | |
| 543 | this.ngRed ux.dispatc h({ | |
| 544 | type: AD D_BOOKMARK , | |
| 545 | payload: rdata.res ponse | |
| 546 | }); | |
| 547 | this.setBo okmarkMess age(rdata. response.c onceptName WithOntolo gyName); | |
| 548 | this.syste mServices. focusOn('c onceptCard Title'); | |
| 549 | this.syste mServices. postMessag eUpdate(); | |
| 550 | }, 1000); | |
| 551 | } | |
| 552 | }); | |
| 553 | } | |
| 554 | ||
| 555 | getBookm arkFromCur rentConcep t() { | |
| 556 | const bookmarks = this.get State().bo okmark.boo kmarks; | |
| 557 | for (l et bookmar k of bookm arks) { | |
| 558 | if ( bookmark.c onceptUri === this.g etCurrentC oncept().u ri) { | |
| 559 | re turn bookm ark; | |
| 560 | } | |
| 561 | } | |
| 562 | return null; | |
| 563 | } | |
| 564 | ||
| 565 | unBookma rkConcept( ) { | |
| 566 | const bookmark = this.getB ookmarkFro mCurrentCo ncept(); | |
| 567 | this.b ookmarkSer vices | |
| 568 | .rem oveBookmar k(bookmark .bookmarkI d) | |
| 569 | .sub scribe((re sponse: Re sponse) => { | |
| 570 | if (response .status == = 200) { | |
| 571 | setTimeout (() => { | |
| 572 | const rd ata = JSON .parse(res ponse.text ()); | |
| 573 | this.ngR edux.dispa tch({ | |
| 574 | type: SET_CURRE NT_BOOKMAR K_SELECTED , | |
| 575 | paylo ad: bookma rk | |
| 576 | }); | |
| 577 | this.ngR edux.dispa tch({ | |
| 578 | type: REMOVE_BOO KMARK, | |
| 579 | payloa d: rdata.r esponse | |
| 580 | }); | |
| 581 | this.ngR edux.dispa tch({ | |
| 582 | type: UPDATE_FIL TERED_LIST | |
| 583 | }); | |
| 584 | this.set BookmarkMe ssage(book mark.conce ptNameWith OntologyNa me); | |
| 585 | this.sys temService s.focusOn( 'conceptCa rdTitle'); | |
| 586 | this.sys temService s.postMess ageUpdate( ); | |
| 587 | }, 1000); | |
| 588 | } | |
| 589 | }); | |
| 590 | } | |
| 591 | ||
| 592 | disableC onceptCard () { | |
| 593 | this.n gRedux.dis patch({ | |
| 594 | type : DISABLE_ CONCEPT_CA RD_VIEW | |
| 595 | }); | |
| 596 | this.n gRedux.dis patch({ | |
| 597 | type : FOCUS_ON , | |
| 598 | payl oad: 'conc eptCardNav Icon' | |
| 599 | }) | |
| 600 | } | |
| 601 | ||
| 602 | returnHa sMappingAs terisk(con cept) { | |
| 603 | return this.hasM appings(co ncept) ? ' *' : ''; | |
| 604 | } | |
| 605 | ||
| 606 | hasMappi ngs(concep t) { | |
| 607 | return concept.h asMapping; | |
| 608 | } | |
| 609 | ||
| 610 | hasMappi ngsMessage (concept) { | |
| 611 | return this.hasM appings(co ncept) ? ' and has m appings' : ' and has no mappin gs'; | |
| 612 | } | |
| 613 | ||
| 614 | isDataEl ementMessa ge(concept ) { | |
| 615 | return this.isBa seline(con cept) ? ' is a data element ' : ''; | |
| 616 | } | |
| 617 | ||
| 618 | isBaseli ne(concept ) { | |
| 619 | return con cept.conce ptUri.inde xOf('http: // URL /baseline/ ') > -1 | |
| 620 | } | |
| 621 | } | |
| 622 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.