-
Notifications
You must be signed in to change notification settings - Fork 572
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
JBPM-10079 ClassCastException when submitting a form in kie-server containing date process variable #2781
Conversation
eb6c75b
to
2a211c6
Compare
Jenkins run fdb |
1 similar comment
Jenkins run fdb |
Jenkins run fdb |
3812229
to
b68af07
Compare
b68af07
to
aa0471c
Compare
Jenkins run fdb |
aa0471c
to
7870c5e
Compare
Jenkins run fdb |
dea60c7
to
5e372bd
Compare
Jenkins run fdb |
52a0d00
to
8c89a1e
Compare
Jenkins run fdb |
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.
Please organize the code better for the PR review.
// add byte array handling support to allow byte[] to be send as payload | ||
classes.add(JaxbByteArray.class); | ||
classes.add(java.time.LocalDateTime.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.
Is this safe with regards to the if clause below if (!formatDate) {
? I would suspect that date types would have same handling in this respect (just guessing though).
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.
the formatDate from issue https://issues.redhat.com/browse/JBPM-7424.I will change it.
this.sqlDate = sqlDate; | ||
} | ||
|
||
public Timestamp getTimestamp() { |
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.
this one is imported as package, yet in other occurrences its FQN is used, java.sql.Timestamp, may be import by accident?
.append("' : ") | ||
.append(appendExtractionExpression(type, field.getBinding(), field.getId(), jsType, field.isShowTime(), field.getType())) | ||
.append(","); | ||
}else { |
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.
whitespace formatting
.append(appendExtractionExpression(type, field.getBinding(), field.getId(), jsType, field.isShowTime())) | ||
.append(wrapEndFieldType(type)) | ||
.append(","); | ||
if ("datetime-local".equals(type) || "Date".equals(type) |
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.
Would it be possible to turn the condition into a boolean method instead? Some distinctive naming that will allow using the method also in appendExtractionExpression
as the logic seems to be the same.
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.
Ad my comment about changing case elsewhere - is this capital letter in Date
the actual reason?
jsonTemplate.append("getDateFormated('") | ||
.append(id) | ||
.append("')"); | ||
} else if (type.equals("Date")) { |
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.
are you sure about this change of case?
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.
I just want to re-use
Line 111 in 8c89a1e
this.inputTypes.put("DatePicker", "Date"); |
} | ||
} else if (type.equals("datetime")) { |
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 we could re-use the boolean method proposed above. It would merge ~4 else-if clauses into a single one.
4acbc7b
to
9a64a75
Compare
...-jbpm-ui/src/main/java/org/kie/server/services/jbpm/ui/form/render/AbstractFormRenderer.java
Outdated
Show resolved
Hide resolved
775889a
to
e2403f9
Compare
Jenkins retest this |
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.
@bxf12315 good work! Overall I'm okay with the change, there are some fixes to do:
- remove the unused import in the JsonMarshallerTest (it breaks the build)
- add the
java.sql
date types (for consistency) - found an issue in task forms with
java.time.LocalDate
types, the date is added in the input value but it's not displayed in the field. That's because the value contines the time.
@@ -18,6 +18,7 @@ | |||
|
|||
import java.io.File; | |||
import java.net.URL; | |||
import java.sql.Timestamp; |
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.
not used import
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.
ok
@@ -509,6 +534,7 @@ private String getFieldType(FormField field) { | |||
case "java.time.LocalDateTime": | |||
return "datetime-local"; | |||
case "java.util.Date": | |||
return "Date"; | |||
case "java.sql.Date": | |||
case "java.sql.Timestamp": |
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.
looks like renderer supports java.sql
Date types but they are not present in the functionMappings or in the JsonMarshaller. I'd add them for consistency
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.
our data modeler and form modeler do not support java.sql.*, so I don't add it.
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.
@bxf12315 +1
@@ -556,11 +556,36 @@ function closeCreationForm(fieldId) { | |||
currentRow = null; | |||
} | |||
|
|||
function getLocalDateWithoutTime(elementId) { | |||
function getFormattedLocalDateTime(jsondate) { |
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.
I'd preffer a single function that recives the datatype as a param but I'm ok with this
…ntaining date process variable
e2403f9
to
45165bb
Compare
Kudos, SonarCloud Quality Gate passed! |
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 with process with variable directly using (not through dataobject) varying datetime related types:
- java.util.Date
- java.time.LocalTime
- java.time.LocalDate
- java.time.LocalDateTime
- java.time.OffsetDateTime
I have limited insight into code, so I leave that to other reviewers to assess.
For some reason the reviewers section does not reflect my review verdict. |
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.
+1
…ntaining date process variable (kiegroup#2781)
…ntaining date process variable (kiegroup#2781)
…ntaining date process variable (#2781)
…ntaining date process variable (#2781)
Thank you for submitting this pull request
JIRA: (please edit the JIRA link if it exists)
https://issues.redhat.com/browse/JBPM-10079
referenced Pull Requests: (please edit the URLs of referenced pullrequests if they exist)
How to replicate CI configuration locally?
Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use build-chain tool to handle cross repository builds and be sure that we always use latest version of the code for each repository.
build-chain tool is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See local execution details to get more information about it.
How to retest this PR or trigger a specific build:
a pull request please add comment: Jenkins retest this
a full downstream build please add comment: Jenkins run fdb
a compile downstream build please add comment: Jenkins run cdb
a full production downstream build please add comment: Jenkins execute product fdb
an upstream build please add comment: Jenkins run upstream