Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
447cd5b
cleanup
mfriesen Jan 23, 2024
079526d
update
mfriesen Jan 23, 2024
a685308
update
mfriesen Jan 25, 2024
a0b4c16
#203 - Add /objects/examine/pdf endpoints for getting metadata from PDF
mfriesen Jan 26, 2024
75c0aaf
#204 - Template may not exceed 1000000 bytes in size
mfriesen Jan 27, 2024
c776bb2
update
mfriesen Jan 27, 2024
9b49f86
update
mfriesen Jan 27, 2024
73f8870
update
mfriesen Jan 27, 2024
4a3bad4
update
mfriesen Jan 27, 2024
548eb7c
update
mfriesen Jan 27, 2024
98590e8
update
mfriesen Jan 28, 2024
a29e4fe
update
mfriesen Jan 28, 2024
b1dd9ac
update
mfriesen Jan 28, 2024
7773fe3
updated dependencies to latest
mfriesen Jan 28, 2024
5ba966e
added /rulesets API
mfriesen Feb 1, 2024
42a7fdf
update
mfriesen Feb 1, 2024
a5a7ccb
#205 - VPC CloudFormation Templates fails in ca-central-1
mfriesen Feb 1, 2024
f56d787
update
mfriesen Feb 1, 2024
f35740a
update
mfriesen Feb 2, 2024
0161d1b
update
mfriesen Feb 2, 2024
8d9b590
update
mfriesen Feb 2, 2024
5fbbe75
update
mfriesen Feb 2, 2024
b365425
update
mfriesen Feb 2, 2024
da61051
update
mfriesen Feb 2, 2024
9da545e
update
mfriesen Feb 2, 2024
14b7e1b
update
mfriesen Feb 3, 2024
2db7087
update
mfriesen Feb 3, 2024
84dc70e
update
mfriesen Feb 3, 2024
f954413
update
mfriesen Feb 6, 2024
2234b13
update
mfriesen Feb 9, 2024
c12d972
update
mfriesen Feb 9, 2024
5989176
update
mfriesen Feb 9, 2024
061d2c9
update
mfriesen Feb 9, 2024
bce7b66
update
mfriesen Feb 9, 2024
6176686
update
mfriesen Feb 11, 2024
806574d
update
mfriesen Feb 11, 2024
b175833
update
mfriesen Feb 11, 2024
3c32cf5
update
mfriesen Feb 12, 2024
02435c3
update
mfriesen Feb 13, 2024
c2edac3
update
mfriesen Feb 15, 2024
3805f9b
Fulltext Action handling when document doesn't exist in Opensearch
mfriesen Feb 15, 2024
f2a1924
update
mfriesen Feb 15, 2024
5419ab8
update
mfriesen Feb 16, 2024
f5b10b5
update
mfriesen Feb 16, 2024
c1f99e4
update
mfriesen Feb 17, 2024
9654602
update
mfriesen Feb 17, 2024
f21ee86
update
mfriesen Feb 17, 2024
e0837d0
update
mfriesen Feb 17, 2024
6cc3c17
update
mfriesen Feb 17, 2024
7e377a6
update
mfriesen Feb 18, 2024
19c2050
update
mfriesen Feb 22, 2024
d9f82df
Added opensearch-bastion CloudFormation template
mfriesen Feb 27, 2024
efa3985
#28 - add limit parameter to /documents/{id}/versions
mfriesen Feb 28, 2024
aa3c738
#209 - Add next and limit to GET /document/{id}/actions endpoint
mfriesen Feb 29, 2024
ff8ba0a
update
mfriesen Mar 1, 2024
419bb6d
update
mfriesen Mar 2, 2024
39cd138
update
mfriesen Mar 2, 2024
a894e82
update
mfriesen Mar 2, 2024
061e6ea
update
mfriesen Mar 2, 2024
c9b036b
update
mfriesen Mar 2, 2024
764d2ee
udpate
mfriesen Mar 2, 2024
be8b2ad
update
mfriesen Mar 2, 2024
23e46da
update
mfriesen Mar 2, 2024
e9fa5bd
update
mfriesen Mar 2, 2024
2326345
update
mfriesen Mar 3, 2024
4719b09
update
mfriesen Mar 7, 2024
654a877
update
mfriesen Mar 8, 2024
f801b1f
update
mfriesen Mar 10, 2024
499e018
update
mfriesen Mar 10, 2024
6730909
update
mfriesen Mar 12, 2024
a3da1d9
update
mfriesen Mar 12, 2024
799d164
update
mfriesen Mar 12, 2024
62a948a
update
mfriesen Mar 12, 2024
c784d17
update
mfriesen Mar 13, 2024
431a6ad
update
mfriesen Mar 14, 2024
c0fc709
#30 - Move OPA and other configuration options into /sites resource
mfriesen Mar 15, 2024
a143328
update
mfriesen Mar 15, 2024
4c66b95
update
mfriesen Mar 17, 2024
987cf46
update
mfriesen Mar 17, 2024
31327cd
update
mfriesen Mar 18, 2024
ff31237
update
mfriesen Mar 18, 2024
b11e2fb
update
mfriesen Mar 19, 2024
20561f4
#212 - /search add range queries
mfriesen Mar 20, 2024
94e5ae8
update
mfriesen Mar 20, 2024
5cff249
update
mfriesen Mar 20, 2024
69ead92
update
mfriesen Mar 21, 2024
6d1c9fe
update
mfriesen Mar 21, 2024
77d06fe
update
mfriesen Mar 22, 2024
bdbffb6
update
mfriesen Mar 22, 2024
d0b2b32
update
mfriesen Mar 23, 2024
a5d03fb
update
mfriesen Mar 23, 2024
1a59cf1
update
mfriesen Mar 24, 2024
78abf6a
update
mfriesen Mar 27, 2024
3dabaf0
update
mfriesen Mar 27, 2024
06ad5d4
update
mfriesen Mar 30, 2024
5e71bae
update Console to v3.4.0
mfriesen Mar 31, 2024
9f664d0
update
mfriesen Apr 1, 2024
a59573a
update
mfriesen Apr 1, 2024
d06757d
update
mfriesen Apr 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions actions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ dependencies {
testImplementation project(':dynamodb-documents')
testImplementation project(':fkq-test-utils')
testImplementation project(':fkq-plugins')
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version:'5.10.0'
testImplementation group: 'org.testcontainers', name: 'testcontainers', version: '1.19.0'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version:'5.10.1'
testImplementation group: 'org.testcontainers', name: 'testcontainers', version: '1.19.4'
}

