Skip to content

Commit

Permalink
Merge pull request #514 from bcgov/feat/srs-75
Browse files Browse the repository at this point in the history
Feat/srs 75
  • Loading branch information
nikhila-aot authored Sep 21, 2023
2 parents 8da797c + df52333 commit c0cdf28
Show file tree
Hide file tree
Showing 7 changed files with 613 additions and 59 deletions.
25 changes: 20 additions & 5 deletions forms-flow-ai/forms-flow-ai-ee/forms-flow-bpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,32 @@ FROM maven:3.8.1-openjdk-17-slim AS MAVEN_TOOL_CHAIN
RUN apt-get update \
&& apt-get install -y git

# expect a build-time variable
ARG FORMFLOW_SOURCE_REPO_URL
# expect ssh private key
ARG ssh_prv_key
# expect ssh public key
ARG ssh_pub_key
# expect a build-time variable
ARG FORMFLOW_SOURCE_REPO_BRANCH
# use the value to set the ENV var default
ENV FORMFLOW_SOURCE_REPO_BRANCH v5.1.0
# expect a build-time variable
ARG FORMFLOW_SOURCE_REPO_URL
ENV FORMFLOW_SOURCE_REPO_BRANCH epd-ff-ee-5.2.0
# use the value to set the ENV var default
ENV FORMFLOW_SOURCE_REPO_URL https://github.com/AOT-Technologies/forms-flow-ai
ENV FORMFLOW_SOURCE_REPO_URL [email protected]:AOT-Technologies/forms-flow-ai-ee.git

RUN mkdir -p /root/.ssh && \
chmod 0700 /root/.ssh && \
echo " IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config

RUN echo "$ssh_prv_key" | sed 's/\\n/\n/g' > /root/.ssh/id_rsa && \
echo "$ssh_pub_key" | sed 's/\\n/\n/g' > /root/.ssh/id_rsa.pub && \
chmod 600 /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa.pub

RUN mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts

# Clone code
RUN git clone -b ${FORMFLOW_SOURCE_REPO_BRANCH} ${FORMFLOW_SOURCE_REPO_URL} /bpm/
RUN git clone ${FORMFLOW_SOURCE_REPO_URL} -b ${FORMFLOW_SOURCE_REPO_BRANCH} /bpm/

RUN cp /bpm/forms-flow-bpm/pom*.xml /tmp/
RUN cp /bpm/forms-flow-bpm/settings-docker.xml /usr/share/maven/ref/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_08oxgyg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.19.0">
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_08oxgyg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.11.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.19.0">
<bpmn:process id="common-email-workflow" name="CommonEmailWorkflow" isExecutable="true" camunda:historyTimeToLive="300">
<bpmn:startEvent id="Event_0kew5uc" name="Start">
<bpmn:outgoing>Flow_15fflso</bpmn:outgoing>
Expand Down Expand Up @@ -39,9 +39,12 @@ authUrl;</camunda:script>
</bpmn:serviceTask>
<bpmn:scriptTask id="Activity_04ks0sg" name="Print Token" scriptFormat="javascript">
<bpmn:incoming>Flow_0cog7s9</bpmn:incoming>
<bpmn:outgoing>Flow_0w1xi39</bpmn:outgoing>
<bpmn:outgoing>Flow_1v2p747</bpmn:outgoing>
<bpmn:script>var system = java.lang.System;
system.out.println ("token: "+token);</bpmn:script>
system.out.println ("token: "+token);

