Skip to content

Commit

Permalink
Merge pull request #30 from hzi-braunschweig/dev
Browse files Browse the repository at this point in the history
fix dhis_url null value
  • Loading branch information
adulojusm committed Oct 14, 2020
2 parents 5e3d34c + 803baa1 commit f63f954
Show file tree
Hide file tree
Showing 11 changed files with 462 additions and 429 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public class sql {

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 path_parent from raw_ where level = ? order by idx asc";

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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,19 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
if (rx.next()) {
sq1 = rx.getInt(1);
}
rx = null;
pstmt = con.prepareStatement(sq_2);
rx = pstmt.executeQuery();
if (rx.next()) {
sq2 = rx.getInt(1);
}
rx = null;
pstmt = con.prepareStatement(sq_3);
rx = pstmt.executeQuery();
if (rx.next()) {
sq3 = rx.getInt(1);
}
rx = null;
pstmt = con.prepareStatement(sq_4);
rx = pstmt.executeQuery();
if (rx.next()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
public class dhisOrgRetrival {

public static int starter(int pg_counterd) {
public static int starter(int pg_counterd, String urll) {
if (pg_counterd > 1) {

String json_all = "{'pager':'233'}";
Expand All @@ -47,7 +47,7 @@ public static int starter(int pg_counterd) {
} else {
try {

String base_urlx = "http://172.105.77.79:8080/api/organisationUnits.json?page=" + pg_counterd + "&maxLevel=4&paging=true&fields=lastUpdated%2Cid%2Cname%2CshortName%2Clevel%2Ccreated%2Cpath";
String base_urlx = urll+"/api/organisationUnits.json?page=" + pg_counterd + "&maxLevel=4&paging=true&fields=lastUpdated%2Cid%2Cname%2CshortName%2Clevel%2Ccreated%2Cpath";
System.out.println(base_urlx);
String nxtpg_url_val = getDemAll(base_urlx);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static com.mirabilia.org.hzi.Util.dhis.DHIS2resolver.getDemAll;
import static com.mirabilia.org.hzi.Util.dhis.dhisOrgRetrival.starter;
import com.mirabilia.org.hzi.sormas.doa.ConffileCatcher;

import java.io.IOException;
import java.sql.PreparedStatement;
Expand All @@ -25,6 +26,15 @@
*/
@WebServlet(urlPatterns = {"/orggetter"})
public class orgUnitConn extends HttpServlet {

private static String[] _url = ConffileCatcher.fileCatcher("passed");



private static String urll = _url[10].toString(); //should come from config file




// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
Expand All @@ -38,8 +48,12 @@ public class orgUnitConn extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

System.out.println("DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"+urll);

HttpSession sessionx = request.getSession(false);

// urll = sessionx.getAttribute("dhis_url").toString();

int initz = 0;
int initzx = 0;
Expand All @@ -53,7 +67,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
}

JSONParser jsonParser = new JSONParser();
String base_url = "http://172.105.77.79:8080/api/organisationUnits.json?fields=lastUpdated,id,closedDate,openingDate,name,shortName,level,created,path&paging=true&maxLevel=4";
String base_url = urll+"/api/organisationUnits.json?fields=lastUpdated,id,closedDate,openingDate,name,shortName,level,created,path&paging=true&maxLevel=4";
String json_all = getDemAll(base_url);


Expand Down Expand Up @@ -151,7 +165,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
if (initzx > 0) {

//process each shunk and send the progress back to progress bar.
int pg_ = starter(initzx);
int pg_ = starter(initzx,urll);

response.setContentType("text/plain;charset=UTF-8");
response.setStatus(200);
Expand Down
Loading

0 comments on commit f63f954

Please sign in to comment.