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