test {
Expand Down
6 changes: 5 additions & 1 deletion actions/src/main/java/com/formkiq/module/actions/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import static com.formkiq.aws.dynamodb.SiteIdKeyGenerator.createDatabaseKey;
import static com.formkiq.aws.dynamodb.objects.Strings.isEmpty;
import static software.amazon.awssdk.services.dynamodb.model.AttributeValue.fromS;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
Expand Down Expand Up @@ -186,6 +185,11 @@ public Map<String, AttributeValue> getAttributes(final String siteId) {
return attrs;
}

@Override
public Map<String, AttributeValue> getDataAttributes() {
return null;
}

private Date getDate(final SimpleDateFormat df, final Map<String, AttributeValue> attrs,
final String key) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ public Map<String, AttributeValue> getAttributes(final String siteIdParam) {
return map;
}

@Override
public Map<String, AttributeValue> getDataAttributes() {
return null;
}

@Override
public DocumentWorkflowRecord getFromAttributes(final String siteIdParam,
final Map<String, AttributeValue> attrs) {
Expand Down
188 changes: 188 additions & 0 deletions actions/src/main/java/com/formkiq/module/actions/Queue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
/**
* 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.module.actions;

import static com.formkiq.aws.dynamodb.SiteIdKeyGenerator.createDatabaseKey;
import java.util.HashMap;
import java.util.Map;
import com.formkiq.aws.dynamodb.DbKeys;
import com.formkiq.aws.dynamodb.DynamodbRecord;
import com.formkiq.graalvm.annotations.Reflectable;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;

/**
*
* Queue object.
*
*/
@Reflectable
public class Queue implements DynamodbRecord<Queue> {

/** Queue Document Id. */
@Reflectable
private String documentId;
/** Record inserted date. */
/** Name of Queue. */
@Reflectable
private String name;
/** Transient Field. */
@Reflectable
private String queueId;

/**
* constructor.
*/
public Queue() {

}

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

/**
* Set Document Id.
*
* @param document {@link String}
* @return {@link Queue}
*/
public Queue documentId(final String document) {
this.documentId = document;
return this;
}

@Override
public Map<String, AttributeValue> getAttributes(final String siteId) {

Map<String, AttributeValue> map = new HashMap<>();

map.put(DbKeys.PK, fromS(pk(siteId)));
map.put(DbKeys.SK, fromS(sk()));
map.put(DbKeys.GSI1_PK, fromS(pkGsi1(siteId)));
map.put(DbKeys.GSI1_SK, fromS(skGsi1()));
map.put("documentId", fromS(this.documentId));
map.put("name", fromS(this.name));

return map;
}

@Override
public Map<String, AttributeValue> getDataAttributes() {
return null;
}

@Override
public Queue getFromAttributes(final String siteId, final Map<String, AttributeValue> attrs) {

Queue record = null;

if (!attrs.isEmpty()) {
record = new Queue().documentId(ss(attrs, "documentId")).name(ss(attrs, "name"));
}

return record;
}

/**
* Get Workflow Name.
*
* @return {@link String}
*/
public String name() {
return this.name;
}

/**
* Set Workflow Name.
*
* @param workflowName {@link String}
* @return {@link Queue}
*/
public Queue name(final String workflowName) {
this.name = workflowName;
return this;
}

@Override
public String pk(final String siteId) {
if (this.documentId == null) {
throw new IllegalArgumentException("'documentId' is required");
}
return createDatabaseKey(siteId, "queues#" + this.documentId);

}

@Override
public String pkGsi1(final String siteId) {
return createDatabaseKey(siteId, "queues#");
}

@Override
public String pkGsi2(final String siteId) {
return null;
}

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

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

@Override
public String sk() {
return "queue";
}

@Override
public String skGsi1() {
if (this.name == null || this.documentId == null) {
throw new IllegalArgumentException("'name' and 'documentId' is required");
}
return "queue#" + this.name + "#" + this.documentId;
}

@Override
public String skGsi2() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ PaginationResults<String> findDocumentsWithStatus(String siteId, ActionStatus st
*/
List<Action> getActions(String siteId, String documentId);

/**
* Get {@link List} {@link Action} for a document.
*
* @param siteId {@link String}
* @param documentId {@link String}
* @param exclusiveStartKey {@link Map}
* @param limit int
* @return {@link PaginationResults} {@link Action}
*/
PaginationResults<Action> getActions(String siteId, String documentId,
Map<String, AttributeValue> exclusiveStartKey, int limit);

/**
* Whether SiteId / DocumentId combination has any actions.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ private void deleteAction(final String siteId, final Action action) {
@Override
public void deleteActions(final String siteId, final String documentId) {

List<Action> actions = queryActions(siteId, documentId, Arrays.asList(PK, SK, "type"), null);
List<Action> actions =
queryActions(siteId, documentId, Arrays.asList(PK, SK, "type"), null, null).getResults();

for (Action action : actions) {

Expand Down Expand Up @@ -189,12 +190,19 @@ public PaginationResults<String> findDocumentsWithStatus(final String siteId,

@Override
public List<Action> getActions(final String siteId, final String documentId) {
return queryActions(siteId, documentId, null, null);
return queryActions(siteId, documentId, null, null, null).getResults();
}

@Override
public PaginationResults<Action> getActions(final String siteId, final String documentId,
final Map<String, AttributeValue> exclusiveStartKey, final int limit) {
return queryActions(siteId, documentId, null, exclusiveStartKey, Integer.valueOf(limit));
}

@Override
public boolean hasActions(final String siteId, final String documentId) {
List<Action> actions = queryActions(siteId, documentId, Arrays.asList(PK), null);
List<Action> actions =
queryActions(siteId, documentId, Arrays.asList(PK), null, null).getResults();
return !actions.isEmpty();
}

Expand Down Expand Up @@ -223,10 +231,12 @@ public void insertBeforeAction(final String siteId, final String documentId,
* @param documentId {@link String}
* @param projectionExpression {@link List} {@link String}
* @param limit {@link Integer}
* @return {@link List} {@link Action}
* @param startKey {@link Map}
* @return {@link PaginationResults} {@link Action}
*/
private List<Action> queryActions(final String siteId, final String documentId,
final List<String> projectionExpression, final Integer limit) {
private PaginationResults<Action> queryActions(final String siteId, final String documentId,
final List<String> projectionExpression, final Map<String, AttributeValue> startKey,
final Integer limit) {

String pk = new Action().documentId(documentId).pk(siteId);
String sk = "action" + TAG_DELIMINATOR;
Expand All @@ -235,7 +245,7 @@ private List<Action> queryActions(final String siteId, final String documentId,
Map<String, AttributeValue> values = Map.of(":pk", AttributeValue.builder().s(pk).build(),
":sk", AttributeValue.builder().s(sk).build());

Builder q = QueryRequest.builder().tableName(this.documentTableName)
Builder q = QueryRequest.builder().tableName(this.documentTableName).exclusiveStartKey(startKey)
.keyConditionExpression(expression).expressionAttributeValues(values).limit(limit);

if (!Objects.notNull(projectionExpression).isEmpty()) {
Expand All @@ -250,10 +260,14 @@ private List<Action> queryActions(final String siteId, final String documentId,
q = q.projectionExpression(String.join(",", names.keySet())).expressionAttributeNames(names);
}

QueryResponse result = this.dbClient.query(q.build());
QueryResponse response = this.dbClient.query(q.build());

List<Action> actions =
response.items().stream().map(a -> new Action().getFromAttributes(siteId, a))
.sorted(new ActionIndexComparator()).collect(Collectors.toList());

return result.items().stream().map(a -> new Action().getFromAttributes(siteId, a))
.sorted(new ActionIndexComparator()).collect(Collectors.toList());
PaginationMapToken pagination = new QueryResponseToPagination().apply(response);
return new PaginationResults<>(actions, pagination);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,21 @@ public interface ActionsValidator {
/**
* Validates {@link Action}.
*
* @param siteId {@link String}
* @param action {@link Action}
* @param configs {@link DynamicObject}
* @return {@link Collection} {@link ValidationError}
*/
Collection<ValidationError> validation(Action action, DynamicObject configs);
Collection<ValidationError> validation(String siteId, Action action, DynamicObject configs);

/**
* Validates {@link List} {@link Action}.
*
* @param siteId {@link String}
* @param action {@link Action}
* @param configs {@link DynamicObject}
* @return {@link List} {@link Collection} {@link ValidationError}
*/
List<Collection<ValidationError>> validation(List<Action> action, DynamicObject configs);
List<Collection<ValidationError>> validation(String siteId, List<Action> action,
DynamicObject configs);
}
Loading