Skip to content

Commit

Permalink
#124 - OCR Tessaract Support
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Friesen authored and mfriesen committed May 12, 2023
1 parent 7739e28 commit 82c138b
Show file tree
Hide file tree
Showing 83 changed files with 4,804 additions and 49 deletions.
3 changes: 3 additions & 0 deletions aws-dynamodb/config/checkstyle/import-control.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<allow pkg="software.amazon.awssdk.services.dynamodb" />
<allow pkg="com.amazonaws.xray.interceptors" />

<subpackage name="objects">
<allow pkg="java.time" />
</subpackage>
</subpackage>

</import-control>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.formkiq.stacks.dynamodb;
package com.formkiq.aws.dynamodb.objects;

import java.text.SimpleDateFormat;
import java.time.DateTimeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.formkiq.stacks.common.formats;
package com.formkiq.aws.dynamodb.objects;

import static com.formkiq.stacks.common.formats.MimeType.MIME_DOCX;
import static com.formkiq.stacks.common.formats.MimeType.MIME_HTML;
import static com.formkiq.stacks.common.formats.MimeType.MIME_JPEG;
import static com.formkiq.stacks.common.formats.MimeType.MIME_JSON;
import static com.formkiq.stacks.common.formats.MimeType.MIME_PDF;
import static com.formkiq.stacks.common.formats.MimeType.MIME_PNG;
import static com.formkiq.aws.dynamodb.objects.MimeType.MIME_DOCX;
import static com.formkiq.aws.dynamodb.objects.MimeType.MIME_HTML;
import static com.formkiq.aws.dynamodb.objects.MimeType.MIME_JPEG;
import static com.formkiq.aws.dynamodb.objects.MimeType.MIME_JSON;
import static com.formkiq.aws.dynamodb.objects.MimeType.MIME_PDF;
import static com.formkiq.aws.dynamodb.objects.MimeType.MIME_PNG;
import java.util.Set;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.formkiq.stacks.common.formats;
package com.formkiq.aws.dynamodb.objects;

/**
* Supported Conversion Formats.
Expand Down
9 changes: 8 additions & 1 deletion aws-sqs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
description = "AWS SQS"

dependencies {

annotationProcessor group: 'com.formkiq', name: 'graalvm-annotations-processor', version: '1.4.0-SNAPSHOT'

implementation group: 'com.formkiq', name: 'graalvm-annotations', version: '1.2.0'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1'

api 'software.amazon.awssdk:sqs:2.20.33'
implementation group: 'software.amazon.awssdk', name: 'url-connection-client', version: '2.20.33'
implementation project(':aws-xray')
Expand All @@ -12,7 +18,8 @@ dependencies {
exclude group: 'software.amazon.awssdk', module: 'netty-nio-client'
}

testImplementation group: 'junit', name: 'junit', version:'4.+'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version:'5.9.1'
//testImplementation group: 'junit', name: 'junit', version:'4.+'
}

test {
Expand Down
2 changes: 2 additions & 0 deletions aws-sqs/config/checkstyle/import-control.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<allow pkg="com.amazonaws.xray.interceptors" />
<allow pkg="software.amazon.awssdk.core.client.config" />

<allow pkg="com.formkiq.graalvm.annotations" />
<allow pkg="com.google.gson.annotations" />
<allow pkg="com.formkiq.module.lambdaservices" />
</subpackage>

Expand Down
217 changes: 217 additions & 0 deletions aws-sqs/src/main/java/com/formkiq/aws/sqs/SqsMessageRecord.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
/**
* MIT License
*
* Copyright (c) 2018 - 2020 FormKiQ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.formkiq.aws.sqs;

import java.util.Map;
import com.formkiq.graalvm.annotations.Reflectable;

/**
* Sqs Message Record Object.
*
*/
@Reflectable
public class SqsMessageRecord {

/** Record Attributes. */
private Map<String, String> attributes;
/** AWS Region. */
private String awsRegion;
/** Request body. */
private String body;
/** Event Source. */
private String eventSource;
/** Md5 of body. */
private String md5OfBody;
/** Message Attributes. */
private Map<String, String> messageAttributes;
/** MessageId. */
private String messageId;
/** Receipt Handle. */
private String receiptHandle;

/**
* constructor.
*/
public SqsMessageRecord() {}

/**
* Get Attributes.
*
* @return {@link Map}
*/
public Map<String, String> attributes() {
return this.attributes;
}

/**
* Set Attributes.
*
* @param map {@link Map}
* @return {@link SqsMessageRecord}
*/
public SqsMessageRecord attributes(final Map<String, String> map) {
this.attributes = map;
return this;
}

/**
* Get AWS Region.
*
* @return {@link String}
*/
public String awsRegion() {
return this.awsRegion;
}

/**
* Set AWS Region.
*
* @param region {@link String}
* @return {@link SqsMessageRecord}
*/
public SqsMessageRecord awsRegion(final String region) {
this.awsRegion = region;
return this;
}

/**
* Get Body.
*
* @return {@link String}
*/
public String body() {
return this.body;
}

/**
* Set Body.
*
* @param s {@link String}
* @return {@link SqsMessageRecord}
*/
public SqsMessageRecord body(final String s) {
this.body = s;
return this;
}

/**
* Get Event Source.
*
* @return {@link String}
*/
public String eventSource() {
return this.eventSource;
}

/**
* Set Event Source.
*
* @param source {@link String}
* @return {@link SqsMessageRecord}
*/
public SqsMessageRecord eventSource(final String source) {
this.eventSource = source;
return this;
}

/**
* Get Md5 Hash of Body.
*
* @return {@link String}
*/
public String md5OfBody() {
return this.md5OfBody;
}

/**
* Set Md5 Hash.
*
* @param md5 {@link String}
* @return {@link SqsMessageRecord}
*/
public SqsMessageRecord md5OfBody(final String md5) {
this.md5OfBody = md5;
return this;
}

/**
* Get Message Attributes.
*
* @return {@link Map}
*/
public Map<String, String> messageAttributes() {
return this.messageAttributes;
}

/**
* Set Message Attributes.
*
* @param map {@link Map}
* @return {@link SqsMessageRecord}
*/
public SqsMessageRecord messageAttributes(final Map<String, String> map) {
this.messageAttributes = map;
return this;
}

/**
* Get Message Id.
*
* @return {@link String}
*/
public String messageId() {
return this.messageId;
}

/**
* Set Message Id.
*
* @param id {@link String}
* @return {@link SqsMessageRecord}
*/
public SqsMessageRecord messageId(final String id) {
this.messageId = id;
return this;
}

/**
* Get Receipt Handle.
*
* @return {@link String}
*/
public String receiptHandle() {
return this.receiptHandle;
}

/**
* Set Receipt Handle.
*
* @param receipt {@link String}
* @return {@link SqsMessageRecord}
*/
public SqsMessageRecord receiptHandle(final String receipt) {
this.receiptHandle = receipt;
return this;
}
}
68 changes: 68 additions & 0 deletions aws-sqs/src/main/java/com/formkiq/aws/sqs/SqsMessageRecords.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* MIT License
*
* Copyright (c) 2018 - 2020 FormKiQ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.formkiq.aws.sqs;

