
org.jboss.windup.project.operation.LineItem Maven / Gradle / Ivy
The newest version!
package org.jboss.windup.project.operation;
import org.jboss.windup.config.GraphRewrite;
import org.jboss.windup.config.operation.iteration.AbstractIterationOperation;
import org.jboss.windup.graph.GraphContext;
import org.jboss.windup.graph.model.FileLocationModel;
import org.jboss.windup.graph.model.ProjectModel;
import org.jboss.windup.graph.service.GraphService;
import org.jboss.windup.reporting.model.OverviewReportLineMessageModel;
import org.ocpsoft.rewrite.config.Rule;
import org.ocpsoft.rewrite.context.EvaluationContext;
/**
* Provides the message that will be reported on the project overview page.
*
* @author Matej Briskar
*/
public class LineItem extends AbstractIterationOperation {
private String message;
LineItem(String variable) {
super(variable);
}
LineItem() {
super();
}
public static LineItem withMessage(String text) {
LineItem lineItem = new LineItem();
lineItem.setMessage(text);
return lineItem;
}
@Override
public void perform(GraphRewrite event, EvaluationContext context, FileLocationModel payload) {
GraphContext graphContext = event.getGraphContext();
GraphService overviewLineService = new GraphService<>(graphContext, OverviewReportLineMessageModel.class);
OverviewReportLineMessageModel overviewLine = overviewLineService.create();
overviewLine.setMessage(message);
ProjectModel projectModel = payload.getFile().getProjectModel();
overviewLine.setProject(projectModel);
overviewLine.setRuleID(((Rule) context.get(Rule.class)).getId());
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy