A class has a method with the following execution flow:
- check if entity is deleted
- return if it is
- check if entity has status done
- return if status done
- check if entity has neither customer nor user
- delete entity and return if so
- check if user cannot be updated
- delete entity and return if so
> create model from entity
- delete entity and return on exception
- check if model customer and user are valid
- delete entity and return if not
- check if model and entity are the same
- return if they are
- check if there is a duplicate
- delete entity and return
> update entity based on model
This method has a complexity of 10 and NPath complexity of 384. I would like to know if there is a Design Pattern for this kind of situation.
I was trying to implement Visitor Pattern and Chain of Responsibilities Pattern but I am not sure if it is the right solution.
Aucun commentaire:
Enregistrer un commentaire