use of org.drools.scenariosimulation.api.utils.ConstantsHolder.VALUE in project drools-wb by kiegroup.
the class AbstractDataManagementStrategy method getPropertiesToHide.
/**
* This method returns a <code>List</code> with the properties of a given <b>Type</b> (Fact, class, other dmn defined) instance,
* to be hidden from the right panel for the selected column.
* <p>
* If click happen on an already assigned property, <b>all</b> all the properties of given type should be shown;
* if, instead, click is on an unassigned property, the already assigned properties must be hidden.
* (e.g. inside GIVEN there is an "Author" group; if clicking on "books" property header, this method returns an <b>empty</b> <code>List</code>;
* if click is on an unassigned property column, this method returns a <code>List</code>.
* with all the <b>already assigned</b> Author's properties)
* @param selectedColumn
* @param abstractScesimGridModel
* @return
*/
protected <T extends AbstractScesimModel<E>, E extends AbstractScesimData> List<List<String>> getPropertiesToHide(ScenarioGridColumn selectedColumn, AbstractScesimGridModel<T, E> abstractScesimGridModel) {
List<List<String>> toReturn = new ArrayList<>();
if (!selectedColumn.isPropertyAssigned()) {
abstractScesimGridModel.getAbstractScesimModel().ifPresent(simulation -> {
final ScesimModelDescriptor simulationDescriptor = simulation.getScesimModelDescriptor();
List<ScenarioGridColumn> instanceColumns = abstractScesimGridModel.getInstanceScenarioGridColumns(selectedColumn);
toReturn.addAll(instanceColumns.stream().filter(ScenarioGridColumn::isPropertyAssigned).map(instanceColumn -> abstractScesimGridModel.getColumns().indexOf(instanceColumn)).map(columnIndex -> {
List<String> propertyNameElements = simulationDescriptor.getFactMappingByIndex(columnIndex).getExpressionElementsWithoutClass().stream().map(ExpressionElement::getStep).collect(Collectors.toList());
if (propertyNameElements.isEmpty()) {
propertyNameElements.add(VALUE);
}
return Collections.unmodifiableList(propertyNameElements);
}).collect(Collectors.toList()));
});
}
return toReturn;
}
Aggregations