1
0
Fork 0

code formatting

This commit is contained in:
Claudio Atzori 2020-12-09 17:07:20 +01:00
parent fcd7689b50
commit 3c5ce1dada
3 changed files with 22 additions and 21 deletions

View File

@ -261,9 +261,9 @@ public class CleaningFunctions {
*/ */
private static boolean filterPid(StructuredProperty pid) { private static boolean filterPid(StructuredProperty pid) {
String value = Optional String value = Optional
.ofNullable(pid.getValue()) .ofNullable(pid.getValue())
.map(s -> StringUtils.replaceAll(s, "\\s", "")) .map(s -> StringUtils.replaceAll(s, "\\s", ""))
.orElse(""); .orElse("");
if (StringUtils.isBlank(value)) { if (StringUtils.isBlank(value)) {
return false; return false;
} }

View File

@ -1,12 +1,6 @@
package eu.dnetlib.dhp.schema.oaf.utils; package eu.dnetlib.dhp.schema.oaf.utils;
import eu.dnetlib.dhp.schema.oaf.CleaningFunctions;
import eu.dnetlib.dhp.schema.oaf.OafEntity;
import eu.dnetlib.dhp.schema.oaf.StructuredProperty;
import eu.dnetlib.dhp.utils.DHPUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -14,6 +8,13 @@ import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import eu.dnetlib.dhp.schema.oaf.CleaningFunctions;
import eu.dnetlib.dhp.schema.oaf.OafEntity;
import eu.dnetlib.dhp.schema.oaf.StructuredProperty;
import eu.dnetlib.dhp.utils.DHPUtils;
/** /**
* Factory class for OpenAIRE identifiers in the Graph * Factory class for OpenAIRE identifiers in the Graph
*/ */

View File

@ -69,9 +69,9 @@ public class PromoteActionPayloadForGraphTableJob {
logger.info("strategy: {}", strategy); logger.info("strategy: {}", strategy);
Boolean shouldGroupById = Optional Boolean shouldGroupById = Optional
.ofNullable(parser.get("shouldGroupById")) .ofNullable(parser.get("shouldGroupById"))
.map(Boolean::valueOf) .map(Boolean::valueOf)
.orElse(true); .orElse(true);
logger.info("shouldGroupById: {}", shouldGroupById); logger.info("shouldGroupById: {}", shouldGroupById);
Class<? extends Oaf> rowClazz = (Class<? extends Oaf>) Class.forName(graphTableClassName); Class<? extends Oaf> rowClazz = (Class<? extends Oaf>) Class.forName(graphTableClassName);
@ -116,13 +116,13 @@ public class PromoteActionPayloadForGraphTableJob {
} }
private static <G extends Oaf, A extends Oaf> void promoteActionPayloadForGraphTable( private static <G extends Oaf, A extends Oaf> void promoteActionPayloadForGraphTable(
SparkSession spark, SparkSession spark,
String inputGraphTablePath, String inputGraphTablePath,
String inputActionPayloadPath, String inputActionPayloadPath,
String outputGraphTablePath, String outputGraphTablePath,
MergeAndGet.Strategy strategy, MergeAndGet.Strategy strategy,
Class<G> rowClazz, Class<G> rowClazz,
Class<A> actionPayloadClazz, Boolean shouldGroupById) { Class<A> actionPayloadClazz, Boolean shouldGroupById) {
Dataset<G> rowDS = readGraphTable(spark, inputGraphTablePath, rowClazz); Dataset<G> rowDS = readGraphTable(spark, inputGraphTablePath, rowClazz);
Dataset<A> actionPayloadDS = readActionPayload(spark, inputActionPayloadPath, actionPayloadClazz); Dataset<A> actionPayloadDS = readActionPayload(spark, inputActionPayloadPath, actionPayloadClazz);
@ -208,8 +208,8 @@ public class PromoteActionPayloadForGraphTableJob {
if (shouldGroupById) { if (shouldGroupById) {
return PromoteActionPayloadFunctions return PromoteActionPayloadFunctions
.groupGraphTableByIdAndMerge( .groupGraphTableByIdAndMerge(
joinedAndMerged, rowIdFn, mergeRowsAndGetFn, zeroFn, isNotZeroFn, rowClazz); joinedAndMerged, rowIdFn, mergeRowsAndGetFn, zeroFn, isNotZeroFn, rowClazz);
} else { } else {
return joinedAndMerged; return joinedAndMerged;
} }