use of de.janrufmonitor.repository.types.IRemoteRepository in project janrufmonitor by tbrandt77.
the class NewJournalAction 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);
}
Aggregations