<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_check_multi_part_attr</TITLE><H1>%mqc_check_multi_part_attr </H1><P CLASS="Paragraph">Classname: <B>%mqc_check_multi_part_attr </B></P><P CLASS="Paragraph">Inherits from: <B><A href=..\checkmate\xug_base_checker.html>%ug_base_checker </A></B></P><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"> </PRE><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"> 
<B>Description:</B>
    Validate part attributes.
 Parameters:
   (Integer) check_type              - Indicate how to perform the check
                                       This is a mandatory parameter for the checker.
      check type can be one of the following options:
        1 -  CHECK_ATTRIBUTE_VALUE,          is to check values of specified attributes
        2 -  CHECK_REQUIRED_ATTRIBUTE,       is to check the specified attributes that must exsit
        3 -  CHECK_VALUE_OPTIONAL_ATTRIBUTE, is to check values of specified attributes if the values are defined
        4 -  CHECK_TITLE_OPTIONAL_ATTRIBUTE, is to check values of specified attributes if attributes exist
        5 -  CHECK_DISALLOWED_ATTRIBUTE,     is to check the specified attributes that can not exist
   (List )  attr_titles_MatchMethod_MatchParam
                                   - List of attributes with the checking method and patterns.
                                     'Attribute  |  Match Method  |  Match Pattern'
                                     For example:
                                      {
                                          "BASE_PART_NO     |     REGULAR_EXPRESSION    |    [A-Za-z0-9]{3}[0-9]{3,5}" ,
                                          "DB_PART_DESC     |     REGULAR_EXPRESSION    |    .*" ,
                                          "DB_PART_NAME     |     REGULAR_EXPRESSION    |    .+" ,
                                          "DB_PART_NO       |     REGULAR_EXPRESSION    |    [A-Za-z0-9]{3}[0-9]{3,5}" ,
                                       }
                                      This is a mandatory parameter for the checker.
     (Boolean)  disabled?          -    If it is true, the checker is disabled.
                                            Default is False.
    (Boolean)  save_log_in_part    -  The flag indicates whether the checking results can
                                       be saved to the part file
                                       Default is True.
   (Integer) log_type              - Indicate which logging type to use to report
                                     the violation
                                       1 - log error
                                       2 - log warning
                                       3 - log information
                                     The default value is 1 which is to log error.
   (String)  log_msg               - User defined message to be added when the system
                                     reports the violation.
                                     The default is an empty string.
Results:
    PASS    -- if all specified part attributes meet specified requirement.
    FAILED  -- if any specified part attribute does not meet specified requirement.

<B>See Also:</B>
    %mqc_check_single_part_attr
=============================================================================================
Create a new checker from this template by specifying the values of the mandatory parameters:
  1. (Must)     change the class name, and the category name
  2. (Optional) change the display name. (optional)
  3. (Must)     specify the check type option
                specify the 'Title  /  Match Method  /  Match Parameter' mapping strings
                for interactive selections.
       ( Integer ) check_type:1;
       ( List )    attr_titles_MatchMethod_MatchParam_init:
                      List of strings of 'Title  /  Match Method  /  Match Parameter'
                      mapping descriptions.
                      It must have the format like:
                        {
                            "attribute_title_1  |  match_method_1 | match_parameter_string_1",
                            "attribute_title_2  |  match_method_2 | match_parameter_string_2",
                            ...
                            "attribute_title_n  |  match_method_n | match_parameter_string_n"
                        };
                      The attribute_title, match_method_option and the layer_range
                      must be separated by '|'.
                      match_method in the description strings must be included in the following
                      string list:
                      { NONE,REGULAR_EXPRESSION,MATCH_ONE_IN_SET,MATCH_ANOTHER_ATTRIBUTE}
                      NONE,                        |    no requirement on the attribute value
                  REGULAR_EXPRESSION,          |    the value must match the pattern of regular expression
                  MATCH_ONE_IN_SET,            |    the value must be one of specified value set
                  MATCH_ANOTHER_ATTRIBUTE      |    the value must match another attribute's value
                      match_parameter_string has the different format according to match method:
                                 match_method         |       parameter format             |       example
                       NONE,                          |    empty string                    |   ""
                       REGULAR_EXPRESSION,            |    regular expression string       |   "[A-Za-z0-9]{3}[0-9]{3,5}"
                       MATCH_ONE_IN_SET,              |    a list of string                |   {"MLDES","MLASM","LYTFMT"}
                       MATCH_ANOTHER_ATTRIBUTE        |    attribute title string          |   "F_CLASS"
                      For example:
                  {
                      "BASE_PART_NO     |     REGULAR_EXPRESSION    |    [A-Za-z0-9]{3}[0-9]{3,5}" ,
                      "DB_PART_DESC     |     REGULAR_EXPRESSION    |    .*" ,
                      "DB_PART_NAME     |     REGULAR_EXPRESSION    |    .+" ,
                      "DB_PART_NO       |     REGULAR_EXPRESSION    |    [A-Za-z0-9]{3}[0-9]{3,5}" ,
                  }
  4. (Optinal) change the default log type
      (integer) log_type:  1;
