Function bodies 391 total
BodyController class · java · L29-L73 (45 LOC)src/main/java/live/yurii/autocatalog/api/body/BodyController.java
public class BodyController {
private final BodyService bodyService;
public BodyController(BodyService bodyService) {
this.bodyService = bodyService;
}
@GetMapping
@Operation(summary = "Get bodies by generation")
public List<BodyResponse> getByGeneration(@RequestParam UUID generationId) {
return bodyService.getByGeneration(new GenerationId(generationId)).stream()
.map(BodyResponse::from).toList();
}
@GetMapping("/{id}")
@Operation(summary = "Get body by ID")
public BodyResponse getById(@PathVariable UUID id) {
return BodyResponse.from(bodyService.getById(new BodyId(id)));
}
@PostMapping
@Operation(summary = "Create a new body configuration")
public ResponseEntity<BodyResponse> create(@Valid @RequestBody BodyRequest request) {
var body = bodyService.create(
new GenerationId(request.generationId()),
request.bodyStyle(),
request.lengthMm(),
request.widthMm(),
request.heightMm(),
request.wheelbaseMm(BodyController method · java · L33-L35 (3 LOC)src/main/java/live/yurii/autocatalog/api/body/BodyController.java
public BodyController(BodyService bodyService) {
this.bodyService = bodyService;
}getByGeneration method · java · L39-L42 (4 LOC)src/main/java/live/yurii/autocatalog/api/body/BodyController.java
public List<BodyResponse> getByGeneration(@RequestParam UUID generationId) {
return bodyService.getByGeneration(new GenerationId(generationId)).stream()
.map(BodyResponse::from).toList();
}getById method · java · L46-L48 (3 LOC)src/main/java/live/yurii/autocatalog/api/body/BodyController.java
public BodyResponse getById(@PathVariable UUID id) {
return BodyResponse.from(bodyService.getById(new BodyId(id)));
}create method · java · L52-L65 (14 LOC)src/main/java/live/yurii/autocatalog/api/body/BodyController.java
public ResponseEntity<BodyResponse> create(@Valid @RequestBody BodyRequest request) {
var body = bodyService.create(
new GenerationId(request.generationId()),
request.bodyStyle(),
request.lengthMm(),
request.widthMm(),
request.heightMm(),
request.wheelbaseMm(),
request.trunkVolumeLitres()
);
var uri = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(body.id().value()).toUri();
return ResponseEntity.created(uri).body(BodyResponse.from(body));
}deleteById method · java · L70-L72 (3 LOC)src/main/java/live/yurii/autocatalog/api/body/BodyController.java
public void deleteById(@PathVariable UUID id) {
bodyService.deleteById(new BodyId(id));
}BodyRequest class · java · L9-L18 (10 LOC)src/main/java/live/yurii/autocatalog/api/body/BodyRequest.java
public record BodyRequest(
@NotNull UUID generationId,
@NotNull BodyStyle bodyStyle,
@Min(1) int lengthMm,
@Min(1) int widthMm,
@Min(1) int heightMm,
@Min(1) int wheelbaseMm,
@Min(1) Integer trunkVolumeLitres
) {
}Repobility · open methodology · https://repobility.com/research/
BodyResponse function · java · L7-L29 (23 LOC)src/main/java/live/yurii/autocatalog/api/body/BodyResponse.java
public record BodyResponse(
UUID id,
UUID generationId,
String bodyStyle,
int lengthMm,
int widthMm,
int heightMm,
int wheelbaseMm,
Integer trunkVolumeLitres
) {
public static BodyResponse from(Body b) {
return new BodyResponse(
b.id().value(),
b.generationId().value(),
b.bodyStyle().name(),
b.lengthMm(),
b.widthMm(),
b.heightMm(),
b.wheelbaseMm(),
b.trunkVolumeLitres()
);
}
}BodyResponse class · java · L7-L29 (23 LOC)src/main/java/live/yurii/autocatalog/api/body/BodyResponse.java
public record BodyResponse(
UUID id,
UUID generationId,
String bodyStyle,
int lengthMm,
int widthMm,
int heightMm,
int wheelbaseMm,
Integer trunkVolumeLitres
) {
public static BodyResponse from(Body b) {
return new BodyResponse(
b.id().value(),
b.generationId().value(),
b.bodyStyle().name(),
b.lengthMm(),
b.widthMm(),
b.heightMm(),
b.wheelbaseMm(),
b.trunkVolumeLitres()
);
}
}from method · java · L17-L28 (12 LOC)src/main/java/live/yurii/autocatalog/api/body/BodyResponse.java
public static BodyResponse from(Body b) {
return new BodyResponse(
b.id().value(),
b.generationId().value(),
b.bodyStyle().name(),
b.lengthMm(),
b.widthMm(),
b.heightMm(),
b.wheelbaseMm(),
b.trunkVolumeLitres()
);
}EngineController class · java · L25-L60 (36 LOC)src/main/java/live/yurii/autocatalog/api/engine/EngineController.java
public class EngineController {
private final EngineService engineService;
public EngineController(EngineService engineService) {
this.engineService = engineService;
}
@GetMapping
@Operation(summary = "Get all engines")
public List<EngineResponse> getAll(@RequestParam(required = false) FuelType fuelType) {
var engines = fuelType != null
? engineService.getByFuelType(fuelType)
: engineService.getAll();
return engines.stream().map(EngineResponse::from).toList();
}
@GetMapping("/{id}")
@Operation(summary = "Get engine by ID")
public EngineResponse getById(@PathVariable UUID id) {
return EngineResponse.from(engineService.getById(new EngineId(id)));
}
@PostMapping
@Operation(summary = "Create a new engine")
public ResponseEntity<EngineResponse> create(@Valid @RequestBody EngineRequest request) {
var engine = engineService.create(
request.code(), request.name(), request.fuelType(),
request.displacementCc(), request.EngineController method · java · L29-L31 (3 LOC)src/main/java/live/yurii/autocatalog/api/engine/EngineController.java
public EngineController(EngineService engineService) {
this.engineService = engineService;
}getById method · java · L44-L46 (3 LOC)src/main/java/live/yurii/autocatalog/api/engine/EngineController.java
public EngineResponse getById(@PathVariable UUID id) {
return EngineResponse.from(engineService.getById(new EngineId(id)));
}create method · java · L50-L59 (10 LOC)src/main/java/live/yurii/autocatalog/api/engine/EngineController.java
public ResponseEntity<EngineResponse> create(@Valid @RequestBody EngineRequest request) {
var engine = engineService.create(
request.code(), request.name(), request.fuelType(),
request.displacementCc(), request.powerKw(), request.torqueNm(),
request.cylinderCount(), request.configuration(), request.systemPowerKw()
);
var uri = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(engine.id().value()).toUri();
return ResponseEntity.created(uri).body(EngineResponse.from(engine));
}EngineRequest class · java · L11-L22 (12 LOC)src/main/java/live/yurii/autocatalog/api/engine/EngineRequest.java
public record EngineRequest(
@NotBlank @Size(max = 50) String code,
@NotBlank @Size(max = 150) String name,
@NotNull FuelType fuelType,
@Positive int displacementCc,
@Positive int powerKw,
@Positive int torqueNm,
@Min(1) @Max(16) Integer cylinderCount,
@Size(max = 20) String configuration,
@Positive Integer systemPowerKw
) {
}Same scanner, your repo: https://repobility.com — Repobility
EngineResponse function · java · L7-L28 (22 LOC)src/main/java/live/yurii/autocatalog/api/engine/EngineResponse.java
public record EngineResponse(
UUID id,
String code,
String name,
String fuelType,
int displacementCc,
int powerKw,
int powerHp,
int torqueNm,
Integer cylinderCount,
String configuration,
Integer systemPowerKw
) {
public static EngineResponse from(Engine engine) {
return new EngineResponse(
engine.id().value(), engine.code(), engine.name(), engine.fuelType().name(),
engine.displacementCc(), engine.powerKw(), engine.powerHp(),
engine.torqueNm(), engine.cylinderCount(), engine.configuration(),
engine.systemPowerKw()
);
}
}EngineResponse class · java · L7-L28 (22 LOC)src/main/java/live/yurii/autocatalog/api/engine/EngineResponse.java
public record EngineResponse(
UUID id,
String code,
String name,
String fuelType,
int displacementCc,
int powerKw,
int powerHp,
int torqueNm,
Integer cylinderCount,
String configuration,
Integer systemPowerKw
) {
public static EngineResponse from(Engine engine) {
return new EngineResponse(
engine.id().value(), engine.code(), engine.name(), engine.fuelType().name(),
engine.displacementCc(), engine.powerKw(), engine.powerHp(),
engine.torqueNm(), engine.cylinderCount(), engine.configuration(),
engine.systemPowerKw()
);
}
}from method · java · L20-L27 (8 LOC)src/main/java/live/yurii/autocatalog/api/engine/EngineResponse.java
public static EngineResponse from(Engine engine) {
return new EngineResponse(
engine.id().value(), engine.code(), engine.name(), engine.fuelType().name(),
engine.displacementCc(), engine.powerKw(), engine.powerHp(),
engine.torqueNm(), engine.cylinderCount(), engine.configuration(),
engine.systemPowerKw()
);
}GenerationController class · java · L27-L66 (40 LOC)src/main/java/live/yurii/autocatalog/api/generation/GenerationController.java
public class GenerationController {
private final GenerationService generationService;
public GenerationController(GenerationService generationService) {
this.generationService = generationService;
}
@GetMapping
@Operation(summary = "Get generations by model")
public List<GenerationResponse> getByModel(@RequestParam UUID modelId) {
return generationService.getByModel(new ModelId(modelId)).stream()
.map(GenerationResponse::from).toList();
}
@GetMapping("/{id}")
@Operation(summary = "Get generation by ID")
public GenerationResponse getById(@PathVariable UUID id) {
return GenerationResponse.from(generationService.getById(new GenerationId(id)));
}
@PostMapping
@Operation(summary = "Create a new generation")
public ResponseEntity<GenerationResponse> create(@Valid @RequestBody GenerationRequest request) {
var generation = generationService.create(
new ModelId(request.modelId()),
request.name(),
new YearRange(request.yeaGenerationController method · java · L31-L33 (3 LOC)src/main/java/live/yurii/autocatalog/api/generation/GenerationController.java
public GenerationController(GenerationService generationService) {
this.generationService = generationService;
}getByModel method · java · L37-L40 (4 LOC)src/main/java/live/yurii/autocatalog/api/generation/GenerationController.java
public List<GenerationResponse> getByModel(@RequestParam UUID modelId) {
return generationService.getByModel(new ModelId(modelId)).stream()
.map(GenerationResponse::from).toList();
}getById method · java · L44-L46 (3 LOC)src/main/java/live/yurii/autocatalog/api/generation/GenerationController.java
public GenerationResponse getById(@PathVariable UUID id) {
return GenerationResponse.from(generationService.getById(new GenerationId(id)));
}create method · java · L50-L59 (10 LOC)src/main/java/live/yurii/autocatalog/api/generation/GenerationController.java
public ResponseEntity<GenerationResponse> create(@Valid @RequestBody GenerationRequest request) {
var generation = generationService.create(
new ModelId(request.modelId()),
request.name(),
new YearRange(request.yearFrom(), request.yearTo())
);
var uri = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(generation.id().value()).toUri();
return ResponseEntity.created(uri).body(GenerationResponse.from(generation));
}Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
close method · java · L63-L65 (3 LOC)src/main/java/live/yurii/autocatalog/api/generation/GenerationController.java
public GenerationResponse close(@PathVariable UUID id, @RequestParam int year) {
return GenerationResponse.from(generationService.close(new GenerationId(id), year));
}GenerationRequest class · java · L11-L17 (7 LOC)src/main/java/live/yurii/autocatalog/api/generation/GenerationRequest.java
public record GenerationRequest(
@NotNull UUID modelId,
@NotBlank @Size(max = 50) String name,
@Min(1886) @Max(2100) int yearFrom,
Integer yearTo
) {
}GenerationResponse class · java · L7-L23 (17 LOC)src/main/java/live/yurii/autocatalog/api/generation/GenerationResponse.java
public record GenerationResponse(
UUID id,
UUID modelId,
String name,
int yearFrom,
Integer yearTo
) {
public static GenerationResponse from(Generation g) {
return new GenerationResponse(
g.id().value(),
g.modelId().value(),
g.name(),
g.years().from(),
g.years().to()
);
}
}GenerationResponse function · java · L7-L23 (17 LOC)src/main/java/live/yurii/autocatalog/api/generation/GenerationResponse.java
public record GenerationResponse(
UUID id,
UUID modelId,
String name,
int yearFrom,
Integer yearTo
) {
public static GenerationResponse from(Generation g) {
return new GenerationResponse(
g.id().value(),
g.modelId().value(),
g.name(),
g.years().from(),
g.years().to()
);
}
}from method · java · L14-L22 (9 LOC)src/main/java/live/yurii/autocatalog/api/generation/GenerationResponse.java
public static GenerationResponse from(Generation g) {
return new GenerationResponse(
g.id().value(),
g.modelId().value(),
g.name(),
g.years().from(),
g.years().to()
);
}MakeController class · java · L24-L64 (41 LOC)src/main/java/live/yurii/autocatalog/api/make/MakeController.java
public class MakeController {
private final MakeService makeService;
public MakeController(MakeService makeService) {
this.makeService = makeService;
}
@GetMapping
@Operation(summary = "Get all makes")
public List<MakeResponse> getAll() {
return makeService.getAll().stream().map(MakeResponse::from).toList();
}
@GetMapping("/{id}")
@Operation(summary = "Get make by ID")
public MakeResponse getById(@PathVariable UUID id) {
return MakeResponse.from(makeService.getById(MakeId.of(id.toString())));
}
@GetMapping("/slug/{slug}")
@Operation(summary = "Get make by slug")
public MakeResponse getBySlug(@PathVariable String slug) {
return MakeResponse.from(makeService.getBySlug(slug));
}
@PostMapping
@Operation(summary = "Create a new make")
public ResponseEntity<MakeResponse> create(@Valid @RequestBody MakeRequest request) {
var make = makeService.create(request.name(), request.country());
var uri = ServletUriComponentsBuilder.fromMakeController method · java · L28-L30 (3 LOC)src/main/java/live/yurii/autocatalog/api/make/MakeController.java
public MakeController(MakeService makeService) {
this.makeService = makeService;
}getAll method · java · L34-L36 (3 LOC)src/main/java/live/yurii/autocatalog/api/make/MakeController.java
public List<MakeResponse> getAll() {
return makeService.getAll().stream().map(MakeResponse::from).toList();
}Want this analysis on your repo? https://repobility.com/scan/
getById method · java · L40-L42 (3 LOC)src/main/java/live/yurii/autocatalog/api/make/MakeController.java
public MakeResponse getById(@PathVariable UUID id) {
return MakeResponse.from(makeService.getById(MakeId.of(id.toString())));
}getBySlug method · java · L46-L48 (3 LOC)src/main/java/live/yurii/autocatalog/api/make/MakeController.java
public MakeResponse getBySlug(@PathVariable String slug) {
return MakeResponse.from(makeService.getBySlug(slug));
}create method · java · L52-L57 (6 LOC)src/main/java/live/yurii/autocatalog/api/make/MakeController.java
public ResponseEntity<MakeResponse> create(@Valid @RequestBody MakeRequest request) {
var make = makeService.create(request.name(), request.country());
var uri = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(make.id().value()).toUri();
return ResponseEntity.created(uri).body(MakeResponse.from(make));
}rename method · java · L61-L63 (3 LOC)src/main/java/live/yurii/autocatalog/api/make/MakeController.java
public MakeResponse rename(@PathVariable UUID id, @Valid @RequestBody MakeRequest request) {
return MakeResponse.from(makeService.rename(MakeId.of(id.toString()), request.name()));
}MakeRequest class · java · L6-L10 (5 LOC)src/main/java/live/yurii/autocatalog/api/make/MakeRequest.java
public record MakeRequest(
@NotBlank @Size(max = 100) String name,
@NotBlank @Size(max = 100) String country
) {
}MakeResponse function · java · L7-L12 (6 LOC)src/main/java/live/yurii/autocatalog/api/make/MakeResponse.java
public record MakeResponse(UUID id, String name, String country, String slug) {
public static MakeResponse from(Make make) {
return new MakeResponse(make.id().value(), make.name(), make.country(), make.slug());
}
}MakeResponse class · java · L7-L12 (6 LOC)src/main/java/live/yurii/autocatalog/api/make/MakeResponse.java
public record MakeResponse(UUID id, String name, String country, String slug) {
public static MakeResponse from(Make make) {
return new MakeResponse(make.id().value(), make.name(), make.country(), make.slug());
}
}from method · java · L9-L11 (3 LOC)src/main/java/live/yurii/autocatalog/api/make/MakeResponse.java
public static MakeResponse from(Make make) {
return new MakeResponse(make.id().value(), make.name(), make.country(), make.slug());
}Repobility · open methodology · https://repobility.com/research/
CarModelController class · java · L25-L63 (39 LOC)src/main/java/live/yurii/autocatalog/api/model/CarModelController.java
public class CarModelController {
private final CarModelService carModelService;
public CarModelController(CarModelService carModelService) {
this.carModelService = carModelService;
}
@GetMapping
@Operation(summary = "Get models by make")
public List<CarModelResponse> getByMake(@RequestParam UUID makeId) {
return carModelService.getByMake(new MakeId(makeId)).stream()
.map(CarModelResponse::from).toList();
}
@GetMapping("/{id}")
@Operation(summary = "Get model by ID")
public CarModelResponse getById(@PathVariable UUID id) {
return CarModelResponse.from(carModelService.getById(new ModelId(id)));
}
@PostMapping
@Operation(summary = "Create a new model")
public ResponseEntity<CarModelResponse> create(@Valid @RequestBody CarModelRequest request) {
var model = carModelService.create(new MakeId(request.makeId()), request.name());
var uri = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(model.id().CarModelController method · java · L29-L31 (3 LOC)src/main/java/live/yurii/autocatalog/api/model/CarModelController.java
public CarModelController(CarModelService carModelService) {
this.carModelService = carModelService;
}getByMake method · java · L35-L38 (4 LOC)src/main/java/live/yurii/autocatalog/api/model/CarModelController.java
public List<CarModelResponse> getByMake(@RequestParam UUID makeId) {
return carModelService.getByMake(new MakeId(makeId)).stream()
.map(CarModelResponse::from).toList();
}getById method · java · L42-L44 (3 LOC)src/main/java/live/yurii/autocatalog/api/model/CarModelController.java
public CarModelResponse getById(@PathVariable UUID id) {
return CarModelResponse.from(carModelService.getById(new ModelId(id)));
}create method · java · L48-L53 (6 LOC)src/main/java/live/yurii/autocatalog/api/model/CarModelController.java
public ResponseEntity<CarModelResponse> create(@Valid @RequestBody CarModelRequest request) {
var model = carModelService.create(new MakeId(request.makeId()), request.name());
var uri = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(model.id().value()).toUri();
return ResponseEntity.created(uri).body(CarModelResponse.from(model));
}addRelation method · java · L57-L62 (6 LOC)src/main/java/live/yurii/autocatalog/api/model/CarModelController.java
public CarModelResponse addRelation(@PathVariable UUID id,
@Valid @RequestBody ModelRelationRequest request) {
return CarModelResponse.from(carModelService.linkRelation(
new ModelId(id), new ModelId(request.targetModelId()), request.type(), request.note()
));
}CarModelRequest class · java · L9-L13 (5 LOC)src/main/java/live/yurii/autocatalog/api/model/CarModelRequest.java
public record CarModelRequest(
@NotNull UUID makeId,
@NotBlank @Size(max = 100) String name
) {
}CarModelResponse class · java · L8-L29 (22 LOC)src/main/java/live/yurii/autocatalog/api/model/CarModelResponse.java
public record CarModelResponse(
UUID id,
UUID makeId,
String name,
String slug,
List<RelationResponse> relations
) {
public static CarModelResponse from(CarModel model) {
return new CarModelResponse(
model.id().value(),
model.makeId().value(),
model.name(),
model.slug(),
model.relations().stream()
.map(r -> new RelationResponse(r.targetModelId().value(), r.type().name(), r.note()))
.toList()
);
}
public record RelationResponse(UUID targetModelId, String type, String note) {
}
}Same scanner, your repo: https://repobility.com — Repobility
CarModelResponse function · java · L8-L29 (22 LOC)src/main/java/live/yurii/autocatalog/api/model/CarModelResponse.java
public record CarModelResponse(
UUID id,
UUID makeId,
String name,
String slug,
List<RelationResponse> relations
) {
public static CarModelResponse from(CarModel model) {
return new CarModelResponse(
model.id().value(),
model.makeId().value(),
model.name(),
model.slug(),
model.relations().stream()
.map(r -> new RelationResponse(r.targetModelId().value(), r.type().name(), r.note()))
.toList()
);
}
public record RelationResponse(UUID targetModelId, String type, String note) {
}
}from method · java · L15-L25 (11 LOC)src/main/java/live/yurii/autocatalog/api/model/CarModelResponse.java
public static CarModelResponse from(CarModel model) {
return new CarModelResponse(
model.id().value(),
model.makeId().value(),
model.name(),
model.slug(),
model.relations().stream()
.map(r -> new RelationResponse(r.targetModelId().value(), r.type().name(), r.note()))
.toList()
);
}ModelRelationRequest class · java · L8-L13 (6 LOC)src/main/java/live/yurii/autocatalog/api/model/ModelRelationRequest.java
public record ModelRelationRequest(
@NotNull UUID targetModelId,
@NotNull ModelRelation.Type type,
String note
) {
}page 1 / 8next ›