protected Map < String , List < Object > > getUserInfoFromIndexResult ( final ListIndexResult indexResult ) { val attachment = indexResult . getIndexAttachments ( ) . stream ( ) . findFirst ( ) . orElse ( null ) ; if ( attachment == null ) { LOGGER . warn ( "Index result has no attachments" ) ; return null ; } val identifier = attachment . getObjectIdentifier ( ) ; val listObjectAttributesRequest = CloudDirectoryUtils . getListObjectAttributesRequest ( properties . getDirectoryArn ( ) , identifier ) ; if ( listObjectAttributesRequest == null ) { LOGGER . warn ( "No object attribute request is available for identifier [{}]" , identifier ) ; return null ; } val attributesResult = amazonCloudDirectory . listObjectAttributes ( listObjectAttributesRequest ) ; if ( attributesResult == null || attributesResult . getAttributes ( ) == null || attributesResult . getAttributes ( ) . isEmpty ( ) ) { LOGGER . warn ( "No object attribute result is available for identifier [{}] or not attributes are found" , identifier ) ; return null ; } return attributesResult . getAttributes ( ) . stream ( ) . map ( a -> { var value = ( Object ) null ; val attributeValue = a . getValue ( ) ; LOGGER . debug ( "Examining attribute [{}]" , a ) ; if ( StringUtils . isNotBlank ( attributeValue . getNumberValue ( ) ) ) { value = attributeValue . getNumberValue ( ) ; } else if ( attributeValue . getDatetimeValue ( ) != null ) { value = DateTimeUtils . zonedDateTimeOf ( attributeValue . getDatetimeValue ( ) ) . toString ( ) ; } else if ( attributeValue . getBooleanValue ( ) != null ) { value = attributeValue . getBooleanValue ( ) . toString ( ) ; } else if ( attributeValue . getBinaryValue ( ) != null ) { value = new String ( attributeValue . getBinaryValue ( ) . array ( ) , StandardCharsets . UTF_8 ) ; } else if ( StringUtils . isNotBlank ( attributeValue . getStringValue ( ) ) ) { value = attributeValue . getStringValue ( ) ; } return Pair . of ( a . getKey ( ) . getName ( ) , value ) ; } ) . filter ( p -> p . getValue ( ) != null ) . collect ( Collectors . toMap ( Pair :: getKey , s -> CollectionUtils . toCollection ( s . getValue ( ) , ArrayList . class ) ) ) ; }
Gets user info from index result .