예제 #1
0
    def update_collection_df(self, lb_intercommunication_obj):
        list_item_valued_object = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].\
        valued_object
        base_now = lb_intercommunication_obj.operation_group[
            lb_intercommunication_obj.
            operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_db")
        search = lb_intercommunication_obj.operation_group[
            lb_intercommunication_obj.
            operation_index_now].useful_request_data.get("search", None)
        path_list = lb_intercommunication_obj.operation_group[
            lb_intercommunication_obj.
            operation_index_now].useful_request_data.get(
                "path_operation", None)

        if (isinstance(search, str)):
            search = json2object(search)
        if (isinstance(path_list, str)):
            path_list = json2object(path_list)

        search_obj = Search(literal=search["literal"],
                            limit=search.get('limit'))
        path_operation_list = []
        for item in path_list:
            path_operation_list.append(
                PathOperation(item["path"], item["mode"], item["fn"],
                              item["args"]))
        try:
            operationreturn = DocumentREST(URL_LB_API,
                                           LIBLIGHTBASE_SET.liblightbase_schemes_df(base_now)).\
                                           update_collection(search_obj=search_obj, path_list=path_operation_list)
        except Exception as e:
            kwargs = {'status': 'error', 'output': \
                'Erro ao atualizar registro!', \
                'scope': 'message', \
                'systemOutput': LbUsefulCs().lbdoc_exception_useful_df()[2], \
                'systemObject': str(e)}
            LbdocExceptionUtil().lbdoc_exception_util(
                lb_intercommunication_obj, **kwargs)
            pass

        lbdoc_return_objs_cs_lbdoc_return_obj_cs = LbdocReturnObjsCs(
        ).LbdocReturnObjCs()
        lbdoc_return_objs_cs_lbdoc_return_obj_cs.status = "success"
        lbdoc_return_objs_cs_lbdoc_return_obj_cs.output = "Sucesso ao atualizar registro!"
        lbdoc_return_objs_cs_lbdoc_return_obj_cs.scope = "message"
        lbdoc_return_objs_cs_lbdoc_return_obj_cs.systemOutput = operationreturn
        lb_intercommunication_obj.lbdoc_return_objs.lbdoc_return_objs_setter(
            lbdoc_return_objs_cs_lbdoc_return_obj_cs,
            lb_intercommunication_obj.operation_index_now)

        return
예제 #2
0
    def _on_execute(self):
        try:
            doc_id=self.params["doc_id"]

            # NOTE: Get raw mapped entity object! By John Doe
            member=self.context.get_raw_member(doc_id)

            if member is None:

                # TODO: Error! By John Doe
                raise RuntimeError('Registro não encontrado')

            doc_dict=self.context.get_full_document(
                json2object(
                    member.document
                )
            )
        except Exception as e:
            return {
                'success': False, 
                'error_message': 'Erro ao recuperar registro!', 
                'systemObject': str(e)
            }

        return { 
            "success": True, 
            "data": doc_dict
        }
예제 #3
0
파일: es.py 프로젝트: lightbase/LBGenerator
    def get_interface(self):
        params = dict(self.request.params)
        if 'lbquery' in params:
            params.pop('lbquery')

            # NOTE: Seta para que automaticamente o ES retorne só as IDs, no
            # caso do retorno vir do LB! By Questor
            params["fields"] = "_metadata.id_doc"

            dict_query = json2object(self.request.body.decode("utf-8"))
            limit = dict_query['size']
            offset = dict_query['from']
            query_lb = True
        else:
            query_lb = False

        url = self.context.get_base().metadata.idx_exp_url
        path = self.request.matchdict['path']
        if path:
            url += path
        response = requests.get(url, params=params)

        if query_lb:
            response_json = response.json()
            id_docs = repr(tuple(map(self.map_id_doc, response_json['hits']['hits'])))
            if id_docs[-2] == ',':
                id_docs = id_docs[:-2] + ')'
            if id_docs == '())' or id_docs == '(,)' or id_docs == '()':
                id_docs = '(null)'
            mock_request = FakeRequest(
                params = {'$$': '{"literal":"id_doc in %s", "limit":null}}' % (id_docs)},
                matchdict = {'base': self.request.matchdict['base']})
            doc_factory = DocumentContextFactory(mock_request)
            doc_view = DocumentCustomView(doc_factory, mock_request)
            doc_view_get_collection = doc_view.get_collection().json()
            doc_view_get_collection['offset'] = offset
            doc_view_get_collection['limit'] = limit

            # NOTE: Tentar fechar a conexão de qualquer forma!
            # -> Na criação da conexão "coautocommit=True"!
            # By Questor
            try:
                if self.context.session.is_active:
                    self.context.session.close()
            except:
                pass

            return doc_view_get_collection

        # NOTE: Tentar fechar a conexão de qualquer forma!
        # -> Na criação da conexão "coautocommit=True"!
        # By Questor
        try:
            if self.context.session.is_active:
                self.context.session.close()
        except:
            pass

        return Response(response.text, content_type='application/json')
예제 #4
0
    def post_interface(self):
        url = self.context.get_base().metadata.idx_exp_url
        params = dict(self.request.params)
        if 'lbquery' in params:
            params.pop('lbquery')
            # Note: Seta para que automaticamente o ES retorne só as IDs, no caso
            # do retorno (OL) vir do LB! By Questor
            params["fields"] = "_metadata.id_doc"
            # Note: Obtém os parâmetros size e from enviados na query ES para
            # setar no retorno do LB! By Questor
            dict_query = json2object(self.request.body.decode("utf-8"))
            limit = dict_query.get('size', None)
            offset = dict_query.get('from', None)
            query_lb = True
        else:
            query_lb = False
        path = self.request.matchdict['path']
        if path: url += path

        # Make the request
        response = requests.get(url, params=params, data=self.request.body)

        if query_lb:
            response_json = response.json()
            id_docs = repr(
                tuple(map(self.map_id_doc, response_json['hits']['hits'])))
            if id_docs[-2] == ',':
                id_docs = id_docs[:-2] + ')'
            if id_docs == '())' or id_docs == '(,)' or id_docs == '()':
                id_docs = '(null)'

            mock_request = FakeRequest(
                params={
                    '$$':
                    '{"literal":"id_doc in %s", "limit":null}}' % (id_docs)
                },
                matchdict={'base': self.request.matchdict['base']})

            doc_factory = DocumentContextFactory(mock_request)
            doc_view = DocumentCustomView(doc_factory, mock_request)

            collection = doc_view.get_collection(render_to_response=False)

            if limit is not None:
                doc_factory.default_limit = int(limit)
            if offset is not None:
                doc_factory.default_offset = int(offset)

            # Note: Serve para setar o total de ocorrências no
            # retorno do LB qdo a pesquisa vem do ES! By Questor
            doc_factory.total_count = int(response_json['hits']['total'])

            return doc_view.render_to_response(collection)

        return Response(response.text, content_type='application/json')
예제 #5
0
    def post_interface(self):
        url = self.context.get_base().metadata.idx_exp_url
        params = dict(self.request.params)
        if 'lbquery' in params:
            params.pop('lbquery')
            # Note: Seta para que automaticamente o ES retorne só as IDs, no caso
            # do retorno (OL) vir do LB! By Questor
            params["fields"] = "_metadata.id_doc"
            # Note: Obtém os parâmetros size e from enviados na query ES para 
            # setar no retorno do LB! By Questor
            dict_query = json2object(self.request.body.decode("utf-8"))
            limit = dict_query.get('size', None)
            offset = dict_query.get('from', None)
            query_lb = True
        else:
            query_lb = False
        path = self.request.matchdict['path']
        if path: url += path

        # Make the request
        response = requests.get(url, params=params, data=self.request.body)

        if query_lb:
            response_json = response.json()
            id_docs = repr(tuple(map(self.map_id_doc, response_json['hits']['hits'])))
            if id_docs[-2] == ',':
                id_docs = id_docs[:-2] + ')'
            if id_docs == '())' or id_docs == '(,)' or id_docs == '()':
                id_docs = '(null)'

            mock_request = FakeRequest(
                params = {'$$': '{"literal":"id_doc in %s", "limit":null}}' % (id_docs)},
                matchdict = {'base': self.request.matchdict['base']})

            doc_factory = DocumentContextFactory(mock_request)
            doc_view = DocumentCustomView(doc_factory, mock_request)

            collection = doc_view.get_collection(
                render_to_response=False)

            if limit is not None:
                doc_factory.default_limit = int(limit)
            if offset is not None:
                doc_factory.default_offset = int(offset)

            # Note: Serve para setar o total de ocorrências no 
            # retorno do LB qdo a pesquisa vem do ES! By Questor
            doc_factory.total_count = int(response_json['hits']['total'])

            return doc_view.render_to_response(collection)

        return Response(response.text, content_type='application/json')
예제 #6
0
    def update_collection_df(self, lb_intercommunication_obj):
        list_item_valued_object = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].\
        valued_object
        base_now = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_db")
        search = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].useful_request_data.get("search", None)
        path_list = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].useful_request_data.get("path_operation", None)

        if(isinstance(search, str)):
            search = json2object(search)
        if(isinstance(path_list, str)):
            path_list = json2object(path_list)

        search_obj = Search(literal=search["literal"], limit = search.get('limit'))
        path_operation_list = []
        for item in path_list:
            path_operation_list.append(PathOperation(item["path"], item["mode"], item["fn"], item["args"] ))
        try:
            operationreturn = DocumentREST(URL_LB_API,
                                           LIBLIGHTBASE_SET.liblightbase_schemes_df(base_now)).\
                                           update_collection(search_obj=search_obj, path_list=path_operation_list)
        except Exception as e:
            kwargs = {'status': 'error', 'output': \
                'Erro ao atualizar registro!', \
                'scope': 'message', \
                'systemOutput': LbUsefulCs().lbdoc_exception_useful_df()[2], \
                'systemObject': str(e)}
            LbdocExceptionUtil().lbdoc_exception_util(lb_intercommunication_obj, **kwargs)
            pass

        lbdoc_return_objs_cs_lbdoc_return_obj_cs = LbdocReturnObjsCs().LbdocReturnObjCs()
        lbdoc_return_objs_cs_lbdoc_return_obj_cs.status = "success"
        lbdoc_return_objs_cs_lbdoc_return_obj_cs.output = "Sucesso ao atualizar registro!"
        lbdoc_return_objs_cs_lbdoc_return_obj_cs.scope = "message"
        lbdoc_return_objs_cs_lbdoc_return_obj_cs.systemOutput = operationreturn
        lb_intercommunication_obj.lbdoc_return_objs.lbdoc_return_objs_setter(lbdoc_return_objs_cs_lbdoc_return_obj_cs, lb_intercommunication_obj.operation_index_now)

        return
