class AssetListController {

    @RequestMapping(path = "/v1/updateFieldsbyresourceType", method = RequestMethod.GET)
    public ResponseEntity<Object> getEditableFieldsByTargetType(
            @RequestParam(name = "ag", required = true) String assetGroup,
            @RequestParam(name = "resourceType", required = true) String resourceType) {
        if (Strings.isNullOrEmpty(assetGroup)) {
            return ResponseUtils.buildFailureResponse(new Exception("Asset group/TargetType is Mandatory"));
        }
        boolean isTargetTypePresent = false;
        for (Map<String, Object> targetType : assetService.getTargetTypesForAssetGroup(assetGroup, null, null)) {
            if (targetType.get("type").toString().equals(resourceType)) {
                isTargetTypePresent = true;
                break;
            }
        }

        if (isTargetTypePresent) {
            ResponseWithFieldsByTargetType response = assetService.getEditFieldsByTargetType(resourceType);
            return ResponseUtils.buildSucessResponse(response);
        } else {
            return ResponseUtils.buildFailureResponse(new Exception("TargetType not present in Asset Group"));
        }
    }

}