コード例 #1
0
ファイル: pipeline.py プロジェクト: zieglerm/TACTIC
    def create(name, desc, search_type, xml=None, code=None, color=None):
        '''will only create if it does not exist, otherwise it just updates'''

        if code:
            sobject = Pipeline.get_by_code(code)
        else:
            sobject = None

        if sobject == None:
            #sobject = Pipeline( Pipeline.SEARCH_TYPE )
            sobject = SearchType.create(Pipeline.SEARCH_TYPE)
        else:
            return sobject

        if not xml:
            xml = Xml()
            xml.create_doc('pipeline')

        if isinstance(xml, basestring):
            xml_string = xml
            xml = Xml()
            xml.read_string(xml_string)

        sobject.set_value("pipeline", xml.get_xml())
        sobject.set_pipeline(xml.to_string())

        sobject.set_value('timestamp',
                          Sql.get_default_timestamp_now(),
                          quoted=False)
        if code:
            sobject.set_value('code', code.strip())
        sobject.set_value('name', name.strip())
        sobject.set_value('search_type', search_type)
        sobject.set_value('description', desc)

        if color:
            sobject.set_value("color", color)

        sobject.commit()

        process_names = sobject.get_process_names()

        for i, process_name in enumerate(process_names):
            process = SearchType.create("config/process")
            process.set_value("pipeline_code", sobject.get_code())
            process.set_value("process", process_name)
            process.set_value("sort_order", i)
            process.set_value("subcontext_options", "(main)")
            process.commit()

        return sobject
コード例 #2
0
ファイル: pipeline.py プロジェクト: 0-T-0/TACTIC
    def create(pipeline_name, desc, pipe_search_type):
        '''will only create if it does not exist, otherwise it just updates'''
        sobject = Pipeline.get_by_name(pipeline_name)
        if sobject == None:
            #sobject = Pipeline( Pipeline.SEARCH_TYPE )
            sobject = SearchType.create( Pipeline.SEARCH_TYPE )
        else:
            return sobject
        xml = Xml()
        xml.create_doc('pipeline')
        root = xml.get_root_node()
        #Xml.set_attribute(root, 'type', type)
        sobject.set_value("pipeline", xml.get_xml())

        sobject.set_value('timestamp', Sql.get_default_timestamp_now(), quoted=False )
        sobject.set_value('code', pipeline_name)
        sobject.set_value('search_type', pipe_search_type)
        sobject.set_value('description', desc)
        sobject.commit()
        return sobject
コード例 #3
0
    def create(pipeline_name, desc, pipe_search_type):
        '''will only create if it does not exist, otherwise it just updates'''
        sobject = Pipeline.get_by_name(pipeline_name)
        if sobject == None:
            #sobject = Pipeline( Pipeline.SEARCH_TYPE )
            sobject = SearchType.create( Pipeline.SEARCH_TYPE )
        else:
            return sobject
        xml = Xml()
        xml.create_doc('pipeline')
        root = xml.get_root_node()
        #Xml.set_attribute(root, 'type', type)
        sobject.set_value("pipeline", xml.get_xml())

        sobject.set_value('timestamp', Sql.get_default_timestamp_now(), quoted=False )
        sobject.set_value('code', pipeline_name)
        sobject.set_value('search_type', pipe_search_type)
        sobject.set_value('description', desc)
        sobject.commit()
        return sobject