@Override public ConditionBuilder when() { QueryGremlinCriterion doctypeSearchCriterion = new QueryGremlinCriterion() { @Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.has(DoctypeMetaModel.PROPERTY_PUBLIC_ID, Text.textRegex(REGEX_HIBERNATE)); Traversal<?, ?> systemIDQuery = event.getGraphContext().getQuery(DoctypeMetaModel.class) .getRawTraversal() .has(DoctypeMetaModel.PROPERTY_SYSTEM_ID, Text.textRegex(REGEX_HIBERNATE)); GraphTraversal<Vertex, Vertex> systemIdPipeline = new GraphTraversalSource(event.getGraphContext().getGraph()).V(systemIDQuery.toList()); pipeline.union(systemIdPipeline); pipeline.dedup(); } }; return Query.fromType(DoctypeMetaModel.class).piped(doctypeSearchCriterion); }
@Override public ConditionBuilder when() { QueryGremlinCriterion doctypeSearchCriterion = new QueryGremlinCriterion() { @Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.has(DoctypeMetaModel.PROPERTY_PUBLIC_ID, Text.textRegex(REGEX_HIBERNATE)); Traversal<?, ?> systemIDQuery = event.getGraphContext().getQuery(DoctypeMetaModel.class) .getRawTraversal().has(DoctypeMetaModel.PROPERTY_SYSTEM_ID, Text.textRegex(REGEX_HIBERNATE)); GraphTraversal<Vertex, Vertex> systemIdPipeline = new GraphTraversalSource(event.getGraphContext().getGraph()).V(systemIDQuery.toList()); pipeline.union(systemIdPipeline); pipeline.dedup(); } }; return Query.fromType(DoctypeMetaModel.class).piped(doctypeSearchCriterion); }
@Override public ConditionBuilder when() { QueryGremlinCriterion doctypeSearchCriterion = new QueryGremlinCriterion() { @Override public void query(GraphRewrite event, GremlinPipeline<Vertex, Vertex> pipeline) { pipeline.has(DoctypeMetaModel.PROPERTY_PUBLIC_ID, Text.REGEX, hibernateRegex); FramedGraphQuery systemIDQuery = event.getGraphContext().getQuery().type(DoctypeMetaModel.class) .has(DoctypeMetaModel.PROPERTY_SYSTEM_ID, Text.REGEX, hibernateRegex); GremlinPipeline<Vertex, Vertex> systemIdPipeline = new GremlinPipeline<>(systemIDQuery.vertices()); pipeline.add(systemIdPipeline); pipeline.dedup(); } }; return Query.fromType(DoctypeMetaModel.class).piped(doctypeSearchCriterion); }
@Override public ConditionBuilder when() { QueryGremlinCriterion doctypeSearchCriterion = new QueryGremlinCriterion() { @Override public void query(GraphRewrite event, GremlinPipeline<Vertex, Vertex> pipeline) { pipeline.has(DoctypeMetaModel.PROPERTY_PUBLIC_ID, Text.REGEX, hibernateRegex); FramedGraphQuery systemIDQuery = event.getGraphContext().getQuery().type(DoctypeMetaModel.class) .has(DoctypeMetaModel.PROPERTY_SYSTEM_ID, Text.REGEX, hibernateRegex); GremlinPipeline<Vertex, Vertex> systemIdPipeline = new GremlinPipeline<>(systemIDQuery.vertices()); pipeline.add(systemIdPipeline); pipeline.dedup(); } }; return Query.fromType(DoctypeMetaModel.class).piped(doctypeSearchCriterion); }
@Override public ConditionBuilder when() { QueryGremlinCriterion doctypeSearchCriterion = new QueryGremlinCriterion() { @Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.has(DoctypeMetaModel.PROPERTY_PUBLIC_ID, Text.textRegex(REGEX_HIBERNATE)); Traversal<?, ?> systemIDQuery = event.getGraphContext().getQuery(DoctypeMetaModel.class) .getRawTraversal().has(DoctypeMetaModel.PROPERTY_SYSTEM_ID, Text.textRegex(REGEX_HIBERNATE)); GraphTraversal<Vertex, Vertex> systemIdPipeline = new GraphTraversalSource(event.getGraphContext().getGraph()).V(systemIDQuery.toList()); pipeline.union(systemIdPipeline); pipeline.dedup(); } }; return Query.fromType(DoctypeMetaModel.class).piped(doctypeSearchCriterion); }
@Override public ConditionBuilder when() { QueryGremlinCriterion doctypeSearchCriterion = new QueryGremlinCriterion() { @Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.has(DoctypeMetaModel.PROPERTY_PUBLIC_ID, Text.textRegex(REGEX_HIBERNATE)); Traversal<?, ?> systemIDQuery = event.getGraphContext().getQuery(DoctypeMetaModel.class) .getRawTraversal() .has(DoctypeMetaModel.PROPERTY_SYSTEM_ID, Text.textRegex(REGEX_HIBERNATE)); GraphTraversal<Vertex, Vertex> systemIdPipeline = new GraphTraversalSource(event.getGraphContext().getGraph()).V(systemIDQuery.toList()); pipeline.union(systemIdPipeline); pipeline.dedup(); } }; return Query.fromType(DoctypeMetaModel.class).piped(doctypeSearchCriterion); }
@Override public boolean evaluate(GraphRewrite event, EvaluationContext context) { QueryBuilderFind q = Query.fromType(InlineHintModel.class); if (StringUtils.isNotBlank(filename)) { q.piped(new QueryGremlinCriterion() { private static final String HINT_STEP = "hintModel"; @Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.as(HINT_STEP); pipeline.out(InlineHintModel.FILE_MODEL); pipeline.has(FileModel.FILE_NAME, filename); pipeline.select(HINT_STEP); } }); } q.withProperty(InlineHintModel.HINT, QueryPropertyComparisonType.REGEX, messagePattern); return q.evaluate(event, context); }
@Override public boolean evaluate(GraphRewrite event, EvaluationContext context) { QueryBuilderFind q = Query.fromType(InlineHintModel.class); if (StringUtils.isNotBlank(filename)) { q.piped(new QueryGremlinCriterion() { private static final String HINT_STEP = "hintModel"; @Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.as(HINT_STEP); pipeline.out(InlineHintModel.FILE_MODEL); pipeline.has(FileModel.FILE_NAME, filename); pipeline.select(HINT_STEP); } }); } q.withProperty(InlineHintModel.HINT, QueryPropertyComparisonType.REGEX, messagePattern); return q.evaluate(event, context); }
@Override public boolean evaluate(GraphRewrite event, EvaluationContext context) { QueryBuilderFind q = Query.fromType(ClassificationModel.class); if (StringUtils.isNotBlank(filename)) { q.piped(new QueryGremlinCriterion() { private static final String CLASSIFICATION_STEP = "classificationModel"; @Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.as(CLASSIFICATION_STEP); pipeline.out(ClassificationModel.FILE_MODEL); pipeline.has(FileModel.FILE_NAME, filename); pipeline.select(CLASSIFICATION_STEP); } }); } q.withProperty(ClassificationModel.CLASSIFICATION, QueryPropertyComparisonType.REGEX, classificationPattern); return q.evaluate(event, context); }
@Override public boolean evaluate(GraphRewrite event, EvaluationContext context) { QueryBuilderFind q = Query.fromType(TechnologyTagModel.class); if (StringUtils.isNotBlank(filename)) { q.piped(new QueryGremlinCriterion() { private static final String TECHNOLOGYTAG_STEP = "technologyTagModel"; @Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.as(TECHNOLOGYTAG_STEP); pipeline.out(TechnologyTagModel.TECH_TAG_TO_FILE_MODEL); pipeline.has(FileModel.FILE_NAME, filename); pipeline.select(TECHNOLOGYTAG_STEP); } }); } q.withProperty(TechnologyTagModel.NAME, QueryPropertyComparisonType.REGEX, namePattern); return q.evaluate(event, context); }
@Override public boolean evaluate(GraphRewrite event, EvaluationContext context) { QueryBuilderFind q = Query.fromType(TechnologyTagModel.class); if (StringUtils.isNotBlank(filename)) { q.piped(new QueryGremlinCriterion() { private static final String TECHNOLOGYTAG_STEP = "technologyTagModel"; @Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.as(TECHNOLOGYTAG_STEP); pipeline.out(TechnologyTagModel.TECH_TAG_TO_FILE_MODEL); pipeline.has(FileModel.FILE_NAME, filename); pipeline.select(TECHNOLOGYTAG_STEP); } }); } q.withProperty(TechnologyTagModel.NAME, QueryPropertyComparisonType.REGEX, namePattern); return q.evaluate(event, context); }
@Override public boolean evaluate(GraphRewrite event, EvaluationContext context) { QueryBuilderFind q = Query.fromType(ClassificationModel.class); if (StringUtils.isNotBlank(filename)) { q.piped(new QueryGremlinCriterion() { private static final String CLASSIFICATION_STEP = "classificationModel"; @Override public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline) { pipeline.as(CLASSIFICATION_STEP); pipeline.out(ClassificationModel.FILE_MODEL); pipeline.has(FileModel.FILE_NAME, filename); pipeline.select(CLASSIFICATION_STEP); } }); } q.withProperty(ClassificationModel.CLASSIFICATION, QueryPropertyComparisonType.REGEX, classificationPattern); return q.evaluate(event, context); }
@Override public Configuration getConfiguration(GraphContext context) { QueryGremlinCriterion shouldDecompileCriterion = new ShouldDecompileCriterion(); return ConfigurationBuilder.begin() .addRule() .when(Query.fromType(ArchiveModel.class).piped(shouldDecompileCriterion)) .perform( new ProcyonDecompilerOperation() .and(IterationProgress.monitoring("Decompiled archive: ", 1)) .and(Commit.every(1)) ) .otherwise(Log.message(Level.WARN, "No archives to decompile.")); } // @formatter:on
@Override public Configuration getConfiguration(RuleLoaderContext ruleLoaderContext) { return ConfigurationBuilder.begin() .addRule() .when(Query.fromType(WindupConfigurationModel.class) .piped((GraphRewrite event, GraphTraversal<?, Vertex> pipeline) -> { pipeline.out(WindupConfigurationModel.INPUT_PATH); pipeline.has(FileModel.IS_DIRECTORY, true); }) ) .perform(new RecurseDirectoryAndAddFiles()) .addRule() .when(Query.fromType(FileModel.class) .withProperty(FileModel.IS_DIRECTORY, false) .withProperty(FileModel.FILE_PATH, QueryPropertyComparisonType.REGEX, ZipUtil.getEndsWithZipRegularExpression()) ) .perform( new AddArchiveReferenceInformation() ); } // @formatter:on
@Override public Configuration getConfiguration(RuleLoaderContext ruleLoaderContext) { return ConfigurationBuilder.begin() .addRule() .when(Query.fromType(WindupConfigurationModel.class) .piped((GraphRewrite event, GraphTraversal<?, Vertex> pipeline) -> { pipeline.out(WindupConfigurationModel.INPUT_PATH); pipeline.has(FileModel.IS_DIRECTORY, true); }) ) .perform(new RecurseDirectoryAndAddFiles()) .addRule() .when(Query.fromType(FileModel.class) .withProperty(FileModel.IS_DIRECTORY, false) .withProperty(FileModel.FILE_PATH, QueryPropertyComparisonType.REGEX, ZipUtil.getEndsWithZipRegularExpression()) ) .perform( new AddArchiveReferenceInformation() ); } // @formatter:on