Project

General

Profile

« Previous | Next » 

Revision 47087

commit local changes in branch lazy routes

View differences:

publication.service.ts
67 67
        this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""};
68 68
        if(data[0]['bestlicense'].hasOwnProperty("classid")) {
69 69
            this.publicationInfo.title.accessMode = data[0]['bestlicense'].classid;
70
            console.info("accessmode by bestlicense = "+this.publicationInfo.title.accessMode);
70
            console.info("accessmode by bestlicence = "+data[0]['bestlicense'].classid);
71 71
        }
72 72
        if(data[1] != null) {
73 73

  
......
211 211

  
212 212
        if(data[3] != null) {
213 213
            if(data[3].hasOwnProperty("instance")) {
214
                this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[]}>();
215
                this.publicationInfo.publishedIn = new Map<string, {"url": string[], "accessMode": string[]}>();
214
                this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>();
215
                this.publicationInfo.publishedIn = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>();
216 216

  
217 217
                this.publicationInfo.types = new Array<string>();
218 218

  
......
244 244

  
245 245
                        if(instance.hasOwnProperty("hostedby")) {
246 246
                            if(instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") {
247
                                if(!this.publicationInfo.downloadFrom.has(instance['hostedby'].name)) {
248
                                    this.publicationInfo.downloadFrom.set(instance['hostedby'].name, {"url": null, "accessMode": null});
249
                                }
247
                                let key: string = instance['hostedby'].name;
250 248

  
251
                                if(this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['url'] == null) {
252
                                    this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['url'] = new Array<string>();
249
                                if(!this.publicationInfo.downloadFrom.has(key)) {
250
                                    this.publicationInfo.downloadFrom.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
253 251
                                }
252
                                if(this.publicationInfo.downloadFrom.get(key)['url'] == null) {
253
                                    this.publicationInfo.downloadFrom.get(key)['url'] = new Array<string>();
254
                                }
254 255

  
255
                                this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['url'].push(url);
256
                                this.publicationInfo.downloadFrom.get(key)['url'].push(url);
256 257

  
257
                                if(this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'] == null) {
258
                                    this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'] = new Array<string>();
258
                                if(this.publicationInfo.downloadFrom.get(key)['accessMode'] == null) {
259
                                    this.publicationInfo.downloadFrom.get(key)['accessMode'] = new Array<string>();
259 260
                                }
260 261

  
261 262
                                if(instance.hasOwnProperty("licence")) {
262
                                    this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'].push(instance['licence'].classid);
263
                                    this.publicationInfo.downloadFrom.get(key)['accessMode'].push(instance['licence'].classid);
264

  
265
                                    switch (this.publicationInfo.downloadFrom.get(key)['bestAccessMode']) {
266
                                        case null:
267
                                            this.publicationInfo.downloadFrom.get(key)['bestAccessMode'] = instance['licence'].classid;
268
                                            break;
269
                                        case "CLOSED":
270
                                            if(instance['licence'].classid == "OPEN" ||
271
                                                instance['licence'].classid == "EMBARGO" ||
272
                                                instance['licence'].classid == "RESTRICTED") {
273
                                                    this.publicationInfo.downloadFrom.get(key)['bestAccessMode'] = instance['licence'].classid;
274
                                            }
275
                                            break;
276
                                        case "RESTRICTED":
277
                                            if(instance['licence'].classid == "OPEN" ||
278
                                                instance['licence'].classid == "EMBARGO") {
279
                                                    this.publicationInfo.downloadFrom.get(key)['bestAccessMode'] = instance['licence'].classid;
280
                                            }
281
                                            break;
282
                                        case "EMBARGO":
283
                                            if(instance['licence'].classid == "OPEN") {
284
                                                    this.publicationInfo.downloadFrom.get(key)['bestAccessMode'] = instance['licence'].classid;
285
                                            }
286
                                            break;
287
                                    }
263 288
                                } else {
264
                                    this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'].push("");
289
                                    this.publicationInfo.downloadFrom.get(key)['accessMode'].push("");
265 290
                                }
266 291
                            } else {
267 292
                                if(data[0] != null && data[0].hasOwnProperty("source")) {
......
276 301
                                    }
277 302
                                    if(key != "") {
278 303
                                        if(!this.publicationInfo.publishedIn.has(key)) {
279
                                            this.publicationInfo.publishedIn.set(key, {"url": null, "accessMode": null});
304
                                            this.publicationInfo.publishedIn.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
280 305
                                        }
281 306

  
282 307
                                        if(this.publicationInfo.publishedIn.get(key)['url'] == null) {
......
291 316

  
292 317
                                        if(instance.hasOwnProperty("licence")) {
293 318
                                            this.publicationInfo.publishedIn.get(key)['accessMode'].push(instance['licence'].classid);
319
                                            switch (this.publicationInfo.publishedIn.get(key)['bestAccessMode']) {
320
                                                case null:
321
                                                    this.publicationInfo.publishedIn.get(key)['bestAccessMode'] = instance['licence'].classid;
322
                                                    break;
323
                                                case "CLOSED":
324
                                                    if(instance['licence'].classid == "OPEN" ||
325
                                                        instance['licence'].classid == "EMBARGO" ||
326
                                                        instance['licence'].classid == "RESTRICTED") {
327
                                                            this.publicationInfo.publishedIn.get(key)['bestAccessMode'] = instance['licence'].classid;
328
                                                    }
329
                                                    break;
330
                                                case "RESTRICTED":
331
                                                    if(instance['licence'].classid == "OPEN" ||
332
                                                        instance['licence'].classid == "EMBARGO") {
333
                                                            this.publicationInfo.publishedIn.get(key)['bestAccessMode'] = instance['licence'].classid;
334
                                                    }
335
                                                    break;
336
                                                case "EMBARGO":
337
                                                    if(instance['licence'].classid == "OPEN") {
338
                                                            this.publicationInfo.publishedIn.get(key)['bestAccessMode'] = instance['licence'].classid;
339
                                                    }
340
                                                    break;
341
                                            }
294 342
                                        } else {
295 343
                                            this.publicationInfo.publishedIn.get(key)['accessMode'].push("");
296 344
                                        }
......
330 378
                                        }
331 379
                                        break;
332 380
                                    case "OPEN":
333
                                        if(this.publicationInfo.title['url'] == "") {
334
                                            this.publicationInfo.title['url'] = url;
335
                                            console.info("title url by empty = "+this.publicationInfo.title.url);
381
                                        if(instance['licence'].classid == "OPEN" &&
382
                                            this.publicationInfo.title['url'] == "") {
383
                                                this.publicationInfo.title['url'] = url;
384
                                                console.info("title url by empty = "+this.publicationInfo.title.url);
336 385
                                        }
337 386
                                        break;
338 387
                                }
......
479 528
            && this.publicationInfo.identifiers.has('doi')) {
480 529

  
481 530
            if( this.publicationInfo.downloadFrom == null) {
482
                this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[]}>();
531
                this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>();
483 532
            }
484 533

  
485 534
            let key: string;
......
488 537
            } else {
489 538
                key = this.publicationInfo.publisher;
490 539
            }
491
            this.publicationInfo.downloadFrom.set(key, {"url": null, "accessMode": null});
540
            this.publicationInfo.downloadFrom.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
492 541

  
493 542
            let url = OpenaireProperties.getDoiURL()+this.publicationInfo.identifiers.get("doi")[0];
494 543

  
......
500 549

  
501 550
            if(this.publicationInfo.title != undefined && this.publicationInfo.title['url'] == "") {
502 551
                this.publicationInfo.title['url'] = url;
503
                console.info("title url by doi = "+this.publicationInfo.title.url);
552
                console.info("title url: by doi");
504 553
            }
505 554
        }
506 555

  

Also available in: Unified diff