コード例 #1
0
class Packaging(Base):
    """Manage Packaging"""
    def run(self):
        #from json import dumps
        #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('generate'):
            self.generateDescriptor()
        elif self.hasOption('install'):
            self.installDescriptor()
        else:
            print('Nothing to do.')

    def generateDescriptor(self):
        dist_folder = self.options['<dist_folder>']
        descriptor_file = self.options['<descriptor_file>']
        rc = self.bonita_client.generateDescriptor(dist_folder,
                                                   descriptor_file)
        self.processResultCode(rc)

    def installDescriptor(self):
        dist_folder = self.options['<dist_folder>']
        descriptor_file = self.options['<descriptor_file>']
        rc = self.bonita_client.installDescriptor(dist_folder, descriptor_file)
        self.processResultCode(rc)
コード例 #2
0
ファイル: portal.py プロジェクト: dantebarba/bonita-cli
class Portal(Base):
    """Manage portal"""
    def run(self):
        # bonita portal [page [deploy <filename_on_server>|get <page_id>|update <page_id> <filename_on_server>]]
        #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('deploy'):
            self.deploy()
        elif self.hasOption('get'):
            self.get()
        elif self.hasOption('update'):
            self.enable()
        else:
            print('Nothing to do.')

    def deploy(self):
        filename = self.options['<filename_on_server>']
        rc, datas = self.bonita_client.deployPage(filename)
        self.processResults(rc, datas)

    def get(self):
        page_id = self.options['<page_id>']
        rc, datas = self.bonita_client.getPage(page_id)
        self.processResults(rc, datas)

    def update(self):
        page_id = self.options['<page_id>']
        filename = self.options['<filename_on_server>']
        rc, datas = self.bonita_client.updatePage(page_id, filename)
        self.processResults(rc, datas)
コード例 #3
0
ファイル: system.py プロジェクト: dantebarba/bonita-cli
class System(Base):
    """Manage system"""
    def run(self):
        #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('tenant'):
            if self.hasOption('get'):
                self.getTenant()
            elif self.hasOption('pause'):
                self.pauseTenant()
            elif self.hasOption('resume'):
                self.resumeTenant()
        else:
            print("Nothing to do.")

    def getTenant(self):
        rc, datas = self.bonita_client.getCurrentTenant()
        self.processResults(rc, datas)

    def toggleTenantState(self, state):
        rc = self.bonita_client.toggleTenantState(state)
        self.processResultCode(rc)

    def pauseTenant(self):
        self.toggleTenantState('true')

    def resumeTenant(self):
        self.toggleTenantState('false')
コード例 #4
0
class Organization(Base):
    """Manage organization"""
    def run(self):
        #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
        # bonita organization [import <filename>|export|delete]
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('import'):
            self.importOrganization()
        elif self.hasOption('export'):
            self.exportOrganization()
        elif self.hasOption('delete'):
            self.delete()
        else:
            print('Nothing to do.')

    def importOrganization(self):
        filename = self.options['<filename>']
        rc, datas = self.bonita_client.importOrganization(filename)
        self.processResults(rc, datas)

    def exportOrganization(self):
        rc, datas = self.bonita_client.exportOrganization()
        self.processResults(rc, datas)

    def delete(self):
        rc, datas = self.bonita_client.deleteOrganization()
        self.processResultCode(rc)
コード例 #5
0
ファイル: session.py プロジェクト: dantebarba/bonita-cli
class Session(Base):
    """Manage sessions"""
    def run(self):
        #print('You supplied the following options:', json.dumps(self.options, indent=2, sort_keys=True))
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('login'):
            self.login()
        elif self.hasOption('logout'):
            self.logout()
        elif self.hasOption('get'):
            self.get()
        else:
            print("Nothing to do.")

    def login(self):
        url = self.options['<url>']
        username = self.options['<username>']
        password = self.options['<password>']

        rc = self.bonita_client.login(url, username, password)

        if rc == 200:
            self.saveConfiguration(self.bonita_client.getConfiguration())
        self.processResultCode(rc)

    def logout(self):
        rc = self.bonita_client.logout()
        self.processResultCode(rc)

    def get(self):
        rc, datas = self.bonita_client.getSession()
        self.processResults(rc, datas)
コード例 #6
0
 def run(self):
     #from json import dumps
     #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
     self.bonita_client = BonitaClient(self.loadConfiguration())
     if self.hasOption('generate'):
         self.generateDescriptor()
     elif self.hasOption('install'):
         self.installDescriptor()
     else:
         print('Nothing to do.')
