From the course: Jakarta EE: Building Your First Application
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Complete business logic in Jakarta RESTful resource
From the course: Jakarta EE: Building Your First Application
Complete business logic in Jakarta RESTful resource
- [Instructor] Let's start from where we left our code that generates the price change value. And now for the business rule, I get the day of the week. So I'll type int dayOfWeek by saying now.get Calendar.DAY_OF_WEEK, which would be 1 for Sunday and 7 for Saturday for a week starting from Sunday. And then I do a switch case of the day of the week. Case 2 and 3 here is Monday and Tuesday. So we have the price increasing by an amount between $1 to $5. So I create a random integer with the least value of 1, inclusive, and an upper bound of 6, exclusive. Case 4, which is Wednesday, we have the price reduced by an amount between $1 to $3 and create a random number like this. But see here that I'm making it a negative value by multiplying it by -1. Case 5 and 6, Thursdays and Fridays, the price increases by $1 to $2, and here's the random number for that. And finally, on Sunday and Saturday, the price is reduced by $1…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Add Enterprise Bean to the Pricing application3m 15s
-
(Locked)
Add Jakarta Persistence entity class5m 39s
-
(Locked)
Inject the EntityManager in the Enterprise Bean3m 40s
-
(Locked)
Add business methods to the Enterprise Bean6m 58s
-
(Locked)
Add the rest of the business methods6m 37s
-
(Locked)
Configure the persistance.xml file3m 41s
-
(Locked)
Call the business methods from the CDI bean3m 53s
-
(Locked)
Add Jakarta RESTful resource to Daily Price Change web service4m
-
(Locked)
Implement business logic in Jakarta RESTful resource3m 31s
-
(Locked)
Complete business logic in Jakarta RESTful resource5m 38s
-
(Locked)
-
-