Skip to main content

JEE

Topic appears in the following WE1 Exams:

  • 2022 01 13 Q3 (3 points)
  • 2021 02 05 Q3 (6 points) Milan kindergarten

Therefore it appears in 33% of the WE1 exams and it is worth 4.5 points on average.

Past exams exercises

2021 02 05 Q3 (6 points) Milan kindergarten

The Municipality of Milan wants to create a web-based system to let parents register their children in a public kindergarten in various regions of the city. The Municipality would like to have a robust architecture to manage this system. Parents use the system to enter an Enrollment Request (ER) where they specify the information about their child, including the area they live in. Kindergartens receive through the system the ER, evaluate it and contact the applicants to inform them if they are rejected/accepted and to further communicate with them. In particular, the system offers the following functions to parents:

  • F1 - Child registration: The parent should be able to register his/her child in the system by giving information such as name/surname, birthdate of the child, working status, phone number, and e- mail address of the parents. As a result of the registration, parents will be able to log in to the system.
  • F2 - Enrollment request: When logged in, parents issue the ER by giving the following data in addition to the data in their profile: city area of interest, and if the child needs any special medical care.
  • F3 - Kindergarten rating: Parents can rate the kindergarten of their child.
  • F4 - Visualization of ER status: This can be one of the following: pending or accepted (for simplicity, we assume that there is enough availability for all children of a certain area, so no application is rejected).

Moreover, the system offers the following functions to kindergartens’ staff:

  • F5 - Kindergarten registration: This is performed by providing at least the following data: kindergarten name, city area, email, capacity.
  • F6 - Profile update: Kindergartens can update their capacity. They will stop receiving ERs whenever their capacity is full.
  • F7 - ER evaluation: The kindergarten’s staff can accept/reject an application.

Finally, the system offers the following support functions:

  • F8 - Upon submission, the system sends ERs to all available kindergartens of the desired city area. Notice that a parent cannot apply for a specific kindergarten, but only for a region.

Notice that when one of the kindergartens accepts an ER, then the ER status is changed to accepted. Also, the system keeps track of who is enrolled in each kindergarten, based on the acceptance information.

Point A (2 points) Web Tier Components

Identify at least two different Components of the Web Tier, their main responsibility and, for each Component, list the requirements that it satisfies.

SOLUTION

The web tier of the application is composed of various JSPs containing HTML forms and Servlets to manage them. For example, below are listed some of the needed components:

ComponentResponsibilityRequirement
JSPFront-end for Child RegistrationF1
JSPFront-end for kindergarten RegistrationF5
JSPFront-end for ER formF8
ChildRegistration_ServletTo forward the forms data to corresponding BeanF5
KindergartenRegistration_ServletTo forward the forms data to corresponding BeanF1
ER_ServletTo forward the ER-Form data to corresponding BeanF8

Point B (3 points) Identify beans

Given the entities defined in the following table, focus on the business layer part of your system, and in particular on the definition of the Beans. More precisely, identify the required Beans, specify their types and, for each Bean, list the functions it satisfies (F1-F8) and at least one method (the most important one).

ComponentTypeRequirement
Kindergarten_ManagerStateless BeanF5, F6, F7
ER_ManagerStateless BeanF4, F8
Child_ManagerStateless BeanF1,F2,F3

Kindergarten_Manager, Child_Manager are stateless beans to manage the operations related to the Kindergarten and Child entities such as registration, profile updating and so on.

ER management could be implemented as a stateless bean, the ER_Manager. To address F8, when a new request is generated by filing the ER form, the main task of the ER_Manager bean is to first extract the requested region in the ER, then query the database to find all the available kindergartens in that region and then send them the ER.

Some methods of Child_Manager, Kindergarten_Manager, and ER_Manager are the following:

  1. Child_Manager:
public Integer updatePassword(String userID, Integer rate) {}
public Integer updateResidenceAddress(String addr) {}
  1. Kindergarten_Manager:
public void SetAvailability(Boolean availability) {}
public Integer updateRating(String userID, Integer rate) {}
  1. ER_Manager:
public Collection<Kindergarten> findKindergartenByRegion(String RegionName){}
public void sendERs(Collection<Kindergarten> kindergartensInRegion) {
    for (kindergarten k : kindergartensInRegion) {
        // send the ER to k
    }
}

Point C (1 point) Reflect on Message-Based model

Reflect on the possibility to adopt a Message-Based Communication model. Which part of the business layer is most suited to be addressed through such model? What is the JEE API to use in this case? Explain how you would incorporate such JEE API in your system.

SOLUTION

The JMS style that could be used here is the publisher-subscriber model, so each region would be a Topic and upon ER submission the Publisher notifies the Subscriber of the respected region. The main advantage of having JMS versus Stateless bean is that here the load of the ER management task is distributed over different Beans, each one responsible for single region.