CO7207 - UML Modeling and Programming with EMF Project Solution 2019

Verified

Added on  2023/04/21

|10
|850
|427
Project
AI Summary
This document presents a solution to a UML modeling and programming project using EMF, focusing on an online bookshop system. It includes a system description outlining stakeholders, business entities, and use cases. The behavioral model is detailed with use case and activity diagrams, illustrating customer interactions such as purchasing books and admin functionalities like managing the book inventory. The structural model features a class diagram representing the system's architecture and OCL constraints to enforce business rules. An object diagram provides a snapshot of the system's state. Finally, the document demonstrates model instantiation by creating a plugin project and generating code to save the model instance, highlighting the practical application of EMF in software development. Desklib provides similar past papers and solved assignments for students.
Document Page
Running head: UML MODELING AND PROGRAMMING WITH EMF
UML Modeling and Programming with EMF
Name of the Student
Name of the University
Author’s auto:
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1UML MODELING AND PROGRAMMING WITH EMF
Table of Contents
Task 1: System Description:............................................................................................................2
Task 2: Behavioral Model...............................................................................................................3
2.a Use Case Diagram:................................................................................................................3
2.b Activity Diagram:..................................................................................................................4
Task 3: Structural Model.................................................................................................................5
3.a Class Diagram:.......................................................................................................................5
3.b Business Constraints:.............................................................................................................5
3.c Object Diagram:.....................................................................................................................6
Task 4: Model Instance....................................................................................................................6
Bibliography:...................................................................................................................................9
Document Page
2UML MODELING AND PROGRAMMING WITH EMF
Task 1: System Description:
The selected organization is an ABC Online Bookshop. The organization allows
customers to purchase books that are available into the system. The organization has mainly
customer, admin and publisher and distributor stakeholders. The corporation, small business
corporation and sole proprietorship are the business entities of the organization. The use cases
are purchase book, make payment, apply discount coupon, add, modify and delete books are the
use cases of the system. The main business activities of ABC Online Bookshop are as following.
i. Customer purchase books from the online shop
ii. Customer login to the system using login credentials
iii. Customer register to the system if the customer does not have any valid login
credentials
iv. The premium customer applying coupon for getting discount
v. The admin adding new books into the system
vi. The admin deleting books from the system
vii. The admin modifying the details of the book available in the system
Document Page
3UML MODELING AND PROGRAMMING WITH EMF
Task 2: Behavioral Model
2.a Use Case Diagram:
Figure 1: Use Case Diagram
(Source: Created by Author)
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4UML MODELING AND PROGRAMMING WITH EMF
2.b Activity Diagram:
Figure 2: Activity Diagram
(Source: Created by Author)
Document Page
5UML MODELING AND PROGRAMMING WITH EMF
Task 3: Structural Model
3.a Class Diagram:
Figure 3: Class Diagram of ABC Online Book Shop
(Source: Created by Author)
3.b Business Constraints:
The following business constraints are main business constraints of ABC Online
Bookshop.
i. Only a valid customer with proper login credentials can purchase books from the
shop
ii. A specific purchase can be done by only one customer
iii. A single payment can be done for each purchase
iv. In order to get discount, the premium customer must enter a valid discount
coupon code
Business Constraint OCL
A specific purchase context Purchase inv: Purchase.Customer->size() = 1;
Document Page
6UML MODELING AND PROGRAMMING WITH EMF
can be done by only
one customer
A single payment can
be done for each
purchase
context Purchase inv: Purchase.Payment ->size() = 1;
3.c Object Diagram:
Figure 4: Object Diagram of IT Solution Provider System
(Source: Created by Author)
Task 4: Model Instance
Created a plugin project with name BookShop.instance.
Then the following dependencies are added to plugin.xml. org.eclipse.emf.ecore,
org.eclipse.emf.ecore.xmi and BookShop.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7UML MODELING AND PROGRAMMING WITH EMF
The class for creating the instance is as following.
package de.vogella.emf.webpage.instance;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.requestImpl;
import BookShop;
public class CreateSaveTester {
public static void main(String[] args) {
BookShop.eINSTANCE.eClass();
BookShop factory = BookShop.eINSTANCE;
.setName("index");
.setDescription("BookShop");
.setKeywords("Eclipse, EMF");
.setTitle("Eclipse EMF");
BookShop().add(page);
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
Map<String, Object> m = reg.getExtensionToFactoryMap();
m.put("BookShop", new requestImpl ());
ResourceSet resSet = new ResourceSetImpl();
Resource resource = resSet.createResource(URI
.createURI("BookShop/request.website"));
pa
ge
pa
ge
pa
ge
pa
ge
Document Page
8UML MODELING AND PROGRAMMING WITH EMF
resource.getContents().add(BookShop);
try {
resource.save(Collections.EMPTY_MAP);
} catch (IOException e) {
e.printStackTrace();
}
}
}
Document Page
9UML MODELING AND PROGRAMMING WITH EMF
Bibliography:
Kahani, N., Bagherzadeh, M., Dingel, J. and Cordy, J.R., 2016, October. The problems with
Eclipse modeling tools: a topic analysis of Eclipse forums. In Proceedings of the ACM/IEEE
19th International Conference on Model Driven Engineering Languages and Systems (pp. 227-
237). ACM.
Sunye, G., 2017, July. Model consistency for distributed collaborative modeling. In European
Conference on Modelling Foundations and Applications (pp. 197-212). Springer, Cham.
chevron_up_icon
1 out of 10
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]