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