Rename basic Routes + validate method returns the validation job in JSON + guidelines parameters use name + add fair profile for data guideline
This commit is contained in:
parent
69818d6b22
commit
3bb02b30e2
|
@ -9,7 +9,8 @@ import eu.dnetlib.validatorapi.entities.ValidationRuleResult;
|
|||
import eu.dnetlib.validatorapi.repositories.ValidationIssueRepository;
|
||||
import eu.dnetlib.validatorapi.repositories.ValidationJobRepository;
|
||||
import eu.dnetlib.validatorapi.repositories.ValidationResultRepository;
|
||||
import eu.dnetlib.validatorapi.routes.OaiPmhRoute2;
|
||||
import eu.dnetlib.validatorapi.routes.FairOaiPmhRoute2;
|
||||
import eu.dnetlib.validatorapi.routes.SimpleOaiPmhRoute;
|
||||
import org.apache.camel.CamelContext;
|
||||
import org.apache.camel.ProducerTemplate;
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
|
@ -177,8 +178,8 @@ public class ValidationController {
|
|||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/realValidator"}, method = RequestMethod.GET)
|
||||
public void validateWithApacheCamel(@RequestParam(name = "guidelines") String guidelinesProfileName,
|
||||
@RequestMapping(value = {"/realValidator"}, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ValidationJob validateWithApacheCamel(@RequestParam(name = "guidelines") String guidelinesProfileName,
|
||||
@RequestParam(name = "baseUrl", defaultValue = "http://repositorium.sdum.uminho.pt/oai/request") String baseURL, //not in use now
|
||||
@RequestParam(name="numberOfRecords", defaultValue = "10") int numberOfRecords,
|
||||
@RequestParam(name="set", required = false) String set//, //not in use now
|
||||
|
@ -209,17 +210,22 @@ public class ValidationController {
|
|||
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
System.out.println("\n\n\n " + uuid);
|
||||
RouteBuilder oaiPmhRouteBuilder =
|
||||
new OaiPmhRoute2("oaipmh://"+baseURL + "?verb=ListRecords&metadataPrefix=" + metadataPrefix ,
|
||||
profile, validationJob, numberOfRecords, uuid.toString());
|
||||
|
||||
RouteBuilder oaiPmhRouteBuilder;
|
||||
|
||||
if (fairProfile == null) {
|
||||
System.out.println("HEREEEE");
|
||||
oaiPmhRouteBuilder =
|
||||
new SimpleOaiPmhRoute("oaipmh://" + baseURL + "?verb=ListRecords&metadataPrefix=" + metadataPrefix,
|
||||
profile, validationJob, numberOfRecords, uuid.toString());
|
||||
} else {
|
||||
System.out.println("THERE");
|
||||
|
||||
oaiPmhRouteBuilder =
|
||||
new FairOaiPmhRoute2("oaipmh://" + baseURL + "?verb=ListRecords&metadataPrefix=" + metadataPrefix,
|
||||
profile, validationJob, numberOfRecords, uuid.toString());
|
||||
}
|
||||
|
||||
/*
|
||||
RouteBuilder oaiPmhRouteBuilder =
|
||||
new OAI_PMH_RouteBuilder("oaipmh://"+baseURL + "?verb=ListRecords&metadataPrefix=" + metadataPrefix ,
|
||||
profile, validationJob, numberOfRecords, validationJobRepository, validationIssueRepository, validationResultRepository);*/
|
||||
camelContext.addRoutes(oaiPmhRouteBuilder);
|
||||
|
||||
}
|
||||
|
@ -232,6 +238,8 @@ public class ValidationController {
|
|||
validationJob.status = validationResultRepository.getStatus(validationJob.id);
|
||||
validationJobRepository.save(validationJob);
|
||||
}
|
||||
|
||||
return validationJob;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/getSets"}, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
@ -243,7 +251,7 @@ public class ValidationController {
|
|||
|
||||
return response;
|
||||
|
||||
/*
|
||||
/*git git
|
||||
System.out.println(camelContext.getRoutes());
|
||||
RouteBuilder listSetsBuilder = new OaiSetListRoute("oaipmh://"+ baseURL + "?verb=ListSets");
|
||||
|
||||
|
@ -359,14 +367,19 @@ public class ValidationController {
|
|||
|
||||
private AbstractOpenAireProfile initializeOpenAireProfile(String guidelinesProfileName) {
|
||||
|
||||
if (guidelinesProfileName.equals("dataArchiveGuidelinesV2Profile")) {
|
||||
System.out.println("GUIDELINES " + guidelinesProfileName);
|
||||
|
||||
if (guidelinesProfileName.equals("OpenAIRE Guidelines for Data Archives Profile v2")) {
|
||||
return new DataArchiveGuidelinesV2Profile();
|
||||
|
||||
} else if (guidelinesProfileName.equals("literatureGuidelinesV3Profile")) {
|
||||
} else if (guidelinesProfileName.equals("OpenAIRE Guidelines for Literature Repositories Profile v3")) {
|
||||
return new LiteratureGuidelinesV3Profile();
|
||||
|
||||
} else if (guidelinesProfileName.equals("literatureGuidelinesV4Profile")) {
|
||||
} else if (guidelinesProfileName.equals("OpenAIRE Guidelines for Literature Repositories Profile v4")) {
|
||||
return new LiteratureGuidelinesV4Profile();
|
||||
|
||||
} else if (guidelinesProfileName.equals("OpenAIRE FAIR Guidelines for Data Repositories Profile")) {//in case they give only fair. TODO: is ti possible?
|
||||
return new FAIR_Data_GuidelinesProfile();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -374,13 +387,13 @@ public class ValidationController {
|
|||
|
||||
private String initializeMetadataPrefix(String guidelinesProfileName) {
|
||||
|
||||
if (guidelinesProfileName.equals("dataArchiveGuidelinesV2Profile")) {
|
||||
if (guidelinesProfileName.equals("OpenAIRE Guidelines for Data Archives Profile v2")) {
|
||||
return "oai_openaire";
|
||||
|
||||
} else if (guidelinesProfileName.equals("literatureGuidelinesV3Profile")) {
|
||||
} else if (guidelinesProfileName.equals("OpenAIRE Guidelines for Literature Repositories Profile v3")) {
|
||||
return "oai_dc";
|
||||
|
||||
} else if (guidelinesProfileName.equals("literatureGuidelinesV4Profile")) {
|
||||
} else if (guidelinesProfileName.equals("OpenAIRE Guidelines for Literature Repositories Profile v4")) {
|
||||
return "oai_openaire";
|
||||
}
|
||||
|
||||
|
@ -391,9 +404,6 @@ public class ValidationController {
|
|||
private AbstractOpenAireProfile initializeFairProfile(String guidelinesProfileName) {
|
||||
if (guidelinesProfileName.equals("dataArchiveGuidelinesV2Profile")) {
|
||||
return new FAIR_Data_GuidelinesProfile();
|
||||
|
||||
} else if (guidelinesProfileName.equals("fairDataGuidelinesProfile")) {
|
||||
return new FAIR_Data_GuidelinesProfile();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -544,3 +554,5 @@ public class ValidationController {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -64,6 +64,11 @@ public class ValidationJob {
|
|||
'}';
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,30 +13,26 @@ import org.apache.camel.builder.RouteBuilder;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
public class OaiPmhRoute2 extends RouteBuilder {
|
||||
public class FairOaiPmhRoute2 extends RouteBuilder {
|
||||
|
||||
private String oaiEndpoint;
|
||||
|
||||
private AbstractOpenAireProfile profile;
|
||||
private long maxNumberOfRecords = 0;
|
||||
private ValidationJob validationJob;
|
||||
CountDownLatch latch;
|
||||
String routeid;
|
||||
String routeid2;
|
||||
|
||||
|
||||
public OaiPmhRoute2(String oaiEndpoint, AbstractOpenAireProfile profile, ValidationJob validationJob,
|
||||
long maxNumberOfRecords, String routeid) {
|
||||
public FairOaiPmhRoute2(String oaiEndpoint, AbstractOpenAireProfile profile, ValidationJob validationJob,
|
||||
long maxNumberOfRecords, String routeid) {
|
||||
this.oaiEndpoint = oaiEndpoint;
|
||||
this.validationJob = validationJob;
|
||||
this.profile = profile;
|
||||
this.maxNumberOfRecords = maxNumberOfRecords;
|
||||
this.routeid = routeid;
|
||||
this.routeid2 = UUID.randomUUID().toString();
|
||||
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
@Override
|
|
@ -11,31 +11,25 @@ import org.apache.camel.Processor;
|
|||
import org.apache.camel.builder.RouteBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
public class OaiPmhRoute extends RouteBuilder {
|
||||
public class SimpleOaiPmhRoute extends RouteBuilder {
|
||||
|
||||
private String oaiEndpoint;
|
||||
|
||||
private AbstractOpenAireProfile profile;
|
||||
private long maxNumberOfRecords = 0;
|
||||
private ValidationJob validationJob;
|
||||
CountDownLatch latch;
|
||||
String routeid;
|
||||
String routeid2;
|
||||
|
||||
|
||||
public OaiPmhRoute(String oaiEndpoint, AbstractOpenAireProfile profile, ValidationJob validationJob,
|
||||
long maxNumberOfRecords, String routeid) {
|
||||
|
||||
public SimpleOaiPmhRoute(String oaiEndpoint, AbstractOpenAireProfile profile, ValidationJob validationJob,
|
||||
long maxNumberOfRecords, String routeid) {
|
||||
this.oaiEndpoint = oaiEndpoint;
|
||||
this.validationJob = validationJob;
|
||||
this.profile = profile;
|
||||
this.maxNumberOfRecords = maxNumberOfRecords;
|
||||
this.routeid = routeid;
|
||||
this.routeid2 = UUID.randomUUID().toString();
|
||||
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
@Override
|
Loading…
Reference in New Issue