a Umg=@s>dZddlZddlZddlmZddlmZGdddZdS)zC Functionality for processing query related logic - get_query_data N) Gen3Config)GraphQLQueryItemc@s0eZdZdZddZddZddZdd Zd S) QueryLogicz0 fe -> filter editor object is required cCs||_tjg|_dS)N)_QueryLogic__esrGEN3_PUBLIC_ACCESS_QueryLogic__public_access)selfesr N/home/cmiss/Jenkins/workspace/12-Labours-API/app/function/query/query_logic.py__init__szQueryLogic.__init__cCst}g}|D]8}tj|jdjg||Rd}|||q|D] }| qNi}| s||}| |q`|S)z8 Handler for using thread to fetch data gen3)targetargs) queueQueue threadingThreadrgetprocess_graphql_queryappendstartjoinemptyupdate)ritemsqueue_ threads_poolrthreadresultdatar r r _handle_thread_fetchs    zQueryLogic._handle_thread_fetchcCs\g}t|j|j|j|jd}||dft|jdkrX|j|jd||df|S)zQ Handler for generating public query item and private query item )nodefiltersearchaccesspublicrprivate) rr"r#r$rrlenr%remove)ritemr query_itemr r r _process_query_item)szQueryLogic._process_query_itemcCs8||}||}d|vr0|dgkr0|dS|dS)z? Handler for fetching data based on query item r(r&)r-r!)rr+r fetch_resultr r r get_query_data:s   zQueryLogic.get_query_dataN)__name__ __module__ __qualname____doc__r r!r-r/r r r r r s r)r3rr app.configrapp.data_schemarrr r r r s