コード例 #7
0
ファイル: session.py プロジェクト: dantebarba/bonita-cli
 def run(self):
     #print('You supplied the following options:', json.dumps(self.options, indent=2, sort_keys=True))
     self.bonita_client = BonitaClient(self.loadConfiguration())
     if self.hasOption('login'):
         self.login()
     elif self.hasOption('logout'):
         self.logout()
     elif self.hasOption('get'):
         self.get()
     else:
         print("Nothing to do.")
コード例 #8
0
ファイル: portal.py プロジェクト: dantebarba/bonita-cli
 def run(self):
     # bonita portal [page [deploy <filename_on_server>|get <page_id>|update <page_id> <filename_on_server>]]
     #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
     self.bonita_client = BonitaClient(self.loadConfiguration())
     if self.hasOption('deploy'):
         self.deploy()
     elif self.hasOption('get'):
         self.get()
     elif self.hasOption('update'):
         self.enable()
     else:
         print('Nothing to do.')
コード例 #9
0
 def run(self):
     #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
     # bonita organization [import <filename>|export|delete]
     self.bonita_client = BonitaClient(self.loadConfiguration())
     if self.hasOption('import'):
         self.importOrganization()
     elif self.hasOption('export'):
         self.exportOrganization()
     elif self.hasOption('delete'):
         self.delete()
     else:
         print('Nothing to do.')
コード例 #10
0
ファイル: system.py プロジェクト: dantebarba/bonita-cli
 def run(self):
     #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
     self.bonita_client = BonitaClient(self.loadConfiguration())
     if self.hasOption('tenant'):
         if self.hasOption('get'):
             self.getTenant()
         elif self.hasOption('pause'):
             self.pauseTenant()
         elif self.hasOption('resume'):
             self.resumeTenant()
     else:
         print("Nothing to do.")
コード例 #11
0
 def run(self):
     #from json import dumps
     #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
     self.bonita_client = BonitaClient(self.loadConfiguration())
     if self.hasOption('import'):
         self.importProfiles()
     elif self.hasOption('export'):
         self.exportProfiles()
     elif self.hasOption('merge'):
         self.mergeProfiles()
     elif self.hasOption('search'):
         self.searchProfiles()
     else:
         print('Nothing to do.')
コード例 #12
0
    def run(self):
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('add'):
            self.add()
        elif self.hasOption('get'):
            self.get()
        elif self.hasOption('remove'):
            self.remove()
#        elif self.hasOption('update'):
#            self.update()
#        elif self.hasOption('remove'):
#            self.remove()
        else:
            print('Nothing to do.')
コード例 #13
0
 def run(self):
     #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
     # bonita organization [import <filename>|export|delete]
     self.bonita_client = BonitaClient(self.loadConfiguration())
     if self.hasOption('install'):
         self.install()
     elif self.hasOption('uninstall'):
         self.uninstall()
     elif self.hasOption('cleanAndUninstall'):
         self.cleanAndUninstall()
     elif self.hasOption('get'):
         self.get()
     else:
         print('Nothing to do.')
コード例 #14
0
ファイル: application.py プロジェクト: dantebarba/bonita-cli
 def run(self):
     # bonita application [get <application_id>]
     #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
     self.bonita_client = BonitaClient(self.loadConfiguration())
     if self.hasOption('get'):
         self.get()
     elif self.hasOption('create'):
         self.create()
     elif self.hasOption('update'):
         self.update()
     elif self.hasOption('delete'):
         self.delete()
     elif self.hasOption('import'):
         self.importApplication()
     else:
         print('Nothing to do.')
コード例 #15
0
ファイル: user.py プロジェクト: dantebarba/bonita-cli
 def run(self):
     # bonita process [deploy <filename_on_server>|get <process_id>|enable <process_id>|disable <process_id>]
     #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
     self.bonita_client = BonitaClient(self.loadConfiguration())
     if self.hasOption('add'):
         self.add()
     # if self.hasOption('update'):
     #    self.add()
     elif self.hasOption('get'):
         self.get()
     elif self.hasOption('remove'):
         self.remove()
     elif self.hasOption('enable'):
         self.enable()
     elif self.hasOption('disable'):
         self.disable()
     else:
         print('Nothing to do.')
