<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_check_single_part_attr</TITLE><H1>%mqc_check_single_part_attr </H1><P CLASS="Paragraph">Classname: <B>%mqc_check_single_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 attribute.
 Parameters:
   (Integer) check_type:             - Selection of check type
                                       This is the mandatory parameter for the checker.
      check type can be following option:
        1 -  CHECK_ATTRIBUTE_VALUE,         | check values of existing attributes.
        2 -  CHECK_REQUIRED_ATTRIBUTE,      | check titles and values of specified attributes
        3 -  CHECK_VALUE_OPTIONAL_ATTRIBUTE,| check titles of specified attributes. Check attribute values if they exist.
        4 -  CHECK_TITLE_OPTIONAL_ATTRIBUTE,| check values of specified attributes, if attribute titles exist.
        5 -  CHECK_DISALLOWED_ATTRIBUTE,    | check disallowed attributest.
   (String)  attr_title:             - Specify the attribute name for check
                                       This is the mandatory parameter for the checker.
   (Integer) val_match_method:       - Selection of the attribute match method
                                       This is the mandatory parameter for the checker.
      value match method can be following option:
       1 -  NONE,                        |    no requirement on the attribute value
       2 -  REGULAR_EXPRESSION,          |    the value must match the pattern of regular expression
       3 -  MATCH_ONE_IN_SET,            |    the value must be one of specified value set
       4 -  MATCH_ANOTHER_ATTRIBUTE      |    the value must match another attribute's value
   (String)  val_match_param:        - Specify the match parameter according to
                                       the match method
                                       This is the mandatory parameter for the checker.
      value match parameter have different format according to val_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"
    (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 the specified part attribute meets specified requirement.
    FAILED  -- if the specified part attribute does not meet specified requirement.

<B>See Also:</B>
   %mqc_check_multi_part_attr
============================================================================================
Create a new checker from this template by providing the mandatory parameters:
   1. (Must) change the class name and the category name
   2. (Must)  specify check type option
              specify the part attribute tiltle
              select  match method
              specify the match parameter according to check type, attribute title , value match method.
        (Integer)    check_type:   1;
        (String)     attr_title: "ATTRIBUTE_NAME_TO_CHECK";
        (Integer)    val_match_method:1;
        (String)     val_match_param:"";
   3. (Optional) change log type:
        (Integer)    log_type:   1;
=============================================================================================
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_check_single_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 Single Part Attribute";

</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>   ( String )            attr_title_label: "Part Attribute Title";
                                                         
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )              val_match_method_label: "Value Match Method";
   ( List )                val_match_method_option: 
                               {
                                  NONE,
                                  REGULAR_EXPRESSION,
                                  MATCH_ONE_IN_SET,
                                  MATCH_ANOTHER_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;
   ( String Parameter )  attr_title: "";
   ( Integer Parameter )   val_match_method: 1;
   ( String Parameter )  val_match_param: "";
   ( String )            val_match_param_label: "Value Match String";                                       
    ( 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 ) rules_to_check:
    
             If  -( attr_title: = "" ) &  
                 -( attr_title: = noValue ) & 
                  ( val_match_method: > 0 ) & 
                  ( val_match_method: < 5 )  
             Then
                 { {attr_title:, val_match_method:, val_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>