use of de.janrufmonitor.framework.ICaller in project janrufmonitor by tbrandt77.
the class ScoreNumberTellows method run.
public void run() {
Viewer v = this.m_app.getApplication().getViewer();
if (v != null) {
IStructuredSelection selection = (IStructuredSelection) v.getSelection();
if (!selection.isEmpty()) {
Iterator iter = selection.iterator();
while (iter.hasNext()) {
Object o1 = iter.next();
Object o = null;
if (o1 instanceof ICall) {
o = ((ICall) o1).getCaller();
}
if (o1 instanceof ICaller) {
o = o1;
}
if (o != null) {
if (!((ICaller) o).getPhoneNumber().isClired() && !PhonenumberAnalyzer.getInstance(getRuntime()).isInternal(((ICaller) o).getPhoneNumber()) && (((ICaller) o).getPhoneNumber().getIntAreaCode().equalsIgnoreCase("49") || ((ICaller) o).getPhoneNumber().getIntAreaCode().equalsIgnoreCase("41") || ((ICaller) o).getPhoneNumber().getIntAreaCode().equalsIgnoreCase("43"))) {
final Object o2 = o1;
final Object o3 = o;
ProgressMonitorDialog pmd = new ProgressMonitorDialog(DisplayManager.getDefaultDisplay().getActiveShell());
try {
IRunnableWithProgress r = new IRunnableWithProgress() {
public void run(IProgressMonitor progressMonitor) {
progressMonitor.beginTask(getI18nManager().getString(getNamespace(), "scoring", "label", getLanguage()), IProgressMonitor.UNKNOWN);
progressMonitor.worked(1);
try {
IAttributeMap m = TellowsProxy.getInstance().getTellowsData(((ICaller) o3).getPhoneNumber().getTelephoneNumber(), ((ICaller) o3).getPhoneNumber().getIntAreaCode());
if (m.size() > 0) {
((ICaller) o3).getAttributes().addAll(m);
if (m_app.getController() instanceof IExtendedApplicationController)
((IExtendedApplicationController) m_app.getController()).updateElement(o2, false);
else
m_app.getController().updateElement(o2);
}
} catch (Exception e) {
PropagationFactory.getInstance().fire(new Message(Message.ERROR, getRuntime().getI18nManagerFactory().getI18nManager().getString(NAMESPACE, "title", "label", getLanguage()), e), "Tray");
}
progressMonitor.done();
}
};
pmd.setBlockOnOpen(false);
pmd.run(true, false, r);
// ModalContext.run(r, true, pmd.getProgressMonitor(),
// DisplayManager.getDefaultDisplay());
} catch (InterruptedException e) {
m_logger.log(Level.SEVERE, e.getMessage(), e);
} catch (InvocationTargetException e) {
m_logger.log(Level.SEVERE, e.getMessage(), e);
}
}
}
}
this.m_app.updateViews(true);
}
}
}
use of de.janrufmonitor.framework.ICaller in project janrufmonitor by tbrandt77.
the class TapiClickDialAction method run.
public void run() {
Viewer v = this.m_app.getApplication().getViewer();
if (v != null) {
IStructuredSelection selection = (IStructuredSelection) v.getSelection();
if (!selection.isEmpty()) {
Object o = selection.getFirstElement();
if (o instanceof ICall) {
o = ((ICall) o).getCaller();
}
if (o instanceof ICaller) {
o = ((ICaller) o).getPhoneNumber();
}
if (o instanceof ITreeItemCallerData) {
o = ((ITreeItemCallerData) o).getPhone();
}
if (o instanceof IPhonenumber) {
if (((IPhonenumber) o).isClired())
return;
String dial = ((IPhonenumber) o).getTelephoneNumber();
if (PhonenumberAnalyzer.getInstance(this.getRuntime()).isInternal(dial)) {
dial = ((IPhonenumber) o).getCallNumber();
} else {
if (!((IPhonenumber) o).getIntAreaCode().equalsIgnoreCase(this.getRuntime().getConfigManagerFactory().getConfigManager().getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_INTAREA))) {
dial = "00" + ((IPhonenumber) o).getIntAreaCode() + dial;
}
if (!dial.startsWith("0"))
dial = "0" + dial;
// added 2010/03/06: check for dial prefix for outgoing calls
// removed 2010/06/25: double addition of prefix. Is already added in Dialogue
// if (this.getRuntime().getConfigManagerFactory().getConfigManager().getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_DIAL_PREFIX).length()>0) {
// if (this.m_logger.isLoggable(Level.INFO))
// this.m_logger.info("Using dial prefix: "+this.getRuntime().getConfigManagerFactory().getConfigManager().getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_DIAL_PREFIX));
// dial = this.getRuntime().getConfigManagerFactory().getConfigManager().getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_DIAL_PREFIX).trim() + dial;
// }
}
TapiDialerDialog id = new TapiDialerDialog(new Shell(DisplayManager.getDefaultDisplay()), dial);
id.open();
this.m_app.updateViews(false);
}
}
}
}
use of de.janrufmonitor.framework.ICaller in project janrufmonitor by tbrandt77.
the class XTapiCall method toCall.
public ICall toCall() {
if (this.m_call == null) {
IRuntime r = PIMRuntime.getInstance();
IPhonenumber phone = PhonenumberAnalyzer.getInstance(r).toClirPhonenumber(this.m_number);
if (phone == null)
phone = PhonenumberAnalyzer.getInstance(r).toInternalPhonenumber(this.m_number, this.m_msn);
if (phone == null)
phone = PhonenumberAnalyzer.getInstance(r).toPhonenumber(this.m_number, this.m_msn);
ICaller c = r.getCallerFactory().createCaller(phone);
IMsn msn = null;
if (this.m_msn == null) {
msn = r.getCallFactory().createMsn(getFestnetzAlias(), "");
} else {
msn = r.getCallFactory().createMsn(this.m_msn, "");
}
msn.setAdditional(r.getMsnManager().getMsnLabel(msn));
if (this.m_name != null && this.m_name.length() > 0) {
c.setName(r.getCallerFactory().createName("", this.m_name));
}
ICip cip = r.getCallFactory().createCip(getDefaultCip(), "");
cip.setAdditional(r.getCipManager().getCipLabel(cip, ""));
// create attributes
IAttributeMap am = r.getCallFactory().createAttributeMap();
am.add(r.getCallFactory().createAttribute("tapi.device", Integer.toString(this.m_device)));
am.add(r.getCallFactory().createAttribute("tapi.instance", Integer.toString(this.m_instance)));
am.add(r.getCallFactory().createAttribute("tapi.key", getKey(this.m_device, this.m_instance)));
am.add(r.getCallFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS, IJAMConst.ATTRIBUTE_VALUE_MISSED));
this.m_call = r.getCallFactory().createCall(c, msn, cip, new Date());
this.m_call.setAttributes(am);
}
return this.m_call;
}
use of de.janrufmonitor.framework.ICaller in project janrufmonitor by tbrandt77.
the class FritzBoxMappingManager method toCallerList.
public ICallerList toCallerList(List l) {
ICallerList cl = getRuntime().getCallerFactory().createCallerList(l.size());
ICaller c = null;
for (int i = 0; i < l.size(); i++) {
try {
c = this.mapFritzBoxCallerToJam((IPhonebookEntry) l.get(i));
if (c != null)
cl.add(c);
} catch (IOException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
}
}
return cl;
}
use of de.janrufmonitor.framework.ICaller in project janrufmonitor by tbrandt77.
the class FritzBoxMappingManager method toFritzBoxCallerList.
public List toFritzBoxCallerList(ICallerList l) {
List cl = new ArrayList(l.size());
IPhonebookEntry pe = null;
for (int i = 0; i < l.size(); i++) {
try {
pe = this.mapJamCallerToFritzBox((ICaller) l.get(i));
if (pe != null)
cl.add(pe);
} catch (IOException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
}
}
return cl;
}
Aggregations