Search

4. Setting Method Variables to String

download PDF
Some types of information have a integer value within the database but the information given in the API has a string value. This is common for search filters which depend on a category; the category has a user-friendly string name and an internal integer.
Attempting to pass the string value when the server expects an integer causes the operation to fail with an error that it cannot find the method.
rhqadmin@localhost:7080$ groupcriteria = new ResourceGroupCriteria();
rhqadmin@localhost:7080$ groupcriteria.addFilterGroupCategory('MIXED')
Can't find method org.rhq.core.domain.criteria.ResourceGroupCriteria.addFilterGroupCategory(string). (<Unknown source>#1)
To use the user-friendly string in script, append the .toString method with the remote API method.
groupcriteria.addFilterGroupCategory.toString('MIXED');
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.