Search in sources :

Example 6 with ICip

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

the class MailNotification method sendTestMail.

public void sendTestMail() {
    ICaller caller = getRuntime().getCallerFactory().createCaller(getRuntime().getCallerFactory().createName("Max", "Mustermann"), getRuntime().getCallerFactory().createPhonenumber("49", "30", "1234567890"));
    IMsn msn = getRuntime().getMsnManager().createMsn("12345");
    ICip cip = getRuntime().getCipManager().createCip("999");
    ICall call = getRuntime().getCallFactory().createCall(caller, msn, cip);
    if (this.m_configuration == null) {
        PropagationFactory.getInstance().fire(new de.janrufmonitor.exception.Message(de.janrufmonitor.exception.Message.ERROR, NAMESPACE, "notstarted", new String[] {}, new Exception()), "Tray");
        return;
    }
    if (this.m_task == null) {
        this.m_task = new MailTask();
        this.m_logger.info("Created new MailTask instance");
    }
    PropagationFactory.getInstance().fire(new de.janrufmonitor.exception.Message(de.janrufmonitor.exception.Message.INFO, NAMESPACE, "testmail", new String[] {}, new Exception()), "Tray");
    this.m_task.setConfiguration(this.m_configuration);
    this.m_task.addMail(call);
    this.m_task.run();
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) ICip(de.janrufmonitor.framework.ICip) ICall(de.janrufmonitor.framework.ICall) IMsn(de.janrufmonitor.framework.IMsn) MessagingException(javax.mail.MessagingException) AddressException(javax.mail.internet.AddressException)

Example 7 with ICip

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

the class FilterWizard method performFinish.

public boolean performFinish() {
    if (this.m_pages[0].isPageComplete() && this.m_pages[1].isPageComplete() && this.m_pages[2].isPageComplete() && this.m_pages[3].isPageComplete() && this.m_pages[4].isPageComplete() && this.m_pages[5].isPageComplete() && this.m_pages[6].isPageComplete()) {
        List filterList = new ArrayList();
        IPhonenumber[] phones = ((FilterPhonesPage) this.m_pages[3]).getResult();
        if (phones != null) {
            filterList.addAll(this.getCallerFilters(phones));
        }
        Date[] dates = ((FilterDatePage) this.m_pages[2]).getResult();
        if (dates != null && dates.length > 0) {
            filterList.add(this.getDateFilter(dates));
        }
        IMsn msn = ((FilterMsnPage) this.m_pages[0]).getResult();
        if (msn != null) {
            if (!msn.getMSN().equalsIgnoreCase("*"))
                filterList.add(new MsnFilter(new IMsn[] { msn }));
        }
        int limit = ((FilterItemCountPage) this.m_pages[4]).getResult();
        if (limit > 0) {
            filterList.add(new ItemCountFilter(limit));
        }
        IAttributeMap m = ((FilterCallTypePage) this.m_pages[5]).getResult();
        if (m != null && m.size() > 0) {
            filterList.add(new AttributeFilter(m));
        }
        ICip cip = ((FilterCipPage) this.m_pages[1]).getResult();
        if (cip != null)
            if (!cip.getCIP().equalsIgnoreCase("*"))
                filterList.add(new CipFilter(cip));
        this.m_filters = new IFilter[filterList.size()];
        for (int i = 0; i < filterList.size(); i++) {
            this.m_filters[i] = (IFilter) filterList.get(i);
        }
        String name = ((FilterNamePage) this.m_pages[6]).getResult();
        IFilterManager fm = new JournalFilterManager();
        if (name != null && name.trim().length() > 0) {
            this.getRuntime().getConfigManagerFactory().getConfigManager().setProperty(Journal.NAMESPACE, "filtername_" + fm.getFiltersToString(getResult()), name);
            this.getRuntime().getConfigManagerFactory().getConfigManager().saveConfiguration();
        } else {
            this.getRuntime().getConfigManagerFactory().getConfigManager().removeProperty(Journal.NAMESPACE, "filtername_" + fm.getFiltersToString(getResult()));
            this.getRuntime().getConfigManagerFactory().getConfigManager().saveConfiguration();
        }
        return true;
    }
    this.m_filters = null;
    return false;
}
Also used : ICip(de.janrufmonitor.framework.ICip) FilterNamePage(de.janrufmonitor.ui.jface.wizards.pages.FilterNamePage) ArrayList(java.util.ArrayList) FilterDatePage(de.janrufmonitor.ui.jface.wizards.pages.FilterDatePage) JournalFilterManager(de.janrufmonitor.ui.jface.application.journal.JournalFilterManager) Date(java.util.Date) CipFilter(de.janrufmonitor.repository.filter.CipFilter) FilterPhonesPage(de.janrufmonitor.ui.jface.wizards.pages.FilterPhonesPage) FilterItemCountPage(de.janrufmonitor.ui.jface.wizards.pages.FilterItemCountPage) FilterMsnPage(de.janrufmonitor.ui.jface.wizards.pages.FilterMsnPage) ItemCountFilter(de.janrufmonitor.repository.filter.ItemCountFilter) IFilterManager(de.janrufmonitor.ui.jface.application.IFilterManager) FilterCipPage(de.janrufmonitor.ui.jface.wizards.pages.FilterCipPage) MsnFilter(de.janrufmonitor.repository.filter.MsnFilter) FilterCallTypePage(de.janrufmonitor.ui.jface.wizards.pages.FilterCallTypePage) AttributeFilter(de.janrufmonitor.repository.filter.AttributeFilter) IAttributeMap(de.janrufmonitor.framework.IAttributeMap) ArrayList(java.util.ArrayList) List(java.util.List) IMsn(de.janrufmonitor.framework.IMsn) IPhonenumber(de.janrufmonitor.framework.IPhonenumber)

