Exemplo n.º 1
0
    def do_update(self, node_id):
        """
        Update the record associated with Node ID to the RAMSTK Program database.

        :param int node_id: the Mode ID of the Mode to save.
        :return: (_error_code, _msg); the error code and associated message.
        :rtype: (int, str)
        """
        _error_code, _msg = RAMSTKDataModel.do_update(self, node_id)

        if _error_code != 0:
            _error_code = 2006
            _msg = 'RAMSTK ERROR: Attempted to save non-existent entity with ' \
                   'Node ID {0:s}.'.format(node_id)

        return _error_code, _msg
Exemplo n.º 2
0
    def do_update(self, node_id):
        """
        Update the record in the RAMSTKAllocation table.

        :param int node_id: the PyPubSub Tree() ID of the Allocation to save.
        :return: False if successful or True if an error is encountered.
        :rtype: bool
        """
        _error_code, _msg = RAMSTKDataModel.do_update(self, node_id)

        if _error_code != 0:
            _error_code = 2207
            _msg = 'RAMSTK ERROR: Attempted to save non-existent Allocation ' \
                   'ID {0:d}.'.format(node_id)

        return _error_code, _msg
Exemplo n.º 3
0
    def do_update(self, node_id):
        """
        Update the record associated with Node ID to the RAMSTK Program database.

        :param str node_id: the PyPubSub Tree() ID of the Requirement to save.
        :return: (_error_code, _msg); the error code and associated message.
        :rtype: (int, str)
        """
        _error_code, _msg = RAMSTKDataModel.do_update(self, node_id)

        if _error_code != 0:
            _error_code = 2006
            _msg = (
                'RAMSTK ERROR: Attempted to save non-existent Requirement ID '
                '{0:s}.'.format(str(node_id)))

        return _error_code, _msg
Exemplo n.º 4
0
    def do_update(self, node_id):
        """
        Update the record in the RAMSTKStakeholder table.

        :param int node_id: the Stakeholder ID to save to the RAMSTK
                                  Program database.
        :return: False if successful or True if an error is encountered.
        :rtype: bool
        """
        _error_code, _msg = RAMSTKDataModel.do_update(self, node_id)

        if _error_code != 0:
            _error_code = 2006
            _msg = 'RAMSTK ERROR: Attempted to save non-existent Stakeholder ' \
                   'ID {0:d}.'.format(node_id)

        return _error_code, _msg
Exemplo n.º 5
0
    def do_update(self, node_id):
        """
        Update the record in the RAMSTKSimilarItem table.

        :param int node_id: the SimilarItem ID to save to the RAMSTK Program
                            database.
        :return: False if successful or True if an error is encountered.
        :rtype: bool
        """
        _error_code, _msg = RAMSTKDataModel.do_update(self, node_id)

        if _error_code != 0 and node_id is not None:
            _error_code = 2207
            _msg = 'RAMSTK ERROR: Attempted to save non-existent SimilarItem ' \
                   'ID {0:d}.'.format(node_id)

        return _error_code, _msg
Exemplo n.º 6
0
    def do_update(self, node_id):
        """
        Update the record in the RAMSTKFailureDefinition table.

        :param int node_id: the Failure Definition ID to save to the RAMSTK
                                  Program database.
        :return: False if successful or True if an error is encountered.
        :rtype: bool
        """
        _error_code, _msg = RAMSTKDataModel.do_update(self, node_id)

        if _error_code != 0:
            _error_code = 2207
            _msg = 'RAMSTK ERROR: Attempted to save non-existent Failure ' \
                   'Definition ID {0:d}.'.format(node_id)

        return _error_code, _msg
Exemplo n.º 7
0
    def do_update(self, node_id):
        """
        Update the selected HazOps in the RAMSTKHazardAnalysis table.

        :param str node_id: the HazOps ID to save to the RAMSTK Program
                            database.
        :return: False if successful or True if an error is encountered.
        :rtype: bool
        """
        _error_code, _msg = RAMSTKDataModel.do_update(self, node_id)
        print _error_code, _msg
        if _error_code != 0:
            _error_code = 2207
            _msg = 'RAMSTK ERROR: Attempted to save non-existent Hazard ' \
                   'Analysis ID {0:s}.'.format(str(node_id))

        return _error_code, _msg
Exemplo n.º 8
0
    def do_update(self, node_id):
        """
        Update the RAMSTKEnvironment record associated with Node ID.

        :param str node_id: the PyPubSub Tree() node ID of the Environment to
                            save to the RAMSTK Program database.
        :return: (_error_code, _msg); the error code and associated message.
        :rtype: (int, str)
        """
        _error_code, _msg = RAMSTKDataModel.do_update(self, node_id)

        if _error_code != 0:
            _error_code = 2006
            _msg = 'RAMSTK ERROR: Attempted to save non-existent Environment ' \
                   'ID {0:d}.'.format(node_id)

        return _error_code, _msg
Exemplo n.º 9
0
    def do_update(self, node_id):
        """
        Update the record associated with Node ID to RAMSTK Program database.

        :param int node_id: the Function ID of the Function to save.
        :return: (_error_code, _msg); the error code and associated message.
        :rtype: (int, str)
        """
        _error_code, _msg = RAMSTKDataModel.do_update(self, node_id)

        # If there was no error and we're not running a test, let anyone
        # who cares know a Function was updated.
        if _error_code == 0:
            if not self._test:
                _attributes = self.do_select(node_id).get_attributes()
                pub.sendMessage('updated_function', attributes=_attributes)
        else:
            _error_code = 2005
            _msg = ("RAMSTK ERROR: Attempted to save non-existent "
                    "Function ID {0:d}.").format(node_id)

        return _error_code, _msg
Exemplo n.º 10
0
    def do_update(self, node_id):
        """
        Update the record associated with Node ID to the RAMSTK Program database.

        :param int node_id: the Mode ID of the Mode to save.
        :return: (_error_code, _msg); the error code and associated message.
        :rtype: (int, str)
        """
        _error_code, _msg = RAMSTKDataModel.do_update(self, node_id)

        if _error_code != 0:
            _error_code = 1
            if self._functional:
                _msg = "RAMSTK ERROR: Attempted to save non-existent " \
                       "Functional FMEA entity with Node ID " \
                       "{0:s}.".format(node_id)
            else:
                _msg = "RAMSTK ERROR: Attempted to save non-existent " \
                       "Hardware FMEA entity with Node ID " \
                       "{0:s}.".format(node_id)

        return _error_code, _msg