Suppose this class diagram:

I have a class with a name Organizationthat many objects are associated with. there are also many objects in addition to StoreHouseand Personnel, but for a simple class diagram, I did not put these classes in the diagram (it is assumed that more than 1000 classes depend on the class Organization).
Now I want to add a field enabledto the class Organization. it is very simple and no problem. but after that I want all business points and services not to use organizations disabled.
for example, suppose this service is below:
@Service
public class PersonnelService {
@Autowired
private PersonnelRepository repository;
public long save(Personnel entity) {
return repository.save(entity);
}
}
If I had the code above in the application, after adding enabledto the field Organization, I should change the method above:
@Service
public class PersonnelService {
@Autowired
private PersonnelRepository repository;
public long save(Personnel entity) {
if(!entity.getOrganization().getEnabled()) {
throw Exception();
}
return repository.save(entity);
}
}
- , 1000 .
, -, , Aspect - , , , Organization t24 > ?