Skip to content

Commit

Permalink
#228 - add IDP Mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
mfriesen committed May 28, 2024
1 parent b6bdff7 commit 2c40d59
Show file tree
Hide file tree
Showing 45 changed files with 5,460 additions and 611 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public enum ActionType {
DOCUMENTTAGGING,
/** Full Text. */
FULLTEXT,
/** Intelligent Document Processing. */
IDP,
/** Notification Action. */
NOTIFICATION,
/** OCR. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
*/
package com.formkiq.aws.dynamodb.objects;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -60,11 +62,9 @@ private static String findMatch(final Collection<String> resourceUrls,
}

return match;
}).collect(Collectors.toList());
}).toList();

o = matches.size() == 1
? Optional.of(Arrays.asList(matches.get(0)).stream().collect(Collectors.joining("/")))
: Optional.empty();
o = matches.size() == 1 ? Optional.of(String.join("/", matches.get(0))) : Optional.empty();
}

return o.orElse(null);
Expand All @@ -79,7 +79,7 @@ private static String findMatch(final Collection<String> resourceUrls,
*/
public static String findUrlMatch(final Collection<String> strs, final String s) {
List<String[]> resourceSplits =
strs.stream().filter(r -> r != null).map(r -> r.split("/")).collect(Collectors.toList());
strs.stream().filter(Objects::nonNull).map(r -> r.split("/")).collect(Collectors.toList());

return findMatch(strs, resourceSplits, s);
}
Expand Down Expand Up @@ -110,8 +110,7 @@ public static String generateRandomString(final int len) {
*/
public static String getExtension(final String filename) {
int pos = filename.lastIndexOf(".");
String ext = pos > -1 ? filename.substring(pos + 1) : "";
return ext;
return pos > -1 ? filename.substring(pos + 1) : "";
}

/**
Expand All @@ -130,7 +129,7 @@ public static String getFilename(final String path) {

private static String getUri(final String path) {

String name = null;
String name;

try {
URI u = new URI(path);
Expand All @@ -149,7 +148,7 @@ private static String getUri(final String path) {
* @return boolean
*/
public static boolean isEmpty(final CharSequence cs) {
return cs == null || cs.length() == 0;
return cs == null || cs.isEmpty();
}

/**
Expand Down Expand Up @@ -184,7 +183,7 @@ public static String removeBackSlashes(final String s) {
* @return {@link String}
*/
public static String removeEndingPunctuation(final String s) {
return s.replaceAll("[!\\.,?]$", "");
return s.replaceAll("[!.,?]$", "");
}

/**
Expand All @@ -196,4 +195,11 @@ public static String removeEndingPunctuation(final String s) {
public static String removeQuotes(final String s) {
return s.replaceAll("^['\"]|['\"]$", "");
}

public static String toString(final Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return sw.toString();
}
}
Loading

0 comments on commit 2c40d59

Please sign in to comment.