Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DROOLS-1663 Kie DMN doesn't support IMPORT decisions between DMN files #1832

Merged
merged 15 commits into from
Mar 27, 2018

Conversation

tarilabs
Copy link
Member

@tarilabs
Copy link
Member Author

@tarilabs
Copy link
Member Author

[ as noted on JIRA, please notice these PRs are relevant only for importing ItemDefinition(s) and BKM(s) ]

@tarilabs
Copy link
Member Author

Jenkins test again

}
List<DMNResource> dmnResources = new ArrayList<>();
for (ResourceWithConfiguration r : resources) {
Definitions definitions = dmnMarshaller.unmarshal(r.getResource().getReader());
Copy link
Contributor

@baldimir baldimir Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking comment No.1: This could be extracted to a separate method. Something like unmarshallResources(...).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry not following: what should I extract? only this line 85?

Copy link
Contributor

@baldimir baldimir Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, sorry for not being exact. I meant the whole logic block here. Same applies for all nitpicking comments.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but why should I extract it? This part of code is not reused -unless I am missing something.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for readability. But this is really just a nitpicking, so for me it is good as it is if you like it better as it is.

}
// enrich with imports
for (DMNResource r : dmnResources) {
for (Import i : r.getDefinitions().getImport()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking comment No.2: This could be extracted to a separate method. Something like resolveImports(...).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would do later, as currently import resolution is limited in functionality.

DMNMarshaller dmnMarshaller = dmnCompiler.getMarshaller();
if (resources.size() == 1) {
// quick path:
internalAddResource(kbuilderImpl, dmnCompiler, resources.iterator().next(), Collections.emptyList());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Will there be a possibility of an external import? I mean some external resource outside of the kjar or from URL. Asking because for this one file import is not resolved (and that is correct in current case).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not as far as I know. @etirelli ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be necessary in the future, but support is not implemented yet. For now, the imported model has to be reachable by the kie-container classloader.
I don't think we need to worry at the moment about "external" imports as that would have additional concerns, like authentication and authorization, that are not covered by the spec at the moment.

public String getModelNamespace() {
if (source != null) {
Object parent = source.getParent();
while (!(parent instanceof Definitions)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking comment No.3: This could be extracted to a separate method. E.g. findParent().

public String getModelName() {
if (source != null) {
Object parent = source.getParent();
while (!(parent instanceof Definitions)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my previous comment. The extracted method can be reused here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for getModel() and getModelNamespace I agree will append commit asap


DMNResult evaluateAll = runtime.evaluateAll(dmnModel, context);
for (DMNMessage message : evaluateAll.getMessages()) {
System.out.println(message);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably leftover from debugging. Please use asserts or logger instead if this is still needed here.

for (DMNMessage message : evaluateAll.getMessages()) {
System.out.println(message);
}
System.out.println(evaluateAll);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will append commit

@etirelli
Copy link
Contributor

@tarilabs this looks good to go as the first version of the implementation (i.e., supports for data types and BKMs).

@tarilabs tarilabs force-pushed the tarilabs-20180309-dmnimport branch from 642ff2a to c85d849 Compare March 27, 2018 07:09
@mariofusco mariofusco merged commit aaf8483 into apache:master Mar 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants