Show Table of Contents
4. Setting Method Variables to String
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');
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.