import java.util.ArrayList;
import java.util.List;
import com.formkiq.graalvm.annotations.Reflectable;
import com.google.gson.annotations.SerializedName;

/**
* Sqs Records Object.
*
*/
@Reflectable
public class SqsMessageRecords {

/** Input Records. */
@SerializedName("Records")
private List<SqsMessageRecord> records;

/**
* constructor.
*/
public SqsMessageRecords() {
this.records = new ArrayList<>();
}

/**
* Get Records.
*
* @return {@link List} {@link SqsMessageRecord}
*/
public List<SqsMessageRecord> records() {
return this.records;
}

/**
* Set Records.
*
* @param list {@link List} {@link SqsMessageRecord}
* @return {@link SqsMessageRecords}
*/
public SqsMessageRecords records(final List<SqsMessageRecord> list) {
this.records = list;
return this;
}
}
4 changes: 2 additions & 2 deletions aws-sqs/src/test/java/com/formkiq/aws/sqs/SqsServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*/
package com.formkiq.aws.sqs;

import static org.junit.Assert.assertEquals;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;

/**
*
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ task buildDistribution(type: Copy) {
from 'lambda-api/build/distributions/formkiq-core'
from 'lambda-s3/build/distributions/formkiq-core'
from 'lambda-typesense/build/distributions/formkiq-module-lambda-typesense'
from 'lambda-ocr-tesseract/build/distributions/formkiq-core'
from 'module-email-notify/build/distributions/formkiq-core'
from 'websocket-api/build/distributions/formkiq-core'
into "${buildDir}/distributions/formkiq-core"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import com.formkiq.aws.dynamodb.model.DocumentTag;
import com.formkiq.aws.dynamodb.model.DocumentTagType;
import com.formkiq.aws.dynamodb.model.DynamicDocumentItem;
import com.formkiq.aws.dynamodb.objects.DateUtil;
import com.formkiq.aws.dynamodb.objects.Objects;
import com.formkiq.aws.dynamodb.objects.Strings;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
Expand Down
Loading

0 comments on commit 82c138b

Please sign in to comment.