// Paste inside LoyaltyController — field loyaltyFacade and dataMapper come from the full class.
/**
* Get loyalty points
* Returns the current loyalty point balance for the customer.
* @param baseSiteId Base site identifier
* @param userId User identifier, or "current"
* @param fields Response field set: BASIC, DEFAULT, or FULL
* @param code Loyalty program code
*/
@Operation(operationId = "getLoyaltyPoints", summary = "Get loyalty points", description = "Returns the current loyalty point balance for the customer.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "Loyalty points returned successfully"),
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", description = "Loyalty account not found")
})
@Secured("ROLE_CUSTOMERGROUP")
@GetMapping(value = "/{code}", produces = { "application/json" })
@ResponseBody
public LoyaltyPointsWsDTO getLoyaltyPoints(
@PathVariable("baseSiteId") @Parameter(description = "Base site identifier", required = true) String baseSiteId,
@PathVariable("userId") @Parameter(description = "User identifier, or \"current\"", required = true) String userId,
@RequestParam(value = "fields", required = false, defaultValue = "DEFAULT") @Parameter(description = "Response field set: BASIC, DEFAULT, or FULL", required = false) String fields,
@PathVariable("code") @Parameter(description = "Loyalty program code", required = true) String code)
{
final LoyaltyPointsData data = loyaltyFacade.getLoyaltyPoints(baseSiteId, userId, fields, code);
if (data == null) {
throw new UnknownIdentifierException("Not found");
}
return dataMapper.map(data, LoyaltyPointsWsDTO.class, fields);
}
OCC (OmniCommerce Connect) is SAP Commerce's REST API layer. Every custom endpoint needs a controller method with the right Spring annotations, parameter bindings, security roles, Swagger documentation, and often a custom WsDTO to shape the response — boilerplate that's easy to get slightly wrong and tedious to write from scratch every time.
This generator builds that controller method (plus optional facade, validator, and WsDTO classes) from a form, and lets you test the generated endpoint logic against a mock server or a real one before it's wired into a project.
The form builds a structured model of the controller method — its path, HTTP method, parameters (query/path), security annotation, and return type. Code generation templates read that model and emit idiomatic Spring/OCC Java: @GetMapping or @PostMapping, @RequestParam/@PathVariable bindings, @Secured roles, and @ApiResponses documentation blocks matching what a real OCC controller needs.
The Test tab runs the same configured request shape against either a built-in mock responder (useful with no backend running) or a real OCC server URL you provide, so you can sanity-check the contract before writing any Java.
A GET method configured for loyalty points generates:
A Spring MVC controller in SAP Commerce's OmniCommerce Connect (OCC) module that exposes a REST endpoint — the same pattern used by SAP Commerce's own out-of-the-box storefront APIs.
Yes — when you define custom response fields, the generator produces the matching WsDTO class alongside the controller method.
Yes — the Test tab can run against a built-in mock response matching your configured return type, so you can verify the shape of the response before any Java is deployed.
Yes — the Security section lets you configure @Secured roles like ROLE_CUSTOMERGROUP, matching standard OCC authorization patterns.
Yes — "Import Java" parses an existing controller class and loads its configuration into the builder.