forked from D-Net/dnet-hadoop
mapping datasource.journal only when an issn is available, null otherwhise
This commit is contained in:
parent
54217d73ff
commit
da9d6f3887
|
@ -13,6 +13,8 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
|
|
||||||
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
||||||
import eu.dnetlib.dhp.utils.DHPUtils;
|
import eu.dnetlib.dhp.utils.DHPUtils;
|
||||||
|
|
||||||
|
@ -183,7 +185,8 @@ public class OafMapperUtils {
|
||||||
final String issnOnline,
|
final String issnOnline,
|
||||||
final String issnLinking,
|
final String issnLinking,
|
||||||
final DataInfo dataInfo) {
|
final DataInfo dataInfo) {
|
||||||
return journal(
|
|
||||||
|
return hasIssn(issnPrinted, issnOnline, issnLinking) ? journal(
|
||||||
name,
|
name,
|
||||||
issnPrinted,
|
issnPrinted,
|
||||||
issnOnline,
|
issnOnline,
|
||||||
|
@ -195,7 +198,7 @@ public class OafMapperUtils {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
dataInfo);
|
dataInfo) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Journal journal(
|
public static Journal journal(
|
||||||
|
@ -212,10 +215,7 @@ public class OafMapperUtils {
|
||||||
final String conferencedate,
|
final String conferencedate,
|
||||||
final DataInfo dataInfo) {
|
final DataInfo dataInfo) {
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(name)
|
if (StringUtils.isNotBlank(name) || hasIssn(issnPrinted, issnOnline, issnLinking)) {
|
||||||
|| StringUtils.isNotBlank(issnPrinted)
|
|
||||||
|| StringUtils.isNotBlank(issnOnline)
|
|
||||||
|| StringUtils.isNotBlank(issnLinking)) {
|
|
||||||
final Journal j = new Journal();
|
final Journal j = new Journal();
|
||||||
j.setName(name);
|
j.setName(name);
|
||||||
j.setIssnPrinted(issnPrinted);
|
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(
|
public static DataInfo dataInfo(
|
||||||
final Boolean deletedbyinference,
|
final Boolean deletedbyinference,
|
||||||
final String inferenceprovenance,
|
final String inferenceprovenance,
|
||||||
|
|
|
@ -586,17 +586,6 @@ public class MigrateDbEntitiesApplication extends AbstractMigrationApplication i
|
||||||
return res;
|
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
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
super.close();
|
super.close();
|
||||||
|
|
Loading…
Reference in New Issue