Class ReferenceMultiFieldPropertyMapping.Builder
java.lang.Object
io.jmix.dataimport.configuration.mapping.ReferenceMultiFieldPropertyMapping.Builder
- Enclosing class:
- ReferenceMultiFieldPropertyMapping
-
Constructor Summary
ConstructorDescriptionBuilder
(String entityPropertyName, ReferenceImportPolicy referenceImportPolicy) -
Method Summary
Modifier and TypeMethodDescriptionaddCustomPropertyMapping
(String entityPropertyName, Function<CustomMappingContext, Object> customValueFunction) Adds a custom mapping for property.addPropertyMapping
(PropertyMapping propertyMapping) Adds specified property mapping.addReferencePropertyMapping
(String entityPropertyName, String dataFieldName, String lookupPropertyName, ReferenceImportPolicy policy) Creates and adds a property mapping for the reference property mapped by one data field.addSimplePropertyMapping
(String entityPropertyName, String dataFieldName) Adds a mapping for specified simple property.build()
All simple properties for which mappings are set will be used to lookup existing entity.protected void
validate()
withDataFieldName
(String dataFieldName) Sets a data field name.withLookupPropertyNames
(String... lookupPropertyNames) Sets names of the properties by which an existing entity will be searchedwithLookupPropertyNames
(List<String> lookupPropertyNames) Sets names of the properties by which an existing entity will be searched
-
Constructor Details
-
Builder
-
-
Method Details
-
addSimplePropertyMapping
public ReferenceMultiFieldPropertyMapping.Builder addSimplePropertyMapping(String entityPropertyName, String dataFieldName) Adds a mapping for specified simple property.- Parameters:
entityPropertyName
- entity property namedataFieldName
- name of the field from input data that contains a raw value of property- Returns:
- current instance of builder
-
addCustomPropertyMapping
public ReferenceMultiFieldPropertyMapping.Builder addCustomPropertyMapping(String entityPropertyName, Function<CustomMappingContext, Object> customValueFunction) Adds a custom mapping for property.- Parameters:
entityPropertyName
- entity property namecustomValueFunction
- function to get value for the- Returns:
- current instance of builder
-
addReferencePropertyMapping
public ReferenceMultiFieldPropertyMapping.Builder addReferencePropertyMapping(String entityPropertyName, String dataFieldName, String lookupPropertyName, ReferenceImportPolicy policy) Creates and adds a property mapping for the reference property mapped by one data field.- Parameters:
entityPropertyName
- reference property namedataFieldName
- name of the field from input data that contains a raw value of lookup propertylookupPropertyName
- property name from the reference entitypolicy
- reference import policy- Returns:
- current instance of builder
- See Also:
-
addPropertyMapping
public ReferenceMultiFieldPropertyMapping.Builder addPropertyMapping(PropertyMapping propertyMapping) Adds specified property mapping. Property mapping can be:- Parameters:
propertyMapping
- property mapping- Returns:
- current instance of builder
- See Also:
-
withLookupPropertyNames
public ReferenceMultiFieldPropertyMapping.Builder withLookupPropertyNames(List<String> lookupPropertyNames) Sets names of the properties by which an existing entity will be searched- Parameters:
lookupPropertyNames
- names of the properties by which an existing entity will be searched- Returns:
- current instance of builder
-
lookupByAllSimpleProperties
All simple properties for which mappings are set will be used to lookup existing entity.- Returns:
- current instance of builder
-
withLookupPropertyNames
public ReferenceMultiFieldPropertyMapping.Builder withLookupPropertyNames(String... lookupPropertyNames) Sets names of the properties by which an existing entity will be searched- Parameters:
lookupPropertyNames
- names of the properties by which an existing entity will be searched- Returns:
- current instance of builder
-
withDataFieldName
Sets a data field name.
Note: actual for JSON/XML formats- Parameters:
dataFieldName
- field/tag name from the input data that has raw values of the reference entity properties- Returns:
- current instance of builder
-
build
-
validate
protected void validate()
-