use of org.jdom2.CDATA in project pwm by pwm-project.
the class StringArrayValue method toXmlValues.
public List<Element> toXmlValues(final String valueElementName, final PwmSecurityKey pwmSecurityKey) {
final List<Element> returnList = new ArrayList<>();
for (final String value : this.values) {
final Element valueElement = new Element(valueElementName);
valueElement.addContent(new CDATA(value));
returnList.add(valueElement);
}
return returnList;
}
use of org.jdom2.CDATA in project pwm by pwm-project.
the class VerificationMethodValue method toXmlValues.
@Override
public List<Element> toXmlValues(final String valueElementName, final PwmSecurityKey pwmSecurityKey) {
final Element valueElement = new Element(valueElementName);
valueElement.addContent(new CDATA(JsonUtil.serialize(value)));
return Collections.singletonList(valueElement);
}
use of org.jdom2.CDATA in project gocd by gocd.
the class BuildLogElement method setTaskError.
public void setTaskError(String errorMessage) {
Element msg = new Element("message");
msg.addContent(new CDATA(errorMessage));
msg.setAttribute("priority", "error");
buildTask.addContent(msg);
}
use of org.jdom2.CDATA in project pwm by pwm-project.
the class StoredConfigurationImpl method writeLocaleBundleMap.
public void writeLocaleBundleMap(final String bundleName, final String keyName, final Map<String, String> localeMap) {
ResourceBundle theBundle = null;
for (final PwmLocaleBundle bundle : PwmLocaleBundle.values()) {
if (bundle.getTheClass().getName().equals(bundleName)) {
theBundle = ResourceBundle.getBundle(bundleName);
}
}
if (theBundle == null) {
LOGGER.info("ignoring unknown locale bundle for bundle=" + bundleName + ", key=" + keyName);
return;
}
if (theBundle.getString(keyName) == null) {
LOGGER.info("ignoring unknown key for bundle=" + bundleName + ", key=" + keyName);
return;
}
resetLocaleBundleMap(bundleName, keyName);
if (localeMap == null || localeMap.isEmpty()) {
LOGGER.info("cleared locale bundle map for bundle=" + bundleName + ", key=" + keyName);
return;
}
preModifyActions();
changeLog.updateChangeLog(bundleName, keyName, localeMap);
try {
domModifyLock.writeLock().lock();
final Element localeBundleElement = new Element("localeBundle");
localeBundleElement.setAttribute("bundle", bundleName);
localeBundleElement.setAttribute("key", keyName);
for (final Map.Entry<String, String> entry : localeMap.entrySet()) {
final String locale = entry.getKey();
final String value = entry.getValue();
final Element valueElement = new Element("value");
if (locale != null && locale.length() > 0) {
valueElement.setAttribute("locale", locale);
}
valueElement.setContent(new CDATA(value));
localeBundleElement.addContent(valueElement);
}
localeBundleElement.setAttribute(XML_ATTRIBUTE_MODIFY_TIME, JavaHelper.toIsoDate(Instant.now()));
document.getRootElement().addContent(localeBundleElement);
} finally {
domModifyLock.writeLock().unlock();
}
}
use of org.jdom2.CDATA in project pwm by pwm-project.
the class LocalizedStringArrayValue method toXmlValues.
public List<Element> toXmlValues(final String valueElementName, final PwmSecurityKey pwmSecurityKey) {
final List<Element> returnList = new ArrayList<>();
for (final Map.Entry<String, List<String>> entry : values.entrySet()) {
final String locale = entry.getKey();
for (final String value : entry.getValue()) {
final Element valueElement = new Element(valueElementName);
valueElement.addContent(new CDATA(value));
if (locale != null && locale.length() > 0) {
valueElement.setAttribute("locale", locale);
}
returnList.add(valueElement);
}
}
return returnList;
}
Aggregations