Skip to content

Commit 59d5331

Browse files
committed
cleanup and rebuild javadocs
1 parent 3982b8a commit 59d5331

File tree

269 files changed

+63726
-30927
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+63726
-30927
lines changed

Java/src/main/java/com/nuix/superutilities/annotations/AnnotationRepository.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ public void storeAllTags(Case nuixCase) throws IOException, SQLException {
346346
* @param nuixCase The case in which items will be tagged.
347347
* @param matchingMethod Determines how a record in the DB file is associated to an item in the case to apply tags to it.
348348
* @throws SQLException Thrown if there are errors while interacting with the SQLite DB file.
349-
* @throws Thrown by Nuix if there is something
350349
*/
351350
public void applyTagsFromDatabaseToCase(Case nuixCase, AnnotationMatchingMethod matchingMethod) throws SQLException {
352351
// Will reuse this multiple times to provide values to be bound to prepared SQL statements later

Java/src/main/java/com/nuix/superutilities/annotations/BulkRedactorSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import nuix.MarkupSet;
1515

1616
/***
17-
* Provides settings regarding bulk redaction performed by {@link BulkRedactor#findAndMarkup(Case, BulkRedactorSettings, Collection)}.
17+
* Provides settings regarding bulk redaction performed by {@link BulkRedactor#findAndMarkup(Case, BulkRedactorSettings, Collection, int)}.
1818
* @author Jason Wells
1919
*
2020
*/

Java/src/main/java/com/nuix/superutilities/export/TemplateExporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public String render(Item item, Map<String,Object> data){
6363
return (String) container.callMethod("", "render", new Object[]{item,toSend});
6464
}
6565

66-
public void renderToFile(Item item, File outputFile, Map<String,Object> data) throws Exception{
66+
public void renderToFile(Item item, File outputFile, Map<String,Object> data) throws Exception {
6767
FileOutputStream fos = null;
6868
BufferedWriter bw = null;
6969

Java/src/main/java/com/nuix/superutilities/items/SuperItemUtility.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.net.URLDecoder;
66
import java.util.ArrayList;
77
import java.util.Collection;
8+
import java.util.Collections;
89
import java.util.HashMap;
910
import java.util.HashSet;
1011
import java.util.List;
@@ -267,4 +268,36 @@ public boolean itemsAreSiblings(Item a, Item b){
267268

268269
return true;
269270
}
271+
272+
/***
273+
* Gets items and sibling items within a certain ordinal distance.
274+
* @param items The items to obtain the neighboring siblings of
275+
* @param itemsBefore How many siblings before each item to include
276+
* @param itemsAfter How many siblings after each item to include
277+
* @return A new list of items which includes both input items and neighboring siblings, sorted by position
278+
*/
279+
public List<Item> getItemsAndNeighboringSiblings(List<Item> items, int itemsBefore, int itemsAfter){
280+
if(itemsBefore < 0) { itemsBefore = 0; }
281+
if(itemsAfter < 0) { itemsAfter = 0; }
282+
283+
if(items.size() < 1) { return Collections.emptyList(); }
284+
else {
285+
Set<Item> tempSet = new HashSet<Item>();
286+
for(Item item : items) {
287+
Item parent = item.getParent();
288+
List<Item> siblings = parent.getChildren();
289+
int itemIndex = siblings.indexOf(item);
290+
int first = itemIndex - itemsBefore;
291+
int last = itemIndex + itemsAfter;
292+
if(first < 0) { first = 0; }
293+
if(last > items.size() - 1) { last = items.size() - 1; }
294+
for (int i = first; i <= last; i++) {
295+
tempSet.add(items.get(i));
296+
}
297+
}
298+
List<Item> result = new ArrayList<Item>();
299+
result.addAll(tempSet);
300+
return SuperUtilities.getItemUtility().sortItemsByPosition(result);
301+
}
302+
}
270303
}

Java/src/main/java/com/nuix/superutilities/misc/ProfileDigester.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public void setDigestCustomField(String digestCustomField) {
329329

330330
/***
331331
* Gets whether an existing value in the specified custom metadata field should be used if present. When true,
332-
* if an item has the custom field specified by callin {@link #setDigestCustomField(String)) and it has a value, that value will
332+
* if an item has the custom field specified by calling {@link #setDigestCustomField(String)} and it has a value, that value will
333333
* be used rather than calculating a value. If false the value will always be calculated fresh.
334334
* @return Whether an existing value in the specified custom metadata field should be used when present
335335
*/
@@ -339,9 +339,9 @@ public boolean getUseExistingValueWhenPresent() {
339339

340340
/***
341341
* Sets whether an existing value in the specified custom metadata field should be used if present. When true,
342-
* if an item has the custom field specified by calling {@link #setDigestCustomField(String)) and it has a value, that value will
342+
* if an item has the custom field specified by calling {@link #setDigestCustomField(String)} and it has a value, that value will
343343
* be used rather than calculating a value. If false the value will always be calculated fresh.
344-
* @param useExistingValueWhenPresent
344+
* @param useExistingValueWhenPresent whether an existing value in the specified custom metadata field should be used if present
345345
*/
346346
public void setUseExistingValueWhenPresent(boolean useExistingValueWhenPresent) {
347347
this.useExistingValueWhenPresent = useExistingValueWhenPresent;

Java/src/main/java/com/nuix/superutilities/misc/ZipHelper.java

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.nuix.superutilities.misc;
22

3+
import java.io.BufferedInputStream;
4+
import java.io.BufferedOutputStream;
35
import java.io.File;
46
import java.io.FileInputStream;
57
import java.io.FileNotFoundException;
@@ -8,10 +10,45 @@
810
import java.util.zip.ZipEntry;
911
import java.util.zip.ZipOutputStream;
1012

13+
import org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry;
14+
import org.apache.commons.compress.archivers.sevenz.SevenZMethod;
15+
import org.apache.commons.compress.archivers.sevenz.SevenZOutputFile;
1116
import org.apache.commons.io.IOUtils;
1217
import org.apache.jena.ext.com.google.common.primitives.Ints;
1318

1419
public class ZipHelper {
20+
21+
public static void compressDirectoryToSevenZipFile(String directory, String sevenZipFile) throws IOException {
22+
SevenZOutputFile sevenZipOutput = new SevenZOutputFile(new File(sevenZipFile));
23+
sevenZipOutput.setContentCompression(SevenZMethod.DEFLATE);
24+
compressDirectoryToSevenZipFile(directory, directory, sevenZipOutput);
25+
sevenZipOutput.finish();
26+
sevenZipOutput.close();
27+
}
28+
29+
private static void compressDirectoryToSevenZipFile(String rootDir, String sourceDir, SevenZOutputFile sevenZipOutput) throws IOException {
30+
for (File file : new File(sourceDir).listFiles()) {
31+
if (file.isDirectory()) {
32+
compressDirectoryToSevenZipFile(rootDir, sourceDir + File.separator + file.getName(), sevenZipOutput);
33+
} else {
34+
String dir = sourceDir.replace(rootDir, "");
35+
SevenZArchiveEntry entry = null;
36+
if (!dir.trim().isEmpty()) {
37+
entry = sevenZipOutput.createArchiveEntry(file,dir + File.separator + file.getName());
38+
} else {
39+
entry = sevenZipOutput.createArchiveEntry(file,file.getName());
40+
}
41+
sevenZipOutput.putArchiveEntry(entry);
42+
FileInputStream in = new FileInputStream(sourceDir + File.separator + file.getName());
43+
BufferedInputStream bufferedIn = new BufferedInputStream(in);
44+
sevenZipOutput.write(bufferedIn);
45+
bufferedIn.close();
46+
in.close();
47+
sevenZipOutput.closeArchiveEntry();
48+
}
49+
}
50+
}
51+
1552
/***
1653
* Compresses the contents of the given directory (files and sub-directories) in to a Zip file.
1754
* @param directory The directory to archive into the Zip file.
@@ -23,8 +60,12 @@ public class ZipHelper {
2360
@SuppressWarnings("deprecation")
2461
public static void compressDirectoryToZipFile(String directory, String zipFile, int compressionLevel) throws IOException, FileNotFoundException {
2562
ZipOutputStream zipStream = null;
63+
FileOutputStream fileOutStream = null;
64+
BufferedOutputStream bufferedOutStream = null;
2665
try{
27-
zipStream = new ZipOutputStream(new FileOutputStream(zipFile));
66+
fileOutStream = new FileOutputStream(zipFile);
67+
bufferedOutStream = new BufferedOutputStream(fileOutStream);
68+
zipStream = new ZipOutputStream(bufferedOutStream);
2869
zipStream.setLevel(Ints.constrainToRange(compressionLevel, 0, 9));
2970
compressDirectoryToZipfile(directory,directory,zipStream);
3071
} finally {
@@ -57,7 +98,8 @@ private static void compressDirectoryToZipfile(String rootDir, String sourceDir,
5798

5899
out.putNextEntry(entry);
59100
FileInputStream in = new FileInputStream(sourceDir + File.separator + file.getName());
60-
IOUtils.copy(in, out);
101+
BufferedInputStream bufferedIn = new BufferedInputStream(in);
102+
IOUtils.copy(bufferedIn, out);
61103
IOUtils.closeQuietly(in);
62104
}
63105
}

Java/src/main/java/com/nuix/superutilities/regex/PatternInfo.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public PatternInfo(String title, String expression){
2525
/***
2626
* Compiles the regular expression String provided into a Java Pattern object
2727
* @param caseSensitive Whether it should be case sensitive
28+
* @param multiline Whether the multi-line matching flag should be set
29+
* @param dotAll Whether the dot matches all flag should be set
2830
*/
2931
public void compile(boolean caseSensitive, boolean multiline, boolean dotAll){
3032
if(pattern == null){
@@ -53,8 +55,8 @@ public String getExpression() {
5355
}
5456

5557
/***
56-
* Gets the compiled Pattern object. Note this will return null until {@link #compile(boolean)} is called.
57-
* @return The compiled Pattern object or null if {@link #compile(boolean)} has not yet been called.
58+
* Gets the compiled Pattern object. Note this will return null until {@link #compile(boolean, boolean, boolean)} is called.
59+
* @return The compiled Pattern object or null if {@link #compile(boolean, boolean, boolean)} has not yet been called.
5860
*/
5961
public Pattern getPattern() {
6062
return pattern;

Java/src/main/java/com/nuix/superutilities/reporting/IntersectionReport.java

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.util.stream.Collectors;
88

99
import org.apache.log4j.Logger;
10+
import org.joda.time.DateTime;
1011

1112
import com.aspose.cells.BackgroundType;
1213
import com.aspose.cells.Color;
@@ -32,6 +33,40 @@ public class IntersectionReport {
3233

3334
private static Logger logger = Logger.getLogger(IntersectionReport.class);
3435

36+
/***
37+
* Analyzes batch loads in the given case, determining which have a loaded datetime that falls
38+
* within the specified range, returning the GUIDs of the batch loads which qualify.
39+
* @param nuixCase The case to analyze
40+
* @param min The minimum date time, can be null
41+
* @param max The maximum date time, can be null
42+
* @return Returns a list of zero or more GUIDs for the batch loads loaded within the given date range
43+
*/
44+
public static List<String> findBatchLoadsInDateRange(Case nuixCase, DateTime min, DateTime max) {
45+
List<String> inRangeBatchLoadGuids = new ArrayList<String>();
46+
List<BatchLoadDetails> allBatchLoads = nuixCase.getBatchLoads();
47+
48+
// Filter all batch loads by whether their loaded date falls within
49+
// the range specifies by the min/max values
50+
for(BatchLoadDetails bld : allBatchLoads) {
51+
boolean satisfiesMin = true;
52+
boolean satisfiesMax = true;
53+
54+
if(min != null) {
55+
satisfiesMin = bld.getLoaded().isAfter(min);
56+
}
57+
58+
if(max != null) {
59+
satisfiesMax = bld.getLoaded().isBefore(max);
60+
}
61+
62+
if(satisfiesMin && satisfiesMax) {
63+
inRangeBatchLoadGuids.add(bld.getBatchId());
64+
}
65+
}
66+
67+
return inRangeBatchLoadGuids;
68+
}
69+
3570
private SimpleXlsx xlsx = null;
3671

3772
private Style rowCategoryLabelStyle = null;
@@ -163,27 +198,8 @@ public void generate(Case nuixCase, String sheetName, IntersectionReportSheetCon
163198
// in the case and filter to those within our date range. Using that filtered set we then get their batch
164199
// load GUIDs and use that to attach additional scope query for those batch loads.
165200
if(sheetConfig.hasBatchLoadDateCriteria()) {
166-
List<String> inRangeBatchLoadGuids = new ArrayList<String>();
167-
List<BatchLoadDetails> allBatchLoads = nuixCase.getBatchLoads();
168-
169-
// Filter all batch loads by whether their loaded date falls within
170-
// the range specifies by the min/max values
171-
for(BatchLoadDetails bld : allBatchLoads) {
172-
boolean satisfiesMin = true;
173-
boolean satisfiesMax = true;
174-
175-
if(sheetConfig.getBatchLoadMinDate() != null) {
176-
satisfiesMin = bld.getLoaded().isAfter(sheetConfig.getBatchLoadMinDate());
177-
}
178-
179-
if(sheetConfig.getBatchLoadMaxDate() != null) {
180-
satisfiesMax = bld.getLoaded().isBefore(sheetConfig.getBatchLoadMaxDate());
181-
}
182-
183-
if(satisfiesMin && satisfiesMax) {
184-
inRangeBatchLoadGuids.add(bld.getBatchId());
185-
}
186-
}
201+
List<String> inRangeBatchLoadGuids = findBatchLoadsInDateRange(nuixCase,
202+
sheetConfig.getBatchLoadMinDate(),sheetConfig.getBatchLoadMaxDate());
187203

188204
String batchLoadGuidQuery = "";
189205
if(inRangeBatchLoadGuids.size() > 0) {

0 commit comments

Comments
 (0)