Skip to content

Commit

Permalink
Merge pull request #29 from hzi-braunschweig/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
adulojusm committed Sep 27, 2020
2 parents 7d1dbaa + ae455a6 commit 5e3d34c
Show file tree
Hide file tree
Showing 26 changed files with 54,099 additions and 1,884 deletions.
75 changes: 75 additions & 0 deletions sormas_HL7v2/DockerController/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright (c) 2020, Mathew
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Copyright (c) 2020, Mathew
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
FROM mirabilia/sormas_fhir_adapter:2-1.0
#local sormas credentials
ARG SORMAS_ADAPTER_POSTGRES_PASSWORD=password
ARG SORMAS_POSTGRES_USER=sormas_user
ARG SORMAS_SERVER_URL=hzi.mirabilialtd.com
#Adapter Credentials
ARG SORMAS-DHIS2_ADAPTER_POSTGRES_PASSWORD=password
ARG SORMAS-DHIS2_POSTGRES_USER=sormas_user
ARG SORMAS-DHIS2_SERVER_URL=hzi-hl7.mirabilialtd.com

ARG DOMAIN_NAME=sormas-dhis
ARG DB_NAME=sormas-dhis

ARG JVM_MAX=2096m

ARG SORMAS_URL=https://github.com/hzi-braunschweig/SORMAS-DHIS/releases/download/released/sormas_HL7v_dockerized
EXPOSE 6080
ARG SORMAS-DHIS_VERSION=v2.1.zip
EXPOSE 6048

ENV ASENV_PATH="/opt/payara5/glassfish/config/asenv.conf"
RUN useradd payara

COPY adapter-setup-server.sh /adapter-setup-server.sh
RUN chmod +x /adapter-setup-server.sh
RUN /adapter-setup-server.sh
COPY adapter-start-server.sh /adapter-start-server.sh
RUN chmod +x /adapter-start-server.sh
CMD ["/adapter-start-server.sh"]
88 changes: 88 additions & 0 deletions sormas_HL7v2/DockerController/adapter-setup-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

#!/bin/bash

ROOT_PREFIX=
USER_NAME=payara

PAYARA_HOME=${ROOT_PREFIX}/opt/payara5
DOMAINS_HOME=${ROOT_PREFIX}/opt/domains
TEMP_DIR=${ROOT_PREFIX}/opt/${DOMAIN_NAME}/temp

DEPLOY_PATH=/tmp/${DOMAIN_NAME}
SORMAS2SORMAS_DIR=${ROOT_PREFIX}/opt/sormas2dhis

DOMAIN_DIR=${DOMAINS_HOME}/${DOMAIN_NAME}
LOG_FILE_PATH=${DOMAIN_DIR}/logs
LOG_FILE_NAME=server_update_`date +"%Y-%m-%d_%H-%M-%S"`.log



mkdir -p ${PAYARA_HOME}
mkdir -p ${DOMAINS_HOME}
mkdir -p ${DEPLOY_PATH}

mkdir -p ${SORMAS2SORMAS_DIR}

pushd ${DEPLOY_PATH}
wget ${SORMAS_URL}/${SORMAS-DHIS_VERSION} -O ${DOMAIN_NAME}.zip
unzip ${DOMAIN_NAME}.zip
rm ${DOMAIN_NAME}.zip
popd



# Setting ASADMIN_CALL and creating domain
echo "Creating domain for Payara..."
${PAYARA_HOME}/bin/asadmin create-domain --domaindir ${DOMAINS_HOME} --portbase ${PORT_BASE} --nopassword --template ${PAYARA_HOME}/glassfish/common/templates/gf/production-domain.jar "${DOMAIN_NAME}"
ASADMIN="${PAYARA_HOME}/bin/asadmin --port ${PORT_ADMIN}"

chown -R ${USER_NAME}:${USER_NAME} ${PAYARA_HOME}

${PAYARA_HOME}/bin/asadmin start-domain --domaindir ${DOMAINS_HOME} ${DOMAIN_NAME}

echo "Configuring domain and database connection..."

# General domain settings
${ASADMIN} delete-jvm-options -Xms2G
${ASADMIN} delete-jvm-options -Xmx2G
${ASADMIN} create-jvm-options -Xmx4096m

${ASADMIN} set configs.config.server-config.admin-service.das-config.autodeploy-enabled=true
${ASADMIN} set configs.config.server-config.admin-service.das-config.dynamic-reload-enabled=true

