Class ScenarioSimulationServiceImpl

  • All Implemented Interfaces:
    org.drools.workbench.screens.scenariosimulation.service.ScenarioSimulationService, org.uberfire.ext.editor.commons.service.support.SupportsCopy, org.uberfire.ext.editor.commons.service.support.SupportsCreate<org.drools.scenariosimulation.api.model.ScenarioSimulationModel>, org.uberfire.ext.editor.commons.service.support.SupportsDelete, org.uberfire.ext.editor.commons.service.support.SupportsRead<org.drools.scenariosimulation.api.model.ScenarioSimulationModel>, org.uberfire.ext.editor.commons.service.support.SupportsRename, org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename<org.drools.scenariosimulation.api.model.ScenarioSimulationModel,​org.guvnor.common.services.shared.metadata.model.Metadata>, org.uberfire.ext.editor.commons.service.support.SupportsUpdate<org.drools.scenariosimulation.api.model.ScenarioSimulationModel,​org.guvnor.common.services.shared.metadata.model.Metadata>

    @ApplicationScoped
    public class ScenarioSimulationServiceImpl
    extends org.kie.workbench.common.services.backend.service.KieService<org.drools.workbench.screens.scenariosimulation.model.ScenarioSimulationModelContent>
    implements org.drools.workbench.screens.scenariosimulation.service.ScenarioSimulationService
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.drools.workbench.screens.scenariosimulation.model.ScenarioSimulationModelContent constructContent​(org.uberfire.backend.vfs.Path path, org.guvnor.common.services.shared.metadata.model.Overview overview)  
      org.uberfire.backend.vfs.Path copy​(org.uberfire.backend.vfs.Path path, String newName, String comment)  
      org.uberfire.backend.vfs.Path copy​(org.uberfire.backend.vfs.Path path, String newName, org.uberfire.backend.vfs.Path targetDirectory, String comment)  
      org.uberfire.backend.vfs.Path create​(org.uberfire.backend.vfs.Path context, String fileName, org.drools.scenariosimulation.api.model.ScenarioSimulationModel content, String comment)  
      org.uberfire.backend.vfs.Path create​(org.uberfire.backend.vfs.Path context, String fileName, org.drools.scenariosimulation.api.model.ScenarioSimulationModel content, String comment, org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type type, String value)  
      protected void createActivatorIfNotExist​(org.uberfire.backend.vfs.Path context)  
      void delete​(org.uberfire.backend.vfs.Path path, String comment)  
      protected boolean editPomIfNecessary​(org.guvnor.common.services.project.model.Dependencies dependencies, org.guvnor.common.services.project.model.GAV gav)  
      protected boolean ensureDependencies​(org.kie.workbench.common.services.shared.project.KieModule module)
      Verify if the project contains all the needed dependencies removing the old ones if available
      protected org.uberfire.java.nio.file.Path getActivatorPath​(org.guvnor.common.services.project.model.Package rootModulePackage)  
      protected List<org.guvnor.common.services.project.model.GAV> getDependencies​(String kieVersion)  
      protected org.uberfire.java.nio.file.Path getJunitActivatorPackagePath​(org.guvnor.common.services.project.model.Package rootModulePackage)  
      protected List<org.guvnor.common.services.project.model.GAV> getOldDependencies()  
      protected org.guvnor.common.services.project.model.Package getOrCreateJunitActivatorPackage​(org.kie.workbench.common.services.shared.project.KieModule kieModule)  
      void init()  
      org.drools.scenariosimulation.api.model.ScenarioSimulationModel load​(org.uberfire.backend.vfs.Path path)  
      protected boolean removeFromPomIfNecessary​(org.guvnor.common.services.project.model.Dependencies dependencies, org.guvnor.common.services.project.model.GAV oldDependency)  
      protected void removeOldActivatorIfExists​(org.uberfire.java.nio.file.Path activatorPath, org.kie.workbench.common.services.shared.project.KieModule kieModule)
      This routine looks for existing activators to migrate
      org.uberfire.backend.vfs.Path rename​(org.uberfire.backend.vfs.Path path, String newName, String comment)  
      org.drools.workbench.screens.scenariosimulation.model.SimulationRunResult runScenario​(org.uberfire.backend.vfs.Path path, org.drools.scenariosimulation.api.model.ScesimModelDescriptor simulationDescriptor, List<org.drools.scenariosimulation.api.model.ScenarioWithIndex> scenarios, org.drools.scenariosimulation.api.model.Settings settings, org.drools.scenariosimulation.api.model.Background background)  
      org.uberfire.backend.vfs.Path save​(org.uberfire.backend.vfs.Path resource, org.drools.scenariosimulation.api.model.ScenarioSimulationModel content, org.guvnor.common.services.shared.metadata.model.Metadata metadata, String comment)  
      org.uberfire.backend.vfs.Path saveAndRename​(org.uberfire.backend.vfs.Path path, String newFileName, org.guvnor.common.services.shared.metadata.model.Metadata metadata, org.drools.scenariosimulation.api.model.ScenarioSimulationModel content, String comment)  
      protected org.drools.scenariosimulation.api.model.ScenarioSimulationModel unmarshalInternal​(String content)  
      List<org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError> validate​(org.drools.scenariosimulation.api.model.Simulation simulation, org.drools.scenariosimulation.api.model.Settings settings, org.uberfire.backend.vfs.Path path)  
      • Methods inherited from class org.kie.workbench.common.services.backend.service.KieService

        getSource, loadContent
      • Methods inherited from interface org.drools.workbench.screens.scenariosimulation.service.ScenarioSimulationService

        loadContent
    • Field Detail

      • dmnTypeService

        @Inject
        protected org.drools.workbench.screens.scenariosimulation.service.DMNTypeService dmnTypeService
    • Constructor Detail

      • ScenarioSimulationServiceImpl

        public ScenarioSimulationServiceImpl()
      • ScenarioSimulationServiceImpl

        @Inject
        public ScenarioSimulationServiceImpl​(org.uberfire.rpc.SessionInfo sessionInfo)
    • Method Detail

      • runScenario

        public org.drools.workbench.screens.scenariosimulation.model.SimulationRunResult runScenario​(org.uberfire.backend.vfs.Path path,
                                                                                                     org.drools.scenariosimulation.api.model.ScesimModelDescriptor simulationDescriptor,
                                                                                                     List<org.drools.scenariosimulation.api.model.ScenarioWithIndex> scenarios,
                                                                                                     org.drools.scenariosimulation.api.model.Settings settings,
                                                                                                     org.drools.scenariosimulation.api.model.Background background)
        Specified by:
        runScenario in interface org.drools.workbench.screens.scenariosimulation.service.ScenarioSimulationService
      • create

        public org.uberfire.backend.vfs.Path create​(org.uberfire.backend.vfs.Path context,
                                                    String fileName,
                                                    org.drools.scenariosimulation.api.model.ScenarioSimulationModel content,
                                                    String comment)
        Specified by:
        create in interface org.uberfire.ext.editor.commons.service.support.SupportsCreate<org.drools.scenariosimulation.api.model.ScenarioSimulationModel>
      • create

        public org.uberfire.backend.vfs.Path create​(org.uberfire.backend.vfs.Path context,
                                                    String fileName,
                                                    org.drools.scenariosimulation.api.model.ScenarioSimulationModel content,
                                                    String comment,
                                                    org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type type,
                                                    String value)
        Specified by:
        create in interface org.drools.workbench.screens.scenariosimulation.service.ScenarioSimulationService
      • load

        public org.drools.scenariosimulation.api.model.ScenarioSimulationModel load​(org.uberfire.backend.vfs.Path path)
        Specified by:
        load in interface org.uberfire.ext.editor.commons.service.support.SupportsRead<org.drools.scenariosimulation.api.model.ScenarioSimulationModel>
      • constructContent

        protected org.drools.workbench.screens.scenariosimulation.model.ScenarioSimulationModelContent constructContent​(org.uberfire.backend.vfs.Path path,
                                                                                                                        org.guvnor.common.services.shared.metadata.model.Overview overview)
        Specified by:
        constructContent in class org.kie.workbench.common.services.backend.service.KieService<org.drools.workbench.screens.scenariosimulation.model.ScenarioSimulationModelContent>
      • save

        public org.uberfire.backend.vfs.Path save​(org.uberfire.backend.vfs.Path resource,
                                                  org.drools.scenariosimulation.api.model.ScenarioSimulationModel content,
                                                  org.guvnor.common.services.shared.metadata.model.Metadata metadata,
                                                  String comment)
        Specified by:
        save in interface org.uberfire.ext.editor.commons.service.support.SupportsUpdate<org.drools.scenariosimulation.api.model.ScenarioSimulationModel,​org.guvnor.common.services.shared.metadata.model.Metadata>
      • delete

        public void delete​(org.uberfire.backend.vfs.Path path,
                           String comment)
        Specified by:
        delete in interface org.uberfire.ext.editor.commons.service.support.SupportsDelete
      • rename

        public org.uberfire.backend.vfs.Path rename​(org.uberfire.backend.vfs.Path path,
                                                    String newName,
                                                    String comment)
        Specified by:
        rename in interface org.uberfire.ext.editor.commons.service.support.SupportsRename
      • copy

        public org.uberfire.backend.vfs.Path copy​(org.uberfire.backend.vfs.Path path,
                                                  String newName,
                                                  String comment)
        Specified by:
        copy in interface org.uberfire.ext.editor.commons.service.support.SupportsCopy
      • copy

        public org.uberfire.backend.vfs.Path copy​(org.uberfire.backend.vfs.Path path,
                                                  String newName,
                                                  org.uberfire.backend.vfs.Path targetDirectory,
                                                  String comment)
        Specified by:
        copy in interface org.uberfire.ext.editor.commons.service.support.SupportsCopy
      • saveAndRename

        public org.uberfire.backend.vfs.Path saveAndRename​(org.uberfire.backend.vfs.Path path,
                                                           String newFileName,
                                                           org.guvnor.common.services.shared.metadata.model.Metadata metadata,
                                                           org.drools.scenariosimulation.api.model.ScenarioSimulationModel content,
                                                           String comment)
        Specified by:
        saveAndRename in interface org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename<org.drools.scenariosimulation.api.model.ScenarioSimulationModel,​org.guvnor.common.services.shared.metadata.model.Metadata>
      • validate

        public List<org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError> validate​(org.drools.scenariosimulation.api.model.Simulation simulation,
                                                                                                               org.drools.scenariosimulation.api.model.Settings settings,
                                                                                                               org.uberfire.backend.vfs.Path path)
        Specified by:
        validate in interface org.drools.workbench.screens.scenariosimulation.service.ScenarioSimulationService
      • createActivatorIfNotExist

        protected void createActivatorIfNotExist​(org.uberfire.backend.vfs.Path context)
      • getOrCreateJunitActivatorPackage

        protected org.guvnor.common.services.project.model.Package getOrCreateJunitActivatorPackage​(org.kie.workbench.common.services.shared.project.KieModule kieModule)
      • removeOldActivatorIfExists

        protected void removeOldActivatorIfExists​(org.uberfire.java.nio.file.Path activatorPath,
                                                  org.kie.workbench.common.services.shared.project.KieModule kieModule)
        This routine looks for existing activators to migrate
        Parameters:
        activatorPath -
        kieModule -
      • ensureDependencies

        protected boolean ensureDependencies​(org.kie.workbench.common.services.shared.project.KieModule module)
        Verify if the project contains all the needed dependencies removing the old ones if available
        Parameters:
        module -
        Returns:
        boolean that specify if there was old dependencies
      • removeFromPomIfNecessary

        protected boolean removeFromPomIfNecessary​(org.guvnor.common.services.project.model.Dependencies dependencies,
                                                   org.guvnor.common.services.project.model.GAV oldDependency)
      • editPomIfNecessary

        protected boolean editPomIfNecessary​(org.guvnor.common.services.project.model.Dependencies dependencies,
                                             org.guvnor.common.services.project.model.GAV gav)
      • getActivatorPath

        protected org.uberfire.java.nio.file.Path getActivatorPath​(org.guvnor.common.services.project.model.Package rootModulePackage)
      • getJunitActivatorPackagePath

        protected org.uberfire.java.nio.file.Path getJunitActivatorPackagePath​(org.guvnor.common.services.project.model.Package rootModulePackage)
      • getOldDependencies

        protected List<org.guvnor.common.services.project.model.GAV> getOldDependencies()
      • getDependencies

        protected List<org.guvnor.common.services.project.model.GAV> getDependencies​(String kieVersion)
      • unmarshalInternal

        protected org.drools.scenariosimulation.api.model.ScenarioSimulationModel unmarshalInternal​(String content)
                                                                                             throws Exception
        Throws:
        Exception