1
0
Fork 0

mapping datasource.journal only when an issn is available, null otherwhise

This commit is contained in:
Claudio Atzori 2021-05-11 10:45:30 +02:00
parent 54217d73ff
commit da9d6f3887
2 changed files with 12 additions and 17 deletions

View File

@ -13,6 +13,8 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Joiner;
import eu.dnetlib.dhp.schema.common.ModelSupport;
import eu.dnetlib.dhp.utils.DHPUtils;
@ -183,7 +185,8 @@ public class OafMapperUtils {
final String issnOnline,
final String issnLinking,
final DataInfo dataInfo) {
return journal(
return hasIssn(issnPrinted, issnOnline, issnLinking) ? journal(
name,
issnPrinted,
issnOnline,
@ -195,7 +198,7 @@ public class OafMapperUtils {
null,
null,
null,
dataInfo);
dataInfo) : null;
}
public static Journal journal(
@ -212,10 +215,7 @@ public class OafMapperUtils {
final String conferencedate,
final DataInfo dataInfo) {
if (StringUtils.isNotBlank(name)
|| StringUtils.isNotBlank(issnPrinted)
|| StringUtils.isNotBlank(issnOnline)
|| StringUtils.isNotBlank(issnLinking)) {
if (StringUtils.isNotBlank(name) || hasIssn(issnPrinted, issnOnline, issnLinking)) {
final Journal j = new Journal();
j.setName(name);
j.setIssnPrinted(issnPrinted);
@ -235,6 +235,12 @@ public class OafMapperUtils {
}
}
private static boolean hasIssn(String issnPrinted, String issnOnline, String issnLinking) {
return StringUtils.isNotBlank(issnPrinted)
|| StringUtils.isNotBlank(issnOnline)
|| StringUtils.isNotBlank(issnLinking);
}
public static DataInfo dataInfo(
final Boolean deletedbyinference,
final String inferenceprovenance,

View File

@ -586,17 +586,6 @@ public class MigrateDbEntitiesApplication extends AbstractMigrationApplication i
return res;
}
private Journal prepareJournal(final ResultSet rs, final DataInfo info) throws SQLException {
if (Objects.isNull(rs)) {
return null;
} else {
return journal(
rs.getString("officialname"), rs.getString("issnPrinted"), rs.getString("issnOnline"),
rs.getString("issnLinking"), info);
}
}
@Override
public void close() throws IOException {
super.close();