use of de.janrufmonitor.framework.configuration.IConfigManager in project janrufmonitor by tbrandt77.
the class Formatter method getParsedDate.
/**
* Parses date object in the specified text representation.
* The wildcard definitions are taken for parsing.
*
* @param text text to parse
* @param date object to get the information from
* @return parsed text
* @deprecated
*/
private String getParsedDate(String text, Date date) {
if (date == null)
return text;
IConfigManager cfg = this.m_runtime.getConfigManagerFactory().getConfigManager();
if (this.containString(text, IJAMConst.GLOBAL_VARIABLE_DATE)) {
SimpleDateFormat formatter = new SimpleDateFormat(cfg.getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_VARIABLE_DATE));
String datetext = formatter.format(date);
text = StringUtils.replaceString(text, IJAMConst.GLOBAL_VARIABLE_DATE, datetext);
text = text.trim();
}
if (this.containString(text, IJAMConst.GLOBAL_VARIABLE_TIME)) {
SimpleDateFormat formatter = new SimpleDateFormat(cfg.getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_VARIABLE_TIME));
String timetext = formatter.format(date);
text = StringUtils.replaceString(text, IJAMConst.GLOBAL_VARIABLE_TIME, timetext);
text = text.trim();
}
return text;
}
use of de.janrufmonitor.framework.configuration.IConfigManager in project janrufmonitor by tbrandt77.
the class Formatter method getParsedCaller.
/**
* Parses caller object in the specified text representation.
* The wildcard definitions are taken for parsing.
*
* @param text text to parse
* @param caller object to get the information from
* @return parsed text
* @deprecated
*/
public String getParsedCaller(String text, ICaller caller) {
if (caller == null)
return text;
IConfigManager cfg = this.m_runtime.getConfigManagerFactory().getConfigManager();
// komplex types
String callernameExpression = cfg.getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_VARIABLE_CALLERNAME);
text = StringUtils.replaceString(text, IJAMConst.GLOBAL_VARIABLE_CALLERNAME, callernameExpression);
text = this.getParsedPhonenumber(text, caller.getPhoneNumber());
text = this.getParsedAttributes(text, caller.getAttributes(), true);
// changed: 2005/11/11: deprecated method is processed last
text = this.getParsedName(text, caller.getName());
text = this.cleanString(text.trim());
return text.trim();
}
use of de.janrufmonitor.framework.configuration.IConfigManager in project janrufmonitor by tbrandt77.
the class GoogleContactsProxy method ensureEditorConfigurationCatergories.
public void ensureEditorConfigurationCatergories(List subfolders) {
List ol = new ArrayList();
IConfigManager mgr = this.getRuntime().getConfigManagerFactory().getConfigManager();
String value = mgr.getProperty("ui.jface.application.editor.Editor", "categories");
if (value.trim().length() > 0) {
String[] values = value.split(",");
for (int i = 0; i < values.length; i++) {
ol.add(values[i]);
}
}
for (int i = 0; i < subfolders.size(); i++) {
if (!ol.contains(subfolders.get(i))) {
ol.add(subfolders.get(i));
// mgr.setProperty("ui.jface.application.editor.Editor", "filter_cat_ol"+i, "(5,category="+subfolders.get(i)+")");
}
}
value = "";
for (int i = 0; i < ol.size(); i++) {
value += ol.get(i) + ",";
}
mgr.setProperty("ui.jface.application.editor.Editor", "categories", value);
mgr.saveConfiguration();
getRuntime().getConfigurableNotifier().notifyByNamespace("ui.jface.application.editor.Editor");
}
use of de.janrufmonitor.framework.configuration.IConfigManager in project janrufmonitor by tbrandt77.
the class OutlookContactProxy method ensureEditorConfigurationCatergories.
public void ensureEditorConfigurationCatergories(List subfolders) {
List ol = new ArrayList();
IConfigManager mgr = this.getRuntime().getConfigManagerFactory().getConfigManager();
String value = mgr.getProperty("ui.jface.application.editor.Editor", "categories");
if (value.trim().length() > 0) {
String[] values = value.split(",");
for (int i = 0; i < values.length; i++) {
ol.add(values[i]);
}
}
for (int i = 0; i < subfolders.size(); i++) {
if (!ol.contains(subfolders.get(i))) {
ol.add(subfolders.get(i));
// mgr.setProperty("ui.jface.application.editor.Editor", "filter_cat_ol"+i, "(5,category="+subfolders.get(i)+")");
}
}
value = "";
for (int i = 0; i < ol.size(); i++) {
value += ol.get(i) + ",";
}
mgr.setProperty("ui.jface.application.editor.Editor", "categories", value);
mgr.saveConfiguration();
getRuntime().getConfigurableNotifier().notifyByNamespace("ui.jface.application.editor.Editor");
}
use of de.janrufmonitor.framework.configuration.IConfigManager in project janrufmonitor by tbrandt77.
the class InfHandler method removeInfData.
public void removeInfData(Properties infData) {
try {
IConfigManager cpm = PIMRuntime.getInstance().getConfigManagerFactory().getConfigManager();
Iterator iter = infData.keySet().iterator();
String key = null;
while (iter.hasNext()) {
key = (String) iter.next();
StringTokenizer st = new StringTokenizer(key, this.NAMESPACE_SEPARATOR);
String namespace = st.nextToken();
String parameter = st.nextToken();
String metainfo = st.nextToken();
if (namespace.startsWith("-")) {
String value = infData.getProperty(key);
namespace = namespace.substring(1);
this.m_logger.info("Detected module config removal.");
this.m_logger.info("Adding " + namespace + "\\:" + parameter + "\\:" + metainfo);
String v = cpm.getProperty(namespace, parameter, metainfo);
if (v == null)
v = "";
// value += infData.getProperty(key);
v = this.concat(v, infData.getProperty(key));
cpm.setProperty(namespace, parameter, metainfo, value, true);
} else if (namespace.startsWith("+")) {
namespace = namespace.substring(1);
this.m_logger.info("Detected module config concatenation.");
this.m_logger.info("De-Concatenating values for " + namespace + "\\:" + parameter + "\\:" + metainfo);
String value = cpm.getProperty(namespace, parameter, metainfo);
value = StringUtils.replaceString(value, infData.getProperty(key, "null"), "");
if (value == null)
value = "";
cpm.setProperty(namespace, parameter, metainfo, value, true);
} else if (namespace.startsWith("~")) {
namespace = namespace.substring(1);
this.m_logger.info("Detected module config restore.");
this.m_logger.info("Restoring values for " + namespace + "\\:" + parameter + "\\:" + metainfo);
String value = cpm.getProperty("_" + namespace, parameter, metainfo);
if (value == null)
value = "";
if (value.length() > 0) {
// config restore means allways overwrite !!
cpm.setProperty(namespace, parameter, metainfo, value, true);
} else {
cpm.removeProperty(namespace, parameter, metainfo);
}
cpm.removeProperty("_" + namespace, parameter, metainfo);
} else if (namespace.startsWith("?")) {
namespace = namespace.substring(1);
this.m_logger.info("Detected module config add only if not present feature.");
this.m_logger.info("Removing value for " + namespace + "\\:" + parameter + "\\:" + metainfo);
cpm.removeProperty(namespace, parameter, metainfo);
} else if (namespace.startsWith("%")) {
namespace = namespace.substring(1);
this.m_logger.info("Detected module config add always feature.");
this.m_logger.info("Removing value for " + namespace + "\\:" + parameter + "\\:" + metainfo);
cpm.removeProperty(namespace, parameter, metainfo);
} else {
cpm.removeProperty(namespace, parameter, metainfo);
}
}
cpm.saveConfiguration();
} catch (NullPointerException ex) {
this.m_logger.severe("Configuration is invalid: " + ex.getMessage());
} catch (NoSuchElementException ex) {
this.m_logger.severe("Configuration is invalid: " + ex.getMessage());
}
}
Aggregations