예제 #7
0
    def get_interface(self):
        params = dict(self.request.params)

        if 'lbquery' in params:
            params.pop('lbquery')
            # Note: Seta para que automaticamente o ES retorne só as IDs, no caso
            # do retorno vir do LB! By Questor
            params["fields"] = "_metadata.id_doc"
            dict_query = json2object(self.request.body.decode("utf-8"))
            limit = dict_query['size']
            offset = dict_query['from']
            query_lb = True
        else:
            query_lb = False

        url = self.context.get_base().metadata.idx_exp_url
        path = self.request.matchdict['path']
        if path:
            url += path
        response = requests.get(url, params=params)

        if query_lb:
            response_json = response.json()
            id_docs = repr(
                tuple(map(self.map_id_doc, response_json['hits']['hits'])))
            if id_docs[-2] == ',':
                id_docs = id_docs[:-2] + ')'
            if id_docs == '())' or id_docs == '(,)' or id_docs == '()':
                id_docs = '(null)'
            mock_request = FakeRequest(
                params={
                    '$$':
                    '{"literal":"id_doc in %s", "limit":null}}' % (id_docs)
                },
                matchdict={'base': self.request.matchdict['base']})
            doc_factory = DocumentContextFactory(mock_request)
            doc_view = DocumentCustomView(doc_factory, mock_request)
            doc_view_get_collection = doc_view.get_collection().json()
            doc_view_get_collection['offset'] = offset
            doc_view_get_collection['limit'] = limit
            return doc_view_get_collection

        return Response(response.text, content_type='application/json')
