public interface ILfnServiceTypeProductValidator
An implementation of this interface must be provided when using ILfnServiceTypeConfiguration to add your own service type to LuciadFusion. LuciadFusion uses the validator to prevent users from adding invalid data to a service type.
Implement this interface to:
Modifier and Type | Method and Description |
---|---|
OptionalInt |
getMaxAllowedDataCount()
Indicates the maximum number of data that can be contained within a product.
|
OptionalInt |
getMaxAllowedProductCount()
Indicates the maximum number of products that can be published in a service.
|
TLcdValidationResult |
validateProductData(List<TLfnData> aDataList)
Validates if a product containing the given data can be published in a service.
|
default TLcdValidationResult |
validateProductData(TLfnProduct aProduct,
List<TLfnData> aDataList)
Validates if the given product with the given data can be published in a service.
|
OptionalInt getMaxAllowedProductCount()
Indicates the maximum number of products that can be published in a service.
Return OptionalInt.empty()
to indicate that there is no limitation on the amount of products in a service.
LuciadFusion Studio will prevent users from adding more products than the maximum.
The maximum allowed product count needs to be larger than zero.
The returned value cannot not be null
.
OptionalInt
containing the maximum number of allowed products or OptionalInt.empty()
for no limitOptionalInt getMaxAllowedDataCount()
OptionalInt.empty()
to indicate that there is no limitation on the amount of data in a product.
LuciadFusion Studio will prevent users from adding more data than the maximum.
The maximum allowed data count needs to be larger than zero.
The returned value cannot not be null
.
OptionalInt
containing the maximum number of allowed data or OptionalInt.empty()
for no limitTLcdValidationResult validateProductData(List<TLfnData> aDataList)
Validates if a product containing the given data can be published in a service.
Start with a TLcdValidationResult.ok()
validation result and add warning and error messages when performing the validation.
Add warnings to the validation result for issues with the data that the service type can work around (for example, one of the data is multidimensional but you will only use one dimension).
Add errors to the validation result for issues with the data that your service type cannot deal with (for example, one of the data in the list is of the wrong type).
LuciadFusion will prevent the product from being published in the service if the severity of the result returned by this method is ERROR
.
aDataList
- the list of data in a product that need to be validateddefault TLcdValidationResult validateProductData(TLfnProduct aProduct, List<TLfnData> aDataList)
Validates if the given product with the given data can be published in a service.
This method is equivalent to validateProductData(List)
.
Override this method if you also need access to the properties of the product during validation.
Always rely on the given list of data to perform the validation. This list of data represents the data that will be in the product after an operation, which may be different from the data that is currently in the product.
Start with a TLcdValidationResult.ok()
validation result and add warning and error messages when performing the validation.
Add warnings to the validation result for issues with the data that the service type can work around (for example, one of the data is multidimensional but you will only use one dimension).
Add errors to the validation result for issues with the data that your service type cannot deal with (for example, one of the data in the list is of the wrong type).
LuciadFusion will prevent the product from being published in the service if the severity of the result returned by this method is ERROR
.
aProduct
- the product for which the data needs to be validatedaDataList
- the list of data in a product that need to be validated