コード例 #16
0
class Profile(Base):

    """Manage Profile"""

    def run(self):
        #from json import dumps
        #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('import'):
            self.importProfiles()
        elif self.hasOption('export'):
            self.exportProfiles()
        elif self.hasOption('merge'):
            self.mergeProfiles()
        elif self.hasOption('search'):
            self.searchProfiles()
        else:
            print('Nothing to do.')

    def importProfiles(self):
        filename = self.options['<filename>']
        rc, datas = self.bonita_client.importProfiles(filename)
        self.processResults(rc, datas)

    def exportProfiles(self):
        filename = self.options['<filename>']
        rc, datas = self.bonita_client.exportProfiles(filename)
        self.processResults(rc, datas)

    def mergeProfiles(self):
        default_profiles = self.options['<default_profiles>']
        custom_profiles = self.options['<custom_profiles>']
        output_profiles = self.options['<output_profiles>']
        rc = self.bonita_client.mergeProfiles(
            default_profiles, custom_profiles, output_profiles)
        self.processResultCode(rc)

    def searchProfiles(self):
        criteria = self.options['<criteria>']
        rc, datas = self.bonita_client.searchProfiles(criteria)
        self.processResults(rc, datas)
コード例 #17
0
ファイル: user.py プロジェクト: dantebarba/bonita-cli
class User(Base):
    """Manage user"""
    def run(self):
        # bonita process [deploy <filename_on_server>|get <process_id>|enable <process_id>|disable <process_id>]
        #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('add'):
            self.add()
        # if self.hasOption('update'):
        #    self.add()
        elif self.hasOption('get'):
            self.get()
        elif self.hasOption('remove'):
            self.remove()
        elif self.hasOption('enable'):
            self.enable()
        elif self.hasOption('disable'):
            self.disable()
        else:
            print('Nothing to do.')

    def add(self):
        payload = {
            'userName': self.getOption("<login>"),
            'password': self.getOption("<password>"),
            'password_confirm': self.getOption("<password>"),
            'icon': self.getOption("<icon>", ""),
            'firstName': self.getOption("<firstName>", ""),
            'lastName': self.getOption("<lastName>", ""),
            'title': self.getOption("<title>", ""),
            'job_title': self.getOption("<job_title>", ""),
            'manager_id': self.getOption("<manager_id>", 0)
        }
        rc, datas = self.bonita_client.addUser(payload)
        self.processResults(rc, datas)

    def get(self):
        if self.hasOption('<user_id>'):
            user_id = self.options['<user_id>']
            rc, datas = self.bonita_client.getUser(user_id)
            self.processResults(rc, datas)
        else:
            rc, datas = self.bonita_client.searchUsers({'p': 0, 'c': 20})
            self.processResults(rc, datas)

    def remove(self):
        if self.hasOption('<user_id>'):
            user_id = self.options['<user_id>']
            rc, datas = self.bonita_client.deleteUser(user_id)
            self.processResults(rc, datas)

    def enable(self):
        user_id = self.options['<user_id>']
        rc, datas = self.bonita_client.enableUser(user_id)
        self.processResults(rc, datas)

    def disable(self):
        user_id = self.options['<user_id>']
        rc, datas = self.bonita_client.disableUser(user_id)
        self.processResults(rc, datas)
コード例 #18
0
class Process(Base):
    """Manage process"""
    def run(self):
        # bonita process [deploy <filename_on_server>|get <process_id>|enable <process_id>|disable <process_id>]
        #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('deploy'):
            self.deploy()
        elif self.hasOption('get'):
            self.get()
        elif self.hasOption('enable'):
            self.enable()
        elif self.hasOption('disable'):
            self.disable()
        else:
            print('Nothing to do.')

    def deploy(self):
        filename = self.options['<filename_on_server>']
        rc, datas = self.bonita_client.deployProcess(filename)
        self.processResults(rc, datas)

    def get(self):
        if self.hasOption('<process_id>'):
            process_id = self.options['<process_id>']
            rc, datas = self.bonita_client.getProcess(process_id)
            self.processResults(rc, datas)
        else:
            rc, datas = self.bonita_client.getProcesses()
            self.processResults(rc, datas)

    def enable(self):
        process_id = self.options['<process_id>']
        rc, datas = self.bonita_client.enableProcess(process_id)
        self.processResults(rc, datas)

    def disable(self):
        process_id = self.options['<process_id>']
        rc, datas = self.bonita_client.disableProcess(process_id)
        self.processResults(rc, datas)
コード例 #19
0
class Membership(Base):
    """Manage membership"""
    def run(self):
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('add'):
            self.add()
        elif self.hasOption('get'):
            self.get()
        elif self.hasOption('remove'):
            self.remove()
