use of de.janrufmonitor.framework.ICall in project janrufmonitor by tbrandt77.
the class Etiquet method renderAsText.
public String renderAsText() {
if (this.m_o != null) {
if (this.m_o instanceof ICall) {
this.m_o = ((ICall) this.m_o).getCaller();
}
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) {
IAttributeMap m = ((ITreeItemCallerData) m_o).getAttributes();
IPhonenumber pn = ((ITreeItemCallerData) m_o).getPhone();
if (m.contains(IMacAddressBookNumberMapping.MAPPING_ATTTRIBUTE_ID + pn.getTelephoneNumber())) {
IAttribute type = m.get(IMacAddressBookNumberMapping.MAPPING_ATTTRIBUTE_ID + pn.getTelephoneNumber());
if (type != null) {
return PIMRuntime.getInstance().getI18nManagerFactory().getI18nManager().getString(NAMESPACE, type.getValue(), "label", getLanguage());
}
}
}
}
return "";
}
use of de.janrufmonitor.framework.ICall in project janrufmonitor by tbrandt77.
the class MySQLCallEventLogger method receivedIdentifiedCall.
public void receivedIdentifiedCall(IEvent event) {
super.receivedIdentifiedCall(event);
ICall aCall = (ICall) event.getData();
if (aCall != null) {
if (getRuntime().getRuleEngine().validate(this.getID(), aCall.getMSN(), aCall.getCIP(), aCall.getCaller().getPhoneNumber())) {
try {
this.getDatabaseHandler().insertCall(aCall);
} catch (SQLException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
}
} else {
this.m_logger.info("No rule assigned to execute this service for call: " + aCall);
}
}
}
use of de.janrufmonitor.framework.ICall in project janrufmonitor by tbrandt77.
the class ChangeAction 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) {
if (((ICaller) o).getPhoneNumber().isClired())
return;
IAttribute att = ((ICaller) o).getAttribute(SoundConst.ATTRIBUTE_USER_SOUNDFILE);
if (att == null) {
att = this.getRuntime().getCallerFactory().createAttribute(SoundConst.ATTRIBUTE_USER_SOUNDFILE, "");
}
// Create the dialog
WizardDialog.setDefaultImage(SWTImageManager.getInstance(this.getRuntime()).get(IJAMConst.IMAGE_KEY_PIM_ICON));
SoundDataWizard sdoW = new SoundDataWizard(att.getValue());
WizardDialog dlg = new WizardDialog(new Shell(DisplayManager.getDefaultDisplay()), sdoW);
dlg.open();
if (dlg.getReturnCode() == WizardDialog.OK) {
att.setValue(sdoW.getResult());
((ICaller) o).setAttribute(att);
this.m_app.getController().updateElement(o);
this.m_app.updateViews(false);
}
}
}
}
}
use of de.janrufmonitor.framework.ICall in project janrufmonitor by tbrandt77.
the class TableCellModifier method modify.
public void modify(Object element, String column, Object value) {
if (element instanceof Item)
element = ((Item) element).getData();
ITableCellRenderer r = RendererRegistry.getInstance().getRenderer(column);
if (r instanceof ITableAttributeCellEditorRenderer && ((ITableAttributeCellEditorRenderer) r).getAttribute() != null) {
if (element instanceof ICall) {
ICall c = ((ICall) element);
IAttribute cAtt = c.getAttribute(((ITableAttributeCellEditorRenderer) r).getAttribute().getName());
if (cAtt != null && value instanceof String) {
if (cAtt.getValue().equalsIgnoreCase((String) value)) {
return;
}
}
IAttribute att = ((ITableAttributeCellEditorRenderer) r).getAttribute();
((ITableAttributeCellEditorRenderer) r).applyAttributeChanges(c, att, value);
if (this.m_ac.getController() instanceof IExtendedApplicationController) {
((IExtendedApplicationController) this.m_ac.getController()).updateElement(c, false);
} else {
this.m_ac.getController().updateElement(c);
}
}
if (element instanceof ICaller) {
ICaller c = ((ICaller) element);
IAttribute cAtt = c.getAttribute(((ITableAttributeCellEditorRenderer) r).getAttribute().getName());
if (cAtt != null && value instanceof String) {
if (cAtt.getValue().equalsIgnoreCase((String) value)) {
return;
}
}
IAttribute att = ((ITableAttributeCellEditorRenderer) r).getAttribute();
((ITableAttributeCellEditorRenderer) r).applyAttributeChanges(c, att, value);
if (this.m_ac.getController() instanceof IExtendedApplicationController) {
((IExtendedApplicationController) this.m_ac.getController()).updateElement(c, false);
} else {
this.m_ac.getController().updateElement(c);
}
}
}
this.m_v.refresh();
}
use of de.janrufmonitor.framework.ICall in project janrufmonitor by tbrandt77.
the class TextCellLabelProvider method getBackground.
public Color getBackground(Object o) {
if (o instanceof ICall)
o = ((ICall) o).getCaller();
if (o instanceof ICaller) {
if (((ICaller) o).getAttributes().contains(IJAMConst.ATTRIBUTE_NAME_SPAM_COLOR)) {
String color = ((ICaller) o).getAttribute(IJAMConst.ATTRIBUTE_NAME_SPAM_COLOR).getValue();
StringTokenizer cs = new StringTokenizer(color, ",");
if (cs.countTokens() == 3)
return new Color(DisplayManager.getDefaultDisplay(), Integer.parseInt(cs.nextToken()), Integer.parseInt(cs.nextToken()), Integer.parseInt(cs.nextToken()));
}
}
return null;
}
Aggregations