buildframework/helium/tools/common/templates/log/scan2_orm.html.ftl
changeset 628 7c4a911dc066
parent 587 85df38eb4012
child 645 b8d81fa19e7d
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
    35 <#assign minutes = (minutes_secs / 60)?floor>
    35 <#assign minutes = (minutes_secs / 60)?floor>
    36 <#assign seconds = (minutes_secs % 60)?floor>
    36 <#assign seconds = (minutes_secs % 60)?floor>
    37     <td>${component.component}</td>
    37     <td>${component.component}</td>
    38 <#--write each of the component tables information -->
    38 <#--write each of the component tables information -->
    39 <td align="center">${hours?string?left_pad(2, "0")}:${minutes?string?left_pad(2, "0")}:${seconds?string?left_pad(2, "0")}</td>
    39 <td align="center">${hours?string?left_pad(2, "0")}:${minutes?string?left_pad(2, "0")}:${seconds?string?left_pad(2, "0")}</td>
    40 <#list color_list?keys as priority>
    40 <#list color_list?keys as severity>
    41     <#assign count =  table_info['jpasingle']['select count(m.id) from MetadataEntry as m JOIN  m.priority as p JOIN m.component as c where UPPER(p.priority) like \'%${priority?upper_case}%\' and c.id=${component.id}'][0] >
    41     <#assign count =  table_info['jpasingle']['select count(m.id) from MetadataEntry as m JOIN  m.severity as p JOIN m.component as c where p.severity=\'${severity?upper_case}\' and c.id=${component.id}'][0] >
    42     <#if priority == 'error' && !logfile?contains('_clean_')>
       
    43         <#assign count_check_missing_files = table_info['jpasingle']['select Count(w.id) from WhatLogEntry w, Component c where c.component=\'${component.component}\' and c.logPathID=${logpath.id} and w.componentID=c.id and w.missing=1'][0]>
       
    44         <#assign count = count + count_check_missing_files>
       
    45     </#if>
       
    46     <#if count &gt; 0>
    42     <#if count &gt; 0>
    47         <#assign color = color_list['${priority}']>
    43         <#assign color = color_list['${severity}']>
    48         <td align="center" bgcolor="${color}"><a href="#section${priority}${href_c_id}">${count}</a></td>
    44         <td align="center" bgcolor="${color}"><a href="#section${severity}${href_c_id}">${count}</a></td>
    49     <#else>
    45     <#else>
    50         <td align="center">${count}</td>
    46         <td align="center">${count}</td>
    51     </#if>
    47     </#if>
    52     <#assign href_id = href_id + 1>
    48     <#assign href_id = href_id + 1>
    53 </#list>
    49 </#list>
    54 </tr>
    50 </tr>
    55 </#macro>
    51 </#macro>
    56 
    52 
    57 <#macro converttime time>${((time/3660)%60)?string?left_pad(2, "0")}:${((time/60)%60)?string?left_pad(2, "0")}:${(time%60)?string?left_pad(2, "0")}</#macro>
    53 <#macro converttime time>${((time/3660)%60)?string?left_pad(2, "0")}:${((time/60)%60)?string?left_pad(2, "0")}:${(time%60)?string?left_pad(2, "0")}</#macro>
    58 
    54 
    59 <#macro print_list_text priority component href_id>
    55 <#macro print_list_text severity component href_id>
    60 <#assign count =  table_info['jpasingle']['select count(m.id) from MetadataEntry as m JOIN m.priority as p JOIN m.component as c where  UPPER(p.priority) like \'%${priority?upper_case}%\' and c.id=${component.id}'][0] >
    56 <#assign count =  table_info['jpasingle']['select count(m.id) from MetadataEntry as m JOIN m.severity as p JOIN m.component as c where p.severity=\'${severity?upper_case}\' and c.id=${component.id}'][0] >
    61 <#if priority == 'error' && !logfile?contains('_clean_')>
       
    62     <#assign count_check_missing_files = table_info['jpasingle']['select Count(w.id) from WhatLogEntry w, Component c where c.component=\'${component.component}\' and c.logPathID=${logpath.id} and w.componentID=c.id and w.missing=1'][0]>
       
    63     <#assign count = count + count_check_missing_files>
       
    64 </#if>
       
    65 <#if count?? && count?number &gt; 0>
    57 <#if count?? && count?number &gt; 0>
    66 <#if "${component.component}" != "general">
    58 <#if "${component.component}" != "general">
    67         <h3><a name="section${href_id}">${component.component}(${count})</a></h3>
    59         <h3><a name="section${href_id}">${component.component}(${count})</a></h3>
    68     <#else>
    60     <#else>
    69         <h3><a name="section${href_id}">Uncategorized(${count})</a></h3>
    61         <h3><a name="section${href_id}">Uncategorized(${count})</a></h3>
    70     </#if>
    62     </#if>
    71 <#list table_info['native:com.nokia.helium.jpa.entity.metadata.MetadataEntry']['select * from metadataentry INNER JOIN component ON component.component_id=metadataentry.component_id INNER JOIN priority ON priority.priority_id=metadataentry.priority_id where component.component_id=${component.id} and UPPER(priority.priority) like \'%${priority?upper_case}%\''] as entry >
    63 <#list table_info['jpa']['select e from MetadataEntry e JOIN e.severity s where e.componentId=${component.id} and s.severity=\'${severity?upper_case}\''] as entry>
    72 ${logfile}:${entry.lineNumber}>${entry.text}<br />
    64 ${logfile.path}:${entry.lineNumber}>${entry.text}<br />
    73 </#list>
       
    74 <#list table_info['jpa']['select distinct w FROM Component c, WhatLogEntry w, LogFile l WHERE c.logPathID = l.id and LOWER(l.path) not like \'%_clean_%\' and c.component=\'${component.component}\' AND c.logPathID=${logpath.id} AND c.id=w.componentID AND w.missing=1'] as entry>
       
    75 ${logfile}: MISSING: ${entry.member}<br/>
       
    76 </#list>
    65 </#list>
    77 </#if>
    66 </#if>
    78 </#macro>
    67 </#macro>
    79 
    68 
    80 <#macro component_check_error component count >
    69 <#macro component_check_error component count >
    81 <#if count &gt; 0>
       
    82 <#list table_info['native:com.nokia.helium.jpa.entity.metadata.WhatLogEntry']['select * from whatlogentry where COMPONENT_ID=${component.id} and missing=1'] as whatlogentry>
       
    83 ${logpath.id}:${whatlogentry.member}<br/><br/>
       
    84 </#list>
       
    85 </#if>
       
    86 </#macro>
    70 </#macro>
    87 
    71 
    88 <#macro add_severity_count severity, color, count>
    72 <#macro add_severity_count severity, color, count>
    89     <#if count &gt; 0>
    73     <#if count &gt; 0>
    90 <td width="12%%" align="center" bgcolor="${color}"><a href="#${severity}">${count}</a></td>
    74 <td width="12%%" align="center" bgcolor="${color}"><a href="#${severity}">${count}</a></td>
    95 
    79 
    96 <#-- end of macros code starts here -->
    80 <#-- end of macros code starts here -->
    97 
    81 
    98 
    82 
    99 <#if (logfilename)??>
    83 <#if (logfilename)??>
   100     <#assign logfile = "${logfilename}"?replace("\\","/") >
    84     <#assign logfilename_cleaned = "${logfilename}"?replace("\\","/") >
   101     <#assign table_info = pp.loadData('com.nokia.helium.metadata.ORMFMPPLoader',
    85     <#assign table_info = pp.loadData('com.nokia.helium.metadata.ORMFMPPLoader',
   102         "${dbPath}") >
    86         "${dbPath}") >
   103 <#-- overall summary -->
    87 <#-- overall summary -->
   104 <#assign logpath = table_info['jpasingle']['select l from LogFile l where LOWER(l.path) like \'%${logfile?lower_case}\''][0] >
    88 <#assign logfile = table_info['jpasingle']['select l from LogFile l where LOWER(l.path)=\'${logfilename_cleaned?lower_case}\''][0] >
   105 <#assign time = table_info['jpasingle']['select et from ExecutionTime et where et.logPathID=${logpath.id}'][0] >
    89 <#assign time = table_info['jpasingle']['select et from ExecutionTime et where et.logFileId=${logfile.id}'][0] >
   106 <html>
    90 <html>
   107 <head><title>${logfile}</title></head>
    91 <head><title>${logfile.path}</title></head>
   108 <body>
    92 <body>
   109 <h2>Overall</h2>
    93 <h2>Overall</h2>
   110 <table border="1" cellpadding="0" cellspacing="0" width="100%%">
    94 <table border="1" cellpadding="0" cellspacing="0" width="100%%">
   111 <tr>
    95 <tr>
   112     <th width="22%%">&nbsp;</th>
    96     <th width="22%%">&nbsp;</th>
   119 </tr>
   103 </tr>
   120 <tr>
   104 <tr>
   121 <#-- need to create variables for the items to be displayed in the comment title Overall_Total
   105 <#-- need to create variables for the items to be displayed in the comment title Overall_Total
   122 doing this the long winded way because I could not find a way to add items to a hash in a loop -->
   106 doing this the long winded way because I could not find a way to add items to a hash in a loop -->
   123 <#assign color_list={'error': 'FF0000', 'warning': 'FFF000', 'critical': 'FF7000', 'remark': 'FFCCFF', 'info': 'FFFFFF'}>
   107 <#assign color_list={'error': 'FF0000', 'warning': 'FFF000', 'critical': 'FF7000', 'remark': 'FFCCFF', 'info': 'FFFFFF'}>
   124 <#assign priority_ids = color_list?keys>
   108 <#assign severity_ids = color_list?keys>
   125 <td width="22%%">Total</td>
   109 <td width="22%%">Total</td>
   126 <td width="12%%" align="center"><@converttime time=time.time /></td>
   110 <td width="12%%" align="center"><@converttime time=time.time /></td>
   127 <#assign count_check_errors = table_info['jpasingle']['select Count(w.id) from WhatLogEntry w JOIN w.component c where c.logPathID=${logpath.id} and w.missing=\'true\''][0]> 
   111 <#assign count_check_errors = table_info['jpasingle']['select Count(w.id) from WhatLogEntry w JOIN w.component c where c.logFileId=${logfile.id} and w.missing=\'true\''][0]> 
   128 <#list priority_ids as priority>
   112 <#list severity_ids as severity>
   129     <#assign count = table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority p where m.logPathId=${logpath.id} and UPPER(p.priority) like \'%${priority?upper_case}%\''][0]>
   113     <#assign count = table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.severity p where m.logFileId=${logfile.id} and p.severity=\'${severity?upper_case}\''][0]>
   130     <#if  '${priority}' == 'error'  && !logfile?contains('_clean_')>
   114     <#if  '${severity}' == 'error'  && !logfile.path?contains('_clean_')>
   131         <#assign count = count + count_check_errors>
   115         <#assign count = count>
   132     </#if>
   116     </#if>
   133     <@add_severity_count severity='${priority}' color=color_list['${priority}'] 
   117     <@add_severity_count severity='${severity}' color=color_list['${severity}'] 
   134         count = count />
   118         count = count />
   135 </#list>
   119 </#list>
   136 </tr>
   120 </tr>
   137 </table>
   121 </table>
   138 
   122 
   139 <#-- Summary for each component -->
   123 <#-- Summary for each component -->
   140 
   124 
   141 <h1>${logfile}</h1>
   125 <h1>${logfile.path}</h1>
   142 <h2>By Component</h2>
   126 <h2>By Component</h2>
   143     <table border="1" cellpadding="0" cellspacing="0" width="100%%">
   127     <table border="1" cellpadding="0" cellspacing="0" width="100%%">
   144         <tr>
   128         <tr>
   145             <th width="50%%">Component</th>
   129             <th width="50%%">Component</th>
   146             <th width="9%%">Time</th>
   130             <th width="9%%">Time</th>
   150             <th width="9%%">Notes</th>
   134             <th width="9%%">Notes</th>
   151             <th width="9%%">Info</th>
   135             <th width="9%%">Info</th>
   152         </tr>
   136         </tr>
   153 
   137 
   154 <#assign c_id = 0>
   138 <#assign c_id = 0>
   155 <#assign general_component_list = table_info['jpasingle']['select c from Component c where LOWER(c.component) like \'%general%\' and c.logPathID=${logpath.id}']>
   139 <#assign general_component_list = table_info['jpasingle']['select c from Component c where LOWER(c.component) like \'%general%\' and c.logFileId=${logfile.id}']>
   156 <#if general_component_list[0]?? >
   140 <#if general_component_list[0]?? >
   157 <#assign general_component = general_component_list[0] >
   141 <#assign general_component = general_component_list[0] >
   158 <@print_component_summary component=general_component  href_c_id="${c_id}"/>
   142 <@print_component_summary component=general_component  href_c_id="${c_id}"/>
   159 <#assign c_id = c_id + 1>
   143 <#assign c_id = c_id + 1>
   160 </#if>
   144 </#if>
   161 <#list table_info['jpa']['select c from Component c where c.logPathID=${logpath.id} and LOWER(c.component) not like \'%general%\' ORDER BY c.component'] as componentEntry>
   145 <#list table_info['jpa']['select c from Component c where c.logFileId=${logfile.id} and LOWER(c.component) not like \'%general%\' ORDER BY c.component'] as componentEntry>
   162 <@print_component_summary component=componentEntry href_c_id="${c_id}"/>
   146 <@print_component_summary component=componentEntry href_c_id="${c_id}"/>
   163 <#assign c_id = c_id + 1>
   147 <#assign c_id = c_id + 1>
   164 
   148 
   165 </#list>
   149 </#list>
   166 </table>
   150 </table>
   167 
   151 
   168 <#-- Individual components status -->
   152 <#-- Individual components status -->
   169 <#list priority_ids as p_id>
   153 <#list severity_ids as p_id>
   170 <#assign p_count = table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p where m.logPathId=${logpath.id} and UPPER(p.priority) like \'%${p_id?upper_case}%\''][0]>
   154 <#assign p_count = table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.severity as p where m.logFileId=${logfile.id} and p.severity=\'${p_id?upper_case}\''][0]>
   171 <#if p_count &gt; 0>
   155 <#if p_count &gt; 0>
   172     <h3><a>${p_id} Details By Component</a></h3>
   156     <h3><a>${p_id} Details By Component</a></h3>
   173 </#if>
   157 </#if>
   174 <#assign href_cid = 0>
   158 <#assign href_cid = 0>
   175 <#if general_component??>
   159 <#if general_component??>
   176     <@print_list_text priority="${p_id}" component=general_component href_id="${p_id}${href_cid}" /> 
   160     <@print_list_text severity="${p_id}" component=general_component href_id="${p_id}${href_cid}" /> 
   177     <#assign href_cid = href_cid + 1>
   161     <#assign href_cid = href_cid + 1>
   178 </#if>
   162 </#if>
   179 <#list table_info['jpa']['select c from Component c where c.logPathID=${logpath.id} and LOWER(c.component) not like \'%general%\' ORDER BY c.component'] as componentEntry>
   163 <#list table_info['jpa']['select c from Component c where c.logFileId=${logfile.id} and LOWER(c.component) not like \'%general%\' ORDER BY c.component'] as componentEntry>
   180     <@print_list_text priority="${p_id}" component=componentEntry href_id="${p_id}${href_cid}" />
   164     <@print_list_text severity="${p_id}" component=componentEntry href_id="${p_id}${href_cid}" />
   181     <#assign href_cid = href_cid + 1>
   165     <#assign href_cid = href_cid + 1>
   182 </#list>
   166 </#list>
   183 </#list>
   167 </#list>
   184 </table>
   168 </table>
   185 </body>
   169 </body>