Class ScenarioSimulationUtils


  • public class ScenarioSimulationUtils
    extends Object
    • Field Detail

      • subGroupCounter

        protected static AtomicInteger subGroupCounter
    • Method Detail

      • getColumnSubGroup

        public static String getColumnSubGroup​(String columnGroup)
        Given a columnGroup, it creates a new subGroup with the following format: 'columnGroupName-x'.
        Parameters:
        columnGroup -
        Returns:
      • getOriginalColumnGroup

        public static String getOriginalColumnGroup​(String columnGroup)
        Given a columnGroup, it returns the original group name, removing the the subgroup part (added in getColumnSubGroup with the following format: 'columnGroupName-x'
        Parameters:
        columnGroup -
        Returns:
      • isSimpleJavaType

        public static boolean isSimpleJavaType​(String className)
        This method can be used ONLY when managing a RULE type Test Scenario.
        Parameters:
        className -
        Returns:
      • getPlaceHolder

        public static String getPlaceHolder​(boolean isInstanceAssigned,
                                            boolean isPropertyAssigned,
                                            org.drools.scenariosimulation.api.model.FactMappingValueType valueType,
                                            String className)
        It provides the correct PlaceHolder value to be assigned to an empty cell given its parameters status.
        Parameters:
        isInstanceAssigned -
        isPropertyAssigned -
        valueType -
        className -
        Returns:
      • getPropertyNameElementsWithoutAlias

        public static List<String> getPropertyNameElementsWithoutAlias​(List<String> propertyNameElements,
                                                                       org.drools.scenariosimulation.api.model.FactIdentifier factIdentifier,
                                                                       org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type type)
        Method to retrieve a new List of property name elements where the first one is the the actual class name (i.e. an eventual alias get replaced)
        Parameters:
        propertyNameElements -
        factIdentifier -
        Returns:
      • getHeaderBuilder

        public static ScenarioSimulationBuilders.HeaderBuilder getHeaderBuilder​(String instanceTitle,
                                                                                String propertyTitle,
                                                                                String columnId,
                                                                                String columnGroup,
                                                                                org.drools.scenariosimulation.api.model.FactMappingType factMappingType,
                                                                                ScenarioHeaderTextBoxSingletonDOMElementFactory factoryHeader)
        Retrieve a single or triple level Header metadata, i.e. a List<GridColumn.HeaderMetaData> with one or three elements, depending on the column Group:

        OTHER: single level

        EXPECT/GIVEN: triple level

        Parameters:
        instanceTitle -
        propertyTitle -
        columnId -
        columnGroup -
        factMappingType -
        factoryHeader -
        Returns:
      • getMiddleXYCell

        public static com.ait.lienzo.client.core.types.Point2D getMiddleXYCell​(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget gridWidget,
                                                                               org.uberfire.ext.wires.core.grids.client.model.GridColumn<?> column,
                                                                               boolean isHeader,
                                                                               int uiRowIndex,
                                                                               org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer gridLayer)
        Returns an array where the 0-element is middle x of given cell and 1-element is middle y
        Parameters:
        gridWidget -
        column -
        isHeader -
        uiRowIndex -
        gridLayer -
        Returns:
      • getCellHeight

        public static int getCellHeight​(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget gridWidget,
                                        org.uberfire.ext.wires.core.grids.client.model.GridColumn<?> column,
                                        boolean isHeader,
                                        int uiRowIndex)
      • getColumnWidth

        protected static double getColumnWidth​(String columnId)