(self)
Function that should be run on insert/update. It's already automatically called during insert.
        On update, the caller needs to call this explicitly. It checks the search type
        this pipeline is associated with and if there is no pipeline code
        column, then update it.  It updates the process table also.
Function that should be run on insert/update. It's already automatically called during insert.
        On update, the caller needs to call this explicitly. It checks the search type
        this pipeline is associated with and if there is no pipeline code
        column, then update it.  It updates the process table also.
Function that should be run on insert / update . It s already automatically called during insert . On update the caller needs to call this explicitly . It checks the search type this pipeline is associated with and if there is no pipeline code column then update it . It updates the process table also .
def update_dependencies(self):
        '''Function that should be run on insert/update. It's already automatically called during insert.
        On update, the caller needs to call this explicitly. It checks the search type
        this pipeline is associated with and if there is no pipeline code
        column, then update it.  It updates the process table also.'''

        search_type = self.get_value('search_type')
        self.update_process_table(search_type=search_type)

        # don't do anything for task sType
        if search_type =='sthpw/task':
            return


        if not search_type:
            return

        if ProdSetting.get_value_by_key('autofill_pipeline_code') != 'false':
            try:
                columns = SearchType.get_columns(search_type)
                if not 'pipeline_code' in columns:
                    # add the pipeline code column
                    from pyasm.command import ColumnAddCmd
                    cmd = ColumnAddCmd(search_type, "pipeline_code", "varchar")
                    cmd.execute()
            except SqlException as e:
                print("Error creating column [pipeline_code] for %" %search_type )
                pass

            # go through all of the sobjects and set all the empty ones
            # to the new pipeline
            search = Search(search_type)
            search.add_op("begin")
            search.add_filter("pipeline_code", "NULL", op='is', quoted=False)
            search.add_filter("pipeline_code", "")
            search.add_op("or")
            sobject_ids = search.get_sobject_ids()

            if sobject_ids:
                # this is much faster and memory efficient
                db_resource = SearchType.get_db_resource_by_search_type(search_type)
                sql = DbContainer.get(db_resource)
                tbl = search.get_table()
                sobject_ids = [str(x) for x in sobject_ids]
                pipeline_code =  self.get_value("code")
                sql.do_update('''UPDATE "%s" SET "pipeline_code" = '%s' WHERE id in (%s) ''' %(tbl, pipeline_code, ','.join(sobject_ids)))
            """
            for sobject in sobjects:
                if not sobject.get_value("pipeline_code"):
                    sobject.set_value("pipeline_code", self.get_value("code") )
                    sobject.commit(triggers=False)
            """
def update_dependencies ( self ) : search_type = self . get_value ( 'search_type' ) self . update_process_table ( search_type = search_type ) # don't do anything for task sType if search_type == 'sthpw/task' : return if not search_type : return if ProdSetting . get_value_by_key ( 'autofill_pipeline_code' ) != 'false' : try : columns = SearchType . get_columns ( search_type ) if not 'pipeline_code' in columns : # add the pipeline code column from pyasm . command import ColumnAddCmd cmd = ColumnAddCmd ( search_type , "pipeline_code" , "varchar" ) cmd . execute ( ) except SqlException as e : print ( "Error creating column [pipeline_code] for %" % search_type ) pass # go through all of the sobjects and set all the empty ones # to the new pipeline search = Search ( search_type ) search . add_op ( "begin" ) search . add_filter ( "pipeline_code" , "NULL" , op = 'is' , quoted = False ) search . add_filter ( "pipeline_code" , "" ) search . add_op ( "or" ) sobject_ids = search . get_sobject_ids ( ) if sobject_ids : # this is much faster and memory efficient db_resource = SearchType . get_db_resource_by_search_type ( search_type ) sql = DbContainer . get ( db_resource ) tbl = search . get_table ( ) sobject_ids = [ str ( x ) for x in sobject_ids ] pipeline_code = self . get_value ( "code" ) sql . do_update ( '''UPDATE "%s" SET "pipeline_code" = '%s' WHERE id in (%s) ''' % ( tbl , pipeline_code , ',' . join ( sobject_ids ) ) ) """
            for sobject in sobjects:
                if not sobject.get_value("pipeline_code"):
                    sobject.set_value("pipeline_code", self.get_value("code") )
                    sobject.commit(triggers=False)
            """