Wiki
This website is a wiki. If you like and use our processes, techniques and tools, please add your experience and best practices. Just register and share.


Contents


User


Smart


Community

















The Master-Detail-Define patterns can be applied to a situation that requires a single master object, such as Vendor with a number of details, such as Product, where the vendor sells these products. A example smart use cases model is displayed below.

Master-Detail-Define

Master-Detail-Define


Characteristics

This pattern includes the following parts:
  • Master-Detail. Smart use case handling the maintenance of a single master instance, such as Vendor. This vendor is first selected using either a Select or a Search like smart use case. The Master-Detail next contains a list of associated details, such as a list of Product, representing the products this particular vendor sells. To edit any of these items, it is selected and the Define smart use case is started. Again, in most cases, when a new item is added to the list, the Define use case is also used for this. However, in most implementations, removing an item from the list is done at the Master-Detail use case directly (often using a confirmation message). It is not until the user submits the changes on this use case that both the master and its details are saved, updated or removed in the database or underlying services, mostly in a single transaction.
  • Define. Smart use case that handles the maintenance of a single detail item, such as Product. When the user submits the changes to the item, navigation is returned to the Master-Detail smart use case, and the new is added to the list, or the modified item is updated. No database (or service) interaction takes place from the Define use case.
  • Select or Search. Smart use case that enables users to select or search for the master instance to maintain.

Tobago MDA modeling guidelines

To generate proper code using Tobago MDA, please apply the following to the model in your UML tool:
  • Master-Detail. Model two properties with this use case. The master, such as Vendor, which is stereotypes as master, and the detail, such as Product, which is stereotypes using detail. Note that this instance name for this detail should be singular, as the templates apply plural for you.
  • Define. Model only the detail property with your use case, such as Product. Stereotype it using define.
  • Select or Search. Place a property on the smart use case that identifies the master, in this example Vendor. Stereotype it either with select or search.

ADF coding guidelines

In addition, to make sure the details are saved with their master, please mark the property on the master that defines the details with the Composition attribute, as in the code example below.


#region CodeGuard(Association ArticleField)

// Association ArticleType[simple] : ArticleField[many]

private DomainCollection articleFields = new DomainCollection();

[Composition]
public DomainCollection ArticleFields
{
get
{
if (!articleFields.IsInitialised)
articleFields.Initialize(ArticleFieldFactory.GetByArticleType(this));

return articleFields;
}
}

public ArticleField NewArticleField()
{
ArticleField articleField = ArticleFieldFactory.New();

articleField.ArticleType = this;

return articleField;
}

#endregion CodeGuard(Association ArticleField)