uc 15 - yshehab/SchoolRoomBooking GitHub Wiki
public void addOrganization(
                            String name, 
                            Address address, 
                            Member aMember)

Given: the Address object address4, the name "Bagpipe Band" and the Member object member1
- The UI attempts to create a new Address object with entered attributes
 As this suceeds:
- A new Address object address4 is created with the supplied attributes:As this is a new Address there will be no Organization with the same name linked to it.
 
- The UI sends the coordinating message with name  "Bagpipe Band", Address address4 and Member member1 as parameters
 
- Check that an organization with  name "Bagpipe Band" doesn_t exist linked to address4 (this check is not needed for this scenario , but is for the alternative scenario)
 As it doesn_t:
- Create a new Organization object organization3 with the name "Bagpipe Band"
 
- organization3 records a reference to address4
- organization3 records a reference to member1
- letting records a reference to organization3
 

Given: the Address object address9, the name "Yoga" and Member object member2
- The UI sends the coordinating message with the name "Yoga" , Address address9 and Member member2 as parameters
- Check if an organization with  name "Yoga" exists linked to address9
 As it doesn_t:
- Create a new Organization object organization7 with name "Yoga" and address address9
 
- organization7 records a reference to member2
- letting records a reference to organization7
 

If an Organization object with the same name is linked to the Address object throw an exception.
Note: as Address class doesn_t have (and shouldn_t have?) a Set<Organization> attribute, the check for organizations with supplied name attribute value existing linked to the supplied address will need to be done by checking all organizations in letting and if they have a matching name check if they are linked to the supplied address.
- none new
- public Organization createNewOrganization(String name, Address address, Member aMember)
- Postconditions: a new Organozation object anOrganization is created with the supplied attributes. A reference to anOrganization is returned.
- None
- public void addOrganization( String name, Address address, Member aMember)
- None
- None new
- none new
public void addOrganization( String name,  Address address) 

Given: All the attributes required to create a new Address object and the name "Bagpipe Band"
- The UI attempts to create a new Address object with entered attributes
 As this suceeds:
- A new Address object address4 is created with the supplied attributes:As this is a new Address there will be no Organization with the same name linked to it.
 
- The UI sends the coordinating message with name  "Bagpipe Band" and Address address4 as parameters
 
- Check if an organization with  name "Bagpipe Band" exists linked to address4 (this check is not needed for this scenario , but is for the alternative scenario)
 As it doesn_t:
- Create a new Organization object organization3 with the name "Bagpipe Band" and address address4
 
- letting records a reference to organization3
 

Given: All the attributes required for creating a new Address and the name "Yoga"
- The UI attempts to create a new Address object with supplied attributes
 As this fails:
- The Address object address9 is returned with the same attribute vales as supplied
 
- The UI sends the coordinating message with the name "Yoga" and Address address9 as parameters
- Check if an organization with  name "Yoga" exists linked to address9
 As it doesn_t:
- Create a new Organization object organization7 with name "Yoga" and address address9
 
- letting records a reference to organization7
 

/images/use_case_15_sequence_diagram.jpg
If an Organization object with the same name is linked to the Address object throw an exception.
Note: as Address class doesn_t have (and shouldn_t have?) a Set<Organization> attribute, the check for organizations with supplied name attribute value existing linked to the supplied address will need to be done by checking all organizations in letting and if they have a matching name check if they are linked to the supplied address.
- none new
- needs a factory method??
- public Organization createNewOrganization(String name, Address address)
- None
- public void addOrganization( String name, Address address)
- None
- None new
- none new
It seems a little bit awkward and error prone for the GUI to pass so many arguments to the coordinating class. If the GUI could use a builder to create an Address object and then pass that to the coordinating method, it would be much cleaner. Thoughts? -Damien
Yes, I agree. I have changed the walkthroughs and added a new sequence diagram - Ben