Class FlowUtils

java.lang.Object
edu.university.ecs.lab.common.utils.FlowUtils

public class FlowUtils extends Object
  • Constructor Details

    • FlowUtils

      public FlowUtils()
  • Method Details

    • buildFlows

      public static List<Flow> buildFlows(MicroserviceSystem microserviceSystem)
      Method for generating all possibilities of Flows
      Parameters:
      microserviceSystem - the microservice system to scan for flows
      Returns:
      the list of all possible flows
    • getAllMicroserviceControllers

      private static Map<Microservice,Set<JClass>> getAllMicroserviceControllers(MicroserviceSystem microserviceSystem)
      This method returns a map of microservices to their controller classes
      Parameters:
      microserviceSystem - the microservice system to convert
      Returns:
      the map of microservice to JClass controllers
    • generateNewFlows

      private static List<Flow> generateNewFlows(Map<Microservice,Set<JClass>> controllerMap)
      This method generates the base flows
      Parameters:
      controllerMap - the controller map
      Returns:
      the base flows
    • generateNewFlows

      private static List<Flow> generateNewFlows(Microservice microservice, List<JClass> controllers)
    • findAllServiceMethodCalls

      private static List<MethodCall> findAllServiceMethodCalls(Flow flow)
      This method find's all method calls from the controllerMethod of a flow
      Parameters:
      flow - the flow
      Returns:
      the list of MethodCalls from the controllerMethod of the flow
    • findServiceField

      private static Field findServiceField(Flow flow)
      This method find's the service field affiliated with a methodCall of a flow
      Parameters:
      flow - the flow
      Returns:
      the field called from this flow's serviceMethodCall
    • findAllServices

      private static List<JClass> findAllServices(Flow flow)
      This method finds any jClass affiliated with the serviceField of a flow. Due to polymorphism the type is not guaranteed to match one class so all possibilities will be considered. Note: This is a source of approximation -- Runtime types
      Parameters:
      flow - the flow
      Returns:
      the jClass affiliated with the serviceField
    • findServiceMethod

      private static Method findServiceMethod(Flow flow)
      This method finds the method affiliated with the serviceMethodCall of a flow
      Parameters:
      flow - the flow
      Returns:
      the method affiliated with the serviceMethodCall
    • findAllRepositoryMethodCalls

      private static List<MethodCall> findAllRepositoryMethodCalls(Flow flow)
      This method find's all method calls from the serviceMethod of a flow
      Parameters:
      flow - the flow
      Returns:
      the list of MethodCalls from the serviceMethod of the flow
    • findRepositoryField

      private static Field findRepositoryField(Flow flow)
      This method find's the repository field affiliated with a methodCall of a flow
      Parameters:
      flow - the flow
      Returns:
      the field called from this flow's repositoryMethodCall
    • findAllRepositorys

      private static List<JClass> findAllRepositorys(Flow flow)
      This method finds any jClass affiliated with the repositoryField of a flow. Due to polymorphism the type is not guaranteed to match one class so all possibilities will be considered. Note: This is a source of approximation -- Runtime types
      Parameters:
      flow - the flow
      Returns:
      the jClass affiliated with the repositoryField
    • findRepositoryMethod

      private static Method findRepositoryMethod(Flow flow)
      This method finds the method affiliated with the repositoryMethodCall of a flow
      Parameters:
      flow - the flow
      Returns:
      the method affiliated with the repositoryMethodCall