use of de.janrufmonitor.framework.event.IEventBroker in project janrufmonitor by tbrandt77.
the class GeoCoding method receivedValidRule.
public void receivedValidRule(ICall call) {
if (call == null)
return;
if (call.getCaller().getPhoneNumber().isClired())
return;
ICaller caller = call.getCaller();
if (caller.getAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_LAT) != null && caller.getAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_LNG) != null) {
this.m_logger.info("Call already set with geo data ...");
return;
}
Point p = GeoCoder.getInstance().getCoordinates(caller.getAttributes());
if (p != null) {
caller.setAttribute(getRuntime().getCallerFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_ACC, Integer.toString(p.getAccurance())));
caller.setAttribute(getRuntime().getCallerFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_LAT, Double.toString(p.getLatitude())));
caller.setAttribute(getRuntime().getCallerFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_LNG, Double.toString(p.getLongitude())));
List callManagerList = this.getRuntime().getCallManagerFactory().getAllCallManagers();
ICallManager icm = null;
IEventBroker eventBroker = this.getRuntime().getEventBroker();
for (int i = 0; i < callManagerList.size(); i++) {
icm = (ICallManager) callManagerList.get(i);
// check if the repository manager allows read/write access
if (icm.isActive() && icm.isSupported(IWriteCallRepository.class)) {
((IWriteCallRepository) icm).updateCall(call);
this.m_logger.info("Call update sent with geocoding: " + call);
eventBroker.send(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_UPDATE_CALL, call));
}
}
} else {
this.m_logger.info("Geocoding not successfully for call: " + call);
}
}
use of de.janrufmonitor.framework.event.IEventBroker in project janrufmonitor by tbrandt77.
the class RunConsole method init.
public void init() {
this.m_logger = LogManager.getLogManager().getLogger(IJAMConst.DEFAULT_LOGGER);
this.m_logger.info("Starting ...");
try {
IEventBroker evtBroker = PIMRuntime.getInstance().getEventBroker();
evtBroker.register(this);
evtBroker.register(this, evtBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_CALL));
} catch (NullPointerException e) {
System.out.println("WARNING: Registering for call events failed. Please restart jAnrufmonitor...");
System.out.println();
}
}
use of de.janrufmonitor.framework.event.IEventBroker in project janrufmonitor by tbrandt77.
the class Reject method startup.
public void startup() {
super.startup();
IEventBroker eventBroker = this.getRuntime().getEventBroker();
eventBroker.register(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_CALL));
eventBroker.register(this);
this.m_logger.info("Reject is started ...");
}
use of de.janrufmonitor.framework.event.IEventBroker in project janrufmonitor by tbrandt77.
the class Sound method shutdown.
public void shutdown() {
super.shutdown();
IEventBroker eventBroker = this.getRuntime().getEventBroker();
eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_CALL));
this.m_logger.info("Sound is shut down ...");
}
use of de.janrufmonitor.framework.event.IEventBroker in project janrufmonitor by tbrandt77.
the class Sound method startup.
public void startup() {
super.startup();
IEventBroker eventBroker = this.getRuntime().getEventBroker();
eventBroker.register(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_CALL));
this.m_logger.info("Sound is started ...");
}
Aggregations