001    package org.nakedobjects.applib.fixtures;
002    
003    import org.nakedobjects.applib.profiles.Profile;
004    import org.nakedobjects.applib.profiles.ProfileService;
005    import org.nakedobjects.applib.profiles.ProfileServiceAware;
006    
007    public abstract class UserProfileFixture extends AbstractFixture implements ProfileServiceAware {
008            
009        private ProfileService profileService;
010    
011        public UserProfileFixture() {
012                    super(FixtureType.USER_PROFILE);
013            }
014        
015        public void setService(ProfileService profileService) {
016            this.profileService = profileService;
017        }
018    
019        public final void install() {
020            installProfiles();
021        }
022    
023        protected abstract void installProfiles();
024    
025        protected Profile newUserProfile() {
026            return profileService.newUserProfile();
027        }
028    
029        protected Profile newUserProfile(Profile profile) {
030            return profileService.newUserProfile(profile);
031        }
032    
033        protected void saveForUser(String name, Profile profile) {
034            profileService.saveForUser(name, profile);
035        }
036    
037        protected void saveAsDefault(Profile profile) {  
038            profileService.saveAsDefault(profile);
039        }
040    
041    }
042    
043    // Copyright (c) Naked Objects Group Ltd.