public static String getTextSetting(String key, String workgroup) { SettingsManager settingsManager = SettingsManager.getInstance(); ChatSetting chatSettings = settingsManager.getChatSetting(key, workgroup); Date now = new Date(); String date = DATE_FORMATTER.format(now); String time = TIME_FORMATTER.format(now); if (chatSettings == null) { return ""; } String value = chatSettings.getValue(); value = WebUtils.replace(value, "${time}", time); value = WebUtils.replace(value, "${date}", date); return value; }
public static String getTextSetting(String key, String workgroup) { WorkgroupManager settingsManager = WorkgroupManager.getInstance(); ChatSetting chatSettings = settingsManager.getChatSetting(key, workgroup); Date now = new Date(); String date = DATE_FORMATTER.format(now); String time = TIME_FORMATTER.format(now); if (chatSettings == null) { return ""; } String value = chatSettings.getValue(); value = FormUtils.replace(value, "${time}", time); value = FormUtils.replace(value, "${date}", date); return value; }
public byte[] getImageFromMap(String imageName, String workgroupName) { ChatSettings chatSettings = (ChatSettings)this.chatSettings.get(workgroupName); ChatSetting imageSetting = chatSettings.getChatSetting(imageName); if (imageSetting == null || imageSetting.getValue() == null) { return null; } else { byte[] bytes = Base64.decode(imageSetting.getValue()); return bytes; } }
/** * Returns a single chat setting based on it's identified key. * * @param key the key to find. * @return the ChatSetting if found, otherwise false. * @throws XMPPException if an error occurs while getting information from the server. * @throws SmackException */ public ChatSetting getChatSetting(String key) throws XMPPException, SmackException { ChatSettings chatSettings = getChatSettings(key, -1); return chatSettings.getFirstEntry(); }