package eu.dnetlib.dhp.schema.sx.api.model.v3; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import com.fasterxml.jackson.annotation.JsonProperty; import eu.dnetlib.dhp.schema.sx.api.model.v2.ScholixCreatorType; import eu.dnetlib.dhp.schema.sx.api.model.v2.ScholixIdentifierType; import eu.dnetlib.dhp.schema.sx.api.model.v2.ScholixLinkProviderType; import eu.dnetlib.dhp.schema.sx.scholix.ScholixResource; /** * The type Scholix item type. */ public class ScholixItemType { @JsonProperty("Identifier") private List identifier = new ArrayList(); @JsonProperty("Title") private String title; @JsonProperty("Type") private String type; @JsonProperty("subType") private String subType; @JsonProperty("Creator") private List creator = new ArrayList<>(); @JsonProperty("PublicationDate") private String publicationDate; @JsonProperty("Publisher") private List publisher = new ArrayList<>(); /** * Gets identifier. * * @return the identifier */ public List getIdentifier() { return identifier; } /** * Sets identifier. * * @param identifier the identifier * @return the identifier */ public ScholixItemType setIdentifier(List identifier) { this.identifier = identifier; return this; } /** * Gets title. * * @return the title */ public String getTitle() { return title; } /** * Sets title. * * @param title the title * @return the title */ public ScholixItemType setTitle(String title) { this.title = title; return this; } /** * Gets type. * * @return the type */ public String getSubType() { return subType; } /** * Sets sub Type. * * @param subType the subType * @return the title */ public ScholixItemType setSubType(String subType) { this.subType = subType; return this; } /** * Gets type. * * @return the type */ public String getType() { return type; } /** * Sets type. * * @param type the type * @return the type */ public ScholixItemType setType(String type) { this.type = type; return this; } /** * Gets creator. * * @return the creator */ public List getCreator() { return creator; } /** * Sets creator. * * @param creator the creator * @return the creator */ public ScholixItemType setCreator(List creator) { this.creator = creator; return this; } /** * Gets publication date. * * @return the publication date */ public String getPublicationDate() { return publicationDate; } /** * Sets publication date. * * @param publicationDate the publication date * @return the publication date */ public ScholixItemType setPublicationDate(String publicationDate) { this.publicationDate = publicationDate; return this; } /** * Gets publisher. * * @return the publisher */ public List getPublisher() { return publisher; } /** * Sets publisher. * * @param publisher the publisher * @return the publisher */ public ScholixItemType setPublisher(List publisher) { this.publisher = publisher; return this; } public static ScholixItemType fromScholixResource(final ScholixResource input) { if (input == null) return null; final ScholixItemType instance = new ScholixItemType(); instance.setType(input.getObjectType()); instance.setSubType(input.getObjectSubType()); // instance.setType("publication".equalsIgnoreCase(input.getObjectType())?"literature": "dataset"); instance.setTitle(input.getTitle()); if (input.getIdentifier()!= null) instance.setIdentifier(input.getIdentifier() .stream() .map(ScholixIdentifierType::fromScholixIdentifier ) .collect(Collectors.toList()) ); if (input.getPublisher()!= null) { instance.setPublisher( input.getPublisher().stream() .map(ScholixLinkProviderType::fromScholixEntityId) .collect(Collectors.toList()) ); } instance.setPublicationDate(input.getPublicationDate()); if(input.getCreator()!=null) instance.setCreator(input.getCreator() .stream() .map(ScholixCreatorType::fromScholixEntityId) .collect(Collectors.toList())); return instance; } }