예제 #8
0
    def _on_execute(self):
        try:
            basename=self.params["basename"]
            base=self.context.get_member(basename)
            if base is None:

                # TODO: Error! By John Doe
                raise RuntimeError("Base não encontrada.")

            base_json=base.struct
            base_dict=json2object(base_json)
        except Exception as e:
            return {
                'success': False, 
                'error_message': 'Erro ao ler base!', 
                'systemObject': str(e)
            }

        return {
            "success": True, 
            "data": base_dict
        }
예제 #9
0
    def _on_execute(self):
        try:

            # TODO: Search params! By John Doe
            search_params=self.params.get('search_params', '{}')

            query=json2object(search_params)
            doc_collection=self.context.get_collection(query)
            docs=list()
            for doc_tuple in doc_collection:
                doc=doc_tuple[2]
                docs.append(doc)

        except Exception as e:
            return {
                'success': False, 
                'error_message': 'Erro ao atualizar registro!', 
                'systemObject': str(e)
            }

        return {
            "success": True, 
            "data": docs
        }
예제 #10
0
    def after_all_df(self, lb_intercommunication_obj):

        if (lb_intercommunication_obj.operation_group != []):
            base = lb_intercommunication_obj.operation_group[\
                lb_intercommunication_obj.operation_index_now].\
                lb_ctrl_set_dict.get("lb_ctrl_db", None)
            operation = lb_intercommunication_obj.operation_group[\
                lb_intercommunication_obj.operation_index_now].\
                lb_ctrl_set_dict.get("lb_ctrl_op", None)

            # Note: Trata erros nas buscas textuais quando não existe
            # índice no ES! By Questor
            if operation == "db_search":
                if lb_intercommunication_obj.lbdoc_return_objs.\
                        lbdoc_return_objs[-1].status == "error":
                    lb_ctrl_sh_ty = lb_intercommunication_obj.\
                        operation_group[-1].lb_ctrl_set_dict.\
                        get("lb_ctrl_sh_ty", None)
                    if lb_ctrl_sh_ty == "textual_sh":
                        system_object_str = str(lb_intercommunication_obj.\
                            lbdoc_return_objs.lbdoc_return_objs[-1].\
                            systemObject)
                        if "status" in system_object_str and "404" in \
                                system_object_str and "error" in \
                                system_object_str and "IndexMissingException" \
                                in system_object_str:
                            lb_intercommunication_obj.lbdoc_return_objs.\
                                lbdoc_return_objs[-1].output = "Não existem "\
                                    "itens a serem pesquisados!"
                            lb_intercommunication_obj.lbdoc_return_objs.\
                                lbdoc_return_objs[-1].systemObject = ""
                            lb_intercommunication_obj.lbdoc_return_objs.\
                                lbdoc_return_objs[-1].systemOutput = ""

            # Note: As demais regras em "AfterAllCs" não se aplicam
            # a operação "fl_get_vf"! By Questor
            if operation == "fl_get_vf" or operation == "rp_get_vf":
                return
                pass

            subject_msg = ""
            body_msg = ""

            # ToDo: Todas as ações dessa condicional deveriam estar
            # no evento "after_op_df", pois envolvem modificações
            # de mensagens de retorno em caso de sucesso (diferente das
            # situações onde 'status == "success"')! By Questor
            if lb_intercommunication_obj.lbdoc_return_objs.\
                    lbdoc_return_objs[0].status == "success":

                if operation == "bd_create":
                    body_msg = " cadastrado com Sucesso."
                elif operation == "bd_update":
                    body_msg = " alterado com Sucesso."
                elif operation == "bd_delete":
                    body_msg = " deletado com Sucesso."

                if base == "db_access":
                    form_data = lb_intercommunication_obj.operation_group[\
                    lb_intercommunication_obj.operation_index_now].\
                    useful_request_data
                    if operation == "db_search":
                        if lb_intercommunication_obj.operation_group[0].\
                                lb_ctrl_set_dict["lb_ctrl_ctx"] == \
                                "search_tables":
                            if lb_intercommunication_obj.lbdoc_return_objs.\
                                    lbdoc_return_objs[0].occurrences.\
                                    _occurrences["db_access"].results_lbdoc:
                                lb_intercommunication_obj.lbdoc_return_objs.\
                                lbdoc_return_objs[0].occurrences.\
                                _occurrences["db_access"].\
                                results_lbdoc[0]["str_password"] = ""
                        str_type = form_data.get("str_type", None)

                        if str_type == "user":
                            subject_msg = "Usuário"
                        else:
                            subject_msg = "Perfil"

                    if operation == "bd_create":
                        str_type = form_data.get("str_type", None)
                        if str_type == "user":
                            subject_msg = "Usuário"
                        else:
                            subject_msg = "Perfil"
                    elif operation == "bd_update":

                        # Note: Primeira regra para tentar obter o
                        # tipo! By Questor
                        if lb_intercommunication_obj.operation_group[0].\
                                specific_brs_data.get("lb_sp_br_type",\
                                None) == "usuário":
                            subject_msg = "Usuário"
                        else:
                            subject_msg = "Perfil"

                        # Note: Segunda regra para tentar obter o
                        # tipo! By Questor
                        str_type = form_data.get("str_type", None)
                        if str_type:
                            if str_type == "user":
                                subject_msg = "Usuário"
                            else:
                                subject_msg = "Perfil"

                        # ToDo: Essas regras deveriam fazer uso de
                        # contexto e de uma obordagem mais clara. Tamanho
                        # do form, tá tosco! By Questor
                        if len(form_data) == 2:
                            if form_data.get("bool_active") == "false":
                                body_msg = " desativado com sucesso."
                            else:
                                body_msg = " ativado com sucesso."

                elif base == "db_reg_anot_teses" or base == \
                        "db_reg_anot_teses_tree":
                    operation_teses = lb_intercommunication_obj.\
                        operation_group[-1].lb_ctrl_set_dict["lb_ctrl_op"]
                    if operation_teses == "bd_part_up" and \
                            lb_intercommunication_obj.operation_group[-1].\
                            useful_request_data.get(\
                            "mg_arq#p0.str_id_arq_assoc", None) != None:
                        subject_msg = "Assunto(s) "
                        body_msg = " vinculado(s) com sucesso!"

                    elif operation_teses == "bd_update" and\
                            lb_intercommunication_obj.operation_group[-1].\
                            useful_request_data.get("bool_ativ", None) == \
                            'false':
                        subject_msg = "Registro "
                        body_msg = " inativado com sucesso!"

                    elif operation_teses == "bd_update" and \
                            lb_intercommunication_obj.operation_group[-1].\
                            useful_request_data.get("bool_ativ", \
                            None) == 'true':
                        subject_msg = "Registro "
                        body_msg = " ativado com sucesso!"

                    elif operation_teses == "update_collection":
                        path_operation = lb_intercommunication_obj.\
                        operation_group[-1].useful_request_data.\
                        get("path_operation", None)
                        if path_operation:
                            dataList = json2object(path_operation)[0]
                            if dataList.get("path",None) == "bool_ativ" \
                                    and dataList.get("args", None)[0] == \
                                    False:
                                subject_msg = "Registro "
                                body_msg = " inativado com sucesso!"
                            elif dataList.get("path",None) == "bool_ativ" \
                                    and dataList.get("args", None)[0] == \
                                    True:
                                subject_msg = "Registro "
                                body_msg = " ativado com sucesso!"
                    else:
                        subject_msg = "Registro"

                if subject_msg != "" and body_msg != "":
                    lb_intercommunication_obj.lbdoc_return_objs.\
                    lbdoc_return_objs[-1].output = subject_msg + body_msg

            if base == "db_access":
                if lb_intercommunication_obj.lbdoc_return_objs.\
                        lbdoc_return_objs[-1].status == "error":
                    system_obj_str = str(lb_intercommunication_obj.\
                        lbdoc_return_objs.lbdoc_return_objs[-1].\
                        systemObject)
                    if "duplicate key value" in system_obj_str or \
                        "duplicar valor da chave" in system_obj_str or \
                        "IntegrityError" in system_obj_str:
                        msg = ""
                        str_type = lb_intercommunication_obj.\
                            operation_group[-1].useful_request_data.\
                            get("str_type", None)
                        if str_type == "user":
                            msg = "Já existe um usuário com esse "\
                                  "login no sistema!"
                        else:
                            msg = "Já existe o perfil no sistema! "

                        lb_intercommunication_obj.lbdoc_return_objs.\
                            lbdoc_return_objs[-1].output = msg
                        lb_intercommunication_obj.lbdoc_return_objs.\
                            lbdoc_return_objs[-1].systemObject = ""
                        lb_intercommunication_obj.lbdoc_return_objs.\
                            lbdoc_return_objs[-1].systemOutput = ""
