def create_event_process_definition(self, version='', module='', class_name='', uri='', arguments=None, event_types = None, sub_types = None, origin_types = None): """ Create a resource which defines the processing of events. @param version str @param module str @param class_name str @param uri str @param arguments list @return procdef_id str """ # Create the event process detail object event_process_definition_detail = EventProcessDefinitionDetail() event_process_definition_detail.event_types = event_types event_process_definition_detail.sub_types = sub_types event_process_definition_detail.origin_types = origin_types # Create the process definition process_definition = ProcessDefinition(name=create_unique_identifier('event_process')) process_definition.executable = { 'module':module, 'class': class_name, 'url': uri } process_definition.version = version process_definition.arguments = arguments process_definition.definition = event_process_definition_detail procdef_id = self.clients.process_dispatcher.create_process_definition(process_definition=process_definition) return procdef_id
def update_event_process_definition(self, event_process_definition_id='', version='', module='', class_name='', uri='', arguments=None, event_types=None, sub_types=None, origin_types=None): """ Update the process definition for the event process. @param event_process_definition_id str @param version str @param module str @param class_name str @param uri str @arguments list """ validate_is_not_none(event_process_definition_id) # The event_process_def is really only a process_def. Read up the process definition process_def = self.clients.resource_registry.read( event_process_definition_id) definition = process_def.definition # Fetch or make a new EventProcessDefinitionDetail object if definition: event_process_def_detail = EventProcessDefinitionDetail() event_process_def_detail.event_types = event_types or definition.event_types event_process_def_detail.sub_types = sub_types or definition.sub_types event_process_def_detail.origin_types = origin_types or definition.origin_types else: event_process_def_detail = EventProcessDefinitionDetail( event_types=event_types, sub_types=sub_types, origin_types=origin_types) # event_process_def_detail = process_def.definition or EventProcessDefinitionDetail() # Update the fields of the process definition process_def.executable['module'] = module process_def.executable['class'] = class_name process_def.executable['uri'] = uri process_def.version = version process_def.arguments = arguments process_def.definition = event_process_def_detail # Finally update the resource registry self.clients.resource_registry.update(process_def)
def create_event_process_definition(self, version='', module='', class_name='', uri='', arguments=None, event_types=None, sub_types=None, origin_types=None): """ Create a resource which defines the processing of events. @param version str @param module str @param class_name str @param uri str @param arguments list @return procdef_id str """ # Create the event process detail object event_process_definition_detail = EventProcessDefinitionDetail() event_process_definition_detail.event_types = event_types event_process_definition_detail.sub_types = sub_types event_process_definition_detail.origin_types = origin_types # Create the process definition process_definition = ProcessDefinition( name=create_unique_identifier('event_process')) process_definition.executable = { 'module': module, 'class': class_name, 'url': uri } process_definition.version = version process_definition.arguments = arguments process_definition.definition = event_process_definition_detail procdef_id = self.clients.process_dispatcher.create_process_definition( process_definition=process_definition) return procdef_id
def update_event_process_definition(self, event_process_definition_id='', version='', module='', class_name='', uri='', arguments=None, event_types=None, sub_types=None, origin_types=None): """ Update the process definition for the event process. @param event_process_definition_id str @param version str @param module str @param class_name str @param uri str @arguments list """ validate_is_not_none(event_process_definition_id) # The event_process_def is really only a process_def. Read up the process definition process_def = self.clients.resource_registry.read(event_process_definition_id) definition = process_def.definition # Fetch or make a new EventProcessDefinitionDetail object if definition: event_process_def_detail = EventProcessDefinitionDetail() event_process_def_detail.event_types = event_types or definition.event_types event_process_def_detail.sub_types = sub_types or definition.sub_types event_process_def_detail.origin_types = origin_types or definition.origin_types else: event_process_def_detail = EventProcessDefinitionDetail(event_types = event_types, sub_types = sub_types, origin_types = origin_types) # event_process_def_detail = process_def.definition or EventProcessDefinitionDetail() # Update the fields of the process definition process_def.executable['module'] = module process_def.executable['class'] = class_name process_def.executable['uri'] = uri process_def.version = version process_def.arguments = arguments process_def.definition = event_process_def_detail # Finally update the resource registry self.clients.resource_registry.update(process_def)