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
IDEMPIERE-5796: for several tables in a row #2244
IDEMPIERE-5796: for several tables in a row #2244
Conversation
@nmicoud - this is unnecessary Same as the swing model generator the "Table Like" parameter accepts several notations, as the Help of the parameters states:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary
Hi @CarlosRuiz-globalqss , doesn't generate anything |
@nmicoud - as the help says "comma separated list of table names enclosed within single quotes (case sensitive)" So, your example must be written as: |
with 'XXA_NdfLine','XXA_NdF' |
is case sensitive - are you sure the table name is XXA_NdfLine (with lowercase f?) |
eagle eye :) Anyway, adding single quotes is not userfriendly. Seems easier to just write table names directly, no? |
it is the same code that is written from the command line - I would just leave it as is - for example I have scripts that run on release time that use this notation, I think it has a lot of years like that |
ok, so maybe adding some code in GenerateModelParameterListener to add those quotes? |
I don't see the value added, that's a developer tool, not an end-user, and that change probably will require also changes on other parts, or make it incompatible with the command line tool. But anyways - you can try to convince @hengsin or @dpansheriya - but IMO there is no value added there :-( |
Ok, let's wait for their opinion (when I was talking about changes on GenerateModel.java, I was talking about the process - no change require elsewhere). |
BTW - at some point I tested if making that parameter ChosenMulti would be good, but it didn't work because you can add LIKE stuff there that are not tablenames |
hi @nmicoud , The changes should be apply to I think making the following changes should make it more user friendly:
|
hi @hengsin , Nicolas |
Looks good to me. |
StringBuilder tableLike = new StringBuilder().append(tableName.trim()); | ||
if (!tableLike.toString().startsWith("'") || !tableLike.toString().endsWith("'")) | ||
tableLike = new StringBuilder("'").append(tableLike).append("'"); | ||
StringBuilder tableLike = new StringBuilder().append(tableName.trim().toUpperCase()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please check?
There are differences between the methods generateSource of ModelClassGenerator vs ModelInterfaceGenerator
In theory these two methods must be the same with exception of the line within the while ... new Model
Ideally, because this is duplicated code, it would be better to have it in just one place.
For example, if we can call ModelClassGenerator.generateSource from ModelInterfaceGenerator.
This line here is very relevant, if you don't remove the quotes, then it will fail on line 848 when receiving a quoted tablename
As we are dealing with tablenames, I think is better also to remove spaces too, with the previous approach spaces in the tableLike were allowed, but with this change, spaces will be problematic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like that?
Not sure about the name of the new generateSource method with type parameter (which is not yet in javadoc).
And I don't understand what you suggest with spaces ; can you give an example where it can fail?
Thanks,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I don't understand what you suggest with spaces ; can you give an example where it can fail?
I haven't tested, but from the code I think before the patch the following will work:
'AD_Table', 'AD_Column'
<- (see the space after the comma)
but after the patch I think it will fail because you are removing the quotes and adding them back, but not removing the spaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just made a test and both tables were considered
…terfaceGenerator / ModelClassGenerator Implement suggestion from @CarlosRuiz-globalqss removing duplicated code
DB.close(rs, pstmt); | ||
rs = null; pstmt = null; | ||
} | ||
ModelInterfaceGenerator.generateSource(ModelInterfaceGenerator.GEN_SOURCE_INTERFACE, sourceFolder, packageName, entityType, tableName, columnEntityType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here probably is GEN_SOURCE_CLASS ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, fixed
…nterfaceGenerator / ModelClassGenerator fix error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested
…2244) * IDEMPIERE-5796: for several tables in a row https://idempiere.atlassian.net/browse/IDEMPIERE-5796 * IDEMPIERE-5796: for several tables in a row - changes done in ModelInterfaceGenerator / ModelClassGenerator Implement suggesion from @hengsin * IDEMPIERE-5796: for several tables in a row - changes done in ModelInterfaceGenerator / ModelClassGenerator Implement suggesion from @hengsin * IDEMPIERE-5796: for several tables in a row - changes done in ModelInterfaceGenerator / ModelClassGenerator Implement suggestion from @CarlosRuiz-globalqss removing duplicated code * IDEMPIERE-5796: for several tables in a row - changes done in ModelInterfaceGenerator / ModelClassGenerator fix error
https://idempiere.atlassian.net/browse/IDEMPIERE-5796
Pull Request Checklist
Tests
Documentation