Class ImportHelper


  • public class ImportHelper
    extends Object
    Helper methods for imports
    • Constructor Detail

      • ImportHelper

        public ImportHelper()
    • Method Detail

      • areAllEmptyValues

        public static boolean areAllEmptyValues​(List<ImportedLineValue> values,
                                                String fieldId,
                                                ImportField... importFields)
        Returns true if all the values of the given fields are empty
      • extractCanonicalFieldAndId

        public static Pair<String,​String> extractCanonicalFieldAndId​(String header)
        Returns the canonical field and the id of the given header. For example, if the header is address[2].name it returns [address.name, 2]
      • getFieldValuesForPrefix

        public static Map<String,​String> getFieldValuesForPrefix​(List<ImportedLineValue> values,
                                                                       String prefix)
        Returns an ordered map[K,V] where K is the field internal name and V is the value. Used for Custom fields and transfer flows were the fields are like field.internalName
      • setFieldValue

        public static <DTO extends Bean> void setFieldValue​(List<ImportedLineValue> values,
                                                            String fieldId,
                                                            ImportField importField,
                                                            DTO dto,
                                                            Property<String,​DTO> prop,
                                                            String defaultValue)
        Finds the value (fieldValue) in the values set according to the fieldId and the importField. If fieldValue is not null, then this value will be set to the specified property of the dto. If fieldValue is null, then the default value (if it's not null) will be set to the specified property of the dto
        Parameters:
        values - the list of values to be searched
        fieldId - the id of the field
        importField - the field
        dto - the dto to be filled
        prop - the property of the dto to be filled
        defaultValue -