// @formatter:off
    @Override
    public Configuration getConfiguration(GraphContext context) {
      AbstractIterationOperation<FileLocationModel> addTypeRefToList =
          new AbstractIterationOperation<FileLocationModel>() {
            @Override
            public void perform(
                GraphRewrite event, EvaluationContext context, FileLocationModel payload) {
              xmlFiles.add(payload);
            }
          };

      return ConfigurationBuilder.begin()
          .addRule()
          .when(
              XmlFile.matchesXpath("/abc:beans")
                  .namespace("abc", "http://www.springframework.org/schema/beans")
                  .as("first"))
          .perform(
              Classification.as("Spring File")
                  .and(
                      Iteration.over("first")
                          .when(
                              XmlFile.from(Iteration.singleVariableIterationName("first"))
                                  .matchesXpath("//windupv1:file-gate")
                                  .namespace("windupv1", "http://www.jboss.org/schema/windup"))
                          .perform(addTypeRefToList)
                          .endIteration()));
    }
 // @formatter:off
 @Override
 public Configuration getConfiguration(GraphContext context) {
   return ConfigurationBuilder.begin()
       .addRule()
       .when(Query.find(FileModel.class).withProperty(FileModel.IS_DIRECTORY, true))
       .perform(
           Iteration.over(FileModel.class)
               .perform(new RecurseDirectoryAndAddFiles())
               .endIteration())
       .addRule()
       .when(
           Query.find(FileModel.class)
               .withProperty(FileModel.IS_DIRECTORY, false)
               .withProperty(
                   FileModel.FILE_PATH,
                   QueryPropertyComparisonType.REGEX,
                   ZipUtil.getEndsWithZipRegularExpression()))
       .perform(Iteration.over().perform(new AddArchiveReferenceInformation()).endIteration());
 }
Beispiel #3
0
  @Override
  public Configuration getConfiguration(GraphContext arg0) {
    ConditionBuilder allProjects = Query.find(MavenProjectModel.class).as("projectModels");

    AbstractIterationOperation<MavenProjectModel> setupParentModule =
        new AbstractIterationOperation<MavenProjectModel>(MavenProjectModel.class, "projectModel") {
          @Override
          public void perform(
              GraphRewrite event, EvaluationContext context, MavenProjectModel payload) {
            setMavenParentProject(payload);
          }
        };

    return ConfigurationBuilder.begin()
        .addRule()
        .when(allProjects)
        .perform(
            Iteration.over("projectModels")
                .as("projectModel")
                .perform(setupParentModule)
                .endIteration());
  }
Beispiel #4
0
  /**
   * Finds all variables in the context with the given names, and also attaches all
   * WindupFreeMarkerMethods from all addons into the map.
   *
   * <p>This allows external addons to extend the capabilities in the freemarker reporting system.
   */
  public static Map<String, Object> findFreeMarkerContextVariables(
      Variables variables, String... varNames) {
    Map<String, Object> results = new HashMap<>();

    for (String varName : varNames) {
      WindupVertexFrame payload = null;
      try {
        payload = Iteration.getCurrentPayload(variables, null, varName);
      } catch (IllegalStateException | IllegalArgumentException e) {
        // oh well
      }

      if (payload != null) {
        results.put(varName, payload);
      } else {
        Iterable<? extends WindupVertexFrame> var = variables.findVariable(varName);
        if (var != null) {
          results.put(varName, var);
        }
      }
    }
    return results;
  }
 @Override
 public void removeCurrentPayload(Variables varStack) {
   Iteration.removeCurrentPayload(varStack, null, var);
 }
 @Override
 public void setCurrentPayload(Variables varStack, WindupVertexFrame element) {
   Iteration.setCurrentPayload(varStack, var, element);
 }