Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WINDUP-264: Display a technology Tag for individual files in the report
- Loading branch information
Showing
9 changed files
with
236 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
reporting/impl/src/main/java/org/jboss/windup/reporting/freemarker/GetEffortForFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.jboss.windup.reporting.freemarker; | ||
|
||
import java.util.List; | ||
|
||
import org.jboss.windup.graph.GraphContext; | ||
import org.jboss.windup.graph.model.resource.FileModel; | ||
import org.jboss.windup.reporting.service.ClassificationService; | ||
import org.jboss.windup.reporting.service.InlineHintService; | ||
|
||
import freemarker.ext.beans.StringModel; | ||
import freemarker.template.TemplateModelException; | ||
|
||
/** | ||
* Gets the number of effort points involved in migrating this particular file | ||
* | ||
* Called from a freemarker template as follows: | ||
* | ||
* getMigrationEffortPointsForFile(FileModel):int | ||
* | ||
* @author jsightler <jesse.sightler@gmail.com> | ||
* | ||
*/ | ||
public class GetEffortForFile implements WindupFreeMarkerMethod | ||
{ | ||
private ClassificationService classificationService; | ||
private InlineHintService inlineHintService; | ||
|
||
@Override | ||
public void setGraphContext(GraphContext context) | ||
{ | ||
this.classificationService = new ClassificationService(context); | ||
this.inlineHintService = new InlineHintService(context); | ||
} | ||
|
||
@Override | ||
public String getMethodName() | ||
{ | ||
return "getMigrationEffortPointsForFile"; | ||
} | ||
|
||
@Override | ||
public Object exec(@SuppressWarnings("rawtypes") List arguments) throws TemplateModelException | ||
{ | ||
if (arguments.size() != 1) | ||
{ | ||
throw new TemplateModelException( | ||
"Error, method expects two arguments (FileModel)"); | ||
} | ||
StringModel fileModelArg = (StringModel) arguments.get(0); | ||
FileModel fileModel = (FileModel) fileModelArg.getWrappedObject(); | ||
|
||
return classificationService.getMigrationEffortPoints(fileModel) | ||
+ inlineHintService.getMigrationEffortPoints(fileModel); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters