Search in sources :

Example 1 with FilterCipPage

use of de.janrufmonitor.ui.jface.wizards.pages.FilterCipPage 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)

Aggregations

IAttributeMap (de.janrufmonitor.framework.IAttributeMap)1 ICip (de.janrufmonitor.framework.ICip)1 IMsn (de.janrufmonitor.framework.IMsn)1 IPhonenumber (de.janrufmonitor.framework.IPhonenumber)1 AttributeFilter (de.janrufmonitor.repository.filter.AttributeFilter)1 CipFilter (de.janrufmonitor.repository.filter.CipFilter)1 ItemCountFilter (de.janrufmonitor.repository.filter.ItemCountFilter)1 MsnFilter (de.janrufmonitor.repository.filter.MsnFilter)1 IFilterManager (de.janrufmonitor.ui.jface.application.IFilterManager)1 JournalFilterManager (de.janrufmonitor.ui.jface.application.journal.JournalFilterManager)1 FilterCallTypePage (de.janrufmonitor.ui.jface.wizards.pages.FilterCallTypePage)1 FilterCipPage (de.janrufmonitor.ui.jface.wizards.pages.FilterCipPage)1 FilterDatePage (de.janrufmonitor.ui.jface.wizards.pages.FilterDatePage)1 FilterItemCountPage (de.janrufmonitor.ui.jface.wizards.pages.FilterItemCountPage)1 FilterMsnPage (de.janrufmonitor.ui.jface.wizards.pages.FilterMsnPage)1 FilterNamePage (de.janrufmonitor.ui.jface.wizards.pages.FilterNamePage)1 FilterPhonesPage (de.janrufmonitor.ui.jface.wizards.pages.FilterPhonesPage)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 List (java.util.List)1