Example 8 with ICip

use of de.janrufmonitor.framework.ICip 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)

Example 9 with ICip

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

the class PIMCapiData method createCallObject.

private ICall createCallObject(String number, String msn, int cip) {
    IPhonenumber phone = PhonenumberAnalyzer.getInstance(getRuntime()).toClirPhonenumber(number);
    if (phone == null)
        phone = PhonenumberAnalyzer.getInstance(getRuntime()).toInternalPhonenumber(number, msn);
    if (phone == null)
        phone = PhonenumberAnalyzer.getInstance(getRuntime()).toPhonenumber("0" + number, msn);
    IName name = this.getRuntime().getCallerFactory().createName("", "");
    ICaller aCaller = this.getRuntime().getCallerFactory().createCaller(name, phone);
    ICip cipObj = this.getRuntime().getCallFactory().createCip(Integer.toString(cip), "");
    IMsn msnObj = this.getRuntime().getCallFactory().createMsn(msn, "");
    ICall c = this.getRuntime().getCallFactory().createCall(aCaller, msnObj, cipObj);
    c.setAttribute(this.getRuntime().getCallFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_BCHANNEL, this.m_plci.toString()));
    c.setAttribute(this.getRuntime().getCallFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_RAW_NUMBER, number));
    c.setAttribute(this.getRuntime().getCallFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS, IJAMConst.ATTRIBUTE_VALUE_MISSED));
    return c;
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) ICip(de.janrufmonitor.framework.ICip) ICall(de.janrufmonitor.framework.ICall) IName(de.janrufmonitor.framework.IName) IMsn(de.janrufmonitor.framework.IMsn) IPhonenumber(de.janrufmonitor.framework.IPhonenumber)

Example 10 with ICip

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

the class XMLCallHandler method startElement.

public void startElement(String uri, String name, String qname, Attributes attributes) throws SAXException {
    if (this.m_multi && qname.equalsIgnoreCase(TAG_CALLLIST)) {
        this.m_calllist = this.getRuntime().getCallFactory().createCallList();
    }
    if (qname.equalsIgnoreCase(TAG_CALL)) {
        this.m_call = this.getRuntime().getCallFactory().createCall(null, this.getRuntime().getCallFactory().createMsn("", ""), this.getRuntime().getCallFactory().createCip("", ""));
    }
    if (qname.equalsIgnoreCase(TAG_CALLER)) {
        this.m_iscaller = true;
    }
    if (this.m_iscaller) {
        super.startElement(uri, name, qname, attributes);
        return;
    }
    if (qname.equalsIgnoreCase(TAG_UUID)) {
        this.m_call.setUUID(attributes.getValue(ATTRIBUTE_VALUE));
    }
    if (qname.equalsIgnoreCase(TAG_DATE)) {
        this.m_call.setDate(new Date(Long.parseLong(attributes.getValue(ATTRIBUTE_VALUE))));
    }
    if (qname.equalsIgnoreCase(TAG_CIP)) {
        ICip cip = this.m_call.getCIP();
        cip.setCIP(attributes.getValue(ATTRIBUTE_VALUE));
        cip.setAdditional(this.getRuntime().getCipManager().getCipLabel(cip, this.getLanguage()));
        this.m_call.setCIP(cip);
    }
    if (qname.equalsIgnoreCase(TAG_MSN)) {
        IMsn msn = this.m_call.getMSN();
        msn.setMSN(attributes.getValue(ATTRIBUTE_VALUE));
        msn.setAdditional(decode(attributes.getValue(ATTRIBUTE_ADDITIONAL)));
        this.m_call.setMSN(msn);
    }
    if (qname.equalsIgnoreCase(TAG_ATTRIBUTE)) {
        IAttribute att = this.getRuntime().getCallerFactory().createAttribute(attributes.getValue(ATTRIBUTE_NAME), decode(attributes.getValue(ATTRIBUTE_VALUE)));
        this.m_call.setAttribute(att);
    }
}
Also used : ICip(de.janrufmonitor.framework.ICip) IAttribute(de.janrufmonitor.framework.IAttribute) IMsn(de.janrufmonitor.framework.IMsn) Date(java.util.Date)

Aggregations

ICip (de.janrufmonitor.framework.ICip)20 IMsn (de.janrufmonitor.framework.IMsn)17 ICaller (de.janrufmonitor.framework.ICaller)14 IPhonenumber (de.janrufmonitor.framework.IPhonenumber)13 Date (java.util.Date)13 ICall (de.janrufmonitor.framework.ICall)10 IAttributeMap (de.janrufmonitor.framework.IAttributeMap)8 IAttribute (de.janrufmonitor.framework.IAttribute)6 IName (de.janrufmonitor.framework.IName)6 IRuntime (de.janrufmonitor.runtime.IRuntime)4 ICallList (de.janrufmonitor.framework.ICallList)3 IEventBroker (de.janrufmonitor.framework.event.IEventBroker)3 AttributeFilter (de.janrufmonitor.repository.filter.AttributeFilter)3 DateFilter (de.janrufmonitor.repository.filter.DateFilter)3 ItemCountFilter (de.janrufmonitor.repository.filter.ItemCountFilter)3 ParseException (java.text.ParseException)3 SimpleDateFormat (java.text.SimpleDateFormat)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 IEvent (de.janrufmonitor.framework.event.IEvent)2