use of org.opennms.netmgt.config.users.Header in project opennms by OpenNMS.
the class UserManager method _saveCurrent.
/**
* Saves into "users.xml" file
*/
private void _saveCurrent() throws Exception {
final List<User> users = new ArrayList<>(m_users.values());
final Userinfo userinfo = new Userinfo();
userinfo.setUsers(users);
final Header header = oldHeader;
if (header != null) {
header.setCreated(EventConstants.formatToString(new Date()));
userinfo.setHeader(header);
}
oldHeader = header;
// marshal to a string first, then write the string to the file. This
// way the original configuration
// isn't lost if the XML from the marshal is hosed.
final StringWriter stringWriter = new StringWriter();
JaxbUtils.marshal(userinfo, stringWriter);
final String writerString = stringWriter.toString();
saveXML(writerString);
}