common/corpus-common-addon/app/services/bnf-resolver.js
changeset 328 04e728651a48
parent 305 ff6cf3fc5f40
equal deleted inserted replaced
327:13564bb13ccc 328:04e728651a48
     2 
     2 
     3 import ResolverService from 'corpus-common-addon/services/resolver-service';
     3 import ResolverService from 'corpus-common-addon/services/resolver-service';
     4 
     4 
     5 export default ResolverService.extend({
     5 export default ResolverService.extend({
     6 
     6 
     7     storeKeyBase: 'bnf',
     7   storeKeyBase: 'bnf',
     8     apiPath:  '/api/v1/resolvers/bnf/',
     8   apiPath: '/api/v1/resolvers/bnf/',
     9     resDocRoot: 'bnfids',
     9   resDocRoot: 'bnfids',
    10 
    10 
    11     init() {
    11   init(...args) {
    12         this._super(...arguments);
    12     this._super(...args);
    13         console.log("BNF", this);
    13   },
    14     },
       
    15 
    14 
    16     processId: function(id) {
    15   processId: function (id) {
    17         var bnfId = id;
    16     let bnfId = id;
    18         if(id.startsWith(constants.BNF_BASE_URL + constants.BNF_ARK_BASE_ID)) {
       
    19             bnfId = id.slice((constants.BNF_BASE_URL + constants.BNF_ARK_BASE_ID).length);
       
    20         }
       
    21         else if (id.startsWith(constants.BNF_ARK_BASE_URL + constants.BNF_ARK_BASE_ID)) {
       
    22             bnfId = id.slice((constants.BNF_ARK_BASE_URL + constants.BNF_ARK_BASE_ID).length);
       
    23         }
       
    24         else if (id.startsWith(constants.BNF_ARK_BASE_ID)) {
       
    25             bnfId = id.slice(constants.BNF_ARK_BASE_ID.length);
       
    26         }
       
    27         return bnfId;
       
    28     },
       
    29 
    17 
    30     getReturnDictKey: function(id) { return constants.BNF_ARK_BASE_ID+id; },
    18     if (id.startsWith(constants.BNF_BASE_URL + constants.BNF_ARK_BASE_ID)) {
       
    19       bnfId = id.slice((constants.BNF_BASE_URL + constants.BNF_ARK_BASE_ID).length);
       
    20     } else if (id.startsWith(constants.BNF_ARK_BASE_URL + constants.BNF_ARK_BASE_ID)) {
       
    21       bnfId = id.slice((constants.BNF_ARK_BASE_URL + constants.BNF_ARK_BASE_ID).length);
       
    22     } else if (id.startsWith(constants.BNF_ARK_BASE_ID)) {
       
    23       bnfId = id.slice(constants.BNF_ARK_BASE_ID.length);
       
    24     }
    31 
    25 
    32     getLabel: function(id) { return this.getName(id); }
    26     return bnfId;
       
    27   },
       
    28 
       
    29   getReturnDictKey: function (id) {
       
    30     return constants.BNF_ARK_BASE_ID + id;
       
    31   },
       
    32 
       
    33   getLabel: function (id) {
       
    34     return this.getName(id);
       
    35   }
    33 
    36 
    34 });
    37 });