1
|
package org.bgbm.biovel.drf.client;
|
2
|
|
3
|
import org.bgbm.biovel.drf.checklist.DRFChecklistException;
|
4
|
import org.bgbm.biovel.drf.query.IQueryClient;
|
5
|
import org.bgbm.biovel.drf.utils.JSONUtils;
|
6
|
import org.slf4j.Logger;
|
7
|
import org.slf4j.LoggerFactory;
|
8
|
|
9
|
public abstract class AbstractClient<QC extends IQueryClient> {
|
10
|
|
11
|
protected Logger logger = LoggerFactory.getLogger(AbstractClient.class);
|
12
|
|
13
|
private ServiceProviderInfo spInfo;
|
14
|
|
15
|
protected QC queryClient;
|
16
|
|
17
|
/**
|
18
|
* @param queryClient the queryClient to set
|
19
|
*/
|
20
|
public abstract void initQueryClient();
|
21
|
|
22
|
public AbstractClient() {
|
23
|
initQueryClient();
|
24
|
spInfo = buildServiceProviderInfo();
|
25
|
}
|
26
|
|
27
|
public AbstractClient(String checklistInfoJson) throws DRFChecklistException {
|
28
|
initQueryClient();
|
29
|
setChecklistInfo(JSONUtils.convertJsonToObject(checklistInfoJson, ServiceProviderInfo.class));
|
30
|
}
|
31
|
|
32
|
public AbstractClient(ServiceProviderInfo spInfo) throws DRFChecklistException {
|
33
|
initQueryClient();
|
34
|
setChecklistInfo(spInfo);
|
35
|
}
|
36
|
|
37
|
public abstract ServiceProviderInfo buildServiceProviderInfo();
|
38
|
|
39
|
public ServiceProviderInfo getServiceProviderInfo() {
|
40
|
return spInfo;
|
41
|
}
|
42
|
|
43
|
public String getChecklistInfoAsJson() throws DRFChecklistException {
|
44
|
|
45
|
if(getServiceProviderInfo() != null) {
|
46
|
return JSONUtils.convertObjectToJson(spInfo);
|
47
|
}
|
48
|
return null;
|
49
|
}
|
50
|
|
51
|
public void setChecklistInfo(ServiceProviderInfo checklistInfo) {
|
52
|
this.spInfo = checklistInfo;
|
53
|
}
|
54
|
|
55
|
|
56
|
public abstract int getMaxPageSize();
|
57
|
|
58
|
|
59
|
|
60
|
}
|