# Set protocol in redirects according to X-Forwarded-Proto (set by reverse proxy)
${ASADMIN} set server.network-config.protocols.protocol.http-listener-1.http.scheme-mapping=X-Forwarded-Proto

cp ${DEPLOY_PATH}/deploy/sormas.properties ${DOMAIN_DIR}
cp ${DEPLOY_PATH}/deploy/start-payara-sormas.sh ${DOMAIN_DIR}

chown -R ${USER_NAME}:${USER_NAME} ${DOMAIN_DIR}

#$GLASSFISH_PATH/bin/asadmin start-domain --domaindir $DOMAIN_PATH $DOMAIN_NAME > $LOG_PATH/$LOG_FILE_NAME

#sleep 10

#echo "Copying apk files..."
#cp ${DEPLOY_PATH}/deploy/android/release/*.apk ${DOWNLOADS_PATH}

echo "Copying server libs..."

cp ${DEPLOY_PATH}/deploy/serverlibs/* ${DOMAIN_DIR}/lib/

echo "Copying apps..."

mkdir -p ${DOMAIN_DIR}/deployments
cp ${DEPLOY_PATH}/deploy/apps/*.ear ${DOMAIN_DIR}/deployments/
cp ${DEPLOY_PATH}/deploy/apps/*.war ${DOMAIN_DIR}/deployments/

${PAYARA_HOME}/bin/asadmin stop-domain --domaindir ${DOMAINS_HOME}

rm -rf ${DOMAIN_DIR}/osgi-cache/*
rm -rf ${DOMAIN_DIR}/applications/*
rm -rf ${DOMAIN_DIR}/generated/*
rm -rf ${DOMAIN_DIR}/logs/*
rm -rf /opt/payara5/mq/javadoc
rm -rf /opt/payara5/mq/examples
rm -rf ${DEPLOY_PATH}

echo "Server setup completed."
1 change: 1 addition & 0 deletions sormas_HL7v2/DockerController/adapter-start-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

22 changes: 11 additions & 11 deletions sormas_HL7v2/nb-configuration.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.7-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>Tomcat</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<netbeans.hint.license>bsd</netbeans.hint.license>
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
</properties>
</project-shared-configuration>
-->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.7-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>Tomcat</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<netbeans.hint.license>bsd</netbeans.hint.license>
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
</properties>
</project-shared-configuration>
Binary file added sormas_HL7v2/outcert.zip
Binary file not shown.
15 changes: 13 additions & 2 deletions sormas_HL7v2/src/main/java/com/mirabilia/org/hzi/Strings/sql.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,19 @@ public class sql {
public static String dup_count_all_from_sorma_local = "SELECT count(*) FROM sormas_local d WHERE d.`level` = 2 and d.duplicate_with is not null and d.duplicate_with != '';";

public static String sync_count_all_synced = "SELECT count(*) FROM sormas_local d WHERE synced = 1;";



public static String sync_primer_all_matched = "SELECT uuid, level, externalid, idx FROM sormas_local d WHERE (d.duplicate_with is null or d.duplicate_with = '') and (d.externalid != '' or d.externalid is not null);";


public static String sync_primer_all_fresh = "select path_parent from raw_ where level = ?";

public static String sync_primer_all_fresh_ = "select idx from raw_ where uuid = ?";
public static String sync_all_fresh = "select name, uuid, idx, rec_created, level from raw_ where level = ? and path_parent like '%?%'";




public static String sync_primer_all_new_matched = "SELECT name, level, externalid, idx, rec_created FROM sormas_local d WHERE (d.duplicate_with is null or d.duplicate_with = '') and (d.externalid != '' or d.externalid is not null);";

public static String getSROMAS_district_PG = "select count(*), c.disease, (select name from district where id = c.district_id), (select externalid from district where id = c.district_id), c.creationdate::date\n"
Expand Down Expand Up @@ -100,7 +111,7 @@ public class sql {
+ "left join facility r on (c.healthfacility_id = r.id)\n"
+ "group by c.caseclassification, c.healthfacility_id, c.classificationdate::date";

public static String sync_send_all_matched_My = "update sormas_local set synced = 1 where idx = ?;";
public static String sync_send_all_matched_My = "update raw_ set synced = 1 where idx = ?;";

//public static String dup_count_matched_no = "SELECT count(*) FROM raw_ r inner JOIN sormas_local d ON (r.UUID = d.externalid) WHERE r.`level` = 2";
// public static String dup_count_all_from_source_no= "SELECT count(*) FROM raw_ r WHERE r.`level` = 2;";
Expand Down

0 comments on commit 5e3d34c

Please sign in to comment.