Search in sources :

Example 1 with CallListGetHandler

use of de.janrufmonitor.service.client.request.handler.CallListGetHandler in project janrufmonitor by tbrandt77.

the class HttpCallManager method getCalls.

public synchronized ICallList getCalls(IFilter[] filters, int count, int offset, ISearchTerm[] searchTerms) {
    if (!this.isConnected()) {
        this.m_logger.warning("Client is not yet connected with the server.");
        return this.getRuntime().getCallFactory().createCallList();
    }
    IRequester r = this.getRequester(new CallListGetHandler(this.getCallManager(), filters, searchTerms));
    IHttpResponse resp = r.request();
    String xml = this.getXmlContent(resp);
    this.handleRequester(resp, r);
    if (xml != null && xml.length() > 0) {
        ICallList l = XMLSerializer.toCallList(xml);
        if (l != null)
            return l;
        this.m_logger.warning("Calllist from remote host was empty.");
        PropagationFactory.getInstance().fire(new Message(Message.ERROR, getNamespace(), "empty", new Exception("CallList from server has either a wrong format, contains forbidden characters or was empty.")));
    }
    return this.getRuntime().getCallFactory().createCallList();
}
Also used : CallListGetHandler(de.janrufmonitor.service.client.request.handler.CallListGetHandler) Message(de.janrufmonitor.exception.Message) ICallList(de.janrufmonitor.framework.ICallList) IRequester(de.janrufmonitor.service.commons.http.IRequester) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse)

Aggregations

Message (de.janrufmonitor.exception.Message)1 ICallList (de.janrufmonitor.framework.ICallList)1 CallListGetHandler (de.janrufmonitor.service.client.request.handler.CallListGetHandler)1 IHttpResponse (de.janrufmonitor.service.commons.http.IHttpResponse)1 IRequester (de.janrufmonitor.service.commons.http.IRequester)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1