uc 21 v2 - yshehab/SchoolRoomBooking GitHub Wiki

21. Add a new member to an existing organization.Version 2

TO DO - revise

Coordinating method

public void addMember(Name aName, 
                      Address anAddress, 
                      Email anEmail, 
                      Organization anOrganization)

Object diagram for a typical scenario.

Walk-through for this scenario

Given: The Name object aName, the Address object anAddress, the Email object anEmail and the Organization object organization35.

  1. Check that no Member object with the supplied attributes exists (linked to any Schools or Organizations in the system)
    As the check suceeds:
  2. A new Member object member6 is created with the supplied attributes
  3. member6 is linked to organization35

Sequence diagram for this scenario

Notes on alternative scenario

If the Member already exists then throw an exception

Updates to implementation model

Classes

Class LettingCoord

Links
private collection <School> school

References a collection of all linked School objects

private collection <Organization> organizations

References a collection of all linked Organization objects

Methods
public void addMember(Name aName, 
                      Address anAddress, 
                      Email anEmail, 
                      Organization anOrganization)

Postcondition: If a Member obect exists in the system with the supplied attributes an exception is thrown, otherwise a new Member object, aMember, is created with the supplied attributes. anOrganization records a reference to aMember

Class School

Links
private Collection<Member> members
Methods
public Boolean hasMember(Name aName, Address anAddress, Email anEmail)

Postcondition: returns True if the receivers members contains a Member with the supplied attributes

Class Organization

Links
private Collection<Member> members
Methods
public Boolean hasMember(Name aName, Address anAddress, Email anEmail)

Postcondition: returns True if the receivers members contains a Member with the supplied attributes

public Boolean addMember(aMember)

Postcondition: a reference to aMember is recorded.

Class Member

Links

None

Methods
Member(Name aName, Address anAddress, Email anEmail)

Post condition: a new Member object aMember is created. A reference to aMember is returned

Navigations

isMemberOf from Organization to Member
worksAt from School to Member

Discussion

⚠️ **GitHub.com Fallback** ⚠️