#        elif self.hasOption('update'):
#            self.update()
#        elif self.hasOption('remove'):
#            self.remove()
        else:
            print('Nothing to do.')

    def add(self):
        payload = {
            'user_id': self.options['<user_id>'],
            'group_id': self.options['<group_id>'],
            'role_id': self.options['<role_id>']
        }
        rc, datas = self.bonita_client.addMembership(payload)
        return self.processResults(rc, datas)

    def get(self):
        user_id = self.options['<user_id>']
        rc, datas = self.bonita_client.getMemberships(user_id)
        return self.processResults(rc, datas)

    # Delete a membership of a user using the group id and role id.#
    def remove(self):
        payload = {
            'user_id': self.options['<user_id>'],
            'group_id': self.options['<group_id>'],
            'role_id': self.options['<role_id>']
        }
        rc, datas = self.bonita_client.removeMembership(payload)
        return self.processResults(rc, datas)
コード例 #20
0
class BDM(Base):
    """Manage Business Data Model"""
    def run(self):
        #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
        # bonita organization [import <filename>|export|delete]
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('install'):
            self.install()
        elif self.hasOption('uninstall'):
            self.uninstall()
        elif self.hasOption('cleanAndUninstall'):
            self.cleanAndUninstall()
        elif self.hasOption('get'):
            self.get()
        else:
            print('Nothing to do.')

    def install(self):
        filename = self.options['<filename>']
        rc, datas = self.bonita_client.installBusinessDataModel(filename)
        self.processResults(rc, datas)

    def uninstall(self):
        rc, datas = self.bonita_client.uninstallBusinessDataModel()
        self.processResults(rc, datas)

    def cleanAndUninstall(self):
        rc, datas = self.bonita_client.cleanAndUninstallBusinessDataModel()
        self.processResultCode(rc)

    def get(self):
        if self.hasOption('version'):
            rc, datas = self.bonita_client.getBusinessDataModelVersion()
            self.processResults(rc, datas)
        elif self.hasOption('clientZip'):
            filename = self.options['<filename>']
            rc, datas = self.bonita_client.getClientBDMZip(filename)
            self.processResults(rc, datas)
コード例 #21
0
ファイル: application.py プロジェクト: dantebarba/bonita-cli
class Application(Base):
    """Manage application"""
    def run(self):
        # bonita application [get <application_id>]
        #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOption('get'):
            self.get()
        elif self.hasOption('create'):
            self.create()
        elif self.hasOption('update'):
            self.update()
        elif self.hasOption('delete'):
            self.delete()
        elif self.hasOption('import'):
            self.importApplication()
        else:
            print('Nothing to do.')

    def get(self):
        application_id = self.options['<application_id>']
        if application_id is None:
            rc, datas = self.bonita_client.getApplications()
            self.processResults(rc, datas)
        else:
            rc, datas = self.bonita_client.getApplication(application_id)
            self.processResults(rc, datas)

    def create(self):
        filename = self.options['<filename>']
        rc, datas = self.bonita_client.createApplication(filename)
        self.processResults(rc, datas)

    def update(self):
        application_id = self.options['<application_id>']
        filename = self.options['<filename>']
        rc, datas = self.bonita_client.updateApplication(
            application_id, filename)
        self.processResults(rc, datas)

    def delete(self):
        application_id = self.options['<application_id>']
        rc, datas = self.bonita_client.deleteApplication(application_id)
        self.processResults(rc, datas)

    def importApplication(self):
        server_filename = self.options['<server_filename>']
        rc, datas = self.bonita_client.importApplication(server_filename)
        self.processResults(rc, datas)
コード例 #22
0
ファイル: platform.py プロジェクト: dantebarba/bonita-cli
class Platform(Base):
    """Manage platform"""
    def run(self):
        #print('You supplied the following options:', dumps(self.options, indent=2, sort_keys=True))
        self.bonita_client = BonitaClient(self.loadConfiguration())
        if self.hasOptions('login'):
            self.login()
        elif self.hasOption('start'):
            self.start()
        elif self.hasOption('stop'):
            self.stop()
        elif self.hasOption('get'):
            self.get()
        elif self.hasOption('logout'):
            self.logout()
        else:
            print('Nothing to do.')

    def login(self):
        url = self.options['<url>']
        username = self.options['<username>']
        password = self.options['<password>']

        rc = self.bonita_client.platformLogin(url, username, password)

        if rc == 200:
            self.saveConfiguration(self.bonita_client.getConfiguration())
        self.processResultCode(rc)

    def logout(self):
        rc = self.bonita_client.platformLogout()
        self.processResultCode(rc)

    def get(self):
        rc, datas = self.bonita_client.getPlatform()
        self.processResults(rc, datas)

    def start(self):
        rc = self.bonita_client.togglePlatformState('start')
        self.processResultCode(rc)

    def stop(self):
        rc = self.bonita_client.togglePlatformState('stop')
        self.processResultCode(rc)