Skip to content

Commit

Permalink
Merge pull request #581 from lincolnthree/WINDUP-505
Browse files Browse the repository at this point in the history
WINDUP-505: Linking between reports for EJB and Spring Beans
  • Loading branch information
lincolnthree committed May 30, 2015
2 parents f275c60 + e970ff5 commit d6f5c52
Show file tree
Hide file tree
Showing 11 changed files with 442 additions and 94 deletions.
Expand Up @@ -5,6 +5,7 @@
import java.util.List;
import java.util.Map;

import org.jboss.windup.graph.Indexed;
import org.jboss.windup.graph.MapInAdjacentVertices;
import org.jboss.windup.graph.model.WindupVertexFrame;

Expand Down Expand Up @@ -61,6 +62,7 @@ public interface ReportModel extends WindupVertexFrame
/**
* The path to the template that produced this report (for example, /reports/blacklist.ftl)
*/
@Indexed
@Property(TEMPLATE_PATH)
public void setTemplatePath(String templatePath);

Expand Down
Expand Up @@ -34,6 +34,9 @@ dl:last-child {
margin-bottom:0;
}

a.windup-file-location {
display: block; position: relative; top: -40px; visibility: hidden;
}


.windup-bar {
Expand Down
13 changes: 12 additions & 1 deletion reporting/impl/src/main/resources/reports/templates/source.ftl
Expand Up @@ -114,6 +114,17 @@


<script type='text/javascript'>
$(window).on("hashchange", function () {
window.scrollTo(window.scrollX, window.scrollY - 50);
});
function offsetAnchor() {
if(location.hash.length !== 0) {
window.scrollTo(window.scrollX, window.scrollY - 50);
}
}
window.setTimeout(function() {
offsetAnchor();
}, 1);
$(document).ready(function(){
$('pre').snippet('${reportModel.sourceType}',{style:'ide-eclipse', showNum:true,boxFill:'#ffeeb9', box: '${reportModel.sourceBlock}' });
Expand All @@ -126,7 +137,7 @@
<#assign lineNumber = hintLine.lineNumber>
<#compress>
$("<a name='${hintLine.asVertex().getId()?c}'></a><#t>
$("<a name='${hintLine.asVertex().getId()?c}' class='windup-file-location'></a><#t>
<div class='inline-source-comment green'><#t>
<#if hintLine.hint?has_content>
<div class='inline-comment'><#t>
Expand Down
48 changes: 6 additions & 42 deletions rules-java-ee/addon/src/main/resources/reports/templates/ejb.ftl
Expand Up @@ -3,43 +3,11 @@

<#assign applicationReportIndexModel = reportModel.applicationReportIndexModel>

<#macro fileSourceLink fileRef name>
<#if fileRef?has_content>
<#assign sourceReportModel = fileModelToSourceReport(fileRef)>

<#if sourceReportModel.reportFilename??>
<a href="${sourceReportModel.reportFilename}"> ${name!""} </a>
<#else>
${name!""}
</#if>
<#else>
${name!""}
</#if>
</#macro>

<#macro renderLinksToClass fqcn>
<#assign sourceFiles = findSourceFilesByClassName(fqcn)>
<#if sourceFiles?has_content>
<#list sourceFiles as sourceFile>
<#assign sourceReportModel = fileModelToSourceReport(sourceFile)>
<a href="${sourceReportModel.reportFilename}">
<#if sourceFile_index == 0>
${fqcn}
<#else>
(${sourceFile_index + 1})
</#if>
</a>
</#list>
<#else>
${fqcn!""}
</#if>
</#macro>

<#macro mdbRenderer mdb>
<tr>
<td><@fileSourceLink mdb.ejbDeploymentDescriptor!"" mdb.beanName!""/></td>
<td><@render_link model=mdb.ejbDeploymentDescriptor text=mdb.beanName /></td>
<td>
<@renderLinksToClass mdb.ejbClass.qualifiedName/>
<@render_link model=mdb.ejbClass/>
</td>
<td><#if mdb.destination??>${mdb.destination.jndiLocation}</#if></td>
</tr>
Expand All @@ -49,12 +17,10 @@
<#macro ejbRenderer ejb>
<tr>
<td>
<@fileSourceLink ejb.ejbDeploymentDescriptor!"" ejb.beanName!""/>
<@render_link model=ejb.ejbDeploymentDescriptor text=ejb.beanName/>
</td>
<td>
<#if ejb.ejbClass??>
<@renderLinksToClass ejb.ejbClass.qualifiedName/>
</#if>
<@render_link model=ejb.ejbClass/>
</td>
<td>
<#if ejb.jndiReference??>${ejb.jndiReference.jndiLocation}</#if>
Expand All @@ -65,12 +31,10 @@
<#macro entityRenderer ejb>
<tr>
<td>
<@fileSourceLink ejb.ejbDeploymentDescriptor!"" ejb.beanName!""/>
<@render_link model=ejb.ejbDeploymentDescriptor text=ejb.beanName />
</td>
<td>
<#if ejb.ejbClass??>
<@renderLinksToClass ejb.ejbClass.qualifiedName/>
</#if>
<@render_link model=ejb.ejbClass/>
</td>
<td>${ejb.tableName!""}</td>
<td>${ejb.persistenceType!""}</td>
Expand Down
24 changes: 3 additions & 21 deletions rules-java-ee/addon/src/main/resources/reports/templates/jbpm.ftl
@@ -1,23 +1,6 @@

<!DOCTYPE html>

<#macro renderLinksToClass fqcn>
<#assign sourceFiles = findSourceFilesByClassName(fqcn)>
<#if sourceFiles?has_content>
<#list sourceFiles as sourceFile>
<#assign sourceReportModel = fileModelToSourceReport(sourceFile)>
<a href="${sourceReportModel.reportFilename}">
<#if sourceFile_index == 0>
${fqcn}
<#else>
(${sourceFile_index + 1})
</#if>
</a>
</#list>
<#else>
${fqcn!""}
</#if>
</#macro>

<#assign applicationReportIndexModel = reportModel.applicationReportIndexModel>

Expand Down Expand Up @@ -69,7 +52,6 @@
<#if iterableHasContent(reportModel.relatedResources.processes)>
<#list reportModel.relatedResources.processes.list.iterator() as process>

<#assign sourceReportModel = fileModelToSourceReport(process)!>
<div class="row">
<div class="container-fluid theme-showcase" role="main">
<div class="panel panel-primary">
Expand All @@ -81,7 +63,7 @@
<div class="panel-body">
<dl class="dl-horizontal small">
<dt>Process</dt>
<dd><a href="${sourceReportModel.reportFilename}">${getPrettyPathForFile(process)}</a></dd>
<dd><@render_link model=process /></dd>

<#if process.processName??>
<dt>Name</dt>
Expand Down Expand Up @@ -126,7 +108,7 @@
</tr>
<#list process.actionHandlers.iterator() as actionHandler>
<tr>
<td><@renderLinksToClass actionHandler.qualifiedName/></td>
<td><@render_link model=actionHandler/></td>
</tr>
</#list>
</table>
Expand All @@ -139,7 +121,7 @@
</tr>
<#list process.decisionHandlers.iterator() as decisionHandler>
<tr>
<td><@renderLinksToClass decisionHandler.qualifiedName/></td>
<td><@render_link model=decisionHandler/></td>
</tr>
</#list>
</table>
Expand Down
Expand Up @@ -67,12 +67,8 @@
</tr>
<#list reportModel.relatedResources.springBeans.list.iterator() as springBean>
<tr>
<td>${springBean.springBeanName!""}</td>
<td>
<#if springBean.javaClass??>
${springBean.javaClass.qualifiedName}
</#if>
</td>
<td><@render_link model=springBean.springConfiguration text=springBean.springBeanName/></td>
<td><@render_link model=springBean.javaClass /></td>
</tr>
</#list>
</table>
Expand Down

0 comments on commit d6f5c52

Please sign in to comment.