[Scholexplorer]:
Removed TypedIdentifier class on summary and resue ScholixIdentifier
This commit is contained in:
parent
c0d47b2248
commit
78c8781fca
|
@ -2,17 +2,43 @@
|
|||
package eu.dnetlib.dhp.schema.sx.scholix;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ScholixIdentifier implements Serializable {
|
||||
private String identifier;
|
||||
private String schema;
|
||||
private String url;
|
||||
|
||||
public ScholixIdentifier() {
|
||||
}
|
||||
|
||||
public ScholixIdentifier(String identifier, String schema) {
|
||||
public ScholixIdentifier(String identifier, String schema, String url) {
|
||||
this.identifier = identifier;
|
||||
this.schema = schema;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
ScholixIdentifier that = (ScholixIdentifier) o;
|
||||
return identifier.equals(that.identifier) && schema.equals(that.schema);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(identifier, schema);
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
|
|
|
@ -2,11 +2,7 @@
|
|||
package eu.dnetlib.dhp.schema.sx.scholix;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import eu.dnetlib.dhp.schema.sx.summary.ScholixSummary;
|
||||
|
||||
public class ScholixResource implements Serializable {
|
||||
|
||||
|
@ -20,63 +16,6 @@ public class ScholixResource implements Serializable {
|
|||
private List<ScholixEntityId> publisher;
|
||||
private List<ScholixCollectedFrom> collectedFrom;
|
||||
|
||||
public static ScholixResource fromSummary(ScholixSummary summary) {
|
||||
|
||||
final ScholixResource resource = new ScholixResource();
|
||||
|
||||
resource.setDnetIdentifier(summary.getId());
|
||||
|
||||
resource
|
||||
.setIdentifier(
|
||||
summary
|
||||
.getLocalIdentifier()
|
||||
.stream()
|
||||
.map(i -> new ScholixIdentifier(i.getId(), i.getType()))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
resource.setObjectType(summary.getTypology().toString());
|
||||
|
||||
if (summary.getTitle() != null && summary.getTitle().size() > 0)
|
||||
resource.setTitle(summary.getTitle().get(0));
|
||||
|
||||
if (summary.getAuthor() != null)
|
||||
resource
|
||||
.setCreator(
|
||||
summary
|
||||
.getAuthor()
|
||||
.stream()
|
||||
.map(c -> new ScholixEntityId(c, null))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
if (summary.getDate() != null && summary.getDate().size() > 0)
|
||||
resource.setPublicationDate(summary.getDate().get(0));
|
||||
if (summary.getPublisher() != null)
|
||||
resource
|
||||
.setPublisher(
|
||||
summary
|
||||
.getPublisher()
|
||||
.stream()
|
||||
.map(p -> new ScholixEntityId(p, null))
|
||||
.collect(Collectors.toList()));
|
||||
if (summary.getDatasources() != null)
|
||||
resource
|
||||
.setCollectedFrom(
|
||||
summary
|
||||
.getDatasources()
|
||||
.stream()
|
||||
.map(
|
||||
d -> new ScholixCollectedFrom(
|
||||
new ScholixEntityId(
|
||||
d.getDatasourceName(),
|
||||
Collections
|
||||
.singletonList(
|
||||
new ScholixIdentifier(d.getDatasourceId(), "dnet_identifier"))),
|
||||
"collected",
|
||||
d.getCompletionStatus()))
|
||||
.collect(Collectors.toList()));
|
||||
return resource;
|
||||
}
|
||||
|
||||
public List<ScholixIdentifier> getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package eu.dnetlib.dhp.schema.sx.summary;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CollectedFromType implements Serializable {
|
||||
|
||||
|
@ -18,6 +19,19 @@ public class CollectedFromType implements Serializable {
|
|||
this.completionStatus = completionStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
CollectedFromType that = (CollectedFromType) o;
|
||||
return Objects.equals(datasourceName, that.datasourceName) && Objects.equals(datasourceId, that.datasourceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(datasourceName, datasourceId);
|
||||
}
|
||||
|
||||
public String getDatasourceName() {
|
||||
return datasourceName;
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import java.util.List;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import eu.dnetlib.dhp.schema.sx.scholix.ScholixIdentifier;
|
||||
|
||||
public class ScholixSummary implements Serializable {
|
||||
private String id;
|
||||
private List<TypedIdentifier> localIdentifier;
|
||||
private List<ScholixIdentifier> localIdentifier;
|
||||
private Typology typology;
|
||||
private String subType;
|
||||
private List<String> title;
|
||||
|
@ -30,11 +32,11 @@ public class ScholixSummary implements Serializable {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public List<TypedIdentifier> getLocalIdentifier() {
|
||||
public List<ScholixIdentifier> getLocalIdentifier() {
|
||||
return localIdentifier;
|
||||
}
|
||||
|
||||
public void setLocalIdentifier(List<TypedIdentifier> localIdentifier) {
|
||||
public void setLocalIdentifier(List<ScholixIdentifier> localIdentifier) {
|
||||
this.localIdentifier = localIdentifier;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
|
||||
package eu.dnetlib.dhp.schema.sx.summary;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class TypedIdentifier implements Serializable {
|
||||
private String id;
|
||||
private String type;
|
||||
private String url;
|
||||
|
||||
public TypedIdentifier() {
|
||||
}
|
||||
|
||||
public TypedIdentifier(String id, String type, String url) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue