Ejemplo n.º 1
0
     byte_a = ord('a')
     while True:
         for i in range(0, 25):
             next_name = ''
             if name_prefix == '':
                 next_name = chr(byte_a + i) + str(name_suffix)
             else:
                 next_name = name_prefix + str(name_suffix)
             
             if not next_name in names_map:
                 names_map[next_name] = 1
                 return next_name

         name_suffix = name_suffix + 1
         
@ModuleInfo.plugin('wb.util.obfuscateCatalog', caption='Obfuscate Object Names in Catalog', input= [wbinputs.currentModel()], groups= ['Catalog/Utilities', 'Menu/Utilities'])
@ModuleInfo.export(grt.INT, grt.classes.workbench_physical_Model)
def obfuscateCatalog(model):     
 
     result = mforms.Utilities.show_warning('Warning', '''This operation will change names of all schemata and tables in the model.
Would you like to also clear SQL code for views and stored procedures?
This action cannot be undone!''', 'Clear SQL', 'Cancel', 'Leave SQL')

     if result == mforms.ResultCancel:
         return 1

     clear_sql_code = (result == mforms.ResultOk)
     schemata_map = {}
     objects_map = {}
     
     def createFiguresMap(model):
Ejemplo n.º 2
0
     byte_a = ord('a')
     while True:
         for i in range(0, 25):
             next_name = ''
             if name_prefix == '':
                 next_name = chr(byte_a + i) + str(name_suffix)
             else:
                 next_name = name_prefix + str(name_suffix)
             
             if not next_name in names_map:
                 names_map[next_name] = 1
                 return next_name

         name_suffix = name_suffix + 1
         
@ModuleInfo.plugin('wb.util.obfuscateCatalog', caption='Obfuscate Object Names in Catalog', input= [wbinputs.currentModel()], groups= ['Catalog/Utilities', 'Menu/Utilities'], accessibilityName="Obsfuscate Object Names in Catalog")
@ModuleInfo.export(grt.INT, grt.classes.workbench_physical_Model)
def obfuscateCatalog(model):     
 
     result = mforms.Utilities.show_warning('Warning', '''This operation will change names of all schemata and tables in the model.
Would you like to also clear SQL code for views and stored procedures?
This action cannot be undone!''', 'Clear SQL', 'Cancel', 'Leave SQL')

     if result == mforms.ResultCancel:
         return 1

     clear_sql_code = (result == mforms.ResultOk)
     schemata_map = {}
     objects_map = {}
     
     def createFiguresMap(model):
Ejemplo n.º 3
0
            next_name = ''
            if name_prefix == '':
                next_name = chr(byte_a + i) + str(name_suffix)
            else:
                next_name = name_prefix + str(name_suffix)

            if not next_name in names_map:
                names_map[next_name] = 1
                return next_name

        name_suffix = name_suffix + 1


@ModuleInfo.plugin('wb.util.obfuscateCatalog',
                   caption='Obfuscate Object Names in Catalog',
                   input=[wbinputs.currentModel()],
                   groups=['Catalog/Utilities', 'Menu/Utilities'])
@ModuleInfo.export(grt.INT, grt.classes.workbench_physical_Model)
def obfuscateCatalog(model):

    result = mforms.Utilities.show_warning(
        'Warning',
        '''This operation will change names of all schemata and tables in the model.
Would you like to also clear SQL code for views and stored procedures?
This action cannot be undone!''', 'Clear SQL', 'Cancel', 'Leave SQL')

    if result == mforms.ResultCancel:
        return 1

    clear_sql_code = (result == mforms.ResultOk)
    schemata_map = {}
Ejemplo n.º 4
0
                text = text.replace("$doc_date_created", model.owner.info.dateCreated)
                import time
                text = text.replace("$timestamp", time.ctime())
                return text

            options = {
                "header_text" : replace_variables(header, self.model),
                "footer_text" : replace_variables(footer, self.model),
            }
            grt.modules.WbPrinting.printDiagramsToFile(l, file, format[1:], options)

            mforms.App.get().set_status_text("Exported %i diagrams to %s." % (len(l), file))



@ModuleInfo.plugin("wb.model.print_model", caption= "Print Model to File", input= [wbinputs.currentModel()])
@ModuleInfo.export(grt.INT, grt.classes.model_Model)
def printModel(model):
    dlg = PrintToFileDialog(model)
    dlg.run()
    return 0


# Quick impl for Rename Diagram... item in modeling overview
@ModuleInfo.plugin("wb.model.rename_diagram", caption= "Rename Diagram...", input= [wbinputs.selectedDiagram()], pluginMenu="Overview")
@ModuleInfo.export(grt.INT, grt.classes.model_Diagram)
def renameDiagram(diagram):
    ret, name = mforms.Utilities.request_input("Rename Diagram", "Enter new name for the diagram", diagram.name)
    if ret:
        grt.modules.Workbench.startTrackingUndo()
        diagram.name = name
                text = text.replace("$doc_date_created", model.owner.info.dateCreated)
                import time
                text = text.replace("$timestamp", time.ctime())
                return text

            options = {
                "header_text" : replace_variables(header, self.model),
                "footer_text" : replace_variables(footer, self.model),
            }
            grt.modules.WbPrinting.printDiagramsToFile(l, file, format[1:], options)

            mforms.App.get().set_status_text("Exported %i diagrams to %s." % (len(l), file))



@ModuleInfo.plugin("wb.model.print_model", caption= "Print Model to File", input= [wbinputs.currentModel()], accessibilityName="Print Model to File")
@ModuleInfo.export(grt.INT, grt.classes.model_Model)
def printModel(model):
    dlg = PrintToFileDialog(model)
    dlg.run()
    return 0


# Quick impl for Rename Diagram... item in modeling overview
@ModuleInfo.plugin("wb.model.rename_diagram", caption= "Rename Diagram...", input= [wbinputs.selectedDiagram()], pluginMenu="Overview", accessibilityName="Rename Diagram")
@ModuleInfo.export(grt.INT, grt.classes.model_Diagram)
def renameDiagram(diagram):
    ret, name = mforms.Utilities.request_input("Rename Diagram", "Enter new name for the diagram", diagram.name)
    if ret:
        grt.modules.Workbench.startTrackingUndo()
        diagram.name = name