final Document createDocument ( List < String > row , DocumentFactory documentFactory ) { String id = StringUtils . EMPTY ; String content = StringUtils . EMPTY ; Language language = documentFactory . getDefaultLanguage ( ) ; Map < AttributeType , Object > attributeMap = new HashMap <> ( ) ; String idField = Config . get ( configProperty , "idField" ) . asString ( "ID" ) . toUpperCase ( ) ; String contentField = Config . get ( configProperty , "contentField" ) . asString ( "CONTENT" ) . toUpperCase ( ) ; String languageField = Config . get ( configProperty , "languageField" ) . asString ( "LANGUAGE" ) . toUpperCase ( ) ; Index < String > fields = getFieldNames ( ) ; for ( int i = 0 ; i < row . size ( ) && i < fieldNames . size ( ) ; i ++ ) { String field = row . get ( i ) ; String fieldName = fields . get ( i ) ; if ( idField . equalsIgnoreCase ( fieldName ) ) { id = field ; } else if ( contentField . equalsIgnoreCase ( fieldName ) ) { content = field ; } else if ( languageField . equalsIgnoreCase ( fieldName ) ) { language = Language . fromString ( field ) ; } else { AttributeType attributeType = AttributeType . create ( fieldName ) ; attributeMap . put ( attributeType , attributeType . getValueType ( ) . decode ( field ) ) ; } } return documentFactory . create ( id , content , language , attributeMap ) ; }
Create document document .