def __init__(self, dao, configuration, **kwargs): """ Initialize a Hardware data controller instance. :param dao: the RAMSTK Program DAO instance to pass to the Hardware Data Model. :type dao: :class:`ramstk.dao.DAO` :param configuration: the Configuration instance associated with the current instance of the RAMSTK application. :type configuration: :class:`ramstk.Configuration.Configuration` """ RAMSTKDataController.__init__(self, configuration, model=dtmHardwareBoM(dao), ramstk_module='hardware BOM', **kwargs) # Initialize private dictionary attributes. # Initialize private list attributes. # Initialize private scalar attributes. self._dmx_hw_rqrmnt_matrix = RAMSTKDataMatrix(dao, RAMSTKHardware, RAMSTKRequirement) self._dmx_hw_tstng_matrix = RAMSTKDataMatrix(dao, RAMSTKHardware, RAMSTKTest) self._dmx_hw_vldtn_matrix = RAMSTKDataMatrix(dao, RAMSTKHardware, RAMSTKValidation)
def __init__(self, dao, configuration, **kwargs): """ Initialize a Allocation data controller instance. :param dao: the data access object used to communicate with the connected RAMSTK Program database. :type dao: :py:class:`ramstk.dao.DAO.DAO` :param configuration: the RAMSTK configuration instance. :type configuration: :py:class:`ramstk.Configuration.Configuration` """ RAMSTKDataController.__init__( self, configuration, model=dtmAllocation(dao), ramstk_module='allocation', **kwargs) # Initialize private dictionary attributes. # Initialize private list attributes. # Initialize private scalar attributes. self._dtm_hardware_bom = dtmHardwareBoM(dao) # Initialize public dictionary attributes. self.dic_hardware_data = {} # Initialize public list attributes. # Initialize public scalar attributes. self.system_hazard_rate = 0.0 pub.subscribe(self.insert_hardware_listener, 'insertedHardware') pub.subscribe(self.request_do_delete, 'deletedHardware')
def __init__(self, dao, configuration, **kwargs): """ Initialize a Validation data controller instance. :param dao: the data access object used to communicate with the connected RAMSTK Program database. :type dao: :class:`ramstk.dao.DAO.DAO` :param configuration: the RAMSTK configuration instance. :type configuration: :class:`ramstk.Configuration.Configuration` """ RAMSTKDataController.__init__(self, configuration, model=dtmValidation(dao), ramstk_module='validation', **kwargs) # Initialize private dictionary attributes. # Initialize private list attributes. # Initialize private scalar attributes. self._dmx_vldtn_rqrmnt_matrix = RAMSTKDataMatrix( dao, RAMSTKValidation, RAMSTKRequirement) self._dmx_vldtn_hw_matrix = RAMSTKDataMatrix(dao, RAMSTKValidation, RAMSTKHardware)
def __init__(self, dao, configuration, **kwargs): """ Initialize a Requirement data controller instance. :param dao: the RAMSTK Program DAO instance to pass to the Requirement Data Model. :type dao: :class:`ramstk.dao.DAO` :param configuration: the Configuration instance associated with the current instance of the RAMSTK application. :type configuration: :class:`ramstk.Configuration.Configuration` """ RAMSTKDataController.__init__(self, configuration, model=dtmRequirement(dao), ramstk_module='requirement', **kwargs) # Initialize private dictionary attributes. # Initialize private list attributes. # Initialize private scalar attributes. self._dmx_rqmt_hw_matrix = RAMSTKDataMatrix(dao, RAMSTKRequirement, RAMSTKHardware) self._dmx_rqmt_sw_matrix = RAMSTKDataMatrix(dao, RAMSTKRequirement, RAMSTKSoftware) self._dmx_rqmt_val_matrix = RAMSTKDataMatrix(dao, RAMSTKRequirement, RAMSTKValidation)
def __init__(self, dao, configuration, **kwargs): """ Initialize a SimilarItem data controller instance. :param dao: the data access object used to communicate with the connected RAMSTK Program database. :type dao: :py:class:`ramstk.dao.DAO.DAO` :param configuration: the RAMSTK configuration instance. :type configuration: :py:class:`ramstk.Configuration.Configuration` """ RAMSTKDataController.__init__(self, configuration, model=dtmSimilarItem(dao), ramstk_module='similar_item', **kwargs) # Initialize private dictionary attributes. # Initialize private list attributes. # Initialize private scalar attributes. # Initialize public dictionary attributes. # Initialize public list attributes. # Initialize public scalar attributes. pub.subscribe(self.insert_hardware_listener, 'insertedHardware') pub.subscribe(self.request_do_delete, 'deletedHardware')
def __init__(self, dao, configuration, **kwargs): """ Initialize a HazardAnalysis data controller instance. :param dao: the data access object used to communicate with the connected RAMSTK Program database. :type dao: :py:class:`ramstk.dao.DAO.DAO` :param configuration: the RAMSTK configuration instance. :type configuration: :py:class:`ramstk.Configuration.Configuration` """ RAMSTKDataController.__init__(self, configuration, model=dtmHazardAnalysis(dao), ramstk_module='hazard_analysis', **kwargs)
def request_do_insert(self, **kwargs): """ Request to add an RAMSTKStakeholder table record. :param int revision_id: the ID of the Revision to add the new Stakeholder to. :param int parent_id: the ID of the parent Stakeholder to add the new Stakeholder to. :keyword bool sibling: indicates whether or not to insert a sibling (default) or child (derived) Stakeholder. :return: False if successful or True if an error is encountered. :rtype: bool """ _revision_id = kwargs['revision_id'] _error_code, _msg = self._dtm_data_model.do_insert( revision_id=_revision_id) if _error_code == 0: self._configuration.RAMSTK_USER_LOG.info(_msg) if not self._test: pub.sendMessage('insertedStakeholder', stakeholder_id=self._dtm_data_model.last_id) else: _msg = _msg + ' Failed to add a new Stakeholder to the RAMSTK ' \ 'Program database.' return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_insert(self, **kwargs): """ Request to add an RAMSTKAllocation table record. :param int revision_id: the Revision ID this Allocation will be associated with. :return: False if successful or True if an error is encountered. :rtype: bool """ _revision_id = kwargs['revision_id'] _hardware_id = kwargs['hardware_id'] _parent_id = kwargs['parent_id'] _error_code, _msg = self._dtm_data_model.do_insert( revision_id=_revision_id, hardware_id=_hardware_id, parent_id=_parent_id) if _error_code == 0: self._configuration.RAMSTK_USER_LOG.info(_msg) if not self._test: pub.sendMessage('insertedAllocation') else: _msg = _msg + (' Failed to add a new Allocation to the RAMSTK ' 'Program database.') self._configuration.RAMSTK_DEBUG_LOG.error(_msg) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_insert(self, **kwargs): """ Request to add an RAMSTKHazardAnalysis table record. :return: False if successful or True if an error is encountered. :rtype: bool """ _revision_id = kwargs['revision_id'] _hardware_id = kwargs['hardware_id'] _error_code, _msg = self._dtm_data_model.do_insert( revision_id=_revision_id, hardware_id=_hardware_id) if _error_code == 0: self._configuration.RAMSTK_USER_LOG.info(_msg) if not self._test: pub.sendMessage('insertedHazardAnalysis', module_id=_hardware_id) else: _msg = _msg + ' Failed to add a new Hazard Analysis to the ' \ 'RAMSTK Program database.' self._configuration.RAMSTK_DEBUG_LOG.error(_msg) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_delete_matrix(self, matrix_type, item_id, row=True): """ Request to remove a row or column from the selected Data Matrix. :param int matrix_type: the type of the Matrix to retrieve. Current Requirement matrix types are: rqrmnt_hrdwr = Requirement:Hardware rqrmnt_sftwr = Requirement:Software rqrmnt_vldtn = Requirement:Validation :param int item_id: the ID of the row or column item to remove from the Matrix. :keyword bool row: indicates whether to insert a row (default) or a column. :return: False if successful or True if an error is encountered. :rtype: bool """ if matrix_type == 'rqrmnt_hrdwr': _error_code, _msg = self._dmx_rqmt_hw_matrix.do_delete(item_id, row=row) elif matrix_type == 'rqrmnt_sftwr': _error_code, _msg = self._dmx_rqmt_sw_matrix.do_delete(item_id, row=row) elif matrix_type == 'rqrmnt_vldtn': _error_code, _msg = self._dmx_rqmt_val_matrix.do_delete(item_id, row=row) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, 'deletedMatrix')
def request_do_delete_matrix(self, matrix_type, item_id, row=True): """ Request to remove a row or column from the selected Data Matrix. :param str matrix_type: the type of the Matrix to retrieve. Current Hardware matrix types are: hrdwr_tstng = Hardware:Testing hrdwr_vldtn = Hardware:Validation :param int item_id: the ID of the row or column item to remove from the Matrix. :keyword bool row: indicates whether to insert a row (default) or a column. :return: False if successful or True if an error is encountered. :rtype: bool """ if matrix_type == 'hrdwr_rqrmnt': _error_code, _msg = self._dmx_hw_rqrmnt_matrix.do_delete(item_id, row=row) if matrix_type == 'hrdwr_tstng': _error_code, _msg = self._dmx_hw_tstng_matrix.do_delete(item_id, row=row) if matrix_type == 'hrdwr_vldtn': _error_code, _msg = self._dmx_hw_vldtn_matrix.do_delete(item_id, row=row) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, 'deletedMatrix')
def request_do_update_matrix(self, revision_id, matrix_type): """ Request to update the selected Data Matrix. :param int revision_id: the ID of the Revision is the matrix to update is associated with. :param int matrix_type: the type of the Matrix to save. Current Hardware matrix types are: hrdwr_tstng = Hardware:Testing hrdwr_vldtn = Hardware:Validation :return: False if successful or True if an error is encountered. :rtype: bool """ if matrix_type == 'hrdwr_rqrmnt': _error_code, _msg = self._dmx_hw_rqrmnt_matrix.do_update( revision_id, matrix_type) elif matrix_type == 'hrdwr_tstng': _error_code, _msg = self._dmx_hw_tstng_matrix.do_update( revision_id, matrix_type) elif matrix_type == 'hrdwr_vldtn': _error_code, _msg = self._dmx_hw_vldtn_matrix.do_update( revision_id, matrix_type) else: _error_code = 6 _msg = 'RAMSTK ERROR: Attempted to update non-existent matrix ' \ '{0:s}.'.format(matrix_type) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, 'savedMatrix')
def __init__(self, dao, configuration, **kwargs): """ Initialize an instance of the Usage Profile data controller. :param dao: the RAMSTK Program DAO instance to pass to the Mission, Mission Phase, and Environment Data Models. :type dao: :py:class:`ramstk.dao.DAO` :param configuration: the Configuration instance associated with the current instance of the RAMSTK application. :type configuration: :py:class:`ramstk.Configuration.Configuration` """ RAMSTKDataController.__init__(self, configuration, model=dtmUsageProfile(dao), ramstk_module='usage_profile', **kwargs)
def request_do_insert(self, **kwargs): """ Request to add an RAMSTKRequirement table record. :return: False if successful or True if an error is encountered. :rtype: bool """ _revision_id = kwargs['revision_id'] _parent_id = kwargs['parent_id'] _error_code, _msg = self._dtm_data_model.do_insert( revision_id=_revision_id, parent_id=_parent_id) if _error_code == 0: self._configuration.RAMSTK_USER_LOG.info(_msg) if not self._test: pub.sendMessage('insertedRequirement', requirement_id=self._dtm_data_model.last_id, parent_id=_parent_id) else: _msg = _msg + ' Failed to add a new Requirement to the RAMSTK ' \ 'Program database.' return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def __init__(self, dao, configuration, **kwargs): """ Initialize a Stakeholder data controller instance. :param dao: the RAMSTK Program DAO instance to pass to the Stakeholder Data Model. :type dao: :class:`ramstk.dao.DAO` :param configuration: the Configuration instance associated with the current instance of the RAMSTK application. :type configuration: :class:`ramstk.Configuration.Configuration` """ RAMSTKDataController.__init__(self, configuration, model=dtmStakeholder(dao), ramstk_module='stakeholder', **kwargs)
def __init__(self, dao, configuration, **kwargs): """ Initialize a Preferences data controller instance. :param dao: the data access object used to communicate with the connected RAMSTK Program database. :type dao: :py:class:`ramstk.dao.DAO.DAO` :param configuration: the RAMSTK configuration instance. :type configuration: :py:class:`ramstk.Configuration.Configuration` """ _site_dao = kwargs['site_dao'] RAMSTKDataController.__init__(self, configuration, model=dtmPreferences( dao, _site_dao, configuration), ramstk_module='preferences', **kwargs)
def __init__(self, dao, configuration, **kwargs): """ Initialize a Function data controller instance. :param dao: the RAMSTK Program DAO instance to pass to the Function Data Model. :type dao: :class:`ramstk.dao.DAO` :param configuration: the Configuration instance associated with the current instance of the RAMSTK application. :type configuration: :class:`ramstk.Configuration.Configuration` """ RAMSTKDataController.__init__(self, configuration, model=dtmFunction(dao, **kwargs), ramstk_module='function', **kwargs) # Initialize private dictionary attributes. # Initialize private list attributes. # Initialize private scalar attributes. self._dmx_fctn_hw_matrix = RAMSTKDataMatrix(dao, RAMSTKFunction, RAMSTKHardware) self._dmx_fctn_sw_matrix = RAMSTKDataMatrix(dao, RAMSTKFunction, RAMSTKSoftware) # Initialize public dictionary attributes. # Initialize public list attributes. # Initialize public scalar attributes. # Subscribe to PyPubSub messages. pub.subscribe(self.request_do_select_all, 'selected_revision') pub.subscribe(self.request_do_delete, 'request_delete_function') pub.subscribe(self.request_do_insert, 'request_insert_function') pub.subscribe(self.request_do_update, 'request_update_function') pub.subscribe(self.request_do_update_all, 'request_update_all_functions') pub.subscribe(self.request_set_attributes, 'editing_function')
def request_do_update_all(self, **kwargs): """ Request all (D)FME(C)A entities be saved to the RAMSTK Program database. :return: False if successful or True if an error is encountered. :rtype: bool """ _error_code, _msg = self._dtm_data_model.do_update_all(**kwargs) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_update_status(self): """ Request to update program Validation task status. :return: False if successful or True if an error is encountered. :rtype: bool """ _error_code, _msg = self._dtm_data_model.do_update_status() return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_update_all(self, **kwargs): # pylint: disable=unused-argument """ Request to update all records in the RAMSTKRequirement table. :return: (_error_code, _msg); the error code and associated message. :rtype: (int, str) """ _error_code, _msg = self._dtm_data_model.do_update_all() return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_update_all(self, **kwargs): """ Request to update all records in the Usage Profile tables. :return: False if successful or True if an error is encountered. :rtype: bool """ _error_code, _msg = self._dtm_data_model.do_update_all(**kwargs) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_update_all(self): """ Request to update all records in the RAMSTKStakeholder table. :return: (_error_code, _msg); the error code and associated message. :rtype: (int, str) """ _error_code, _msg = self._dtm_data_model.do_update_all() return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_update(self, node_id): """ Request to update an RAMSTKStakeholder table record. :param int stakeholder_id: the ID of the stakeholder to save. :return: False if successful or True if an error is encountered. :rtype: bool """ _error_code, _msg = self._dtm_data_model.do_update(node_id) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, 'savedStakeholder')
def request_do_update(self, node_id): """ Request to update an RAMSTKMission, RAMSTKMissionPhase, or RAMSTKEnvironment. :param int node_id: the ID of the entity to save. :return: False if successful or True if an error is encountered. :rtype: bool """ _error_code, _msg = self._dtm_data_model.do_update(node_id) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_insert(self, revision_id, parent_id, **kwargs): # pylint: disable=unused-argument """ Request to add an RAMSTKFunction table record. :return: False if successful or True if an error is encountered. :rtype: bool """ _error_code, _msg = self._dtm_data_model.do_insert( revision_id=revision_id, parent_id=parent_id) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_update(self, node_id): """ Request to update an RAMSTKFunction table record. :param int node_id: the PyPubSub Tree() ID of the Function to save. :return: False if successful or True if an error is encountered. :rtype: bool """ _error_code, _msg = self._dtm_data_model.do_update(node_id) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_update_all(self, **kwargs): """ Request to update all records in the RAMSTKHazardAnalysis table. :param int node_id: the ID of the Hardware item to update the HazOps for. :return: False if successful or True if an error is encountered. :rtype: bool """ _error_code, _msg = self._dtm_data_model.do_update_all(**kwargs) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)
def request_do_update(self, node_id): """ Request to update an RAMSTKHazardAnalysis table record. :param str node_id: the node ID to update. :return: (_error_code, _msg); the error code and associated error message. :rtype: (int, str) """ _error_code, _msg = self._dtm_data_model.do_update(node_id) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, 'savedHazardAnalysis')
def request_do_delete(self, node_id): """ Request to delete an RAMSTKRequirement table record. :param str node_id: the PyPubSub Tree() ID of the Requirement to delete. :return: False if successful or True if an error is encountered. :rtype: bool """ _error_code, _msg = self._dtm_data_model.do_delete(node_id) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, 'deletedRequirement')
def request_do_delete(self, node_id): """ Request entity and it's children be deleted from the FMEA. :param str node_id: the Mode, Mechanism, Cause, Controle, or Action ID to delete. :return: False if successful or True if an error is encountered. :rtype: bool """ _error_code, _msg = self._dtm_data_model.do_delete(node_id) return RAMSTKDataController.do_handle_results(self, _error_code, _msg, None)