From 4edae3f518353bb21a02fcda2dfcff83c5a72fc3 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 26 Jan 2012 12:08:39 +0100 Subject: New onCommit scripting system. --- server/src/journal_uploadserver.cc | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'server/src/journal_uploadserver.cc') diff --git a/server/src/journal_uploadserver.cc b/server/src/journal_uploadserver.cc index a1299ec..eac6cd5 100644 --- a/server/src/journal_uploadserver.cc +++ b/server/src/journal_uploadserver.cc @@ -163,7 +163,10 @@ JournalUploadServer::JournalUploadServer(std::string host, } void JournalUploadServer::commit() + throw(Journal::Exception) { + int ret = 0; + #ifdef USE_MULTIPLE_USERS std::string resume; std::string olduser; @@ -177,9 +180,12 @@ void JournalUploadServer::commit() } if(i->second.user != olduser && olduser != "" && resume != "") { - journal_commit(patientID().c_str(), olduser.c_str(), - host.c_str(), port, - resume.c_str(), resume.size()); + ret = journal_commit(patientID().c_str(), olduser.c_str(), + host.c_str(), port, + resume.c_str(), resume.size()); + + if(ret == -1) throw Journal::Exception("Journal Commit error."); + // FIXME - UGLY HACK: Avoid upload server spooling in the wrong order. usleep(200000); resume = ""; @@ -195,9 +201,9 @@ void JournalUploadServer::commit() if(resume == "") return; - journal_commit(patientID().c_str(), olduser.c_str(), - host.c_str(), port, - resume.c_str(), resume.size()); + ret = journal_commit(patientID().c_str(), olduser.c_str(), + host.c_str(), port, + resume.c_str(), resume.size()); #else std::string resume; std::string user; @@ -222,10 +228,12 @@ void JournalUploadServer::commit() if(resume == "") return; // Connect to praxisuploadserver and commit all resumes in one bulk. - journal_commit(patientID().c_str(), user.c_str(), - host.c_str(), port, - resume.c_str(), resume.size()); + ret = journal_commit(patientID().c_str(), user.c_str(), + host.c_str(), port, + resume.c_str(), resume.size()); #endif/*USE_MULTIPLE_USERS*/ + + if(ret == -1) throw Journal::Exception("Journal Commit error."); } -- cgit v1.2.3