Currently I have a domainObjectPersistenceService which calls DAO functions on the Domain Object, and I have a separate domainObjectDomainService which processes Business Logic. For example, userPersistenceService and userDomainService.
I am unsure whether to handle the initial call to the domainObjectPersistenceService from the Controller directly, or call it from inside the domainObjectDomainService.
What is the preferred way?
@Controller
public class Controller {
public controllerMethod(int fileId) {
domainObject = domainObjectPersistenceService.getFile(fileId);
data = domainObjectDomainService.processFile(domainObject);
// convert data into DTO
return dataDTO;
}
}
or
@Controller
public class Controller {
public controllerMethod(int fileId) {
// domainObjectDomainService handles persistence layer calls.
data = domainObjectDomainService.processFile(fileId);
// convert data into DTO
return dataDTO;
}
}
Many thanks!