예제 #11
0
        return task_url

    def update_column(self, 
        column_path, 
        json_new_column, 
        async=False, 
        task_id=None):
        """ Updates a column structure
        """

        if async:
            task_manager=LBTaskManager()

        try:
            dict_new_column=json2object(json_new_column)

            # NOTE: New_column is either a Group or a Field
            # (liblightbase.lbbase.lbstruct)! By John Doe
            new_column=self.object2content(dict_new_column)

            # NOTE: Base is a LBBase object! By John Doe
            base=self.get_base()

            member=self.get_member(base.metadata.name)
            if member is None:
                if async:
                    exc=Exception('Base not found: ' + base.metadata.name)
                    task_manager.on_error(task_id, exp)
                return None
예제 #12
0
    def after_all_df(self, lb_intercommunication_obj):

        if(lb_intercommunication_obj.operation_group != []):
            base = lb_intercommunication_obj.operation_group[\
                lb_intercommunication_obj.operation_index_now].\
                lb_ctrl_set_dict.get("lb_ctrl_db", None)
            operation = lb_intercommunication_obj.operation_group[\
                lb_intercommunication_obj.operation_index_now].\
                lb_ctrl_set_dict.get("lb_ctrl_op", None)

            # Note: Trata erros nas buscas textuais quando não existe
            # índice no ES! By Questor
            if operation == "db_search":
                if lb_intercommunication_obj.lbdoc_return_objs.\
                        lbdoc_return_objs[-1].status == "error":
                    lb_ctrl_sh_ty = lb_intercommunication_obj.\
                        operation_group[-1].lb_ctrl_set_dict.\
                        get("lb_ctrl_sh_ty", None)
                    if lb_ctrl_sh_ty == "textual_sh":
                        system_object_str = str(lb_intercommunication_obj.\
                            lbdoc_return_objs.lbdoc_return_objs[-1].\
                            systemObject)
                        if "status" in system_object_str and "404" in \
                                system_object_str and "error" in \
                                system_object_str and "IndexMissingException" \
                                in system_object_str:
                            lb_intercommunication_obj.lbdoc_return_objs.\
                                lbdoc_return_objs[-1].output = "Não existem "\
                                    "itens a serem pesquisados!"
                            lb_intercommunication_obj.lbdoc_return_objs.\
                                lbdoc_return_objs[-1].systemObject = ""
                            lb_intercommunication_obj.lbdoc_return_objs.\
                                lbdoc_return_objs[-1].systemOutput = ""

            # Note: As demais regras em "AfterAllCs" não se aplicam 
            # a operação "fl_get_vf"! By Questor
            if operation == "fl_get_vf" or operation == "rp_get_vf":
                return
                pass

            subject_msg = ""
            body_msg = ""

            # ToDo: Todas as ações dessa condicional deveriam estar
            # no evento "after_op_df", pois envolvem modificações
            # de mensagens de retorno em caso de sucesso (diferente das 
            # situações onde 'status == "success"')! By Questor
            if lb_intercommunication_obj.lbdoc_return_objs.\
                    lbdoc_return_objs[0].status == "success":

                if operation == "bd_create":
                    body_msg = " cadastrado com Sucesso."
                elif operation == "bd_update":
                    body_msg = " alterado com Sucesso."
                elif operation == "bd_delete":
                     body_msg = " deletado com Sucesso."

                if base == "db_access":
                    form_data = lb_intercommunication_obj.operation_group[\
                    lb_intercommunication_obj.operation_index_now].\
                    useful_request_data
                    if operation == "db_search":
                        if lb_intercommunication_obj.operation_group[0].\
                                lb_ctrl_set_dict["lb_ctrl_ctx"] == \
                                "search_tables":
                            if lb_intercommunication_obj.lbdoc_return_objs.\
                                    lbdoc_return_objs[0].occurrences.\
                                    _occurrences["db_access"].results_lbdoc:
                                lb_intercommunication_obj.lbdoc_return_objs.\
                                lbdoc_return_objs[0].occurrences.\
                                _occurrences["db_access"].\
                                results_lbdoc[0]["str_password"] = ""
                        str_type = form_data.get("str_type", None)

                        if str_type == "user":
                            subject_msg = "Usuário"
                        else:
                            subject_msg = "Perfil"

                    if operation == "bd_create":
                        str_type = form_data.get("str_type", None)
                        if str_type == "user":
                            subject_msg = "Usuário"
                        else:
                            subject_msg = "Perfil"
                    elif operation == "bd_update":

                        # Note: Primeira regra para tentar obter o 
                        # tipo! By Questor
                        if lb_intercommunication_obj.operation_group[0].\
                                specific_brs_data.get("lb_sp_br_type",\
                                None) == "usuário":
                            subject_msg = "Usuário"
                        else:
                            subject_msg = "Perfil"

                        # Note: Segunda regra para tentar obter o 
                        # tipo! By Questor
                        str_type = form_data.get("str_type", None)
                        if str_type:
                            if str_type == "user":
                                subject_msg = "Usuário"
                            else:
                                subject_msg = "Perfil"

                        # ToDo: Essas regras deveriam fazer uso de 
                        # contexto e de uma obordagem mais clara. Tamanho 
                        # do form, tá tosco! By Questor
                        if len(form_data) == 2:
                            if form_data.get("bool_active") == "false":
                                body_msg = " desativado com sucesso."
                            else:
                                body_msg = " ativado com sucesso."

                elif base == "db_reg_anot_teses" or base == \
                        "db_reg_anot_teses_tree":
                    operation_teses = lb_intercommunication_obj.\
                        operation_group[-1].lb_ctrl_set_dict["lb_ctrl_op"]
                    if operation_teses == "bd_part_up" and \
                            lb_intercommunication_obj.operation_group[-1].\
                            useful_request_data.get(\
                            "mg_arq#p0.str_id_arq_assoc", None) != None:
                        subject_msg = "Assunto(s) "
                        body_msg = " vinculado(s) com sucesso!"

                    elif operation_teses == "bd_update" and\
                            lb_intercommunication_obj.operation_group[-1].\
                            useful_request_data.get("bool_ativ", None) == \
                            'false':
                        subject_msg = "Registro "
                        body_msg = " inativado com sucesso!"

                    elif operation_teses == "bd_update" and \
                            lb_intercommunication_obj.operation_group[-1].\
                            useful_request_data.get("bool_ativ", \
                            None) == 'true':
                        subject_msg = "Registro "
                        body_msg = " ativado com sucesso!"

                    elif operation_teses == "update_collection":
                        path_operation = lb_intercommunication_obj.\
                        operation_group[-1].useful_request_data.\
                        get("path_operation", None)
                        if path_operation:
                            dataList= json2object(path_operation)[0]
                            if dataList.get("path",None) == "bool_ativ" \
                                    and dataList.get("args", None)[0] == \
                                    False:
                                subject_msg = "Registro "
                                body_msg = " inativado com sucesso!"
                            elif dataList.get("path",None) == "bool_ativ" \
                                    and dataList.get("args", None)[0] == \
                                    True:
                                subject_msg = "Registro "
                                body_msg = " ativado com sucesso!"
                    else:
                        subject_msg = "Registro"

                if subject_msg != "" and body_msg != "":
                    lb_intercommunication_obj.lbdoc_return_objs.\
                    lbdoc_return_objs[-1].output = subject_msg + body_msg

            if base == "db_access":
                if lb_intercommunication_obj.lbdoc_return_objs.\
                        lbdoc_return_objs[-1].status == "error":
                    system_obj_str = str(lb_intercommunication_obj.\
                        lbdoc_return_objs.lbdoc_return_objs[-1].\
                        systemObject)
                    if "duplicate key value" in system_obj_str or \
                        "duplicar valor da chave" in system_obj_str or \
                        "IntegrityError" in system_obj_str:
                        msg = ""
                        str_type = lb_intercommunication_obj.\
                            operation_group[-1].useful_request_data.\
                            get("str_type", None)
                        if str_type == "user":
                            msg = "Já existe um usuário com esse "\
                                  "login no sistema!"
                        else:
                            msg = "Já existe o perfil no sistema! "

                        lb_intercommunication_obj.lbdoc_return_objs.\
                            lbdoc_return_objs[-1].output = msg
                        lb_intercommunication_obj.lbdoc_return_objs.\
                            lbdoc_return_objs[-1].systemObject = ""
                        lb_intercommunication_obj.lbdoc_return_objs.\
                            lbdoc_return_objs[-1].systemOutput = ""
