'Check that all parameters have values, and fill in with default
values where necessary. This could be called after loading values
from a database in case new parameters have been added.'

def check_and_update_param_values(self, values, trans, update_values=True, workflow_building_mode=False):

    messages = {}
    request_context = WorkRequestContext(app=trans.app, user=trans.user, history=trans.history, workflow_building_mode=workflow_building_mode)
    def validate_inputs(input, value, error, parent, context, prefixed_name, prefixed_label, **kwargs):
        if (not error):
            (value, error) = check_param(request_context, input, value, context)
        if error:
            if update_values:
                try:
                    previous_value = value
                    value = input.get_initial_value(request_context, context)
                    if (not prefixed_name.startswith('__')):
                        messages[prefixed_name] = (error if (previous_value == value) else ("%s    Using    default:    '%s'." % (error, value)))
                    parent[input.name] = value
                except:
                    messages[prefixed_name] = ("Attempt    to    replace    invalid    value    for    '%s'    failed." % prefixed_label)
            else:
                messages[prefixed_name] = error
    visit_input_values(self.inputs, values, validate_inputs)
    return messages
