String sid = top.getAttributeValue("id");
UUID id = sid==null ? UUID.randomUUID() : UUID.fromString(sid);
String name = top.getAttributeValue("name");
try {
Role rootRole = db.getRole(AuthDB.REALM_ROOT_ROLE);
if (rootRole==null) {
getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
return new StringRepresentation("Realm root role not found.");
}
Role editorRole = db.getRole(AuthDB.EDITOR_ROLE);
if (editorRole==null) {
getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
return new StringRepresentation("Editor role not found.");
}
Realm realm = db.getRealm(name);