class AssetController {

    @ApiOperation(httpMethod = "POST", value = "Update Asset values")
    @PostMapping(value = "/v1/update-asset")
    public ResponseEntity<Object> updateAsset(@RequestBody(required = true) AssetUpdateRequest request)
            throws DataException {
        String assetGroup = request.getAg();
        if (Strings.isNullOrEmpty(assetGroup)) {
            return ResponseUtils.buildFailureResponse(new Exception("Asset group is Mandatory"));
        }
        String targettype = request.getTargettype();
        if (Strings.isNullOrEmpty(targettype)) {
            return ResponseUtils.buildFailureResponse(new Exception("Target type is Mandatory"));
        }
        String updatedBy = request.getUpdateBy();
        if (Strings.isNullOrEmpty(updatedBy)) {
            updatedBy = "";
        }
        Map<String, Object> resources = request.getResources();
        int totalRows = assetService
                .updateAsset(assetGroup, targettype, resources, updatedBy, request.getUpdates());
        if (totalRows > 0) {
            return ResponseUtils.buildSucessResponse(HttpStatus.OK);
        } else {
            return ResponseUtils.buildFailureResponse(new Exception("Update failed"));
        }
    }

}