public void importQueryDefinition ( XMLWriteHandle queryDef ) { List < XMLEvent > importedList = Utilities . importFromHandle ( queryDef ) ; // modify XMLEvent list if the imported XML was a structured query. XMLEvent firstEvent = importedList . get ( 0 ) ; if ( firstEvent . getEventType ( ) == XMLStreamConstants . START_ELEMENT ) { StartElement startElement = firstEvent . asStartElement ( ) ; if ( RequestConstants . SEARCH_NS . equals ( startElement . getName ( ) . getNamespaceURI ( ) ) && startElement . getName ( ) . getLocalPart ( ) . equals ( "query" ) ) { //wrap in search. List < XMLEvent > wrappedList = new ArrayList <> ( ) ; XMLEventFactory eventFactory = XMLEventFactory . newInstance ( ) ; XMLEvent startSearchElement = eventFactory . createStartElement ( "search" , RequestConstants . SEARCH_NS , "search" ) ; XMLEvent endSearchElement = eventFactory . createEndElement ( "search" , RequestConstants . SEARCH_NS , "search" ) ; wrappedList . add ( startSearchElement ) ; wrappedList . addAll ( importedList ) ; wrappedList . add ( endSearchElement ) ; this . queryPayload = wrappedList ; } else { this . queryPayload = importedList ; } } else { logger . warn ( "Expected imported XML to be an element, but it's not." ) ; this . queryPayload = importedList ; } }
Imports an XML combined search definition that defines the matching criteria for this rule .