buildframework/helium/sf/java/metadata/src/templates/scan2.html.ftl
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 629 541af5ee3ed9
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
     1 <#--
       
     2 ============================================================================ 
       
     3 Name        : scan2.html.ftl 
       
     4 Part of     : Helium 
       
     5 
       
     6 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     7 All rights reserved.
       
     8 This component and the accompanying materials are made available
       
     9 under the terms of the License "Eclipse Public License v1.0"
       
    10 which accompanies this distribution, and is available
       
    11 at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    12 
       
    13 Initial Contributors:
       
    14 Nokia Corporation - initial contribution.
       
    15 
       
    16 Contributors:
       
    17 
       
    18 Description:
       
    19 
       
    20 ============================================================================
       
    21 -->
       
    22 
       
    23 <#macro print_component_summary component href_c_id >
       
    24 <#assign href_id = 0>
       
    25 <#assign component_time_list = table_info['jpasingle']['select t.componentTime from ComponentTime t where  t.componentId =${component.id}']>
       
    26 
       
    27 <#if component_time_list[0]?? >
       
    28     <#assign time = component_time_list[0]?number>
       
    29 <#else>
       
    30     <#assign time = 0>
       
    31 </#if>
       
    32 <tr>
       
    33 <#assign hours = (time /(60 * 60))?floor>
       
    34 <#assign minutes_secs = (time % (60 * 60))?floor>
       
    35 <#assign minutes = (minutes_secs / 60)?floor>
       
    36 <#assign seconds = (minutes_secs % 60)?floor>
       
    37     <td>${component.component}</td>
       
    38 <#--write each of the component tables information -->
       
    39 <td align="center">${hours?string("00")}:${minutes?string("00")}:${seconds?string("00")}</td>
       
    40 <#list color_list?keys as priority>
       
    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] >
       
    42     <#if count &gt; 0>
       
    43         <#assign color = color_list['${priority}']>
       
    44         <td align="center" bgcolor="${color}"><a href="#section${priority}${href_c_id}">${count}</a></td>
       
    45     <#else>
       
    46         <td align="center">${count}</td>
       
    47     </#if>
       
    48     <#assign href_id = href_id + 1>
       
    49 </#list>
       
    50 </tr>
       
    51 </#macro>
       
    52 
       
    53 <#macro print_list_text priority component href_id>
       
    54 <#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] >
       
    55 <#if count?? && count?number &gt; 0>
       
    56 <#if "${component.component}" != "general">
       
    57         <h3><a name="section${href_id}">${component.component}(${count})</a></h3>
       
    58     <#else>
       
    59         <h3><a name="section${href_id}">Uncategorized(${count})</a></h3>
       
    60     </#if>
       
    61 </#if>
       
    62 <#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 ${logfile}:${entry.lineNumber}>${entry.text}<br />
       
    64 </#list>
       
    65 </#macro>
       
    66 
       
    67 <#macro add_severity_count severity, color, count>
       
    68     <#if count &gt; 0>
       
    69 <td width="12%%" align="center" bgcolor="${color}"><a href="#${severity}">${count}</a></td>
       
    70     <#else>
       
    71     <td align="center">${count}</td>
       
    72     </#if>
       
    73 </#macro>
       
    74 
       
    75 <#-- end of macros code starts here -->
       
    76 
       
    77 
       
    78 <#if (doc)??>
       
    79     <#assign logfile = "${doc.sbsinfo.logfile.@name}" >
       
    80     <#assign time = "${doc.sbsinfo.duration.@time}" >
       
    81 
       
    82     <#assign table_info = pp.loadData('com.nokia.helium.metadata.ORMFMPPLoader',
       
    83         "${dbPath}") >
       
    84 <#-- overall summary -->
       
    85 <#assign logpath_id_list = table_info['jpasingle']['select l.id from LogFile l where l.path like \'%${logfile}\''] >
       
    86 <#if logpath_id_list[0]?? >
       
    87 <#assign logpath_id = logpath_id_list[0] > 
       
    88 </#if>
       
    89 <html>
       
    90 <head><title>${logfile}</title></head>
       
    91 <body>
       
    92 <h2>Overall</h2>
       
    93 <table border="1" cellpadding="0" cellspacing="0" width="100%%">
       
    94 <tr>
       
    95     <th width="22%%">&nbsp;</th>
       
    96     <th width="11%%">Time</th>
       
    97     <th width="11%%">Errors</th>
       
    98     <th width="11%%">Warnings</th>
       
    99     <th width="11%%">Critical</th>
       
   100     <th width="23%%">Migration Notes</th>
       
   101     <th width="11%%">Info</th>
       
   102 </tr>
       
   103 <tr>
       
   104 <#-- need to create variables for the items tobe displayed in the comment title Overall_Total
       
   105 doing this the long winded way because I could not find a way to add items to a hash in a loop -->
       
   106 <#assign color_list={'error': 'FF0000', 'warning': 'FFF000', 'critical': 'FF7000', 'remark': 'FFCCFF', 'info': 'FFFFFF'}>
       
   107 <#assign priority_ids = color_list?keys>
       
   108 <td width="22%%">Total</td>
       
   109 <td width="12%%" align="center">${time}</td>
       
   110 <#list priority_ids as priority>
       
   111     <@add_severity_count severity='${priority}' color=color_list['${priority}'] 
       
   112         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 </#list>
       
   114 </tr>
       
   115 </table>
       
   116 <#-- Summary for each component -->
       
   117 <h1>${logfile}</h1>
       
   118 <h2>By Component</h2>
       
   119     <table border="1" cellpadding="0" cellspacing="0" width="100%%">
       
   120         <tr>
       
   121             <th width="50%%">Component</th>
       
   122             <th width="9%%">Time</th>
       
   123             <th width="9%%">Errors</th>
       
   124             <th width="9%%">Warnings</th>
       
   125             <th width="9%%">Criticals</th>
       
   126             <th width="9%%">Notes</th>
       
   127             <th width="9%%">Info</th>
       
   128         </tr>
       
   129 
       
   130 <#assign c_id = 0>
       
   131 <#assign general_component_list = table_info['jpasingle']['select c from Component c where LOWER(c.component) like \'%general%\' and c.logPathID=${logpath_id}']>
       
   132 <#if general_component_list[0]?? >
       
   133 <#assign general_component = general_component_list[0] >
       
   134 <@print_component_summary component=general_component  href_c_id="${c_id}"/>
       
   135 <#assign c_id = c_id + 1>
       
   136 </#if>
       
   137 <#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>
       
   138 <@print_component_summary component=componentEntry href_c_id="${c_id}"/>
       
   139 <#assign c_id = c_id + 1>
       
   140 
       
   141 </#list>
       
   142 </table>
       
   143 
       
   144 <#-- Individual components status -->
       
   145 <#list priority_ids as p_id>
       
   146 <#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]>
       
   147 <#if p_count &gt; 0>
       
   148     <h3><a>${p_id} Details By Component</a></h3>
       
   149 </#if>
       
   150 <#assign href_cid = 0>
       
   151 <#if general_component??>
       
   152     <@print_list_text priority="${p_id}" component=general_component href_id="${p_id}${href_cid}" /> 
       
   153     <#assign href_cid = href_cid + 1>
       
   154 </#if>
       
   155 <#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>
       
   156     <@print_list_text priority="${p_id}" component=componentEntry href_id="${p_id}${href_cid}" />
       
   157     <#assign href_cid = href_cid + 1>
       
   158 </#list>
       
   159 </#list>
       
   160 </body>
       
   161 </html>
       
   162 </#if>