readded deprecated field (typology) in /ds/update

This commit is contained in:
Michele Artini 2022-05-13 11:47:11 +02:00
parent f113bcbfdd
commit b1f115dfc1
2 changed files with 29 additions and 12 deletions

View File

@ -97,31 +97,32 @@ public class DsmMappingUtils {
}); });
} }
_fix_typology(dbe, d); _fix_typology(dbe, d.getTypology(), d.getEoscDatasourceType());
return dbe; return dbe;
} }
@Deprecated @Deprecated
private static void _fix_typology(final DatasourceDbEntry dbe, final DatasourceDetails d) { private static void _fix_typology(final DatasourceDbEntry dbe, final String oldTypology, final String eoscTypology) {
if (StringUtils.isNotBlank(d.getTypology()) && StringUtils.isBlank(d.getEoscDatasourceType())) {
if (StringUtils.isNotBlank(oldTypology) && StringUtils.isBlank(eoscTypology)) {
// THE ORDER IS IMPORTANT: DO NOT CHANGE IT // THE ORDER IS IMPORTANT: DO NOT CHANGE IT
if (d.getTypology().startsWith("crissystem")) { if (oldTypology.startsWith("crissystem")) {
dbe.setEoscDatasourceType("CRIS system"); dbe.setEoscDatasourceType("CRIS system");
} else if (d.getTypology().startsWith("entityregistry")) { } else if (oldTypology.startsWith("entityregistry")) {
dbe.setEoscDatasourceType("Registry"); dbe.setEoscDatasourceType("Registry");
} else if (d.getTypology().startsWith("pubscatalogue") || d.getTypology().equals("websource")) { } else if (oldTypology.startsWith("pubscatalogue") || oldTypology.equals("websource")) {
dbe.setEoscDatasourceType("Catalogue"); dbe.setEoscDatasourceType("Catalogue");
} else if (d.getTypology().contains("journal")) { } else if (oldTypology.contains("journal")) {
dbe.setEoscDatasourceType("Journal archive"); dbe.setEoscDatasourceType("Journal archive");
} else if (d.getTypology().startsWith("aggregator")) { } else if (oldTypology.startsWith("aggregator")) {
dbe.setEoscDatasourceType("Aggregator"); dbe.setEoscDatasourceType("Aggregator");
} else if (d.getTypology().contains("repository")) { } else if (oldTypology.contains("repository")) {
dbe.setEoscDatasourceType("Repository"); dbe.setEoscDatasourceType("Repository");
} else { } else {
dbe.setEoscDatasourceType("Aggregator"); dbe.setEoscDatasourceType("Aggregator");
} }
} else if (StringUtils.isBlank(d.getTypology()) && StringUtils.isNotBlank(d.getEoscDatasourceType())) { } else if (StringUtils.isBlank(oldTypology) && StringUtils.isNotBlank(eoscTypology)) {
if (dbe.getEoscDatasourceType().equals("CRIS system")) { if (dbe.getEoscDatasourceType().equals("CRIS system")) {
dbe.setTypology("crissystem"); dbe.setTypology("crissystem");
} else if (dbe.getEoscDatasourceType().equals("Registry")) { } else if (dbe.getEoscDatasourceType().equals("Registry")) {
@ -141,7 +142,9 @@ public class DsmMappingUtils {
} }
public static DatasourceDbEntry asDbEntry(final DatasourceDetailsUpdate d) { public static DatasourceDbEntry asDbEntry(final DatasourceDetailsUpdate d) {
return _convert(d, DatasourceDbEntry.class); final DatasourceDbEntry dbe = _convert(d, DatasourceDbEntry.class);
_fix_typology(dbe, d.getTypology(), d.getEoscDatasourceType());
return dbe;
} }
// HELPERS // HELPERS

View File

@ -49,7 +49,10 @@ public class DatasourceDetailsUpdate {
@ApiModelProperty(position = 9) @ApiModelProperty(position = 9)
private String timezone; private String timezone;
@NotBlank @Deprecated
@ApiModelProperty(position = 12)
private String typology;
@ApiModelProperty(position = 13) @ApiModelProperty(position = 13)
private String eoscDatasourceType; private String eoscDatasourceType;
@ -252,4 +255,15 @@ public class DatasourceDetailsUpdate {
return this; return this;
} }
@Deprecated
public String getTypology() {
return typology;
}
@Deprecated
public DatasourceDetailsUpdate setTypology(final String typology) {
this.typology = typology;
return this;
}
} }