summaryrefslogtreecommitdiff
path: root/server/src/journal_uploadserver.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2012-01-26 12:08:39 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2012-01-26 12:08:39 +0100
commit4edae3f518353bb21a02fcda2dfcff83c5a72fc3 (patch)
tree7902e2b6af1dabdb5c49b906b8592874bfce407d /server/src/journal_uploadserver.cc
parente9ff9842e9a8c178f5e17c0cf5dde16db1a0d8fc (diff)
New onCommit scripting system.
Diffstat (limited to 'server/src/journal_uploadserver.cc')
-rw-r--r--server/src/journal_uploadserver.cc26
1 files changed, 17 insertions, 9 deletions
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.");
}