MediaType.APPLICATION_XML})
public DefectAsset updateDefect(DefectAsset asset,
@Context LinkBuilders linkProcessor,
@PathParam("defect") String defectId) {
DataStore store = DataStore.getInstance();
// verify Defect exist in the store, return 404 otherwise
DefectBean bean = store.getDefect(defectId);
if (bean == null) {
logger.info("Defect {} does not exist", defectId);
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
// set Id in the resources data for cases that element <id> is missing
// in the request body
DefectBean defect = asset.getDefect();
defect.setId(defectId);
// update defect legacy bean to the store
store.putDefect(defectId, defect);
return asset;
}