Search in sources :

Example 26 with ICallList

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

the class AbstractFilterCallManager method processCallerFilters.

private ICallList processCallerFilters(ICallList cl, List callerFilter) {
    ICallList mergeList = this.getRuntime().getCallFactory().createCallList();
    ICallList[] filterLists = new ICallList[callerFilter.size()];
    for (int i = 0, n = callerFilter.size(); i < n; i++) {
        filterLists[i] = this.getRuntime().getCallFactory().createCallList();
        filterLists[i].add(cl);
    }
    IFilter f = null;
    for (int i = 0, n = callerFilter.size(); i < n; i++) {
        f = (IFilter) callerFilter.get(i);
        mergeList.add(this.filterCalls(f, filterLists[i]));
    }
    return mergeList;
}
Also used : ICallList(de.janrufmonitor.framework.ICallList) IFilter(de.janrufmonitor.repository.filter.IFilter)

Example 27 with ICallList

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

the class AbstractFilterCallManager method getCalls.

public synchronized ICallList getCalls(IFilter[] filters) {
    if (filters != null && filters.length > 0) {
        if (this.hasMultipleCallerFilter(filters)) {
            this.m_logger.info("Detected multiple caller filters.");
            List callerFilterList = new ArrayList();
            List itemCountFilterList = new ArrayList();
            ICallList cl = null;
            for (int i = 0; i < filters.length; i++) {
                if (filters[i].getType().equals(FilterType.CALLER)) {
                    // isolate caller filters, apply all others
                    callerFilterList.add(filters[i]);
                } else if (filters[i].getType().equals(FilterType.ITEMCOUNT)) {
                    // isolate item count filters, apply all others
                    itemCountFilterList.add(filters[i]);
                } else {
                    if (cl == null) {
                        cl = this.filterCalls(filters[i], null);
                    } else {
                        cl = this.filterCalls(filters[i], cl);
                    }
                }
            }
            if (callerFilterList.size() > 0) {
                if (cl == null)
                    cl = this.filterCalls(null, null);
                cl = processCallerFilters(cl, callerFilterList);
            }
            if (itemCountFilterList.size() > 0) {
                if (cl == null)
                    cl = this.filterCalls(null, null);
                // only process the first filter, more does not make sense...
                cl = filterCalls((IFilter) itemCountFilterList.get(0), cl);
            }
            return cl;
        } else {
            ICallList cl = this.filterCalls(filters[0], null);
            for (int i = 1; i < filters.length; i++) {
                cl = this.filterCalls(filters[i], cl);
                this.m_logger.info("Filter " + filters[i] + " is applied by this manager.");
            }
            return cl;
        }
    }
    return this.filterCalls(null, null);
}
Also used : ICallList(de.janrufmonitor.framework.ICallList) IFilter(de.janrufmonitor.repository.filter.IFilter) ArrayList(java.util.ArrayList) ICallList(de.janrufmonitor.framework.ICallList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 28 with ICallList

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

the class AbstractPersistentCallManager method setCall.

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

Example 29 with ICallList

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

the class HsqldbCallDatabaseHandler method buildCallList.

protected ICallList buildCallList(IFilter[] filters, int count, int offset, ISearchTerm[] searchTerms) throws SQLException {
    ICallList cl = this.getRuntime().getCallFactory().createCallList();
    if (!isConnected())
        return cl;
    Statement stmt = m_con.createStatement();
    ResultSet rs = stmt.executeQuery(prepareStatement(filters, count, offset, false, searchTerms));
    while (rs.next()) {
        try {
            cl.add(Serializer.toCall(rs.getString("content").getBytes(), this.getRuntime()));
        } catch (SerializerException e) {
            this.m_logger.log(Level.SEVERE, e.getMessage(), e);
        }
    }
    return cl;
}
Also used : ICallList(de.janrufmonitor.framework.ICallList) Statement(java.sql.Statement) ResultSet(java.sql.ResultSet) SerializerException(de.janrufmonitor.util.io.SerializerException)

Example 30 with ICallList

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

the class DeleteAction method run.

public void run() {
    Viewer v = this.m_app.getApplication().getViewer();
    if (v != null && v instanceof TableViewer) {
        IStructuredSelection selection = (IStructuredSelection) v.getSelection();
        if (!selection.isEmpty()) {
            Iterator i = selection.iterator();
            ICallList list = getRuntime().getCallFactory().createCallList();
            Object o = null;
            while (i.hasNext()) {
                o = i.next();
                if (o instanceof ICall) {
                    list.add((ICall) o);
                }
            }
            if (list.size() > 0) {
                if (MessageDialog.openConfirm(new Shell(DisplayManager.getDefaultDisplay()), this.getI18nManager().getString(this.getNamespace(), "delete", "label", this.getLanguage()), this.getI18nManager().getString(this.getNamespace(), "delete", "description", this.getLanguage()))) {
                    this.m_app.getController().deleteElements(list);
                    this.m_app.getApplication().initializeController();
                    this.m_app.updateViews(true);
                }
            }
        }
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ICall(de.janrufmonitor.framework.ICall) ICallList(de.janrufmonitor.framework.ICallList) Iterator(java.util.Iterator) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TableViewer(org.eclipse.jface.viewers.TableViewer)

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