use of password.pwm.config.CustomLinkConfiguration in project pwm by pwm-project.
the class CustomLinkValue method toDebugString.
public String toDebugString(final Locale locale) {
if (values != null && !values.isEmpty()) {
final StringBuilder sb = new StringBuilder();
for (final CustomLinkConfiguration formRow : values) {
sb.append("Link Name:").append(formRow.getName()).append("\n");
sb.append(" Type:").append(formRow.getType());
sb.append("\n");
sb.append(" Description:").append(JsonUtil.serializeMap(formRow.getLabels())).append("\n");
sb.append(" New Window:").append(formRow.isCustomLinkNewWindow()).append("\n");
sb.append(" Url:").append(formRow.getCustomLinkUrl()).append("\n");
}
return sb.toString();
} else {
return "";
}
}
use of password.pwm.config.CustomLinkConfiguration in project pwm by pwm-project.
the class CustomLinkValue method toXmlValues.
public List<Element> toXmlValues(final String valueElementName, final PwmSecurityKey pwmSecurityKey) {
final List<Element> returnList = new ArrayList<>();
for (final CustomLinkConfiguration value : values) {
final Element valueElement = new Element(valueElementName);
valueElement.addContent(JsonUtil.serialize(value));
returnList.add(valueElement);
}
return returnList;
}
use of password.pwm.config.CustomLinkConfiguration in project pwm by pwm-project.
the class CustomLinkValue method factory.
public static StoredValueFactory factory() {
return new StoredValueFactory() {
public CustomLinkValue fromJson(final String input) {
if (input == null) {
return new CustomLinkValue(Collections.emptyList());
} else {
List<CustomLinkConfiguration> srcList = JsonUtil.deserialize(input, new TypeToken<List<CustomLinkConfiguration>>() {
});
srcList = srcList == null ? Collections.emptyList() : srcList;
while (srcList.contains(null)) {
srcList.remove(null);
}
return new CustomLinkValue(Collections.unmodifiableList(srcList));
}
}
public CustomLinkValue fromXmlElement(final Element settingElement, final PwmSecurityKey key) throws PwmOperationalException {
final List valueElements = settingElement.getChildren("value");
final List<CustomLinkConfiguration> values = new ArrayList<>();
for (final Object loopValue : valueElements) {
final Element loopValueElement = (Element) loopValue;
final String value = loopValueElement.getText();
if (value != null && value.length() > 0 && loopValueElement.getAttribute("locale") == null) {
values.add(JsonUtil.deserialize(value, CustomLinkConfiguration.class));
}
}
return new CustomLinkValue(values);
}
};
}
Aggregations