Juan Hernandez has posted comments on this change. Change subject: restapi: Report available errata for host ......................................................................
Patch Set 3: (4 comments) http://gerrit.ovirt.org/#/c/37436/3/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd File backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd: Line 1938: <xs:element name="selinux" type="SELinux" minOccurs="0" maxOccurs="1" /> Line 1939: <xs:element name="auto_numa_status" type="xs:string" minOccurs="0" maxOccurs="1"/> Line 1940: <xs:element name="numa_supported" type="xs:boolean" minOccurs="0" maxOccurs="1"/> Line 1941: <xs:element name="live_snapshot_support" type="xs:boolean" minOccurs="0" maxOccurs="1" /> Line 1942: <xs:element ref="katello_errata" minOccurs="0"/> Indicate explicitly the value of "maxOccurs". Line 1943: </xs:sequence> Line 1944: </xs:extension> Line 1945: </xs:complexContent> Line 1946: </xs:complexType> http://gerrit.ovirt.org/#/c/37436/3/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml File backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml: Line 3062: signatures: [] Line 3063: urlparams: Line 3064: max: {context: matrix, type: 'xs:int', value: 'max results', required: false} Line 3065: headers: {} Line 3066: - name: /hosts/{host:id}/katelloerrata/{katelloerrata:id}|rel=get The "variable" name should be in singular, I mean "{katelloerratum:id}". Same in the description below. Line 3067: description: get the details of the specific errata available for the host Line 3068: request: Line 3069: body: Line 3070: parameterType: null http://gerrit.ovirt.org/#/c/37436/3/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ErratumMapper.java File backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ErratumMapper.java: Line 13: Line 14: @Mapping(from = Erratum.class, to = KatelloErratum.class) Line 15: public static KatelloErratum map(Erratum entity, KatelloErratum model) { Line 16: model = model == null ? new KatelloErratum() : model; Line 17: model.setId(entity.getId()); The identifier of the backend entity can't be directly copied to the RESTAPI model, as it may contain characters that aren't valid for such an identifier. For example, the identifier provided by the backend could be "hello/world", and that would result in a URL like this: http://.../ovirt-engine/api/hosts/{host:id}/katelloerrata/hello/world If the client then requests this URL RESTEasy will assume that the id is "hello" and not "hello/world". Similar things may happen with other characters. To solve this please convert the identifier provided by the backend to an hex string, using the method HexUtils.string2hex. Same for the other direction, using HexUtils.hex2string. Line 18: model.setTitle(entity.getTitle()); Line 19: model.setSummary(entity.getSummary()); Line 20: model.setSolution(entity.getSolution()); Line 21: model.setDescription(entity.getDescription()); Line 43: public static Erratum map(KatelloErratum model, Erratum template) { Line 44: Erratum entity = template != null ? template : new Erratum(); Line 45: Line 46: if (model.isSetId()) { Line 47: entity.setId(model.getId()); Remember to convert from hex to string. Line 48: } Line 49: Line 50: if (model.isSetTitle()) { Line 51: entity.setTitle(model.getTitle()); -- To view, visit http://gerrit.ovirt.org/37436 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iad98a8066bd0f002cd58129ce583bc932afee8bc Gerrit-PatchSet: 3 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <[email protected]> Gerrit-Reviewer: Juan Hernandez <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
