Search in sources :

Example 1 with ICallList

use of de.janrufmonitor.framework.ICallList in project janrufmonitor by tbrandt77.

the class HttpCallManager method setCall.

public void setCall(ICall call) {
    ICallList l = this.getRuntime().getCallFactory().createCallList();
    l.add(call);
    this.setCalls(l);
}
Also used : ICallList(de.janrufmonitor.framework.ICallList)

Example 2 with ICallList

use of de.janrufmonitor.framework.ICallList in project janrufmonitor by tbrandt77.

the class HttpCallManager method removeCall.

public void removeCall(ICall call) {
    ICallList l = this.getRuntime().getCallFactory().createCallList();
    l.add(call);
    this.removeCalls(l);
}
Also used : ICallList(de.janrufmonitor.framework.ICallList)

Example 3 with ICallList

use of de.janrufmonitor.framework.ICallList 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)

Example 4 with ICallList

use of de.janrufmonitor.framework.ICallList in project janrufmonitor by tbrandt77.

the class LastCalled method renderAsText.

public String renderAsText() {
    if (this.m_o != null) {
        if (this.m_o instanceof ICaller) {
            this.m_o = new TreeItemCallerData(((ICaller) this.m_o).getAttributes(), ((ICaller) this.m_o).getPhoneNumber());
        }
        if (this.m_o instanceof ITreeItemCallerData) {
            IPhonenumber pn = ((ITreeItemCallerData) m_o).getPhone();
            List cms = PIMRuntime.getInstance().getCallManagerFactory().getTypedCallManagers(IReadCallRepository.class);
            if (cms.size() > 0) {
                ICallManager cm = null;
                for (int i = 0, j = cms.size(); i < j; i++) {
                    cm = (ICallManager) cms.get(i);
                    if (cm.isActive() && cm.isSupported(IReadCallRepository.class)) {
                        IFilter[] filters = new IFilter[] { new PhonenumberFilter(pn), new ItemCountFilter(1) };
                        ICallList cl = ((IReadCallRepository) cm).getCalls(filters, 1, 0);
                        cl.sort(0, false);
                        if (cl.size() > 0) {
                            ICall c = cl.get(0);
                            return getFormatter().parse(IJAMConst.GLOBAL_VARIABLE_CALLTIME, c.getDate());
                        }
                    }
                }
            }
        }
    }
    return "";
}
Also used : IReadCallRepository(de.janrufmonitor.repository.types.IReadCallRepository) ICall(de.janrufmonitor.framework.ICall) ICallManager(de.janrufmonitor.repository.ICallManager) ICaller(de.janrufmonitor.framework.ICaller) IFilter(de.janrufmonitor.repository.filter.IFilter) ItemCountFilter(de.janrufmonitor.repository.filter.ItemCountFilter) ICallList(de.janrufmonitor.framework.ICallList) PhonenumberFilter(de.janrufmonitor.repository.filter.PhonenumberFilter) ICallList(de.janrufmonitor.framework.ICallList) List(java.util.List) ITreeItemCallerData(de.janrufmonitor.ui.jface.application.ITreeItemCallerData) ITreeItemCallerData(de.janrufmonitor.ui.jface.application.ITreeItemCallerData) IPhonenumber(de.janrufmonitor.framework.IPhonenumber)

Example 5 with ICallList

use of de.janrufmonitor.framework.ICallList in project janrufmonitor by tbrandt77.

the class FritzXCallImporter method doImport.

public ICallList doImport() {
    long startDate = System.currentTimeMillis();
    try {
        File fritzxfile = new File(m_filename);
        FileInputStream fis = new FileInputStream(fritzxfile);
        DBFReader dbfReader = new DBFReader(fis);
        int size = dbfReader.getRecordCount();
        size = Math.abs(size);
        m_callList = getRuntime().getCallFactory().createCallList(size);
        Object[] rowObjects = null;
        CallCollection cc = null;
        List cc_list = new ArrayList();
        while ((rowObjects = dbfReader.nextRecord()) != null) {
            if (cc != null && cc.getId().equalsIgnoreCase((String) rowObjects[0])) {
                cc.add(rowObjects);
            } else {
                cc = new CallCollection((String) rowObjects[0]);
                cc_list.add(cc);
                cc.add(rowObjects);
            }
        }
        for (int i = 0, j = cc_list.size(); i < j; i++) {
            new MigratorThread(this.m_callList, (CallCollection) cc_list.get(i)).run();
        }
        fis.close();
    } catch (FileNotFoundException ex) {
        this.m_logger.warning("Cannot find call file " + m_filename);
        return this.m_callList;
    } catch (IOException ex) {
        this.m_logger.severe("IOException on file " + m_filename);
        return this.m_callList;
    }
    long endDate = System.currentTimeMillis();
    this.m_logger.info("Successfully imported call file " + m_filename);
    this.m_logger.info("Found " + new Integer(this.m_callList.size()).toString() + " call items in " + new Float((endDate - startDate) / 1000).toString() + " secs.");
    return m_callList;
}
Also used : ArrayList(java.util.ArrayList) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) DBFReader(com.linuxense.javadbf.DBFReader) ICallList(de.janrufmonitor.framework.ICallList) ArrayList(java.util.ArrayList) List(java.util.List) File(java.io.File)

Aggregations

ICallList (de.janrufmonitor.framework.ICallList)35 ICall (de.janrufmonitor.framework.ICall)13 ICallManager (de.janrufmonitor.repository.ICallManager)11 List (java.util.List)10 IReadCallRepository (de.janrufmonitor.repository.types.IReadCallRepository)8 IWriteCallRepository (de.janrufmonitor.repository.types.IWriteCallRepository)8 ArrayList (java.util.ArrayList)8 IFilter (de.janrufmonitor.repository.filter.IFilter)7 IOException (java.io.IOException)5 Message (de.janrufmonitor.exception.Message)4 File (java.io.File)4 FileNotFoundException (java.io.FileNotFoundException)4 TableViewer (org.eclipse.jface.viewers.TableViewer)4 ICaller (de.janrufmonitor.framework.ICaller)3 ICip (de.janrufmonitor.framework.ICip)3 IPhonenumber (de.janrufmonitor.framework.IPhonenumber)3 DateFilter (de.janrufmonitor.repository.filter.DateFilter)3 HandlerException (de.janrufmonitor.service.commons.http.handler.HandlerException)3 FileInputStream (java.io.FileInputStream)3 Viewer (org.eclipse.jface.viewers.Viewer)3