system.out.println ("category: "+category);
system.out.println ("name: "+name);</bpmn:script>
</bpmn:scriptTask>
<bpmn:serviceTask id="Activity_1w8sq4d" name="Send Notification Email">
<bpmn:extensionElements>
Expand All @@ -58,18 +61,18 @@ system.out.println ("token: "+token);</bpmn:script>
<camunda:script scriptFormat="javascript">var p = {
"bcc": [],
"bodyType": "html",
"body": "You have an update to your application, please log in to review. The status is: " + execution.getVariable('applicationStatus'),
"body": execution.getVariable("text"),
"cc": [],
"delayTS": 0,
"encoding": "utf-8",
"from": "[email protected]",
"priority": "normal",
"subject": "EPD Application Update",
"subject": execution.getVariable("subject"),
"to": [],
"tag": "",
"attachments": []
}
p.to.push(clientEmail)
p.to.push(execution.getVariable("emailTo"))
console.log("Payload")
console.log(JSON.stringify(p))
JSON.stringify(p)</camunda:script>
Expand All @@ -81,21 +84,24 @@ JSON.stringify(p)</camunda:script>
</camunda:inputOutput>
<camunda:connectorId>http-connector</camunda:connectorId>
</camunda:connector>
<camunda:inputOutput>
<camunda:inputParameter name="text">
<camunda:script scriptFormat="groovy">new String(execution.getVariable("mailContent"))</camunda:script>
</camunda:inputParameter>
<camunda:inputParameter name="subject">${dmnResult.get("subject")}</camunda:inputParameter>
<camunda:inputParameter name="emailTo">
<camunda:script scriptFormat="groovy">execution.getVariable("emailTo")</camunda:script>
</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0jqov5w</bpmn:incoming>
<bpmn:incoming>Flow_0tc827u</bpmn:incoming>
<bpmn:outgoing>Flow_093urcj</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:endEvent id="Event_1jy96yb" name="End">
<bpmn:incoming>Flow_1lr16lw</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0cog7s9" sourceRef="Activity_0nm63gf" targetRef="Activity_04ks0sg" />
<bpmn:sequenceFlow id="Flow_093urcj" sourceRef="Activity_1w8sq4d" targetRef="Activity_1cy9bql" />
<bpmn:task id="Activity_1uz4epi" name="Generate Email Body (TODO)">
<bpmn:incoming>Flow_0w1xi39</bpmn:incoming>
<bpmn:outgoing>Flow_0jqov5w</bpmn:outgoing>
</bpmn:task>
<bpmn:sequenceFlow id="Flow_0w1xi39" sourceRef="Activity_04ks0sg" targetRef="Activity_1uz4epi" />
<bpmn:sequenceFlow id="Flow_0jqov5w" sourceRef="Activity_1uz4epi" targetRef="Activity_1w8sq4d" />
<bpmn:sequenceFlow id="Flow_15fflso" sourceRef="Event_0kew5uc" targetRef="Activity_0nm63gf" />
<bpmn:sequenceFlow id="Flow_1lr16lw" sourceRef="Activity_1cy9bql" targetRef="Event_1jy96yb" />
<bpmn:scriptTask id="Activity_1cy9bql" name="Print Result" scriptFormat="javascript">
Expand All @@ -104,61 +110,94 @@ JSON.stringify(p)</camunda:script>
<bpmn:script>var system = java.lang.System;
system.out.println ("result: "+result);</bpmn:script>
</bpmn:scriptTask>
<bpmn:businessRuleTask id="BusinessRuleTask_02kbmdk" name="Email Template" camunda:resultVariable="dmnResult" camunda:decisionRef="decide-email-template" camunda:mapDecisionResult="singleResult">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="category">${category}</camunda:inputParameter>
<camunda:outputParameter name="support">
<camunda:script scriptFormat="groovy">dmnResult.get("support")</camunda:script>
</camunda:outputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1v2p747</bpmn:incoming>
<bpmn:outgoing>Flow_1uskeb8</bpmn:outgoing>
</bpmn:businessRuleTask>
<bpmn:scriptTask id="Task_1q29nrc" name="Get Mail Content" scriptFormat="groovy" camunda:resultVariable="mailContent">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="templateFile">
<camunda:script scriptFormat="freemarker" resource="${dmnResult.get(&#34;file&#34;)}" />
</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1uskeb8</bpmn:incoming>
<bpmn:outgoing>Flow_0tc827u</bpmn:outgoing>
<bpmn:script>templateFile.getBytes("UTF-8")</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_1v2p747" sourceRef="Activity_04ks0sg" targetRef="BusinessRuleTask_02kbmdk" />
<bpmn:sequenceFlow id="Flow_1uskeb8" sourceRef="BusinessRuleTask_02kbmdk" targetRef="Task_1q29nrc" />
<bpmn:sequenceFlow id="Flow_0tc827u" sourceRef="Task_1q29nrc" targetRef="Activity_1w8sq4d" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="common-email-workflow">
<bpmndi:BPMNShape id="Event_0kew5uc_di" bpmnElement="Event_0kew5uc">
<dc:Bounds x="182" y="102" width="36" height="36" />
<dc:Bounds x="172" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="188" y="145" width="25" height="14" />
<dc:Bounds x="178" y="145" width="25" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_1hi0nx6" bpmnElement="Activity_0nm63gf">
<dc:Bounds x="270" y="80" width="100" height="80" />
<dc:Bounds x="240" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1ynm6j6_di" bpmnElement="Activity_04ks0sg">
<dc:Bounds x="415" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0pegmhv_di" bpmnElement="Activity_1w8sq4d">
<dc:Bounds x="710" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1uz4epi_di" bpmnElement="Activity_1uz4epi">
<dc:Bounds x="550" y="80" width="100" height="80" />
<bpmndi:BPMNShape id="Activity_13xdoy5_di" bpmnElement="Activity_1cy9bql">
<dc:Bounds x="930" y="80" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1jy96yb_di" bpmnElement="Event_1jy96yb">
<dc:Bounds x="1052" y="102" width="36" height="36" />
<dc:Bounds x="1072" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1062" y="145" width="20" height="14" />
<dc:Bounds x="1082" y="145" width="20" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_13xdoy5_di" bpmnElement="Activity_1cy9bql">
<dc:Bounds x="880" y="80" width="100" height="80" />
<bpmndi:BPMNLabel />
<bpmndi:BPMNShape id="Activity_0pegmhv_di" bpmnElement="Activity_1w8sq4d">
<dc:Bounds x="780" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1l8slzj_di" bpmnElement="Task_1q29nrc">
<dc:Bounds x="640" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BusinessRuleTask_02kbmdk_di" bpmnElement="BusinessRuleTask_02kbmdk">
<dc:Bounds x="510" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1ynm6j6_di" bpmnElement="Activity_04ks0sg">
<dc:Bounds x="370" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_0cog7s9_di" bpmnElement="Flow_0cog7s9">
<di:waypoint x="340" y="120" />
<di:waypoint x="370" y="120" />
<di:waypoint x="415" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_093urcj_di" bpmnElement="Flow_093urcj">
<di:waypoint x="810" y="120" />
<di:waypoint x="880" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0w1xi39_di" bpmnElement="Flow_0w1xi39">
<di:waypoint x="515" y="120" />
<di:waypoint x="550" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0jqov5w_di" bpmnElement="Flow_0jqov5w">
<di:waypoint x="650" y="120" />
<di:waypoint x="710" y="120" />
<di:waypoint x="930" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_15fflso_di" bpmnElement="Flow_15fflso">
<di:waypoint x="218" y="120" />
<di:waypoint x="270" y="120" />
<di:waypoint x="208" y="120" />
<di:waypoint x="240" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1lr16lw_di" bpmnElement="Flow_1lr16lw">
<di:waypoint x="980" y="120" />
<di:waypoint x="1052" y="120" />
<di:waypoint x="1030" y="120" />
<di:waypoint x="1072" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1v2p747_di" bpmnElement="Flow_1v2p747">
<di:waypoint x="470" y="120" />
<di:waypoint x="510" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1uskeb8_di" bpmnElement="Flow_1uskeb8">
<di:waypoint x="610" y="120" />
<di:waypoint x="640" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0tc827u_di" bpmnElement="Flow_0tc827u">
<di:waypoint x="740" y="120" />
<di:waypoint x="780" y="120" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<text></text>
</outputEntry>
<outputEntry id="LiteralExpression_1modk4k">
<text>"SIR Application Rejected"</text>
<text>"Site Information Request Rejected"</text>
</outputEntry>
<outputEntry id="LiteralExpression_18eytpn">
<text>"templates/sir_application_rejected.ftl"</text>
Expand All @@ -40,6 +40,32 @@
<text>"[email protected]"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1ntr60u">
<inputEntry id="UnaryTests_0ml6jeo">
<text>"sir_status_approved"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0pe3y12">
<text></text>
</outputEntry>
<outputEntry id="LiteralExpression_0x28v17">
<text>"[email protected]"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1rifrbf">
<text></text>
</outputEntry>
<outputEntry id="LiteralExpression_1x7izwu">
<text></text>
</outputEntry>
<outputEntry id="LiteralExpression_03f3dbu">
<text>"Site Information Request Approved"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1b28w7x">
<text>"templates/sir_application_approved.ftl"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0326fv6">
<text>"[email protected]"</text>
</outputEntry>
</rule>
</decisionTable>
</decision>
<dmndi:DMNDI>
Expand Down
Loading

0 comments on commit c0cdf28

Please sign in to comment.