Using the preceding approach, you could divide the abstraction of the domain service into two parts—the main service abstraction and a read-only service abstraction:
public abstract class ReadOnlyBaseService<TE, T> { private final Repository<TE, T> repository; ReadOnlyBaseService(ReadOnlyRepository<TE, T> repository) { this.repository = repository; } ... }
The following diagram contains the OTRS services and their relationships:
Now, we could use this ReadOnlyBaseService to create BaseService. Here, we are using the dependency injection pattern via a constructor to map concrete objects with abstraction: ...