Project

General

Profile

1
//Classes used in linking / inlinelinking when selecting an entity
2
export class ClaimResult{
3
    public id: string;
4
    public type: string;
5
    public source: string;
6
    public title: string;
7
    public url: string;
8
    public result: any;
9
    public accessRights: string = "OPEN";
10
    public embargoEndDate: string;
11
    public date: string;
12
    public authors: string[] =[];
13
    public publisher: string;
14
    public description: string;
15
    public resourceType:string;
16

    
17
    public static generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
18

    
19
        var result: ClaimResult = new ClaimResult();
20
        result.id = itemId;
21
        result.type = itemType;
22
        result.source = itemSource;
23

    
24
        result.title = (Array.isArray(itemTitle) && itemTitle.length > 0 )?itemTitle[0]:itemTitle;
25
        result.url = itemUrl;
26
        result.accessRights = 'OPEN';
27
        result.date = date;
28
        result.result = item;
29
        if(item.publisher){
30
          result.publisher = item.publisher;
31
        }
32

    
33
         if(itemSource == 'datacite'){
34

    
35
           result.publisher = item.attributes['container-title'];
36
           if(item.attributes.author){
37
             result.authors =[]
38
             for(var i=0; i< item.attributes.author.length; i++){
39
               result.authors.push((item.attributes.author[i].family)?item.attributes.author[i].family+', '+item.attributes.author[i].given:item.attributes.author[i].literal);
40
             }
41
           }
42

    
43
           // result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date};
44
         }else if (itemSource == 'openaire'){
45
           //TODO put right access rights
46
           // result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: this.nextDate, date: date};
47
           // result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessmode, embargoEndDate: this.nextDate, date : date};
48
           result.embargoEndDate = accessmode;
49

    
50
         }else if(itemSource == 'crossref'){
51
           date = (date == null) ? null : date.substring(0,10);
52
           result.date = date;
53
           result.resourceType = item.type;
54
           result.description = item.abstract;
55
           if(item.author){
56
             result.authors =[]
57
             for(var i=0; i< item.author.length; i++){
58
               result.authors.push(item.author[i].family +" "+ item.author[i].given );
59
             }
60
           }
61
           // result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date};
62
         }else if (itemSource == 'orcid'){
63
           date = (date == null) ? null : date + "-01.-01"
64
           result.date = date;
65
           if(item['work-type']){
66
             result.resourceType = item.type;
67

    
68
           }
69
           if(item.contributors){
70
             result.authors =[]
71
             for(var i=0; i< item.contributors.length; i++){
72
               result.authors.push(item.contributors[i]);
73
             }
74
           }
75

    
76
         }
77
         return result;
78
       }
79
}
80
export class ClaimProject{
81
    public funderId: string;
82
    public funderName: string;
83
    public projectId: string;
84
    public projectName: string;
85
    public projectAcronym: string;
86
    public startDate: string;
87
    public endDate: string;
88
    public code: string;
89
    public jurisdiction: string;
90
    public fundingLevel0: string;
91

    
92

    
93
}
94

    
95
export class ClaimContext{
96
    public community: string;
97
    public category: string;
98
    public concept:any;
99

    
100
}
(4-4/11)