2017-12-19 13:53:46 +01:00
|
|
|
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
2018-02-15 11:36:12 +01:00
|
|
|
import { ErrorCodes} from '../../utils/properties/errorCodes';
|
2019-02-19 16:26:59 +01:00
|
|
|
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
|
2019-06-14 15:06:58 +02:00
|
|
|
import {SearchCustomFilter, SearchUtilsClass} from '../../searchPages/searchUtils/searchUtils.class';
|
2018-02-05 14:14:59 +01:00
|
|
|
import{EnvProperties} from '../../utils/properties/env-properties';
|
2018-10-30 12:37:52 +01:00
|
|
|
import {StringUtils} from '../../utils/string-utils.class';
|
2017-12-19 13:53:46 +01:00
|
|
|
export class FetchDataproviders {
|
|
|
|
private errorCodes: ErrorCodes;
|
2019-02-19 16:26:59 +01:00
|
|
|
private errorMessages: ErrorMessagesComponent;
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
public results =[];
|
|
|
|
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
|
|
|
public sub: any; public subResults: any;
|
|
|
|
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
|
|
|
|
"export":[]
|
|
|
|
};
|
|
|
|
public CSVDownloaded = false;
|
|
|
|
public csvParams: string;
|
2019-02-12 12:15:21 +01:00
|
|
|
public loadPaging: boolean = true;
|
|
|
|
public oldTotalResults: number = 0;
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
constructor ( private _searchDataprovidersService: SearchDataprovidersService ) {
|
|
|
|
this.errorCodes = new ErrorCodes();
|
2019-02-19 16:26:59 +01:00
|
|
|
this.errorMessages = new ErrorMessagesComponent();
|
2017-12-19 13:53:46 +01:00
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ngOnDestroy() {
|
|
|
|
if(this.sub){
|
|
|
|
this.sub.unsubscribe();
|
|
|
|
}
|
|
|
|
if(this.subResults){
|
|
|
|
this.subResults.unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-14 15:06:58 +02:00
|
|
|
public getResultsByKeyword(keyword:string, page: number, size: number, properties:EnvProperties, customFilter:SearchCustomFilter=null){
|
2017-12-19 13:53:46 +01:00
|
|
|
var parameters = "";
|
|
|
|
if(keyword.length > 0){
|
2018-10-30 12:37:52 +01:00
|
|
|
parameters = "q=" + StringUtils.URIEncode(keyword);
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
2019-06-14 15:06:58 +02:00
|
|
|
var refineParams = null;
|
|
|
|
if(customFilter){
|
|
|
|
refineParams = (refineParams?(refineParams+'&'):'')+"&fq="+StringUtils.URIEncode(customFilter.queryFieldName + " exact " + StringUtils.quote((customFilter.valueId )));
|
|
|
|
}
|
|
|
|
this.subResults = this._searchDataprovidersService.searchDataproviders(parameters,refineParams, page, size,[], properties).subscribe(
|
2017-12-19 13:53:46 +01:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
2019-02-14 11:15:44 +01:00
|
|
|
//console.info("search Content Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
|
2017-12-19 13:53:46 +01:00
|
|
|
this.results = data[1];
|
|
|
|
|
|
|
|
//ar errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
2019-02-19 16:26:59 +01:00
|
|
|
/*console.log(err);
|
2017-12-19 13:53:46 +01:00
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
|
|
|
}
|
2019-02-19 16:26:59 +01:00
|
|
|
*/
|
|
|
|
this.handleError("Error getting content providers for keyword: "+keyword, err);
|
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-05-10 16:36:33 +02:00
|
|
|
public getResultsForHome(size: number, properties:EnvProperties){
|
|
|
|
let page = 1;
|
|
|
|
var parameters = "&sortBy=resultdateofacceptance,descending";//"orderby=date";
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
|
|
|
this.subResults = this._searchDataprovidersService.searchDataproviders(parameters,null, page, size,[], properties).subscribe(
|
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
2019-02-14 11:15:44 +01:00
|
|
|
//console.info("search Content Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
|
2018-05-10 16:36:33 +02:00
|
|
|
this.results = data[1];
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
2019-02-19 16:26:59 +01:00
|
|
|
/*console.log(err);
|
2018-05-10 16:36:33 +02:00
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
2019-02-19 16:26:59 +01:00
|
|
|
}*/
|
|
|
|
this.handleError("Error getting content providers with parameters: "+parameters + " for Home", err);
|
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
2018-05-10 16:36:33 +02:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
public getNumForEntity(entity: string, id:string, properties:EnvProperties) {
|
2017-12-19 13:53:46 +01:00
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
|
|
|
if(id != "" && entity != "") {
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
this._searchDataprovidersService.numOfEntityDataproviders(id, entity, properties).subscribe(
|
2017-12-19 13:53:46 +01:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data;
|
|
|
|
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
2019-02-19 16:26:59 +01:00
|
|
|
/*console.log(err);
|
2017-12-19 13:53:46 +01:00
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
2019-02-19 16:26:59 +01:00
|
|
|
}*/
|
|
|
|
this.handleError("Error getting content providers for "+entity+" with id: "+id, err);
|
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-14 15:06:58 +02:00
|
|
|
public getNumForSearch(keyword: string, properties:EnvProperties, refineParams:string=null) {
|
2017-12-19 13:53:46 +01:00
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
2019-06-14 15:06:58 +02:00
|
|
|
this._searchDataprovidersService.numOfSearchDataproviders(keyword, properties, refineParams).subscribe(
|
2017-12-19 13:53:46 +01:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data;
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
|
|
|
|
if(this.searchUtils.totalResults == 0) {
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
2019-02-19 16:26:59 +01:00
|
|
|
/*console.log(err);
|
2017-12-19 13:53:46 +01:00
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
2019-02-19 16:26:59 +01:00
|
|
|
}*/
|
|
|
|
this.handleError("Error getting number of content providers for keyword: "+keyword, err);
|
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
public getResultsForDeposit(id:string, type:string, page: number, size: number, properties:EnvProperties){
|
2017-12-19 13:53:46 +01:00
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
2019-02-12 12:15:21 +01:00
|
|
|
this.results = [];
|
|
|
|
this.searchUtils.totalResults = 0;
|
|
|
|
this.loadPaging = false;
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
if(id != "") {
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
this._searchDataprovidersService.searchDataprovidersForDeposit(id,type, page, size, properties).subscribe(
|
2017-12-19 13:53:46 +01:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
2019-02-14 11:15:44 +01:00
|
|
|
//console.info("search Dataproviders forDeposit: [id:"+id+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]");
|
2017-12-19 13:53:46 +01:00
|
|
|
this.results = data[1];
|
|
|
|
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
2019-02-12 12:15:21 +01:00
|
|
|
|
|
|
|
if(this.searchUtils.status == this.errorCodes.DONE) {
|
|
|
|
// Page out of limit!!!
|
|
|
|
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
|
|
|
if(!(Number.isInteger(totalPages))) {
|
|
|
|
totalPages = (parseInt(totalPages, 10) + 1);
|
|
|
|
}
|
|
|
|
if(totalPages < page) {
|
|
|
|
this.searchUtils.totalResults = 0;
|
|
|
|
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.loadPaging = true;
|
|
|
|
this.oldTotalResults = this.searchUtils.totalResults;
|
2017-12-19 13:53:46 +01:00
|
|
|
},
|
|
|
|
err => {
|
2019-02-19 16:26:59 +01:00
|
|
|
/*console.log(err);
|
2017-12-19 13:53:46 +01:00
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
2019-02-19 16:26:59 +01:00
|
|
|
}*/
|
|
|
|
this.handleError("Error getting content providers in share "+type+" for organization with id: "+id, err);
|
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
|
2019-02-12 12:15:21 +01:00
|
|
|
this.loadPaging = true;
|
|
|
|
this.oldTotalResults = 0;
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2018-02-05 14:14:59 +01:00
|
|
|
public getResultsBySubjectsForDeposit(subject:string, type:string, page: number, size: number, properties:EnvProperties){
|
2017-12-19 13:53:46 +01:00
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
2019-02-12 12:15:21 +01:00
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
2019-02-12 12:15:21 +01:00
|
|
|
this.results = [];
|
|
|
|
this.searchUtils.totalResults = 0;
|
|
|
|
this.loadPaging = false;
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
this._searchDataprovidersService.searchDataProvidersBySubjects(subject,type, page, size, properties).subscribe(
|
2017-12-19 13:53:46 +01:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
2019-02-14 11:15:44 +01:00
|
|
|
//console.info("search Dataproviders forDeposit: [subject:"+subject+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]");
|
2017-12-19 13:53:46 +01:00
|
|
|
this.results = data[1];
|
|
|
|
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
2019-02-12 12:15:21 +01:00
|
|
|
if(this.searchUtils.status == this.errorCodes.DONE) {
|
|
|
|
// Page out of limit!!!
|
|
|
|
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
|
|
|
if(!(Number.isInteger(totalPages))) {
|
|
|
|
totalPages = (parseInt(totalPages, 10) + 1);
|
|
|
|
}
|
|
|
|
if(totalPages < page) {
|
|
|
|
this.searchUtils.totalResults = 0;
|
|
|
|
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.loadPaging = true;
|
|
|
|
this.oldTotalResults = this.searchUtils.totalResults;
|
2017-12-19 13:53:46 +01:00
|
|
|
},
|
|
|
|
err => {
|
2019-02-19 16:26:59 +01:00
|
|
|
/*console.log(err);
|
2017-12-19 13:53:46 +01:00
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
2019-02-19 16:26:59 +01:00
|
|
|
}*/
|
|
|
|
this.handleError("Error getting content providers in share "+type+" by subject: "+subject, err);
|
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
|
2019-02-12 12:15:21 +01:00
|
|
|
this.loadPaging = true;
|
|
|
|
this.oldTotalResults = 0;
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
2018-02-05 14:14:59 +01:00
|
|
|
public getResultsForEntity(entity:string, id:string, page: number, size: number, properties:EnvProperties){
|
2017-12-19 13:53:46 +01:00
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
|
|
|
var parameters = "";
|
|
|
|
|
|
|
|
if(entity == "organization") {
|
|
|
|
parameters = "organizations/"+id;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(parameters != "") {
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
this._searchDataprovidersService.searchDataprovidersForEntity(parameters, page, size, properties).subscribe(
|
2017-12-19 13:53:46 +01:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
2019-02-14 11:15:44 +01:00
|
|
|
//console.info("search Dataproviders for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
|
2017-12-19 13:53:46 +01:00
|
|
|
this.results = data[1];
|
|
|
|
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
2019-02-19 16:26:59 +01:00
|
|
|
/*console.log(err);
|
2017-12-19 13:53:46 +01:00
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
2019-02-19 16:26:59 +01:00
|
|
|
}*/
|
|
|
|
this.handleError("Error getting content providers for "+entity+" with id: "+id, err);
|
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
public getResultsForDataproviders(id:string, page: number, size: number, properties:EnvProperties){
|
2017-12-19 13:53:46 +01:00
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
this._searchDataprovidersService.getDataProvidersforEntityRegistry(id, page, size, properties).subscribe(
|
2017-12-19 13:53:46 +01:00
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
2019-02-14 11:15:44 +01:00
|
|
|
//console.info("search Dataproviders for Entity Registry: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
|
2017-12-19 13:53:46 +01:00
|
|
|
this.results = data[1];
|
|
|
|
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
2019-02-19 16:26:59 +01:00
|
|
|
/*console.log(err);
|
2017-12-19 13:53:46 +01:00
|
|
|
//TODO check erros (service not available, bad request)
|
|
|
|
// if( ){
|
|
|
|
// this.searchUtils.status = ErrorCodes.ERROR;
|
|
|
|
// }
|
|
|
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
//this.searchUtils.status = errorCodes.ERROR;
|
|
|
|
if(err.status == '404') {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
|
|
|
} else if(err.status == '500') {
|
|
|
|
this.searchUtils.status = this.errorCodes.ERROR;
|
|
|
|
} else {
|
|
|
|
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
2019-02-19 16:26:59 +01:00
|
|
|
}*/
|
|
|
|
this.handleError("Error getting content providers for entity registry with id: "+id, err);
|
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2019-02-19 16:26:59 +01:00
|
|
|
|
|
|
|
private handleError(message: string, error) {
|
|
|
|
console.error("Fetch Content Providers (class): "+message, error);
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|