diff --git a/rules-reviewed/technology-usage/ejb-technology-usage.windup.groovy b/rules-reviewed/technology-usage/ejb-technology-usage.windup.groovy new file mode 100644 index 000000000..4ce3f477d --- /dev/null +++ b/rules-reviewed/technology-usage/ejb-technology-usage.windup.groovy @@ -0,0 +1,40 @@ +import org.jboss.windup.config.GraphRewrite +import org.jboss.windup.config.operation.iteration.AbstractIterationOperation +import org.jboss.windup.config.phase.DependentPhase +import org.jboss.windup.config.phase.PostMigrationRulesPhase +import org.jboss.windup.config.phase.PreReportGenerationPhase +import org.jboss.windup.config.query.Query +import org.jboss.windup.graph.model.ProjectModel +import org.jboss.windup.reporting.model.TechnologyTagLevel +import org.jboss.windup.reporting.service.TechnologyTagService +import org.jboss.windup.rules.apps.javaee.model.EjbBeanBaseModel +import org.ocpsoft.rewrite.context.EvaluationContext + +ruleSet("ejb-technology-usage-groovy") +/* if we need to query for TechnologyUsageStatisticsModel models + added during PostMigrationRulesPhase phase +.setPhase(DependentPhase.class) +.addExecuteAfter(PostMigrationRulesPhase.class) +.addExecuteBefore(PreReportGenerationPhase.class) +*/ +.setPhase(PostMigrationRulesPhase.class) +.addRule() + .when( + Query.fromType(EjbBeanBaseModel.class) + ) + .perform( + new AbstractIterationOperation() + { + void perform(GraphRewrite event, EvaluationContext context, EjbBeanBaseModel payload) + { + List projectModels = payload.getApplications() + for (ProjectModel projectModel : projectModels) + { + TechnologyTagService technologyTagService = new TechnologyTagService(event.getGraphContext()) + technologyTagService.addTagToFileModel(projectModel.getRootFileModel(), "Enterprise Java Bean", TechnologyTagLevel.INFORMATIONAL) + } + } + + } + ) + .withId("ejb-technology-usage-groovy-00000") diff --git a/rules-reviewed/technology-usage/tests/ejb-technology-usage.windup.test.xml b/rules-reviewed/technology-usage/tests/ejb-technology-usage.windup.test.xml index b6dc4a764..3e3a90492 100644 --- a/rules-reviewed/technology-usage/tests/ejb-technology-usage.windup.test.xml +++ b/rules-reviewed/technology-usage/tests/ejb-technology-usage.windup.test.xml @@ -2,6 +2,7 @@ data/ejb/ ../ejb-technology-usage.windup.xml + ../ejb-technology-usage.windup.groovy @@ -60,6 +61,18 @@ + + + + + + + + + + + +