@Produces({ MediaType.APPLICATION_JSON })
public String retrieveCollateralDetails(@Context final UriInfo uriInfo, @PathParam("loanId") final Long loanId,
@PathParam("collateralId") final Long CollateralId) {
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
CollateralData CollateralData = this.collateralReadPlatformService.retrieveCollateral(loanId, CollateralId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
if (settings.isTemplate()) {
final Collection<CodeValueData> codeValues = this.codeValueReadPlatformService
.retrieveCodeValuesByCode(CollateralApiConstants.COLLATERAL_CODE_NAME);
CollateralData = CollateralData.template(CollateralData, codeValues);
}
return this.apiJsonSerializerService.serialize(settings, CollateralData, RESPONSE_DATA_PARAMETERS);
}