-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NU-1806] extract common parts, minor cleanups
- Loading branch information
Showing
7 changed files
with
62 additions
and
81 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
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
38 changes: 38 additions & 0 deletions
38
...in/scala/pl/touk/nussknacker/engine/definition/activity/CommonModelDataInfoProvider.scala
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,38 @@ | ||
package pl.touk.nussknacker.engine.definition.activity | ||
|
||
import pl.touk.nussknacker.engine.ModelData | ||
import pl.touk.nussknacker.engine.api.process.ComponentUseCase | ||
import pl.touk.nussknacker.engine.api.{MetaData, NodeId, process} | ||
import pl.touk.nussknacker.engine.canonicalgraph.CanonicalProcess | ||
import pl.touk.nussknacker.engine.compile.ExpressionCompiler | ||
import pl.touk.nussknacker.engine.compile.nodecompilation.{LazyParameterCreationStrategy, NodeCompiler} | ||
import pl.touk.nussknacker.engine.definition.fragment.FragmentParametersDefinitionExtractor | ||
import pl.touk.nussknacker.engine.graph.node.{SourceNodeData, asFragmentInputDefinition, asSource} | ||
import pl.touk.nussknacker.engine.resultcollector.ProductionServiceInvocationCollector | ||
|
||
class CommonModelDataInfoProvider(modelData: ModelData) { | ||
|
||
private lazy val expressionCompiler = ExpressionCompiler.withoutOptimization(modelData).withLabelsDictTyper | ||
|
||
private lazy val nodeCompiler = new NodeCompiler( | ||
modelData.modelDefinition, | ||
new FragmentParametersDefinitionExtractor(modelData.modelClassLoader.classLoader), | ||
expressionCompiler, | ||
modelData.modelClassLoader.classLoader, | ||
Seq.empty, | ||
ProductionServiceInvocationCollector, | ||
ComponentUseCase.TestDataGeneration, | ||
nonServicesLazyParamStrategy = LazyParameterCreationStrategy.default | ||
) | ||
|
||
protected def prepareSourceObj( | ||
source: SourceNodeData | ||
)(implicit metaData: MetaData, nodeId: NodeId): Option[process.Source] = { | ||
nodeCompiler.compileSource(source).compiledObject.toOption | ||
} | ||
|
||
protected def collectAllSources(scenario: CanonicalProcess): List[SourceNodeData] = { | ||
scenario.collectAllNodes.flatMap(asSource) ++ scenario.collectAllNodes.flatMap(asFragmentInputDefinition) | ||
} | ||
|
||
} |
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