Search in sources :

Example 31 with ICall

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

the class ImagePreviewBig method renderAsImageID.

public String renderAsImageID() {
    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) {
            if (ImageHandler.getInstance().hasImage((ICaller) this.m_o)) {
                String path = ImageHandler.getInstance().getImagePath((ICaller) this.m_o);
                if (new File(path).exists())
                    return path;
                String newPath = PathResolver.getInstance().getTempDirectory() + File.separator + ((ICaller) this.m_o).getUUID() + ".jpg";
                try {
                    FileOutputStream fos = new FileOutputStream(newPath);
                    InputStream imgin = ImageHandler.getInstance().getImageStream((ICaller) this.m_o);
                    Stream.copy(imgin, fos, true);
                    return newPath;
                } catch (FileNotFoundException e) {
                } catch (IOException e) {
                }
            }
        }
    }
    return "";
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) ICall(de.janrufmonitor.framework.ICall) InputStream(java.io.InputStream) FileOutputStream(java.io.FileOutputStream) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) File(java.io.File)

Example 32 with ICall

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

the class GeoCoding 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) {
            IAttributeMap m = ((ICaller) (this.m_o)).getAttributes();
            if (m.contains(IJAMConst.ATTRIBUTE_NAME_GEO_LAT) && m.contains(IJAMConst.ATTRIBUTE_NAME_GEO_LNG)) {
                StringBuffer co = new StringBuffer();
                co.append(getLatitute(m.get(IJAMConst.ATTRIBUTE_NAME_GEO_LAT).getValue()));
                co.append(", ");
                co.append(getLongitute(m.get(IJAMConst.ATTRIBUTE_NAME_GEO_LNG).getValue()));
                return co.toString();
            }
        }
    }
    return "";
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) ICall(de.janrufmonitor.framework.ICall) IAttributeMap(de.janrufmonitor.framework.IAttributeMap)

Example 33 with ICall

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

the class ImageBase64 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) {
            if (ImageHandler.getInstance().hasImage((ICaller) this.m_o)) {
                try {
                    InputStream fim = ImageHandler.getInstance().getImageStream((ICaller) this.m_o);
                    ByteArrayOutputStream encodedOut = new ByteArrayOutputStream();
                    Base64Encoder b64 = new Base64Encoder(encodedOut);
                    Stream.copy(fim, b64);
                    b64.flush();
                    b64.close();
                    return new String(encodedOut.toByteArray());
                } catch (IOException e) {
                }
            }
        }
    }
    return "";
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) ICall(de.janrufmonitor.framework.ICall) InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) Base64Encoder(de.janrufmonitor.util.io.Base64Encoder)

Example 34 with ICall

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

the class Status method renderAsImageID.

public String renderAsImageID() {
    if (this.m_o != null) {
        if (this.m_o instanceof ICall) {
            ICall call = (ICall) this.m_o;
            IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_REJECTED)) {
                return IJAMConst.IMAGE_KEY_REJECTED_GIF;
            }
            // att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_ACCEPTED)) {
                return IJAMConst.IMAGE_KEY_ACCEPTED_GIF;
            }
            // att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_OUTGOING)) {
                return IJAMConst.IMAGE_KEY_OUTGOING_GIF;
            }
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_MISSED)) {
                return IJAMConst.IMAGE_KEY_AWAY_GIF;
            }
            /**
             *				// 2008/11/08: work-a-round for showing old status fields
             *				att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_REJECTED);
             *				if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
             *					return IJAMConst.IMAGE_KEY_REJECTED_GIF;
             *				}
             *				att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_ACCEPTED);
             *				if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
             *					return IJAMConst.IMAGE_KEY_ACCEPTED_GIF;
             *				}
             *				att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_OUTGOING);
             *				if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
             *					return IJAMConst.IMAGE_KEY_OUTGOING_GIF;
             *				}
             */
            return IJAMConst.IMAGE_KEY_AWAY_GIF;
        }
    }
    return "";
}
Also used : ICall(de.janrufmonitor.framework.ICall) IAttribute(de.janrufmonitor.framework.IAttribute)

Example 35 with ICall

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

the class CallSimulator method sendEvent.

protected void sendEvent(String number, String msn, String cip) {
    if (number != null && number.length() > 0)
        number = PhonenumberAnalyzer.getInstance(this.getRuntime()).toCallable(number);
    if (!number.startsWith("0") && isRaw) {
        number = "0" + number;
    }
    IEventBroker evtBroker = this.getRuntime().getEventBroker();
    evtBroker.register(this);
    evtBroker.register(this, evtBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_CALL));
    IPhonenumber phone = PhonenumberAnalyzer.getInstance(this.getRuntime()).toClirPhonenumber(number);
    if (phone == null)
        phone = PhonenumberAnalyzer.getInstance(this.getRuntime()).toInternalPhonenumber(number, msn);
    if (phone == null)
        phone = PhonenumberAnalyzer.getInstance(this.getRuntime()).toPhonenumber(number, msn);
    IName name = PIMRuntime.getInstance().getCallerFactory().createName("", "");
    ICaller aCaller = PIMRuntime.getInstance().getCallerFactory().createCaller(name, phone);
    ICip ocip = PIMRuntime.getInstance().getCallFactory().createCip(cip, "");
    IMsn omsn = PIMRuntime.getInstance().getCallFactory().createMsn(msn, "");
    ICall currentCall = PIMRuntime.getInstance().getCallFactory().createCall(aCaller, omsn, ocip);
    currentCall.setAttribute(this.getRuntime().getCallFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS, IJAMConst.ATTRIBUTE_VALUE_MISSED));
    IEvent ev = evtBroker.createEvent(IEventConst.EVENT_TYPE_INCOMINGCALL, currentCall);
    evtBroker.send(this, ev);
    evtBroker.unregister(this);
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) ICip(de.janrufmonitor.framework.ICip) ICall(de.janrufmonitor.framework.ICall) IEvent(de.janrufmonitor.framework.event.IEvent) IName(de.janrufmonitor.framework.IName) IMsn(de.janrufmonitor.framework.IMsn) IEventBroker(de.janrufmonitor.framework.event.IEventBroker) IPhonenumber(de.janrufmonitor.framework.IPhonenumber)

Aggregations

ICall (de.janrufmonitor.framework.ICall)89 ICaller (de.janrufmonitor.framework.ICaller)41 List (java.util.List)23 Viewer (org.eclipse.jface.viewers.Viewer)20 IPhonenumber (de.janrufmonitor.framework.IPhonenumber)19 ArrayList (java.util.ArrayList)19 IAttribute (de.janrufmonitor.framework.IAttribute)18 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)18 ICallList (de.janrufmonitor.framework.ICallList)17 IOException (java.io.IOException)14 Properties (java.util.Properties)14 Date (java.util.Date)13 Iterator (java.util.Iterator)13 Shell (org.eclipse.swt.widgets.Shell)13 File (java.io.File)12 InvocationTargetException (java.lang.reflect.InvocationTargetException)12 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)11 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)11 ICip (de.janrufmonitor.framework.ICip)10 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)10