fix after merge

This commit is contained in:
Michele Artini 2022-11-16 10:26:10 +01:00
parent 77d0e46652
commit 08f5466105
4 changed files with 42 additions and 37 deletions

View File

@ -6,7 +6,7 @@
<parent>
<groupId>eu.dnetlib.dhp</groupId>
<artifactId>apps</artifactId>
<version>3.2.1-SNAPSHOT</version>
<version>3.3.3-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>

View File

@ -3,26 +3,23 @@ package eu.dnetlib.openaire.directindex;
import java.util.Properties;
import org.apache.velocity.app.VelocityEngine;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import eu.dnetlib.common.app.AbstractDnetApp;
import eu.dnetlib.common.clients.ISLookupClientFactory;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableSwagger2
@EnableCaching
@EnableScheduling
@ComponentScan(basePackages = "eu.dnetlib")
public class DirectIndexApplication extends AbstractDnetApp {
@Value("${openaire.service.islookup.wsdl}")
@ -32,20 +29,12 @@ public class DirectIndexApplication extends AbstractDnetApp {
SpringApplication.run(DirectIndexApplication.class, args);
}
@Override
protected void configSwagger(final Docket docket) {
docket.select()
.apis(RequestHandlerSelectors.any())
.paths(p -> p.startsWith("/api/"))
.build()
.apiInfo(new ApiInfoBuilder()
.title("OpenAIRE DirectIndex API")
.description("APIs documentation")
.version("1.1")
.contact(ApiInfo.DEFAULT_CONTACT)
.license("Apache 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0")
.build());
@Bean
public GroupedOpenApi publicApi() {
return GroupedOpenApi.builder()
.group("D-Net DirectIndex API")
.pathsToMatch("/api/**")
.build();
}
@Bean
@ -64,4 +53,9 @@ public class DirectIndexApplication extends AbstractDnetApp {
return ve;
}
@Override
protected String swaggerTitle() {
return "OpenAIRE DirectIndex API";
}
}

View File

@ -1,24 +1,25 @@
package eu.dnetlib.openaire.directindex.input;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* Created by michele on 02/12/15.
*/
public class PidEntry {
@Schema(required = true, description = "E.g. doi, pmc, urn. See http://api.openaire.eu/vocabularies/dnet:pid_types")
private String type;
@Schema(required = true)
private String value;
public PidEntry() {
}
public PidEntry() {}
public PidEntry(final String type, final String value) {
this.type = type;
this.value = value;
}
@ApiModelProperty(required = true, value = "E.g. doi, pmc, urn. See http://api.openaire.eu/vocabularies/dnet:pid_types")
public String getType() {
return type;
}
@ -27,7 +28,6 @@ public class PidEntry {
this.type = type;
}
@ApiModelProperty(required = true)
public String getValue() {
return value;
}
@ -35,4 +35,4 @@ public class PidEntry {
public void setValue(final String value) {
this.value = value;
}
}
}

View File

@ -11,7 +11,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.openaire.directindex.DirectIndexApiException;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* Created by michele on 02/12/15.
@ -20,28 +20,48 @@ public class ResultEntry {
private String openaireId;
private String originalId;
@Schema(required = true)
private String title;
private List<String> authors = new ArrayList<>();
private String publisher;
private String description;
@Schema(description = "ISO Alpha-3 code. E.g. 'eng', 'ita'")
private String language;
private List<PidEntry> pids = new ArrayList<>();
@Schema(required = false, allowableValues = {
"OPEN", "CLOSED", "RESTRICTED", "EMBARGO", "UNKNOWN", "OTHER", "OPEN SOURCE"
})
private String accessRightCode;
private String embargoEndDate;
/**
* One of publication, dataset, software, other. Default value is publication.
*/
@Schema(allowableValues = {
"publication", "dataset", "software", "other"
})
private String type = "publication";
@Schema(required = true, description = "Use 001 for articles, 021 for datasets, 0029 for software. See: http://api.openaire.eu/vocabularies/dnet:publication_resource for all the available resource types.")
private String resourceType;
@Schema(required = true)
private String url;
@Schema(required = true, description = "Use opendoar___::2659 for Zenodo Publications; re3data_____::r3d100010468 for Zenodo datasets; infrastruct::openaire for OpenAIRE portal.")
private String collectedFromId;
private String hostedById;
// String according to the EGI context profile, example: egi::classification::natsc::math
@Schema(description = "E.g. fet, egi::classification::natsc::math::pure, egi::projects::EMI")
private List<String> contexts = new ArrayList<>();
// String according to openaire guidelines:
// info:eu-repo/grantAgreement/Funder/FundingProgram/ProjectID/[Jurisdiction]/[ProjectName]/[ProjectAcronym]
@Schema(description = "E.g. info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus")
private List<String> linksToProjects = new ArrayList<>();
private static final Log log = LogFactory.getLog(ResultEntry.class);
@ -64,7 +84,6 @@ public class ResultEntry {
this.originalId = originalId;
}
@ApiModelProperty(required = true)
public String getTitle() {
return title;
}
@ -97,7 +116,6 @@ public class ResultEntry {
this.description = description;
}
@ApiModelProperty(value = "ISO Alpha-3 code. E.g. 'eng', 'ita'")
public String getLanguage() {
return language;
}
@ -119,7 +137,6 @@ public class ResultEntry {
*
* @return access rights code
*/
@ApiModelProperty(required = false, allowableValues = "OPEN, CLOSED, RESTRICTED, EMBARGO, UNKNOWN, OTHER, OPEN SOURCE")
public String getAccessRightCode() {
return accessRightCode;
}
@ -128,7 +145,6 @@ public class ResultEntry {
this.accessRightCode = accessRightCode;
}
@ApiModelProperty(required = true, value = "Use 001 for articles, 021 for datasets, 0029 for software. See: http://api.openaire.eu/vocabularies/dnet:publication_resource for all the available resource types.")
public String getResourceType() {
return resourceType;
}
@ -137,7 +153,6 @@ public class ResultEntry {
this.resourceType = resourceType;
}
@ApiModelProperty(required = true)
public String getUrl() {
return url;
}
@ -146,7 +161,6 @@ public class ResultEntry {
this.url = url;
}
@ApiModelProperty(required = true, value = "Use opendoar___::2659 for Zenodo Publications; re3data_____::r3d100010468 for Zenodo datasets; infrastruct::openaire for OpenAIRE portal.")
public String getCollectedFromId() {
return collectedFromId;
}
@ -163,7 +177,6 @@ public class ResultEntry {
this.hostedById = hostedById;
}
@ApiModelProperty(value = "E.g. fet, egi::classification::natsc::math::pure, egi::projects::EMI")
public List<String> getContexts() {
return contexts;
}
@ -172,7 +185,6 @@ public class ResultEntry {
this.contexts = contexts;
}
@ApiModelProperty(value = "E.g. info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus")
public List<String> getLinksToProjects() {
return linksToProjects;
}
@ -181,7 +193,6 @@ public class ResultEntry {
this.linksToProjects = linksToProjects;
}
@ApiModelProperty(allowableValues = "publication, dataset, software, other")
public String getType() {
return type;
}