download_validate_metadata (public)
download_validate_metadata repository_id metadata_info archive_type_id
Defined in packages/download/tcl/download-procs.tcl
Validate metadata arguments for a given archive_type
- Parameters:
- repository_id (required)
- metadata_info (required)
- archive_type_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: array set metadata $metadata_info set metadata_with_missing_responses [list] ##Iterate over the metadata information db_foreach metadata { select dam.metadata_id, dam.pretty_name, dam.data_type, dam.required_p from download_archive_metadata dam where dam.repository_id = :repository_id and dam.computed_p = 'f' and (dam.archive_type_id = :archive_type_id or dam.archive_type_id is null) order by sort_key } { # date's are complex. convert them first if { $data_type eq "date" } { if [catch { set metadata($metadata_id) [validate_ad_dateentrywidget "" metadata.$metadata_id [ns_getform]]} errmsg] { if {$required_p == "t"} { ad_complain "$errmsg: Please make sure your dates are valid." } else { set metadata($metadata_id) "" } } } if { ([info exists metadata($metadata_id)] && $metadata($metadata_id) ne "") } { set response_value [string trim $metadata($metadata_id)] } elseif {$required_p == "t"} { lappend metadata_with_missing_responses $pretty_name continue } else { set response_to_question($metadata_id) "" set response_value "" } if {$response_value ne ""} { if { $data_type eq "number" } { if { ![regexp {^(-?[0-9]+\.)?[0-9]+$} $response_value] } { ad_complain "The value for \"$metadata\" must be a number. Your value was \"$response_value\"." continue } } elseif { $data_type eq "integer" } { if { ![regexp {^[0-9]+$} $response_value] } { ad_complain "The value for \"$metadata\" must be an integer. Your value was \"$response_value\"." continue } } } ns_log Debug "LOGGING: Metadata $pretty_name: $metadata($metadata_id)" } if { [llength $metadata_with_missing_responses] > 0 } { ad_complain "You didn't respond to all required sections. You skipped:" ad_complain [join $metadata_with_missing_responses "\n"] } return [array get metadata]Generic XQL file: <fullquery name="download_validate_metadata.metadata"> <querytext> select dam.metadata_id, dam.pretty_name, dam.data_type, dam.required_p from download_archive_metadata dam where dam.repository_id = :repository_id and dam.computed_p = 'f' and (dam.archive_type_id = :archive_type_id or dam.archive_type_id is null) order by sort_key </querytext> </fullquery>packages/download/tcl/download-procs.xql
PostgreSQL XQL file: packages/download/tcl/download-procs-postgresql.xql
Oracle XQL file: packages/download/tcl/download-procs-oracle.xql