/***
 * Excerpted from "Domain-Driven Design Using Naked Objects",
 * published by The Pragmatic Bookshelf.
 * Copyrights apply to this code. It may not be used to create training material, 
 * courses, books, articles, and the like. Contact us if you are in doubt.
 * We make no guarantees that this code is fit for any purpose. 
 * Visit http://www.pragmaticprogrammer.com/titles/dhnako for more book information.
***/
package com.pragprog.dhnako.carserv.wicket.app;

import java.util.Map;
import java.util.TreeMap;

import org.nakedobjects.applib.profiles.Perspective;
import org.nakedobjects.applib.profiles.Profile;
import org.nakedobjects.applib.profiles.ProfileService;

public final class ProfileServiceNoop implements ProfileService {
	public class ProfileNoop implements Profile {
		private Map<String, Perspective> perspectives = new TreeMap<String, Perspective>(); 
		public void addToOptions(String name, String value) {
		}
		public void addToPerspectives(Perspective perspective) {
			PerspectiveNoop perspectiveNoop = (PerspectiveNoop) perspective;
			perspectives.put(perspectiveNoop.getName(), perspective);
		}
		public Perspective getPerspective(String name) {
			return perspectives.get(name);
		}
		public Perspective newPerspective(String name) {
			return new PerspectiveNoop(name);
		}
	}

	public Profile newUserProfile() {
		return new ProfileNoop(); // only to avoid NullPointerExceptions
	}

	public Profile newUserProfile(Profile profile) {
		return new ProfileNoop(); // only to avoid NullPointerExceptions
	}

	public void saveAsDefault(Profile profile) {
	}

	public void saveForUser(String name, Profile profile) {
	}
}