Unable to add string to DefaultJqlQueryParser.parseQuery()

Hello,

We are running the below script, trying to automatically update the content of filters. It will be useful for us as in the near future we will have to change the names for all the projects in our JIRA instance, and all the filters will be updated. The script below should go through each filter id, change it into a string, make the change (old name to new name) and then change the string back to a jql object.

Somehow, the error that we receive when we run it through the console is:

No signature of method: static
com.atlassian.jira.jql.parser.DefaultJqlQueryParser.parseQuery() is
applicable for argument types: (java.lang.String) values: [project =
“nume nou” AND issuetype = Story ORDER BY Rank ASC]
Possible solutions: parseQuery(java.lang.String)

although, from our point of view, we gave it a string.

The script is below:

import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchRequest
import com.atlassian.jira.issue.search.SearchRequestEntity
import com.atlassian.jira.issue.search.SearchRequestManager
import com.atlassian.jira.sharing.SharePermission
import com.atlassian.jira.sharing.SharePermissionImpl
import com.atlassian.jira.sharing.SharedEntity.SharePermissions
import com.atlassian.jira.sharing.type.ShareType.Name
import com.atlassian.jira.bc.filter.SearchRequestService
import com.atlassian.jira.jql.parser.DefaultJqlQueryParser
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.issue.search.SearchRequestAppender
import com.atlassian.query.Query

def list = [32100,32000]
for (String item : list) {
long l = Long.parseLong(item);

SearchRequestManager srm = ComponentAccessor.getComponentOfType(SearchRequestManager.class);

def searchService = ComponentAccessor.getComponentOfType(SearchService.class)

for (eachitem in l) {
SearchRequest filter = srm.getSearchRequestById((Long)eachitem);
String str = filter.getQuery().getQueryString()
str= str.replace (“Wow a new name”, “nume nou”)
def jqlqueryparser = DefaultJqlQueryParser.parseQuery(str)
filter.setQuery(jqlqueryparser)
srm.update(filter)

return jqlqueryparser
}

}