public FactMapping(FactIdentifier factIdentifier, ExpressionIdentifier expressionIdentifier) { this(expressionIdentifier.getName(), factIdentifier, expressionIdentifier); }
public FactMapping(FactIdentifier factIdentifier, ExpressionIdentifier expressionIdentifier) { this(expressionIdentifier.getName(), factIdentifier, expressionIdentifier); }
public FactMapping addFactMapping(int index, FactIdentifier factIdentifier, ExpressionIdentifier expressionIdentifier) { return addFactMapping(index, expressionIdentifier.getName(), factIdentifier, expressionIdentifier); }
public FactMappingValue addMappingValue(FactIdentifier factIdentifier, ExpressionIdentifier expressionIdentifier, Object value) { String factName = factIdentifier.getName(); if (getFactMappingValue(factIdentifier, expressionIdentifier).isPresent()) { throw new IllegalArgumentException( new StringBuilder().append("A fact value for expression '").append(expressionIdentifier.getName()) .append("' and fact '").append(factName).append("' already exist").toString()); } FactMappingValue factMappingValue = new FactMappingValue(factIdentifier, expressionIdentifier, value); factMappingValues.add(factMappingValue); return factMappingValue; }
public FactMapping addFactMapping(int index, FactIdentifier factIdentifier, ExpressionIdentifier expressionIdentifier) { return addFactMapping(index, expressionIdentifier.getName(), factIdentifier, expressionIdentifier); }
public FactMappingValue addMappingValue(FactIdentifier factIdentifier, ExpressionIdentifier expressionIdentifier, Object value) { String factName = factIdentifier.getName(); if (getFactMappingValue(factIdentifier, expressionIdentifier).isPresent()) { throw new IllegalArgumentException( new StringBuilder().append("A fact value for expression '").append(expressionIdentifier.getName()) .append("' and fact '").append(factName).append("' already exist").toString()); } FactMappingValue factMappingValue = new FactMappingValue(factIdentifier, expressionIdentifier, value); factMappingValues.add(factMappingValue); return factMappingValue; }
public FactMapping addFactMapping(int index, String factAlias, FactIdentifier factIdentifier, ExpressionIdentifier expressionIdentifier) { if (getFactMapping(factIdentifier, expressionIdentifier).isPresent()) { throw new IllegalArgumentException( new StringBuilder().append("An expression with name '").append(expressionIdentifier.getName()) .append("' already exists for the fact '").append(factIdentifier.getName()).append("'").toString()); } if (index > factMappings.size()) { throw new IllegalArgumentException( new StringBuilder().append("Impossible to add an element at position ").append(index) .append(" because there are only ").append(factMappings.size()).append(" elements").toString()); } FactMapping factMapping = new FactMapping(factAlias, factIdentifier, expressionIdentifier); factMappings.add(index, factMapping); return factMapping; }
public FactMapping addFactMapping(int index, String factAlias, FactIdentifier factIdentifier, ExpressionIdentifier expressionIdentifier) { if (getFactMapping(factIdentifier, expressionIdentifier).isPresent()) { throw new IllegalArgumentException( new StringBuilder().append("An expression with name '").append(expressionIdentifier.getName()) .append("' already exists for the fact '").append(factIdentifier.getName()).append("'").toString()); } if (index > factMappings.size()) { throw new IllegalArgumentException( new StringBuilder().append("Impossible to add an element at position ").append(index) .append(" because there are only ").append(factMappings.size()).append(" elements").toString()); } FactMapping factMapping = new FactMapping(factAlias, factIdentifier, expressionIdentifier); factMappings.add(index, factMapping); return factMapping; }
public int getIndexByIdentifier(FactIdentifier factIdentifier, ExpressionIdentifier expressionIdentifier) { return IntStream.range(0, factMappings.size()).filter(index -> { FactMapping factMapping = factMappings.get(index); return factMapping.getExpressionIdentifier().equals(expressionIdentifier) && factMapping.getFactIdentifier().equals(factIdentifier); }).findFirst().orElseThrow(() -> new IllegalArgumentException( new StringBuilder().append("Impossible to find a FactMapping with factIdentifier '").append(factIdentifier.getName()) .append("' and expressionIdentifier '").append(expressionIdentifier.getName()).append("'").toString())); }
public int getIndexByIdentifier(FactIdentifier factIdentifier, ExpressionIdentifier expressionIdentifier) { return IntStream.range(0, factMappings.size()).filter(index -> { FactMapping factMapping = factMappings.get(index); return factMapping.getExpressionIdentifier().equals(expressionIdentifier) && factMapping.getFactIdentifier().equals(factIdentifier); }).findFirst().orElseThrow(() -> new IllegalArgumentException( new StringBuilder().append("Impossible to find a FactMapping with factIdentifier '").append(factIdentifier.getName()) .append("' and expressionIdentifier '").append(expressionIdentifier.getName()).append("'").toString())); }
@Test public void getScenarioGridColumnLocal() { String columnId = factMappingDescription.getExpressionIdentifier().getName(); String instanceTitle = factMappingDescription.getFactIdentifier().getName(); String propertyTitle = "PROPERTY TITLE"; final FactMappingType type = factMappingDescription.getExpressionIdentifier().getType(); String columnGroup = type.name(); scenarioGrid.getScenarioGridColumnLocal(instanceTitle, propertyTitle, columnId, columnGroup, type, ScenarioSimulationEditorConstants.INSTANCE.insertValue()); verify(scenarioGrid, times(1)).getScenarioHeaderTextBoxSingletonDOMElementFactory(); verify(scenarioGrid, times(1)).getHeaderBuilderLocal(eq(instanceTitle), eq(propertyTitle), eq(columnId), eq(columnGroup), eq(type), eq(scenarioHeaderTextBoxSingletonDOMElementFactoryMock)); }
@Test public void setHeaderColumn() { String columnId = factMappingDescription.getExpressionIdentifier().getName(); FactMappingType type = factMappingDescription.getExpressionIdentifier().getType(); String columnGroup = type.name(); reset(scenarioGridColumnMock); reset(scenarioGridModelMock); columnId = factMappingGiven.getExpressionIdentifier().getName(); type = factMappingGiven.getExpressionIdentifier().getType(); columnGroup = type.name();
when(propertyHeaderMetaDataMock.getColumnId()).thenReturn(GRID_COLUMN_ID); when(indexHeaderMetaDataMock.getTitle()).thenReturn(ExpressionIdentifier.INDEX.getName()); when(scenarioIndexGridColumnMock.getInformationHeaderMetaData()).thenReturn(indexHeaderMetaDataMock);
protected void setHeaderColumn(int columnIndex, FactMapping factMapping, boolean editableHeaders) { final FactIdentifier factIdentifier = factMapping.getFactIdentifier(); String columnId = factMapping.getExpressionIdentifier().getName(); String instanceTitle = factMapping.getFactAlias(); String propertyTitle = factMapping.getExpressionAlias(); String columnGroup = factMapping.getExpressionIdentifier().getType().name(); boolean isInstanceAssigned = isInstanceAssigned(factIdentifier); boolean isPropertyAssigned = isPropertyAssigned(isInstanceAssigned, factMapping); String placeHolder = getPlaceholder(isPropertyAssigned); ScenarioGridColumn scenarioGridColumn = getScenarioGridColumnLocal(instanceTitle, propertyTitle, columnId, columnGroup, factMapping.getExpressionIdentifier().getType(), placeHolder); scenarioGridColumn.setInstanceAssigned(isInstanceAssigned); scenarioGridColumn.setPropertyAssigned(isPropertyAssigned); scenarioGridColumn.setFactIdentifier(factIdentifier); scenarioGridColumn.setEditableHeaders(editableHeaders); // by default ScenarioGridColumnBuilders.ScenarioGridColumnBuilder.build() set ColumnWidthMode.auto to all generated columns if (FactMappingType.OTHER.equals(factMapping.getExpressionIdentifier().getType())) { scenarioGridColumn.setColumnWidthMode(ColumnWidthMode.FIXED); scenarioGridColumn.setMinimumWidth(scenarioGridColumn.getWidth()); } ((ScenarioGridModel) model).insertColumnGridOnly(columnIndex, scenarioGridColumn); }