Bug 536186 (RHQ-563)
| Summary: | DeployPackagesResponse should let me change results | ||
|---|---|---|---|
| Product: | [Other] RHQ Project | Reporter: | John Mazzitelli <mazz> |
| Component: | Content | Assignee: | Jason Dobies <__jdobies> |
| Status: | CLOSED NEXTRELEASE | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 1.0 | Keywords: | Improvement |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| URL: | http://jira.rhq-project.org/browse/RHQ-563 | ||
| Whiteboard: | |||
| Fixed In Version: | 1.0.1 | Doc Type: | Enhancement |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | Type: | --- | |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
ugh - same problem with DeployIndividualPackageResponse. This API is much harder to work with than it should be. Need to do one or both of: 1) provide a setContentResponseResult() method 2) have setErrorMessage methods implicitly set the result to FAILURE same problems with RemovePackageResponse/RemoveIndividualPackageResponse r960 - DeployPackagesResponse.java, DeployIndividualPackageResponse.java, RemoveIndividualPackageResponse.java, RemovePackagesResponse.java - Loosened up result code setting restrictions by adding setter and constructor that doesn't require it. This bug was previously known as http://jira.rhq-project.org/browse/RHQ-563 |
DeployPackagesResponse takes a result in the constructor. But there is no setter. So I can't create one initally, set the result to SUCCESS and later if I determine an error occurred, I can't flip it to FAILURE. There *are* setters to set the error message - so it would make sense to let me change the results. It would make using the response object easier. Here's how I think you shoudl be able to use this object - notice I build it up as I go along iteratng thru the packages to be deployed: DeployPackagesResponse r = new DeployPackagesResponse(key, SUCCESS); for each package to deploy() { try { ... deploy package.... r.addPackageResponse(...); } catch (Exception e) { r.setErrorMessageWithThrowable(e); r.setResult(FAILURE); // see below- shoudln't really need to do this anyway) } } another alternative is to have the setErrorMessage methods implicitly change the result to FAILURE. In fact, it should do this anyway. If I create a response with SUCCESS but later set an error message, it doesn't make sense that the result remain SUCCESS. Setting an error message should implicitly assume the result was a FAILURE. If it works like this, I don't see a setter to set the results (though it might still make the api nicer). I actually don't see how you easily work with this response object as it is now. You can't set a bulk collection of individual package responses (i.e. this is missing an API like "addAllPackageResponses()", so how do you easily build up a DeployPackagesResponse without forcing to know what the end result is before hand (which you need because you can only set the result via the constructor).