예제 #13
0
    def LB_Read_df(self, lb_intercommunication_obj):

        use_es = False
        lb_sh_request = dict()

        # ToDo: Validar! By Questor
        # Note: Captura a query e seta um literal! By Questor
        if "lb_ctrl_qry" in lb_intercommunication_obj.operation_group[
                lb_intercommunication_obj.
                operation_index_now].lb_ctrl_set_dict:
            lb_sh_request["literal"] = str(lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].\
            lb_ctrl_set_dict["lb_ctrl_qry"])
            pass

        # ToDo: Validar! By Questor
        # Note: Trata o tipo de pesquisa se for ES! By Questor
        if lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_ty", None) == "textual_sh":
            # Note: Preciso validar a pesquisa ES se ele mesmo faz isso!? By Questor
            if "\"query\"" in lb_sh_request[
                    "literal"] and "\"query_string\"" in lb_sh_request[
                        "literal"]:
                dict_es_query = None
                valid_json = False
                try:
                    dict_es_query = json2object(lb_sh_request["literal"])
                    dict_es_query_original = copy.deepcopy(dict_es_query)
                    valid_json = True
                except Exception:
                    pass
                if valid_json:
                    dict_es_query_query = dict_es_query.get("query", None)
                    dict_es_query_highlight = dict_es_query.get(
                        "highlight", None)
                    if dict_es_query_query != None:
                        limit_val = dict_es_query.get("size", None)
                        offset_val = dict_es_query.get("from", None)
                        self.check_user_sh_rqst_df(lb_intercommunication_obj,
                                                   limit_val, offset_val)
                        if limit_val == None:
                            # Note: Define um limite padrão para evitar ataques com pesquisas "muito pesadas"! By Questor
                            dict_es_query["size"] = USER_RQST_SH_MAX_RSTS
                            pass
                        # Note: Faz parte da validação da query ES! By Questor
                        use_es = True
                        pass
                    if dict_es_query_highlight != None:

                        # Note: Esses procedimentos servem para permitir "highlight" sobre
                        # o "souce" em caso de busca textual! By Questor
                        lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                                operation_index_now].misc["dict_es_query_original"] = \
                                dict_es_query_original
                        dict_es_query_highlight["pre_tags"] = [
                            "<3252c1bf-88a4-442b-93cf-b7c613fe6bb6>"
                        ]
                        dict_es_query_highlight["post_tags"] = [
                            "</3252c1bf-88a4-442b-93cf-b7c613fe6bb6>"
                        ]

                        pass
                    if use_es:
                        lb_sh_request["literal"] = json.dumps(
                            dict_es_query, default=lambda o: o.__dict__)
                        pass
                else:
                    kwargs = {'status': 'error', 'output': \
                        'Valores inválidos para uma busca textual!', \
                        'scope': 'message'}
                    LbdocExceptionUtil().lbdoc_exception_util(
                        lb_intercommunication_obj, **kwargs)
                    pass
                pass
            pass

        if use_es:

            # Note: To debug! By Questor
            if DEBUG_MODE:
                start_time_now = time.time()
                pass

            # ToDo: Tratar os casos onde o ES não localiza nenhum registro! By Questor
            ReadCs().read_df(lb_intercommunication_obj,
                             str(lb_sh_request["literal"]), "ES")

            # Note: Habilita a busca full o que inclui o conteúdo dos arquivos anexos! By Questor
            if "lb_ctrl_fl_tx" in lb_intercommunication_obj.operation_group[
                    lb_intercommunication_obj.
                    operation_index_now].lb_ctrl_set_dict:
                if lb_intercommunication_obj.operation_group[
                        lb_intercommunication_obj.
                        operation_index_now].lb_ctrl_set_dict[
                            "lb_ctrl_fl_tx"] == "1":
                    self.get_file_contents_df(lb_intercommunication_obj)
                    pass
                pass

            # Note: To debug! By Questor
            if DEBUG_MODE:
                elapsed_time = time.time() - start_time_now
                # print("**************** Elapsed Time (Query ES - Lib) ****************")
                # print(str(elapsed_time) + " seconds!");
                # print("***************************************************************")
                pass

        else:

            # Note: Parâmetro relativo ao item "select" nas buscas! Perceba que itens
            # definidos como obrigatórios para o LB irão gerar erro se este não for
            # incluso! Para obter o "metadata" do LB adicione o item "_metadata"! By Questor
            lb_ctrl_sh_slt = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_slt", None)
            if lb_ctrl_sh_slt != None:
                slt_lst = []
                for item in lb_ctrl_sh_slt.split(","):
                    slt_lst.append(item.strip())
                    pass
                lb_sh_request["select"] = slt_lst
                pass

            # Note: Parâmetros relativos à ordenação nas buscas! By Questor
            lb_ctrl_sh_orby = {}
            lb_ctrl_sh_oba = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_oba", None)
            if lb_ctrl_sh_oba != None:
                asc_lst = []
                for item in lb_ctrl_sh_oba.split(","):
                    asc_lst.append(item.strip())
                    pass
                lb_ctrl_sh_orby["asc"] = asc_lst
                pass

            lb_ctrl_sh_obd = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_obd", None)
            if lb_ctrl_sh_obd != None:
                desc_lst = []
                for item in lb_ctrl_sh_obd.split(","):
                    desc_lst.append(item.strip())
                    pass
                lb_ctrl_sh_orby["desc"] = desc_lst
                pass

            if lb_ctrl_sh_orby != {}:
                lb_sh_request["order_by"] = OrderBy(**lb_ctrl_sh_orby)
                pass

            lb_ctrl_sh_lmt = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_lmt", None)

            if lb_ctrl_sh_lmt != None:
                if str(lb_ctrl_sh_lmt).lower() == "null":
                    lb_sh_request["limit"] = None
                else:
                    lb_sh_request["limit"] = int(lb_ctrl_sh_lmt)
                    pass
                pass
            else:
                # Note: Define um limite padrão para evitar ataques com pesquisas "muito pesadas"! By Questor
                lb_sh_request["limit"] = USER_RQST_SH_MAX_RSTS
                pass

            lb_ctrl_sh_ost = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_ost", None)

            if lb_ctrl_sh_ost != None:
                lb_sh_request["offset"] = int(lb_ctrl_sh_ost)
                pass

            self.check_user_sh_rqst_df(lb_intercommunication_obj,
                                       lb_ctrl_sh_lmt, lb_ctrl_sh_ost)

            # Note: To debug! By Questor
            if DEBUG_MODE:
                start_time_now = time.time()
                pass

            # Note: Trata-se de "workaround" para permitir que sejam realizadas
            # buscas por conteúdo de arquivo no REST! By Questor
            # ToDo: Isso deveria der feito pelo REST! By Questor
            read_df_result = None
            search_file_contents = False
            if "filetext" in lb_sh_request[
                    "literal"] and "like" in lb_sh_request["literal"]:
                search_file_contents = True
                lb_sh_request["select"] = ["id_doc"]
                read_df_result = ReadCs().read_df(lb_intercommunication_obj,
                                                  lb_sh_request, "FL")
                new_literal = "id_doc in ("
                use_comma = ""
                items_found = False
                for item in read_df_result.results:
                    items_found = True
                    new_literal = new_literal + use_comma + str(item.id_doc)
                    use_comma = ", "
                    pass
                new_literal = new_literal + ")"
                lb_sh_request = dict()
                # Note: Seta uma nova query de pesquisa destinada a localizar os
                # documentos que possuem o conteúdo desejado! By Questor
                if not items_found:
                    lb_sh_request["literal"] = "id_doc in (null)"
                else:
                    lb_sh_request["literal"] = new_literal
                    pass
                # Note: Serve para emular o comportamento de uma pesquisa "convencional"
                # setando o "offset", o "limit" e o "result_count" com o retorno da
                # pesquisa "de fato"! By Questor
                offset_holder = read_df_result.offset
                limit_holder = read_df_result.limit
                result_count_holder = read_df_result.result_count
                pass

            ReadCs().read_df(lb_intercommunication_obj, lb_sh_request)

            if search_file_contents:
                lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].\
                    lb_occurrences_list.limit = limit_holder
                lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].\
                    lb_occurrences_list.offset = offset_holder
                lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].\
                    lb_occurrences_list.result_count = result_count_holder
                pass

            # Note: Habilita a busca full o que inclui o conteúdo dos arquivos anexos! By Questor
            if "lb_ctrl_fl_tx" in lb_intercommunication_obj.operation_group[
                    lb_intercommunication_obj.
                    operation_index_now].lb_ctrl_set_dict:
                if lb_intercommunication_obj.operation_group[
                        lb_intercommunication_obj.
                        operation_index_now].lb_ctrl_set_dict[
                            "lb_ctrl_fl_tx"] == "1":
                    self.get_file_contents_df(lb_intercommunication_obj)
                    pass
                pass

            # Note: To debug! By Questor
            if DEBUG_MODE:
                elapsed_time = time.time() - start_time_now
                # print("**************** Elapsed Time (Query LB - Lib) ****************")
                # print(str(elapsed_time) + " seconds!");
                # print("***************************************************************")
                pass

            pass

        return
