}
public void createView(Subject user, EntityContext context, String viewName) throws MeasurementViewException {
String key = context.getLegacyKey();
MeasurementPreferences measurementPreferences = new MeasurementPreferences(user);
MetricViewsPreferences prefs = measurementPreferences.getMetricViews(key);
if (prefs.views.contains(viewName)) {
throw new MeasurementViewException("View name already in use: '" + viewName + "'");
}
prefs.views.add(viewName);
measurementPreferences.setMetricViews(prefs, key);