List of usage examples for org.apache.commons.configuration DataConfiguration getBoolean
public boolean getBoolean(String key)
From source file:gov.nih.nci.caarray.web.helper.EmailHelper.java
/** * @param registrationRequest request/*from w w w.j a va 2 s . c o m*/ * @throws MessagingException on other error */ public static void registerEmail(RegistrationRequest registrationRequest) throws MessagingException { DataConfiguration config = ConfigurationHelper.getConfiguration(); if (!config.getBoolean(ConfigParamEnum.SEND_CONFIRM_EMAIL.name())) { return; } String subject = config.getString(ConfigParamEnum.CONFIRM_EMAIL_SUBJECT.name()); String from = config.getString(ConfigParamEnum.EMAIL_FROM.name()); String mailBodyPattern = config.getString(ConfigParamEnum.CONFIRM_EMAIL_CONTENT.name()); String mailBody = MessageFormat.format(mailBodyPattern, registrationRequest.getId()); EmailUtil.sendMail(Collections.singletonList(registrationRequest.getEmail()), from, subject, mailBody); }
From source file:gov.nih.nci.caarray.web.helper.EmailHelper.java
/** * @param registrationRequest request/*from w w w . j av a 2s . c o m*/ * @throws MessagingException on error */ public static void registerEmailAdmin(RegistrationRequest registrationRequest) throws MessagingException { DataConfiguration config = ConfigurationHelper.getConfiguration(); if (!config.getBoolean(ConfigParamEnum.SEND_ADMIN_EMAIL.name())) { return; } String subject = config.getString(ConfigParamEnum.REG_EMAIL_SUBJECT.name()); String from = registrationRequest.getEmail(); String admin = config.getString(ConfigParamEnum.REG_EMAIL_TO.name()); String mailBody = "Registration Request:\n" + "First Name: " + registrationRequest.getFirstName() + "\n" + "Middle Initial: " + registrationRequest.getMiddleInitial() + "\n" + "Last Name: " + registrationRequest.getLastName() + "\n" + "Email: " + registrationRequest.getEmail() + "\n" + "Phone: " + registrationRequest.getPhone() + "\n" + "Fax: " + registrationRequest.getFax() + "\n" + "Organization: " + registrationRequest.getOrganization() + "\n" + "Address1: " + registrationRequest.getAddress1() + "\n" + "Address2: " + registrationRequest.getAddress2() + "\n" + "City: " + registrationRequest.getCity() + "\n" + "State: " + registrationRequest.getState() + "\n" + "Province: " + registrationRequest.getProvince() + "\n" + "Country: " + registrationRequest.getCountry().getPrintableName() + "\n" + "Zip: " + registrationRequest.getZip() + "\n" + "Role: " + registrationRequest.getRole(); EmailUtil.sendMail(Collections.singletonList(admin), from, subject, mailBody); }
From source file:pl.otros.logview.gui.message.pattern.StyleProperties.java
public static Style getStyle(StyleContext styleContext, DataConfiguration styleConfig, String styleName, int group) { Style style = styleContext.addStyle(styleName, styleContext.getStyle(StyleContext.DEFAULT_STYLE)); String groupSuffix = "." + group; if (group <= 0) { groupSuffix = ""; }//from w w w .j ava 2 s . c o m String fontFamily = styleConfig.getString(PROP_FONT_FAMILY + groupSuffix, ""); if (fontFamily.trim().length() > 0) { StyleConstants.setFontFamily(style, styleConfig.getString(PROP_FONT_FAMILY + groupSuffix)); } if (styleConfig.getString(PROP_FONT_SIZE + groupSuffix, "").trim().length() > 0) { StyleConstants.setFontSize(style, styleConfig.getInt(PROP_FONT_SIZE + groupSuffix)); } if (styleConfig.getString(PROP_FONT_BOLD + groupSuffix, "").trim().length() > 0) { StyleConstants.setBold(style, styleConfig.getBoolean(PROP_FONT_BOLD + groupSuffix)); } if (styleConfig.getString(PROP_FONT_ITALIC + groupSuffix, "").trim().length() > 0) { StyleConstants.setItalic(style, styleConfig.getBoolean(PROP_FONT_ITALIC + groupSuffix)); } if (styleConfig.getString(PROP_FONT_UNDERLINE + groupSuffix, "").trim().length() > 0) { StyleConstants.setUnderline(style, styleConfig.getBoolean(PROP_FONT_UNDERLINE + groupSuffix)); } if (styleConfig.getString(PROP_BACKGROUND + groupSuffix, "").trim().length() > 0) { StyleConstants.setBackground(style, styleConfig.getColor(PROP_BACKGROUND + groupSuffix)); } if (styleConfig.getString(PROP_FOREGROUND + groupSuffix, "").trim().length() > 0) { StyleConstants.setForeground(style, styleConfig.getColor(PROP_FOREGROUND + groupSuffix)); } return style; }