Search in sources :

Example 1 with IModifierService

use of de.janrufmonitor.service.IModifierService in project janrufmonitor by tbrandt77.

the class MacAddressBookMappingManager method setGeoData.

private void setGeoData(ICaller macCaller) {
    // check cache
    try {
        String LNG = MacAddressBookProxy.getInstance().getDataHandler().selectAttribute(macCaller.getUUID(), IJAMConst.ATTRIBUTE_NAME_GEO_LNG);
        String LAT = MacAddressBookProxy.getInstance().getDataHandler().selectAttribute(macCaller.getUUID(), IJAMConst.ATTRIBUTE_NAME_GEO_LAT);
        String ACC = MacAddressBookProxy.getInstance().getDataHandler().selectAttribute(macCaller.getUUID(), IJAMConst.ATTRIBUTE_NAME_GEO_ACC);
        IAttribute a = null;
        if (LNG != null && LNG.length() > 0 && LAT != null && LAT.length() > 0) {
            a = createAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_LNG, LNG);
            if (a != null)
                macCaller.getAttributes().add(a);
            a = createAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_LAT, LAT);
            if (a != null)
                macCaller.getAttributes().add(a);
            if (ACC != null && ACC.length() > 0) {
                a = createAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_ACC, ACC);
                if (a != null)
                    macCaller.getAttributes().add(a);
            }
            return;
        }
    } catch (SQLException e) {
        this.m_logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
    }
    List msvc = getRuntime().getServiceFactory().getModifierServices();
    IModifierService s = null;
    for (int k = 0, l = msvc.size(); k < l; k++) {
        s = (IModifierService) msvc.get(k);
        if (s != null && s.getServiceID().equalsIgnoreCase("GeoCoding") && s.isEnabled()) {
            if (m_logger.isLoggable(Level.INFO))
                m_logger.info("Processing modifier service <" + s.getServiceID() + ">");
            s.modifyObject(macCaller);
            if (macCaller.getAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_LNG) != null && macCaller.getAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_LAT) != null && macCaller.getAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_ACC) != null) {
                try {
                    MacAddressBookProxy.getInstance().getDataHandler().insertAttribute(macCaller.getUUID(), IJAMConst.ATTRIBUTE_NAME_GEO_LNG, macCaller.getAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_LNG).getValue());
                    MacAddressBookProxy.getInstance().getDataHandler().insertAttribute(macCaller.getUUID(), IJAMConst.ATTRIBUTE_NAME_GEO_LAT, macCaller.getAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_LAT).getValue());
                    MacAddressBookProxy.getInstance().getDataHandler().insertAttribute(macCaller.getUUID(), IJAMConst.ATTRIBUTE_NAME_GEO_ACC, macCaller.getAttribute(IJAMConst.ATTRIBUTE_NAME_GEO_ACC).getValue());
                } catch (SQLException e) {
                    this.m_logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
                }
            }
        }
    }
}
Also used : SQLException(java.sql.SQLException) IAttribute(de.janrufmonitor.framework.IAttribute) IModifierService(de.janrufmonitor.service.IModifierService) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with IModifierService

use of de.janrufmonitor.service.IModifierService in project janrufmonitor by tbrandt77.

the class FritzBoxCallListImporter method processModifierServices.

private void processModifierServices(ICallList cl) {
    if (cl != null && cl.size() > 0) {
        List msvc = PIMRuntime.getInstance().getServiceFactory().getModifierServices();
        IModifierService s = null;
        for (int k = 0, l = msvc.size(); k < l; k++) {
            s = (IModifierService) msvc.get(k);
            if (s != null && s.isEnabled()) {
                if (m_logger.isLoggable(Level.INFO))
                    m_logger.info("Processing modifier service <" + s.getServiceID() + ">");
                ICall call = null;
                for (int i = 0, j = cl.size(); i < j; i++) {
                    call = cl.get(i);
                    s.modifyObject(call);
                }
            }
        }
    }
}
Also used : ICall(de.janrufmonitor.framework.ICall) IModifierService(de.janrufmonitor.service.IModifierService) ICallList(de.janrufmonitor.framework.ICallList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 3 with IModifierService

use of de.janrufmonitor.service.IModifierService in project janrufmonitor by tbrandt77.

the class SynchronizerService method processModifierServices.

private void processModifierServices(ICallList cl, IProgressMonitor progressMonitor) {
    if (cl != null && cl.size() > 0) {
        List msvc = getRuntime().getServiceFactory().getModifierServices();
        IModifierService s = null;
        for (int k = 0, l = msvc.size(); k < l; k++) {
            s = (IModifierService) msvc.get(k);
            if (s != null && s.isEnabled()) {
                if (m_logger.isLoggable(Level.INFO))
                    m_logger.info("Processing modifier service <" + s.getServiceID() + ">");
                ICall call = null;
                for (int i = 0, j = cl.size(); i < j; i++) {
                    call = cl.get(i);
                    if (progressMonitor != null && s.getServiceID().equalsIgnoreCase("GeoCoding")) {
                        progressMonitor.setTaskName(getI18nManager().getString(getNamespace(), "geocodeprogress2", "label", getLanguage()) + Formatter.getInstance(this.getRuntime()).parse(IJAMConst.GLOBAL_VARIABLE_CALLERNAME, call));
                        try {
                            Thread.sleep(75);
                        } catch (InterruptedException e1) {
                            m_logger.log(Level.SEVERE, e1.getMessage(), e1);
                        }
                    }
                    s.modifyObject(call);
                }
            }
        }
    }
}
Also used : ICall(de.janrufmonitor.framework.ICall) IModifierService(de.janrufmonitor.service.IModifierService) ICallList(de.janrufmonitor.framework.ICallList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 4 with IModifierService

use of de.janrufmonitor.service.IModifierService in project janrufmonitor by tbrandt77.

the class ReIdentifyAction method processModifierServices.

private void processModifierServices(ICall call) {
    if (call != null) {
        List msvc = getRuntime().getServiceFactory().getModifierServices();
        IModifierService s = null;
        for (int k = 0, l = msvc.size(); k < l; k++) {
            s = (IModifierService) msvc.get(k);
            if (s != null && s.isEnabled()) {
                if (m_logger.isLoggable(Level.INFO))
                    m_logger.info("Processing modifier service <" + s.getServiceID() + ">");
                s.modifyObject(call);
            }
        }
    }
}
Also used : IModifierService(de.janrufmonitor.service.IModifierService) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

IModifierService (de.janrufmonitor.service.IModifierService)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 ICall (de.janrufmonitor.framework.ICall)2 ICallList (de.janrufmonitor.framework.ICallList)2 IAttribute (de.janrufmonitor.framework.IAttribute)1 SQLException (java.sql.SQLException)1