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;
}
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);
}
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);
}
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;
}
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);
}
}
}
}
}
Aggregations