}
} else {
maximumWeight = 0;
}
if (minimumEnabled || maximumEnabled) {
MinMaxContractLine contractLine = new MinMaxContractLine();
contractLine.setId(contractLineId);
contractLine.setContract(contract);
contractLine.setContractLineType(contractLineType);
contractLine.setMinimumEnabled(minimumEnabled);
if (minimumEnabled) {
int minimumValue = Integer.parseInt(minElement.getText());
if (minimumValue < 1) {
throw new IllegalArgumentException("The minimumValue (" + minimumValue
+ ") of contract (" + contract.getCode() + ") and contractLineType ("
+ contractLineType + ") should be at least 1.");
}
contractLine.setMinimumValue(minimumValue);
contractLine.setMinimumWeight(minimumWeight);
}
contractLine.setMaximumEnabled(maximumEnabled);
if (maximumEnabled) {
int maximumValue = Integer.parseInt(maxElement.getText());
if (maximumValue < 0) {
throw new IllegalArgumentException("The maximumValue (" + maximumValue
+ ") of contract (" + contract.getCode() + ") and contractLineType ("
+ contractLineType + ") should be at least 0.");
}
contractLine.setMaximumValue(maximumValue);
contractLine.setMaximumWeight(maximumWeight);
}
contractLineList.add(contractLine);
contractLineListOfContract.add(contractLine);
contractLineId++;
}