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

IVYPORTAL-17694 Remove usages of deprecated methods Query#fromJson an… #1346

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mnhnam-axonivy
Copy link
Contributor

…d Query#asJson

  • Replaced methods

@mnhnam-axonivy mnhnam-axonivy added the enhancement New feature or request label Dec 25, 2024
public TaskQuery createQuery() {
TaskQuery finalQuery = TaskQuery.create();
setNewQueryCreated(isNewQueryCreated() || customTaskQuery == null || hasTaskId() || hasCaseId());

if (!isNewQueryCreated()) {
finalQuery = TaskQuery.fromJson(customTaskQuery.asJson()); // clone to keep the original custom query
finalQuery.where().and(customTaskQuery);
Copy link
Contributor

Choose a reason for hiding this comment

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

and or andOverall?

@@ -63,7 +64,7 @@ public CaseQuery createQuery() {

setNewQueryCreated(isNewQueryCreated() || customCaseQuery == null || hasCaseId());
if (!isNewQueryCreated()) {
finalQuery.where().andOverall(CaseQuery.fromJson(customCaseQuery.asJson())); // clone to keep the original custom query
finalQuery.where().andOverall(customCaseQuery);
Copy link
Contributor

Choose a reason for hiding this comment

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

andOverall or and?

@@ -244,30 +245,30 @@ private ExpiryStatistic createExpiryTimeStampToCountMap(Recordset recordSet) thr
return expiryStatistic;
}

@SuppressWarnings("deprecation")
private TaskQuery extendQueryWithUserHasPermissionToSee(TaskSearchCriteria criteria) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Before

TaskService extendQueryWithUserHasPermissionToSee: SELECT  
FROM IWA_Task  
LEFT JOIN IWA_TaskLocalized IWA_TaskLocalized ON (Column(IWA_Task.TaskId) = Column(IWA_TaskLocalized.TaskId) && Column(IWA_TaskLocalized.LanguageId) IN (1))
LEFT JOIN IWA_TaskCustomStringField TskCstmStrngFld_HIDE ON (Column(IWA_Task.TaskId) = Column(IWA_TaskCustomStringField.TaskId) && Column(TskCstmStrngFld_HIDE.Name) = HIDE)
WHERE (((Column(IWA_Task.State) = 0 || Column(IWA_Task.State) = 4 || Column(IWA_Task.State) = 5 || Column(IWA_Task.State) = 8 || Column(IWA_Task.State) = 1 || Column(IWA_Task.State) = 6 || Column(IWA_Task.State) = 3 || Column(IWA_Task.State) = 7 || Column(IWA_Task.State) = 11 || Column(IWA_Task.State) = 10 || Column(IWA_Task.State) = 12) && (Column(IWA_TaskLocalized.Name) ~LIKE %loc% || Column(IWA_TaskLocalized.Description) ~LIKE %loc%)) && Column(TskCstmStrngFld_HIDE.Value) IS NULL) 
ORDER BY Column(IWA_Task.ExpiryTimestamp) NULL_FIRST DESCENDING 

((true & true) & true)

After

extendQueryWithUserHasPermissionToSee: SELECT  
FROM IWA_Task  
LEFT JOIN IWA_TaskLocalized IWA_TaskLocalized ON (Column(IWA_Task.TaskId) = Column(IWA_TaskLocalized.TaskId) && Column(IWA_TaskLocalized.LanguageId) IN (1))
LEFT JOIN IWA_TaskCustomStringField TskCstmStrngFld_HIDE ON (Column(IWA_Task.TaskId) = Column(IWA_TaskCustomStringField.TaskId) && Column(TskCstmStrngFld_HIDE.Name) = HIDE)
WHERE ((Column(IWA_Task.State) = 0 || Column(IWA_Task.State) = 4 || Column(IWA_Task.State) = 5 || Column(IWA_Task.State) = 8 || Column(IWA_Task.State) = 1 || Column(IWA_Task.State) = 6 || Column(IWA_Task.State) = 3 || Column(IWA_Task.State) = 7 || Column(IWA_Task.State) = 11 || Column(IWA_Task.State) = 10 || Column(IWA_Task.State) = 12) && (Column(IWA_TaskLocalized.Name) ~LIKE %loc% || Column(IWA_TaskLocalized.Description) ~LIKE %loc%) && Column(TskCstmStrngFld_HIDE.Value) IS NULL) 
ORDER BY Column(IWA_Task.ExpiryTimestamp) NULL_FIRST DESCENDING 

(true & true & true)

Basically correct

@@ -281,7 +282,7 @@ private TaskQuery extendQueryWithInvolvedUser(TaskSearchCriteria criteria) {
}

private TaskQuery extendQueryWithUserCanWorkOn(TaskSearchCriteria criteria) {
TaskQuery finalQuery = criteria.getFinalTaskQuery();
TaskQuery finalQuery = criteria.createQuery();
Copy link
Contributor

Choose a reason for hiding this comment

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

Before:

TaskService extendQueryWithUserCanWorkOn: SELECT  
FROM IWA_Task  
LEFT JOIN IWA_TaskCustomStringField TskCstmStrngFld_HIDE ON (Column(IWA_Task.TaskId) = Column(IWA_TaskCustomStringField.TaskId) && Column(TskCstmStrngFld_HIDE.Name) = HIDE)
WHERE ((Column(IWA_Task.BusinessState) = 2 || Column(IWA_Task.BusinessState) = 1 || Column(IWA_Task.BusinessState) = 0) && (Column(IWA_Task.WorkerId) = Column(IWA_Task.WorkerId) && Column(IWA_Task.State) IN (0, 4, 5, 8)) && Column(TskCstmStrngFld_HIDE.Value) IS NULL) 

(true & true & true)

After

TaskService extendQueryWithUserCanWorkOn: SELECT  
FROM IWA_Task  
LEFT JOIN IWA_TaskCustomStringField TskCstmStrngFld_HIDE ON (Column(IWA_Task.TaskId) = Column(IWA_TaskCustomStringField.TaskId) && Column(TskCstmStrngFld_HIDE.Name) = HIDE)
WHERE (((Column(IWA_Task.BusinessState) = 2 || Column(IWA_Task.BusinessState) = 1 || Column(IWA_Task.BusinessState) = 0) && (Column(IWA_Task.WorkerId) = Column(IWA_Task.WorkerId) && Column(IWA_Task.State) IN (0, 4, 5, 8))) && Column(TskCstmStrngFld_HIDE.Value) IS NULL) 

((true & true) & true)

So basically correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants