Project

General

Profile

« Previous | Next » 

Revision 60221

[Trunk | Library]:
1. string-utils.class: Create method 'getIdentifierFromString()' to return a single Identifier.
2. resultLanding.component:
a. Add 'pid' as possible parameter in page url for persistent identifiers.
b. In method 'getResultLandingInfo()' add Identifier parameter to build the appropriate query.
c. Do not re-build url (location.go) if url parameter was "pid".
d. [For orcid - coming soon] Join all identifiers of result into a string: pidsArrayString.
3. resultLanding.service:
a. In method 'getResultLandingInfo()' add Identifier parameter to build tthe appropriate query.
b. Add method 'buildResultLandingInfoUrl()' called by 'getResultLandingInfo()'.
c. Im method 'getResultLandingInfo()', if given identifier and not id parameter, the response is search-like with array of results:
if there are no results, throw HttpErrorResponse with status 404 (like landing response, which returns 404 when no results), otherwise return first result (results['result'][0]).

View differences:

string-utils.class.ts
134 134
    
135 135
    for (let id of words) {
136 136
      if (id.length > 0) {
137
        if (Identifier.isValidDOI(id)) {
138
          identifiers.push({"class": "doi", "id": id})
139
        } else if (Identifier.isValidORCID(id)) {
140
          identifiers.push({"class": "ORCID", "id": id})
141
        } else if (Identifier.isValidPMCID(id)) {
142
          identifiers.push({"class": "pmc", "id": id})
143
        } else if (Identifier.isValidPMID(id)) {
144
          identifiers.push({"class": "pmid", "id": id})
145
        } else if (Identifier.isValidHANDLE(id)) {
146
          identifiers.push({"class": "handle", "id": id})
137
        let identifier: Identifier = this.getIdentifierFromString(id);
138
        if(identifier) {
139
          identifiers.push(identifier);
147 140
        }
148 141
      }
149 142
    }
150 143
    return identifiers;
151 144
  }
145

  
146
  public static getIdentifierFromString(pid: string): Identifier {
147
    if (Identifier.isValidDOI(pid)) {
148
      return {"class": "doi", "id": pid};
149
    } else if (Identifier.isValidORCID(pid)) {
150
      return {"class": "ORCID", "id": pid};
151
    } else if (Identifier.isValidPMCID(pid)) {
152
      return {"class": "pmc", "id": pid};
153
    } else if (Identifier.isValidPMID(pid)) {
154
      return {"class": "pmid", "id": pid};
155
    } else if (Identifier.isValidHANDLE(pid)) {
156
      return {"class": "handle", "id": pid};
157
    }
158
    return null;
159
  }
152 160
  
153 161
  public static isValidDOI(str: string): boolean {
154 162
    var exp1 = /\b(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])\S)+)\b/g

Also available in: Unified diff