예제 #14
0
        return task_url

    def update_column(self,
                      column_path,
                      json_new_column,
                      async=False,
                      task_id=None):
        """ Updates a column structure
        """

        if async:
            task_manager = LBTaskManager()

        try:
            dict_new_column = json2object(json_new_column)

            # NOTE: New_column is either a Group or a Field
            # (liblightbase.lbbase.lbstruct)! By John Doe
            new_column = self.object2content(dict_new_column)

            # NOTE: Base is a LBBase object! By John Doe
            base = self.get_base()

            member = self.get_member(base.metadata.name)
            if member is None:
                if async:
                    exc = Exception('Base not found: ' + base.metadata.name)
                    task_manager.on_error(task_id, exp)
                return None
예제 #15
0
    def LB_Read_df(self, lb_intercommunication_obj):

        use_es = False
        lb_sh_request = dict()

        # ToDo: Validar! By Questor
        # Note: Captura a query e seta um literal! By Questor
        if "lb_ctrl_qry" in lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].lb_ctrl_set_dict:
            lb_sh_request["literal"] = str(lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].\
            lb_ctrl_set_dict["lb_ctrl_qry"])
            pass

        # ToDo: Validar! By Questor
        # Note: Trata o tipo de pesquisa se for ES! By Questor
        if lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_ty", None) == "textual_sh":
            # Note: Preciso validar a pesquisa ES se ele mesmo faz isso!? By Questor
            if "\"query\"" in lb_sh_request["literal"] and "\"query_string\"" in lb_sh_request["literal"]:
                dict_es_query = None
                valid_json = False
                try:
                    dict_es_query = json2object(lb_sh_request["literal"])
                    dict_es_query_original = copy.deepcopy(dict_es_query)
                    valid_json = True
                except Exception:
                    pass
                if valid_json:
                    dict_es_query_query = dict_es_query.get("query", None)
                    dict_es_query_highlight = dict_es_query.get("highlight", None)
                    if dict_es_query_query != None:
                        limit_val = dict_es_query.get("size", None)
                        offset_val = dict_es_query.get("from", None)
                        self.check_user_sh_rqst_df(lb_intercommunication_obj, limit_val, offset_val)
                        if limit_val == None:
                            # Note: Define um limite padrão para evitar ataques com pesquisas "muito pesadas"! By Questor
                            dict_es_query["size"] = USER_RQST_SH_MAX_RSTS
                            pass
                        # Note: Faz parte da validação da query ES! By Questor
                        use_es = True
                        pass
                    if dict_es_query_highlight != None:

                        # Note: Esses procedimentos servem para permitir "highlight" sobre
                        # o "souce" em caso de busca textual! By Questor
                        lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                                operation_index_now].misc["dict_es_query_original"] = \
                                dict_es_query_original
                        dict_es_query_highlight["pre_tags"] = ["<3252c1bf-88a4-442b-93cf-b7c613fe6bb6>"]
                        dict_es_query_highlight["post_tags"] = ["</3252c1bf-88a4-442b-93cf-b7c613fe6bb6>"]

                        pass
                    if use_es:
                        lb_sh_request["literal"] = json.dumps(dict_es_query, default=lambda o: o.__dict__)
                        pass
                else:
                    kwargs = {'status': 'error', 'output': \
                        'Valores inválidos para uma busca textual!', \
                        'scope': 'message'}
                    LbdocExceptionUtil().lbdoc_exception_util(lb_intercommunication_obj, **kwargs)
                    pass
                pass
            pass

        if use_es:

            # Note: To debug! By Questor
            if DEBUG_MODE:
                start_time_now = time.time()
                pass

            # ToDo: Tratar os casos onde o ES não localiza nenhum registro! By Questor
            ReadCs().read_df(lb_intercommunication_obj, str(lb_sh_request["literal"]), "ES")

            # Note: Habilita a busca full o que inclui o conteúdo dos arquivos anexos! By Questor
            if "lb_ctrl_fl_tx" in lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].lb_ctrl_set_dict:
                if lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].lb_ctrl_set_dict["lb_ctrl_fl_tx"] == "1":
                    self.get_file_contents_df(lb_intercommunication_obj)
                    pass
                pass

            # Note: To debug! By Questor
            if DEBUG_MODE:
                elapsed_time = time.time() - start_time_now
                # print("**************** Elapsed Time (Query ES - Lib) ****************")
                # print(str(elapsed_time) + " seconds!");
                # print("***************************************************************")
                pass

        else:

            # Note: Parâmetro relativo ao item "select" nas buscas! Perceba que itens
            # definidos como obrigatórios para o LB irão gerar erro se este não for
            # incluso! Para obter o "metadata" do LB adicione o item "_metadata"! By Questor
            lb_ctrl_sh_slt = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_slt", None)
            if lb_ctrl_sh_slt != None:
                slt_lst = []
                for item in lb_ctrl_sh_slt.split(","):
                    slt_lst.append(item.strip())
                    pass
                lb_sh_request["select"] = slt_lst
                pass

            # Note: Parâmetros relativos à ordenação nas buscas! By Questor
            lb_ctrl_sh_orby = {}
            lb_ctrl_sh_oba = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_oba", None)
            if lb_ctrl_sh_oba != None:
                asc_lst = []
                for item in lb_ctrl_sh_oba.split(","):
                    asc_lst.append(item.strip())
                    pass
                lb_ctrl_sh_orby["asc"] = asc_lst
                pass

            lb_ctrl_sh_obd = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_obd", None)
            if lb_ctrl_sh_obd != None:
                desc_lst = []
                for item in lb_ctrl_sh_obd.split(","):
                    desc_lst.append(item.strip())
                    pass
                lb_ctrl_sh_orby["desc"] = desc_lst
                pass

            if lb_ctrl_sh_orby != {}:
                lb_sh_request["order_by"] = OrderBy(**lb_ctrl_sh_orby)
                pass

            lb_ctrl_sh_lmt = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_lmt", None)

            if lb_ctrl_sh_lmt != None:
                if str(lb_ctrl_sh_lmt).lower() == "null":
                    lb_sh_request["limit"] = None
                else:
                    lb_sh_request["limit"] = int(lb_ctrl_sh_lmt)
                    pass
                pass
            else:
                # Note: Define um limite padrão para evitar ataques com pesquisas "muito pesadas"! By Questor
                lb_sh_request["limit"] = USER_RQST_SH_MAX_RSTS
                pass

            lb_ctrl_sh_ost = lb_intercommunication_obj.operation_group[lb_intercommunication_obj.\
                operation_index_now].lb_ctrl_set_dict.get("lb_ctrl_sh_ost", None)

            if lb_ctrl_sh_ost != None:
                lb_sh_request["offset"] = int(lb_ctrl_sh_ost)
                pass

            self.check_user_sh_rqst_df(lb_intercommunication_obj, lb_ctrl_sh_lmt, lb_ctrl_sh_ost)

            # Note: To debug! By Questor
            if DEBUG_MODE:
                start_time_now = time.time()
                pass

            # Note: Trata-se de "workaround" para permitir que sejam realizadas
            # buscas por conteúdo de arquivo no REST! By Questor
            # ToDo: Isso deveria der feito pelo REST! By Questor
            read_df_result = None
            search_file_contents = False
            if "filetext" in lb_sh_request["literal"] and "like" in lb_sh_request["literal"]:
                search_file_contents = True
                lb_sh_request["select"] = ["id_doc"]
                read_df_result = ReadCs().read_df(lb_intercommunication_obj, lb_sh_request, "FL")
                new_literal = "id_doc in ("
                use_comma = ""
                items_found = False
                for item in read_df_result.results:
                    items_found = True
                    new_literal = new_literal + use_comma + str(item.id_doc)
                    use_comma = ", "
                    pass
                new_literal = new_literal + ")"
                lb_sh_request = dict()
                # Note: Seta uma nova query de pesquisa destinada a localizar os
                # documentos que possuem o conteúdo desejado! By Questor
                if not items_found:
                    lb_sh_request["literal"] = "id_doc in (null)"
                else:
                    lb_sh_request["literal"] = new_literal
                    pass
                # Note: Serve para emular o comportamento de uma pesquisa "convencional"
                # setando o "offset", o "limit" e o "result_count" com o retorno da
                # pesquisa "de fato"! By Questor
                offset_holder = read_df_result.offset
                limit_holder = read_df_result.limit
                result_count_holder = read_df_result.result_count
                pass

            ReadCs().read_df(lb_intercommunication_obj, lb_sh_request)

            if search_file_contents:
                lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].\
                    lb_occurrences_list.limit = limit_holder
                lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].\
                    lb_occurrences_list.offset = offset_holder
                lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].\
                    lb_occurrences_list.result_count = result_count_holder
                pass

            # Note: Habilita a busca full o que inclui o conteúdo dos arquivos anexos! By Questor
            if "lb_ctrl_fl_tx" in lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].lb_ctrl_set_dict:
                if lb_intercommunication_obj.operation_group[lb_intercommunication_obj.operation_index_now].lb_ctrl_set_dict["lb_ctrl_fl_tx"] == "1":
                    self.get_file_contents_df(lb_intercommunication_obj)
                    pass
                pass

            # Note: To debug! By Questor
            if DEBUG_MODE:
                elapsed_time = time.time() - start_time_now
                # print("**************** Elapsed Time (Query LB - Lib) ****************")
                # print(str(elapsed_time) + " seconds!");
                # print("***************************************************************")
                pass

            pass

        return