use of de.janrufmonitor.repository.types.ILocalRepository in project janrufmonitor by tbrandt77.
the class OpenJournalAction method updateLastOpenJournalEntries.
private void updateLastOpenJournalEntries(ICallManager mgr) {
List cms = new ArrayList();
Properties config = getRuntime().getConfigManagerFactory().getConfigManager().getProperties(LastOpenJournalAction.NAMESPACE);
String lastOpen = config.getProperty(JournalConfigConst.CFG_LASTOPEN, "");
if (lastOpen.length() > 0) {
String[] locm = lastOpen.split(";");
if (locm != null && locm.length > 0) {
String l = null;
for (int i = 0; i < locm.length; i++) {
l = locm[i];
cms.add(l);
}
}
}
if (mgr instanceof ILocalRepository) {
String newcm = mgr.getManagerID() + "%" + ((ILocalRepository) mgr).getFile();
if (!cms.contains(newcm))
cms.add(0, newcm);
}
if (mgr instanceof IRemoteRepository) {
String newcm = mgr.getManagerID();
if (!cms.contains(newcm))
cms.add(0, newcm);
}
cms = cms.subList(0, Math.min(cms.size(), 5));
StringBuffer sb = new StringBuffer();
for (int i = 0; i < cms.size(); i++) {
sb.append(cms.get(i));
sb.append(";");
}
config.setProperty(JournalConfigConst.CFG_LASTOPEN, sb.toString());
getRuntime().getConfigManagerFactory().getConfigManager().setProperties(LastOpenJournalAction.NAMESPACE, config);
getRuntime().getConfigurableNotifier().notifyByNamespace(Journal.NAMESPACE);
}
use of de.janrufmonitor.repository.types.ILocalRepository in project janrufmonitor by tbrandt77.
the class OpenJournalAction method getSubActions.
public IAction[] getSubActions() {
List localCallManagers = getRuntime().getCallManagerFactory().getTypedCallManagers(ILocalRepository.class);
List remoteCallManagers = getRuntime().getCallManagerFactory().getTypedCallManagers(IRemoteRepository.class);
IAction[] actions = new IAction[localCallManagers.size() + (remoteCallManagers.size() > 0 ? remoteCallManagers.size() : 0)];
for (int i = 0; i < localCallManagers.size(); i++) {
actions[i] = new LocalAction((ILocalRepository) localCallManagers.get(i));
}
if (remoteCallManagers.size() > 0)
for (int i = 0; i < remoteCallManagers.size(); i++) {
actions[i + localCallManagers.size()] = new RemoteAction((IRemoteRepository) remoteCallManagers.get(i));
}
return actions;
}
use of de.janrufmonitor.repository.types.ILocalRepository in project janrufmonitor by tbrandt77.
the class Editor method getTitleExtension.
protected String getTitleExtension() {
String id = this.m_configuration.getProperty(CFG_REPOSITORY, "");
if (id != null && id.length() > 0) {
ICallerManager cm = getRuntime().getCallerManagerFactory().getCallerManager(id);
if (cm != null && cm.isSupported(ILocalRepository.class)) {
String title = "";
if (cm instanceof IConfigurable) {
title = getI18nManager().getString(((IConfigurable) cm).getNamespace(), "title", "label", getLanguage()) + " - ";
}
title += ((ILocalRepository) cm).getFile();
return title;
}
if (cm != null && cm.isSupported(IRemoteRepository.class)) {
String title = "";
if (cm instanceof IConfigurable) {
title = getI18nManager().getString(((IConfigurable) cm).getNamespace(), "title", "label", getLanguage());
}
return title;
}
}
return null;
}
use of de.janrufmonitor.repository.types.ILocalRepository in project janrufmonitor by tbrandt77.
the class OpenEditorAction method updateLastOpenEditorEntries.
private void updateLastOpenEditorEntries(ICallerManager mgr) {
List cms = new ArrayList();
Properties config = getRuntime().getConfigManagerFactory().getConfigManager().getProperties(LastOpenEditorAction.NAMESPACE);
String lastOpen = config.getProperty(EditorConfigConst.CFG_LASTOPEN, "");
if (lastOpen.length() > 0) {
String[] locm = lastOpen.split(";");
if (locm != null && locm.length > 0) {
String l = null;
for (int i = 0; i < locm.length; i++) {
l = locm[i];
cms.add(l);
}
}
}
if (mgr instanceof ILocalRepository) {
String newcm = mgr.getManagerID() + "%" + ((ILocalRepository) mgr).getFile();
if (!cms.contains(newcm))
cms.add(0, newcm);
}
if (mgr instanceof IRemoteRepository) {
String newcm = mgr.getManagerID();
if (!cms.contains(newcm))
cms.add(0, newcm);
}
cms = cms.subList(0, Math.min(cms.size(), 5));
StringBuffer sb = new StringBuffer();
for (int i = 0; i < cms.size(); i++) {
sb.append(cms.get(i));
sb.append(";");
}
config.setProperty(EditorConfigConst.CFG_LASTOPEN, sb.toString());
getRuntime().getConfigManagerFactory().getConfigManager().setProperties(LastOpenEditorAction.NAMESPACE, config);
getRuntime().getConfigurableNotifier().notifyByNamespace(LastOpenEditorAction.NAMESPACE);
}
use of de.janrufmonitor.repository.types.ILocalRepository in project janrufmonitor by tbrandt77.
the class AbstractPhonesPage method getCaller.
private ICaller getCaller(IPhonenumber pn, List managers) {
if (pn.isClired()) {
return this.getRuntime().getCallerFactory().createCaller(this.getRuntime().getCallerFactory().createName("", ""), this.getRuntime().getCallerFactory().createPhonenumber(true));
}
if (pn.getIntAreaCode().equalsIgnoreCase(IJAMConst.INTERNAL_CALL) && pn.getCallNumber().equalsIgnoreCase(IJAMConst.INTERNAL_CALL_NUMBER_SYMBOL)) {
return (this.getRuntime().getCallerFactory().createCaller(this.getRuntime().getCallerFactory().createName("", ""), this.getRuntime().getCallerFactory().createPhonenumber(IJAMConst.INTERNAL_CALL, "", IJAMConst.INTERNAL_CALL_NUMBER_SYMBOL)));
}
if (managers == null)
managers = this.getActiveCallerManagers();
ICallerManager man = null;
List remoteManagers = new ArrayList();
for (int i = 0; i < managers.size(); i++) {
man = (ICallerManager) managers.get(i);
// first only check local repository managers for performance
if (!(man instanceof ILocalRepository)) {
remoteManagers.add(man);
} else {
try {
if (man != null && man.isActive() && man.isSupported(IIdentifyCallerRepository.class))
return ((IIdentifyCallerRepository) man).getCaller(pn);
} catch (CallerNotFoundException e) {
this.m_logger.warning(e.getMessage());
}
}
}
// check for all non-local repositorymanagers
for (int i = 0; i < remoteManagers.size(); i++) {
man = (ICallerManager) remoteManagers.get(i);
try {
if (man != null && man.isActive() && man.isSupported(IIdentifyCallerRepository.class))
return ((IIdentifyCallerRepository) man).getCaller(pn);
} catch (CallerNotFoundException e) {
this.m_logger.warning(e.getMessage());
}
}
return null;
}
Aggregations