1'use strict'; 2 3(function(angular) { 4 angular.module('BruSo.common').factory('Sectors', [ '$resource', function($resource) { 5 6 var apiPath = 'rest'; 7 var resources = $resource(apiPath, {}, { 8 getAll : { 9 method : 'GET', 10 url : apiPath + '/sectors/', 11 cache : false, 12 isArray : true 13 }, 14 getById : { 15 method : 'GET', 16 url : apiPath + '/sector/:sectorId', 17 cache : false, 18 isArray : false 19 }, 20 getByIds: { 21 method: 'GET', 22 url: apiPath + '/sector/list/:sectorIds', 23 cache: false, 24 isArray: true 25 }, 26 getPaths : { 27 method : 'GET', 28 url : apiPath + '/sector/:sectorId/paths', 29 cache : false, 30 isArray : false 31 }, 32 getOrganisations : { 33 method : 'GET', 34 url : apiPath + '/sector/:sectorId/organisations', 35 cache : false, 36 isArray : true 37 } 38 }); 39 40 return { 41 42 pathPendingCalls: {}, 43 pathResults: {}, 44 45 /** 46 * Fetches all sectors 47 */ 48 getAll : function() { 49 return resources.getAll().$promise; 50 }, 51 /** 52 * Fetches the sector with the specified ID. 53 */ 54 getById : function(sectorId) { 55 return resources.getById({ 56 sectorId : sectorId 57 }).$promise; 58 }, 59 /** 60 * Fetches the sectors matching the sector IDs in the specified array. 61 */ 62 getByIds: function(sectorIds) { 63 var ids = sectorIds.join(','); 64 return resources.getByIds({sectorIds: ids}).$promise; 65 }, 66 /** 67 * Fetches the sector paths. 68 */ 69 getPaths : function(sectorId) { 70 return resources.getPaths({ 71 sectorId : sectorId 72 }).$promise; 73 }, 74 /** 75 * Fetches the sector paths. 76 */ 77 getOrganisations : function(sectorId) { 78 return resources.getOrganisations({ 79 sectorId : sectorId 80 }).$promise; 81 } 82 }; 83 } ]); 84})(angular);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.