Defining domain services
The topology and inventory system is about the visualization and management of network assets, so we need to enable the user to handle collections of such network assets. One way to do that is through services. With services, we can define behaviors to deal with system entities and value objects.
All the services that we'll create in this section reside in the service
package.
Let's start by creating a service to deal with collections of routers.
Router service
In the previous section, when implementing the Router
, CoreRouter
, and EdgeRouter
entities, we also created some methods to return predicates to aid us in filtering collections of routers. With a domain service, we can use these predicates to filter such collections, as follows:
package dev.davivieira.topologyinventory.domain.service; import dev.davivieira.topologyinventory.domain.entity.Equipment; import dev.davivieira.topologyinventory.domain.entity.Router; import dev.davivieira...