This Project Work(Contact App) video is based on Business Logic(Service Implementation) and testing it independently(out of MVC and Without Web Server).
WHAT IS BUSINESS LOGIC OR DOMAIN LOGIC OR SERVICE?
Business Logic is a most important part of the project(backbone) where customer requirement is development along with workflow.
According to wikipedia(https://en.wikipedia.org/wiki/Busines...) :
In computer software, business logic or domain logic is the part of the program that encodes the real-world business rules that determine how data can be created, stored, and changed.
WHAT IS BUSINESS LAYER OR SERVICE LAYER?
Service layer contains business logic of the project. There can be multiple service class and interfaces involved to meet the business requirement. It should be independent, portable and loosely coupled with another layer of the project/application.
HOW SERVICE CLASS IS DIFFERENT FROM DAO CLASS?
Service Class contains business logic where different operations can be executed together in a proper order to meet business-requirement. The logic in service class can communicate with other systems like Email Server, FTP Server, SMS API. The logic in service layer can join multiple tables to fetch records or prepare the reports.
DAO Class contains operations/methods to handle CRUD operations for SINGLE ENTITY/TABLE. In practices DAO does not contains table-join operation. But DAO can be reused in Service Layer.
HOW TO DEVELOP BUSINESS LOGIC or SERVICES?
1.Create SERVICE INTERFACE which contains different business methods prototypes with proper documentation.
2.Provide Service Implementation class. This class contains the definition of business methods. The Service Class can reuse DAO classes.It also contains Database Operation, Transaction Handing, Business Flow, Email/SMTP Operations, SMS Operations or anything which is required to client(client-requirement).
3. Finally test the Service independently(out of MVC layer). JUnit can also be used.
COVERAGE IN THIS VIDEO:
1. Service Implementation Class(Service Bean) - UserServiceImpl
2. Testing of UserService and implementation
CODE REFERENCE:
//UserService.java
package in.ezeon.capp.service;
import in.ezeon.capp.dao.BaseDAO;
import in.ezeon.capp.dao.UserDAO;
import in.ezeon.capp.domain.User;
import in.ezeon.capp.exception.UserBlockedException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
Its an implementation of UserService.
@author Vikram
*/
@Service
public class UserServiceImpl extends BaseDAO implements UserService{
@Autowired
private UserDAO userDAO;
@Override
public void register(User u) {
userDAO.save(u);
}
@Override
public User login(String loginName, String password) throws UserBlockedException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public List getUserList() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void changeLoginStatus(Integer userId, Integer loginStatus) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
Don't skip or miss any video, just follow step by step video series.
Also check the source code listing in our
blog http://ezeon.in/blog
Don't forget to subscribe my channel.