=============================================================================================
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_check_multi_part_attr( %ug_base_checker );
</FONT></PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   (String)       %test_category: "Template.File Structure";
   (String)       %displayed_name: "Check Multiple Part Attributes";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>  ( String )                 check_type_label: "Select Check Type ";
  ( List  )                  check_type_option: 
                             {
                                 CHECK_ATTRIBUTE_VALUE,       
                                 CHECK_REQUIRED_ATTRIBUTE,   
                                 CHECK_VALUE_OPTIONAL_ATTRIBUTE,
                                 CHECK_TITLE_OPTIONAL_ATTRIBUTE,
                                 CHECK_DISALLOWED_ATTRIBUTE  
                               };
  
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>    ( List )                     log_type_option: { LOG_ERROR, LOG_WARNING, LOG_INFO };
    ( String )                   log_type_label: "Log Option";
 # parameter for log_message     
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( Boolean Parameter )   disabled?: false;
   ( Boolean Parameter )    save_log_in_part: true;
  ( Integer Parameter )      check_type:  1;
  ( List Parameter )    attr_titles_MatchMethod_MatchParam: attr_titles_MatchMethod_MatchParam_init:;
  ( String )            attr_titles_MatchMethod_MatchParam_label: "Title  /  Match Method  /  Match Parameter";
  ( List )              attr_titles_MatchMethod_MatchParam_init: {};
    ( Integer Parameter )        log_type: 1;
    ( String Parameter )         log_msg: "";
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">   Checker function</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>    ( String )                   log_msg_label: "Log Message";
    
    ( List )  val_match_method_list: {
                                      "NONE", 
                                      "REGULAR_EXPRESSION", 
                                      "MATCH_ONE_IN_SET", 
                                      "MATCH_ANOTHER_ATTRIBUTE" 
                                      };

 
 ( List ) rules_to_check:
    
             If  -Empty?( attr_titles_MatchMethod_MatchParam: )
             Then  Loop
             {
                For  $each_sel  In  attr_titles_MatchMethod_MatchParam:;
 
                For  $sel_list  Is  Splitstring( $each_sel, "|" );
            For  $moveblank Is  mqc_removePreSufBlank($sel_list);
                         
            For  $attr_title  Is  First ( $moveblank );
            For  $match_method_string Is  Second( $moveblank );
            For  $match_method Is Position( $match_method_string, val_match_method_list:);
            For  $match_param  Is  Third( $moveblank );
            
            For  $valid_map Is ( ( -( $attr_title = "" ) ) & ( -( $attr_title = noValue ) ) &  ( -( $match_method_string = "" ) ) & ( -( $match_method_string = noValue ) ) );  
                          
            For  $valid_method  Is  member($match_method_string, val_match_method_list:);
                         
            Do  If ( $valid_map )
                Then  If ( $valid_method )
                      Then donothing
                      Else  ug_mqc_log( LOG_WARNING, {}, "Match method " + $match_method_string + " with invalid string." )
                Else  ug_mqc_log( LOG_WARNING, {}, "Invalid mapping: " + $each_sel +" ." );
            If  ( $valid_method ) & ( $valid_map )
                   Append { { $attr_title,$match_method,$match_param } };
             }
             
             Else
                {};
 
 
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   (Any Uncached)   do_check: 
   @{ 
        if -( empty?(rules_to_check:)) then
        loop
           {
             for $i from 1 to length(rules_to_check:);

             for $attr_title is first( nth($i, rules_to_check:) );
             for $val_match_method is second( nth($i, rules_to_check: ) ); 
             for $val_match_parameter is third( nth($i, rules_to_check: ) ); 
        
        # convert value match param into list
             for $val_match_param_list is
             if $val_match_method = 1  # NONE
             then
                {} # no requirement
             else if $val_match_method = 2 # REGULAR_EXPRESSION
             then
                {$val_match_parameter}
             else if $val_match_method = 3 # MATCH_ONE_IN_SET
             then
               mqc_removePreSufBlank( SplitString($val_match_parameter, ";") )
             else if $val_match_method = 4  #MATCH_ANOTHER_ATTRIBUTE
             then
               {$val_match_parameter}
             else 
               {};

             do ug_mqc_checkPartAttribute( check_type:-1, 
                                         $attr_title, 
                                         $val_match_method-1, 
                                         $val_match_param_list,
                                         nth( log_type:, log_type_option: ), 
                                         log_msg:);
           }
       else 
          ug_mqc_empty_param_warning();    
   };

</SPAN></FONT></PRE></DIV></TABLE><p class=EndLine>&nbsp;</p><p class=blank>&nbsp;</p></BODY></HTML>