1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
/**
* $Id: ehrclient.h 2 2009-10-31 02:48:23Z l0728348 $
*
* Copyright 2009
*
* @author Manuel Mausz (0728348)
* @brief implements the main routines of the console application
*/
#ifndef EHRCLIENT_H
#define EHRCLIENT_H
#include <string>
#include <vector>
#include <utility>
#include <stdexcept>
#include <Ice/Ice.h>
#include "ehr.h"
#include "security.h"
/**
* implements the main routines of the console application
*/
class EhrClient
: virtual public Ice::Application
{
public:
/**
* @brief exception thrown by EhrClient
*/
class runtime_error : public std::runtime_error {
public:
/**
* @brief Default exception ctor
* @param what message to pass along
*/
runtime_error(const std::string& what)
: std::runtime_error(what)
{}
};
/**
* @brief main routine
* gets called by Ice after internal setup
* @param argc argc from main
* @param argv argv from main
*/
virtual int run(int argc, char *argv[]);
/**
* @brief retrieves and returns documentlist from server
* @return list of documents
*/
Ehr::DocumentList getDocumentList();
/**
* @brief search for documents using parameters
* @param hasFrom set true to consider from parameter
* @param from value for from parameter
* @param hasTill set true to consider till parameter
* @param till value for till parameter
* @param doctype document type to search for
* @param docid document id to search for
* @return list of documents
* @throw Ehr::EhrException
*/
Ehr::DocumentList searchDocument(const bool hasFrom = false, const long from = 0,
const bool hasTill = false, const long till = 0,
const Ehr::DocumentType doctype = Ehr::DOCANY, const long docid = 0);
/**
* @brief overloaded method for searching for documents
* @param from value for from parameter
* @param till value for till parameter
* @return list of documents
* @throw Ehr::EhrException
*/
Ehr::DocumentList searchDocument(const long from, const long till)
{
return searchDocument(true, from, true, till);
}
/**
* @brief overloaded method for searching for documents
* @param doctype document type to search for
* @return list of documents
* @throw Ehr::EhrException
*/
Ehr::DocumentList searchDocument(const Ehr::DocumentType doctype)
{
return searchDocument(false, 0, false, 0, doctype);
}
/**
* @brief overloaded method for searching for documents
* @param docid document id to search for
* @return list of documents
* @throw Ehr::EhrException
*/
Ehr::DocumentList searchDocument(const long docid)
{
return searchDocument(false, 0, false, 0, Ehr::DOCANY, docid);
}
/**
* @brief list all document on server on console output
*/
void listDocuments();
/**
* @brief retrieves document with documentid, generates a pdf document
* and stores it as output on disc
* @param docid document id
* @param output filename to store the pdf document
* @throw EhrClient::runtime_error
*/
void saveDocument(const long docid, const std::string& output);
/**
* @brief get current time in milliseconds
* @return current time in milliseconds
*/
long getTime();
/**
* @brief generate date string
* @param msecs time in milliseconds since 01.01.1900 00:00
* @return string containing the date. syntax: dd.mm.yyyy
*/
std::string getDate(long msecs);
/**
* @brief generate date string
* @param date date in Ehr::Date format
* @return string containing the date. syntax: dd.mm.yyyy
*/
std::string getDate(const Ehr::Date& date);
/**
* @brief convert ice request to bytestream
* @param request ice request to convert
* @return converted bytestream containing the request
*/
std::vector<Ice::Byte> convertToByteStream(const Ice::ObjectPtr& request);
/**
* @brief split commonname (syntax user @ domain) of certificate
* into user and domain
* @param cert certificate which contains the commonname
* @return pair of user and domain
* @throw EhrClient::runtime_error
*/
std::pair<std::string, std::string> splitCN(const std::string& cert);
private:
Ehr::ProviderPrx m_provider;
Security *m_security;
std::string m_ownercert;
std::string m_requestorcert;
};
#endif
/* vim: set et sw=2 ts=2: */
|