imixs / imixs-workflow

The open source technology for business process management
http://www.imixs.org/
GNU General Public License v3.0
358 stars 64 forks source link

Refactoring- Removed 3 design smells #856

Closed ashishbhasin45 closed 7 months ago

ashishbhasin45 commented 7 months ago
  1. Refactored to resolve cyclic dependency Location-
    Sub-Project: imixs-workflow-engine Package: org.imixs.workflow.engine Classes: AsyncEventScheduler and AsyncEventService

  2. Refactoring applied- Move method to increase cohesion. Location(s)- Sub-project: imixs-workflow-jax-rs Package: org.imixs.workflow.jaxrs Class: ModelRestService

    Sub-project: imixs-workflow-engine Package: org.imixs.workflow.engine Class: ModelService

    Sub-project: imixs-workflow-core Package: org.imixs.workflow Class: ModelManager ModelRestService was using ModelService’s methods quite a few times in its method printVersionTable. I moved the method to perform the desired operation in the ModelService where it belonged and then called that method once in the ModelRestService to get the output. The model was also defined in the ModelManager interface as ModelService implements it.

  3. Refactoring applied- Replace conditional with polymorphism. Location(s)- Sub-project: imixs-workflow-faces Package: org.imixs.workflow.faces.util Class: ErrorHandler

    Sub-project: imixs-workflow-faces Package: org.imixs.workflow.faces.util Class: ValidationException

    Sub-project: imixs-workflow-core Package: org.imixs.workflow.exceptions Class: PluginException

    Sub-project: imixs-workflow-core Package: org.imixs.workflow.exceptions Class: WorkflowException ErrorHandler class had conditionals in the addErrorMessage where it was checking the instance of PluginException and ValidationException and performing action based on that. I created a method formatErrorMessageWithParameters in the abstract class workflowException and overrode this method in PluginException and ValidationException child classes. In the ErrorHandler class I changed the conditional with the call to this new method and based on the object type it will perform desired behavior.