_attachments__attachments_name_api (private)

 _attachments__attachments_name_api

Defined in packages/attachments/tcl/test/attachments-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 aa_equals aa_equals (public) aa_log aa_log (public) aa_log_result aa_log_result (public) acs_object::get_element acs_object::get_element (public) acs_object_type acs_object_type (public) _attachments__attachments_name_api _attachments__attachments_name_api _attachments__attachments_name_api->aa_equals _attachments__attachments_name_api->aa_log _attachments__attachments_name_api->aa_log_result _attachments__attachments_name_api->acs_object::get_element _attachments__attachments_name_api->acs_object_type

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
    foreach attachment_id [db_list get_attachments {
        select item_id from attachments fetch first 10 rows only
    }] {
        #
        # Try our best to get the 'title', depending on the object type
        #
        set title ""
        set object_type [acs_object_type $attachment_id]
        if {[content::extlink::is_extlink -item_id $attachment_id]} {
            #
            # URL
            #
            set title [content::extlink::name -item_id $attachment_id]
        } elseif {[content::item::is_subclass  -object_type $object_type  -supertype "content_item"]} {
            #
            # Content item, or subtype
            #
            set title [content::item::get_title -item_id $attachment_id]
        } elseif {[content::item::is_subclass  -object_type $object_type   -supertype "content_revision"]} {
            #
            # Content revision, or subtype
            #
            set title [content::revision::get_title -revision_id $attachment_id]
        } else {
            #
            # Let's try the 'title' column on 'acs_objects'
            #
            set title [acs_object::get_element  -object_id $attachment_id  -element "title"]
        }
        #
        # If everything fails, set the 'attachment_id' as title
        #
        if {$title eq ""} {
            set title $attachment_id
        }

        aa_equals "Name for attachment '$attachment_id' is expected"  $title [attachments::get_title -attachment_id $attachment_id]
    }
}} {
          aa_log "Running testcase body $body_count"
          set ::__aa_test_indent [info level]
          set catch_val [catch $testcase_body msg]
          if {$catch_val != 0 && $catch_val != 2} {
              aa_log_result "fail" "attachments_name_api (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo"
          }
          incr body_count
        }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: