2023-07-14 17:22:25 +02:00
|
|
|
import {Injectable} from "@angular/core";
|
|
|
|
import {HttpClient} from "@angular/common/http";
|
|
|
|
import {environment} from "../../environments/environment";
|
2023-07-25 10:58:23 +02:00
|
|
|
import {map} from "rxjs";
|
2023-07-14 17:22:25 +02:00
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: "root"
|
|
|
|
})
|
|
|
|
export class OaipmhValidatorService {
|
|
|
|
|
|
|
|
constructor(private http: HttpClient) {}
|
|
|
|
|
|
|
|
getAnalysis(jobId: string) {
|
|
|
|
let url: string = environment.validatorAPI + "reports/getResultsByJobId?jobId="+jobId;
|
|
|
|
return this.http.get(url);
|
|
|
|
}
|
|
|
|
|
|
|
|
getWarnings(jobId: string, ruleName: string) {
|
|
|
|
let url: string = environment.validatorAPI + "reports/getWarningsReport?jobId="+jobId+"&ruleName="+ruleName;
|
|
|
|
return this.http.get<any>(url);
|
|
|
|
}
|
|
|
|
|
|
|
|
getErrors(jobId: string, ruleName: string) {
|
|
|
|
let url:string = environment.validatorAPI + "reports/getErrorsReport?jobId="+jobId+"&ruleName="+ruleName;
|
|
|
|
return this.http.get<any>(url);
|
|
|
|
}
|
|
|
|
|
|
|
|
getJobResult(jobId: string) {
|
|
|
|
let url: string = environment.validatorAPI + "reports/getJobResult?jobId="+jobId;
|
|
|
|
return this.http.get(url);
|
|
|
|
}
|
2023-07-25 10:58:23 +02:00
|
|
|
|
|
|
|
getSets(baseUrl) {
|
|
|
|
let url: string = environment.validatorAPI + "getSets?baseUrl="+baseUrl;
|
|
|
|
return this.http.get(url).pipe(map(res => res['set']));
|
|
|
|
}
|
|
|
|
|
|
|
|
validate(guidelines: string, baseUrl: string, numberOfRecords: string, set: string) {
|
|
|
|
let url: string = environment.validatorAPI + "realValidator?guidelines="+guidelines+"&baseUrl="+baseUrl
|
2023-07-25 15:58:41 +02:00
|
|
|
+(numberOfRecords ? ("&numberOfRecords="+numberOfRecords) : "") + (set && set != 'all' ? ("&set="+set) : "");
|
2023-07-25 10:58:23 +02:00
|
|
|
console.log(url);
|
2023-07-25 15:58:41 +02:00
|
|
|
return this.http.get(url);
|
2023-07-25 10:58:23 +02:00
|
|
|
}
|
2023-07-14 17:22:25 +02:00
|
|
|
}
|