de.novanic.eventservice.service.registry.user
Class DomainUserMapping

java.lang.Object
  extended by de.novanic.eventservice.service.registry.user.DomainUserMapping

public class DomainUserMapping
extends java.lang.Object

DomainUserMapping manages the allocation of users (UserInfo) to domains (Domain) and provides several methods for access and modifications.

Author:
sstrohschein
Date: 09.09.2009
Time: 15:04:36

Constructor Summary
DomainUserMapping()
          Creates a new, empty DomainUserMapping.
 
Method Summary
 void addUser(Domain aDomain, UserInfo aUserInfo)
          Adds a new user to a domain and creates a new domain entry when the domain is new to the DomainUserMapping.
 java.util.Set<Domain> getDomains()
          Returns all domains which have added users
 java.util.Set<Domain> getDomains(UserInfo aUserInfo)
          Returns all domains to a user.
 java.util.Set<UserInfo> getUsers(Domain aDomain)
          Returns all users of a domain.
 boolean isUserContained(Domain aDomain, UserInfo aUserInfo)
          Checks if a user is added to the domain.
 boolean isUserContained(UserInfo aUserInfo)
          Checks if a user is added to a domain.
 boolean removeUser(Domain aDomain, UserInfo aUserInfo)
          Removes a user from a specified domain and removes the domain when no other users are added to the domain.
 void removeUser(UserInfo aUserInfo)
          Removes a user from all domains and removes the domains when no other users are added to the domain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainUserMapping

public DomainUserMapping()
Creates a new, empty DomainUserMapping.

Method Detail

addUser

public void addUser(Domain aDomain,
                    UserInfo aUserInfo)
Adds a new user to a domain and creates a new domain entry when the domain is new to the DomainUserMapping.

Parameters:
aDomain - domain to add the user to
aUserInfo - user

removeUser

public void removeUser(UserInfo aUserInfo)
Removes a user from all domains and removes the domains when no other users are added to the domain.

Parameters:
aUserInfo - user

removeUser

public boolean removeUser(Domain aDomain,
                          UserInfo aUserInfo)
Removes a user from a specified domain and removes the domain when no other users are added to the domain.

Parameters:
aDomain - domain
aUserInfo - user
Returns:
true when the user is removed from the domain, otherwise false

getDomains

public java.util.Set<Domain> getDomains()
Returns all domains which have added users

Returns:
all domains which have added users

getDomains

public java.util.Set<Domain> getDomains(UserInfo aUserInfo)
Returns all domains to a user.

Parameters:
aUserInfo - user
Returns:
all domains where the user is added

getUsers

public java.util.Set<UserInfo> getUsers(Domain aDomain)
Returns all users of a domain.

Parameters:
aDomain - domain
Returns:
all users of the domain

isUserContained

public boolean isUserContained(UserInfo aUserInfo)
Checks if a user is added to a domain.

Parameters:
aUserInfo - user
Returns:
true when the user is added to a domain, otherwise false

isUserContained

public boolean isUserContained(Domain aDomain,
                               UserInfo aUserInfo)
Checks if a user is added to the domain.

Parameters:
aDomain - domain
aUserInfo - user
Returns:
true when the user is added to the domain, otherwise false