From 4a8ad34b72a010539f7e794878814efb67dbed97 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Wed, 4 Nov 2020 17:16:51 +0100 Subject: [PATCH] removed commented lines --- .../eu/dnetlib/dhp/oa/graph/dump/MakeTar.java | 123 +----------------- .../dhp/oa/graph/dump/ResultMapper.java | 16 +-- 2 files changed, 5 insertions(+), 134 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/MakeTar.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/MakeTar.java index 7d8013c53d..30e2ec792f 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/MakeTar.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/MakeTar.java @@ -70,127 +70,6 @@ public class MakeTar implements Serializable { } -// private static TarArchiveOutputStream getTar(FileSystem fileSystem, String outputPath) throws IOException { -// Path hdfsWritePath = new Path(outputPath); -// FSDataOutputStream fsDataOutputStream = null; -// if (fileSystem.exists(hdfsWritePath)) { -// fileSystem.delete(hdfsWritePath, true); -// -// } -// fsDataOutputStream = fileSystem.create(hdfsWritePath); -// -// return new TarArchiveOutputStream(fsDataOutputStream.getWrappedStream()); -// } -// -// private static void writeMaxSize(FileSystem fileSystem, String inputPath, String outputPath, String dir_name, -// int gBperSplit) throws IOException { -// final long bytesPerSplit = 1024L * 1024L * 1024L * gBperSplit; -// -// long sourceSize = fileSystem.getContentSummary(new Path(inputPath)).getSpaceConsumed(); -// -// final long numberOfSplits = sourceSize / bytesPerSplit; -// -// if (numberOfSplits < 2) { -// write(fileSystem, inputPath, outputPath + ".tar", dir_name); -// } else { -// int partNum = 0; -// -// RemoteIterator fileStatusListIterator = fileSystem -// .listFiles( -// new Path(inputPath), true); -// boolean next = fileStatusListIterator.hasNext(); -// while (sourceSize > 0 && next) { -// TarArchiveOutputStream ar = getTar(fileSystem, outputPath + "_" + (partNum + 1) + ".tar"); -// -// long current_size = 0; -// while (next && current_size < bytesPerSplit) { -// LocatedFileStatus fileStatus = fileStatusListIterator.next(); -// -// Path p = fileStatus.getPath(); -// String p_string = p.toString(); -// if (!p_string.endsWith("_SUCCESS")) { -// String name = p_string.substring(p_string.lastIndexOf("/") + 1); -// if (name.trim().equalsIgnoreCase("communities_infrastructures")) { -// name = "communities_infrastructures.json"; -// } -// TarArchiveEntry entry = new TarArchiveEntry(dir_name + "/" + name); -// entry.setSize(fileStatus.getLen()); -// current_size += fileStatus.getLen(); -// ar.putArchiveEntry(entry); -// -// InputStream is = fileSystem.open(fileStatus.getPath()); -// -// BufferedInputStream bis = new BufferedInputStream(is); -// -// int count; -// byte data[] = new byte[1024]; -// while ((count = bis.read(data, 0, data.length)) != -1) { -// ar.write(data, 0, count); -// } -// bis.close(); -// ar.closeArchiveEntry(); -// -// } -// next = fileStatusListIterator.hasNext(); -// -// } -// sourceSize = sourceSize - current_size; -// partNum += 1; -// ar.close(); -// } -// -// } -// -// } -// -// private static void write(FileSystem fileSystem, String inputPath, String outputPath, String dir_name) -// throws IOException { -// -// Path hdfsWritePath = new Path(outputPath); -// FSDataOutputStream fsDataOutputStream = null; -// if (fileSystem.exists(hdfsWritePath)) { -// fileSystem.delete(hdfsWritePath, true); -// -// } -// fsDataOutputStream = fileSystem.create(hdfsWritePath); -// -// TarArchiveOutputStream ar = new TarArchiveOutputStream(fsDataOutputStream.getWrappedStream()); -// -// RemoteIterator fileStatusListIterator = fileSystem -// .listFiles( -// new Path(inputPath), true); -// -// while (fileStatusListIterator.hasNext()) { -// LocatedFileStatus fileStatus = fileStatusListIterator.next(); -// -// Path p = fileStatus.getPath(); -// String p_string = p.toString(); -// if (!p_string.endsWith("_SUCCESS")) { -// String name = p_string.substring(p_string.lastIndexOf("/") + 1); -// if (name.trim().equalsIgnoreCase("communities_infrastructures")) { -// name = "communities_infrastructures.json"; -// } -// TarArchiveEntry entry = new TarArchiveEntry(dir_name + "/" + name); -// entry.setSize(fileStatus.getLen()); -// ar.putArchiveEntry(entry); -// -// InputStream is = fileSystem.open(fileStatus.getPath()); -// -// BufferedInputStream bis = new BufferedInputStream(is); -// -// int count; -// byte data[] = new byte[1024]; -// while ((count = bis.read(data, 0, data.length)) != -1) { -// ar.write(data, 0, count); -// } -// bis.close(); -// ar.closeArchiveEntry(); -// -// } -// -// } -// -// ar.close(); -// } + } diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/ResultMapper.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/ResultMapper.java index 9bb6653d0b..a92c31423e 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/ResultMapper.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/ResultMapper.java @@ -156,7 +156,6 @@ public class ResultMapper implements Serializable { .ifPresent(value -> value.stream().forEach(c -> contributorList.add(c.getValue()))); out.setContributor(contributorList); - // List countryList = new ArrayList<>(); Optional .ofNullable(input.getCountry()) .ifPresent( @@ -188,7 +187,6 @@ public class ResultMapper implements Serializable { .filter(Objects::nonNull) .collect(Collectors.toList()))); - // out.setCountry(countryList); final List coverageList = new ArrayList<>(); Optional @@ -286,7 +284,6 @@ public class ResultMapper implements Serializable { Optional .ofNullable(input.getSource()) .ifPresent(value -> value.stream().forEach(s -> sourceList.add(s.getValue()))); - // out.setSource(input.getSource().stream().map(s -> s.getValue()).collect(Collectors.toList())); List subjectList = new ArrayList<>(); Optional .ofNullable(input.getSubject()) @@ -397,12 +394,7 @@ public class ResultMapper implements Serializable { } - private static void setCommonValue(eu.dnetlib.dhp.schema.oaf.Instance i, I instance) {// - // I - // getInstance(eu.dnetlib.dhp.schema.oaf.Instance - // i, boolean graph) { + private static void setCommonValue(eu.dnetlib.dhp.schema.oaf.Instance i, I instance) { Optional opAr = Optional .ofNullable(i.getAccessright()); if (opAr.isPresent()) { @@ -427,7 +419,7 @@ public class ResultMapper implements Serializable { Optional .ofNullable(i.getRefereed()) .ifPresent(value -> instance.setRefereed(value.getClassname())); - // .ifPresent(value -> instance.setRefereed(value.getValue())); + Optional .ofNullable(i.getInstancetype()) .ifPresent(value -> instance.setType(value.getClassname())); @@ -437,10 +429,10 @@ public class ResultMapper implements Serializable { private static List getUniqueProvenance(List provenance) { Provenance iProv = new Provenance(); - // iProv.setProvenance(Constants.INFERRED); + Provenance hProv = new Provenance(); - // hProv.setProvenance(Constants.HARVESTED); + Provenance lProv = new Provenance(); for (Provenance p : provenance) {