Search in sources :

Example 1 with ICallerImporter

use of de.janrufmonitor.repository.imexport.ICallerImporter in project janrufmonitor by tbrandt77.

the class ConsoleImport method execute.

public void execute() throws Exception {
    this.isExecuting = true;
    if (this.getExecuteParams().length != 1) {
        System.out.println("ERROR: Paramters are invalid. Please specify a valid module for installation.");
        this.isExecuting = false;
        return;
    }
    String filename = this.getExecuteParams()[0];
    IImExporter imp = ImExportFactory.getInstance().getImporter("OldDatFileCallerImporter");
    if (imp != null && imp instanceof ICallerImporter) {
        ((ICallerImporter) imp).setFilename(filename);
        ICallerList cl = ((ICallerImporter) imp).doImport();
        ICallerManager mgr = this.getRuntime().getCallerManagerFactory().getCallerManager("CallerDirectory");
        if (mgr != null && mgr.isActive() && mgr.isSupported(IWriteCallerRepository.class)) {
            ((IWriteCallerRepository) mgr).setCaller(cl);
            System.out.println("INFO: Successfully imported " + cl.size() + " caller entries.");
        } else {
            System.out.println("ERROR: Caller manager is missing.");
        }
    } else {
        System.out.println("ERROR: import filter for DAT files is missing.");
    }
    this.isExecuting = false;
}
Also used : ICallerList(de.janrufmonitor.framework.ICallerList) IWriteCallerRepository(de.janrufmonitor.repository.types.IWriteCallerRepository) IImExporter(de.janrufmonitor.repository.imexport.IImExporter) ICallerImporter(de.janrufmonitor.repository.imexport.ICallerImporter) ICallerManager(de.janrufmonitor.repository.ICallerManager)

Aggregations

ICallerList (de.janrufmonitor.framework.ICallerList)1 ICallerManager (de.janrufmonitor.repository.ICallerManager)1 ICallerImporter (de.janrufmonitor.repository.imexport.ICallerImporter)1 IImExporter (de.janrufmonitor.repository.imexport.IImExporter)1 IWriteCallerRepository (de.janrufmonitor.repository.types.IWriteCallerRepository)1