Function bodies 391 total
getAll method · java · L34-L36 (3 LOC)src/main/java/live/yurii/autocatalog/application/make/MakeService.java
public List<Make> getAll() {
return makeRepository.findAll();
}rename method · java · L38-L42 (5 LOC)src/main/java/live/yurii/autocatalog/application/make/MakeService.java
public Make rename(MakeId id, String newName) {
var make = getById(id);
make.rename(newName);
return makeRepository.save(make);
}CarModelService class · java · L13-L47 (35 LOC)src/main/java/live/yurii/autocatalog/application/model/CarModelService.java
public class CarModelService {
private final CarModelRepository modelRepository;
private final MakeRepository makeRepository;
public CarModelService(CarModelRepository modelRepository, MakeRepository makeRepository) {
this.modelRepository = modelRepository;
this.makeRepository = makeRepository;
}
public CarModel create(MakeId makeId, String name) {
if (makeRepository.findById(makeId).isEmpty())
throw new EntityNotFoundException("Make not found: " + makeId.value());
if (modelRepository.existsByMakeIdAndName(makeId, name))
throw new IllegalStateException("Model already exists for make " + makeId.value() + ": " + name);
return modelRepository.save(CarModel.create(makeId, name));
}
public CarModel getById(ModelId id) {
return modelRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Model not found: " + id.value()));
}
public List<CarModel> getByMake(MakeId makeId) {
return modelRepository.findByMakeId(CarModelService method · java · L18-L21 (4 LOC)src/main/java/live/yurii/autocatalog/application/model/CarModelService.java
public CarModelService(CarModelRepository modelRepository, MakeRepository makeRepository) {
this.modelRepository = modelRepository;
this.makeRepository = makeRepository;
}create method · java · L23-L29 (7 LOC)src/main/java/live/yurii/autocatalog/application/model/CarModelService.java
public CarModel create(MakeId makeId, String name) {
if (makeRepository.findById(makeId).isEmpty())
throw new EntityNotFoundException("Make not found: " + makeId.value());
if (modelRepository.existsByMakeIdAndName(makeId, name))
throw new IllegalStateException("Model already exists for make " + makeId.value() + ": " + name);
return modelRepository.save(CarModel.create(makeId, name));
}getById method · java · L31-L34 (4 LOC)src/main/java/live/yurii/autocatalog/application/model/CarModelService.java
public CarModel getById(ModelId id) {
return modelRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Model not found: " + id.value()));
}getByMake method · java · L36-L38 (3 LOC)src/main/java/live/yurii/autocatalog/application/model/CarModelService.java
public List<CarModel> getByMake(MakeId makeId) {
return modelRepository.findByMakeId(makeId);
}Repobility (the analyzer behind this table) · https://repobility.com
linkRelation method · java · L40-L46 (7 LOC)src/main/java/live/yurii/autocatalog/application/model/CarModelService.java
public CarModel linkRelation(ModelId fromId, ModelId toId,
ModelRelation.Type type, String note) {
var from = getById(fromId);
getById(toId);
from.addRelation(toId, type, note);
return modelRepository.save(from);
}EntityNotFoundException class · java · L3-L7 (5 LOC)src/main/java/live/yurii/autocatalog/application/shared/EntityNotFoundException.java
public class EntityNotFoundException extends RuntimeException {
public EntityNotFoundException(String message) {
super(message);
}
}EntityNotFoundException method · java · L4-L6 (3 LOC)src/main/java/live/yurii/autocatalog/application/shared/EntityNotFoundException.java
public EntityNotFoundException(String message) {
super(message);
}TransmissionService class · java · L11-L37 (27 LOC)src/main/java/live/yurii/autocatalog/application/transmission/TransmissionService.java
public class TransmissionService {
private final TransmissionRepository transmissionRepository;
public TransmissionService(TransmissionRepository transmissionRepository) {
this.transmissionRepository = transmissionRepository;
}
public Transmission create(TransmissionType type, int gearCount) {
if (transmissionRepository.existsByTypeAndGearCount(type, gearCount))
throw new IllegalStateException("Transmission already exists: " + type + " " + gearCount + "-speed");
return transmissionRepository.save(Transmission.create(type, gearCount));
}
public Transmission getById(TransmissionId id) {
return transmissionRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Transmission not found: " + id.value()));
}
public List<Transmission> getAll() {
return transmissionRepository.findAll();
}
public List<Transmission> getByType(TransmissionType type) {
return transmissionRepository.findByType(type);
}
}TransmissionService method · java · L15-L17 (3 LOC)src/main/java/live/yurii/autocatalog/application/transmission/TransmissionService.java
public TransmissionService(TransmissionRepository transmissionRepository) {
this.transmissionRepository = transmissionRepository;
}create method · java · L19-L23 (5 LOC)src/main/java/live/yurii/autocatalog/application/transmission/TransmissionService.java
public Transmission create(TransmissionType type, int gearCount) {
if (transmissionRepository.existsByTypeAndGearCount(type, gearCount))
throw new IllegalStateException("Transmission already exists: " + type + " " + gearCount + "-speed");
return transmissionRepository.save(Transmission.create(type, gearCount));
}getById method · java · L25-L28 (4 LOC)src/main/java/live/yurii/autocatalog/application/transmission/TransmissionService.java
public Transmission getById(TransmissionId id) {
return transmissionRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Transmission not found: " + id.value()));
}getAll method · java · L30-L32 (3 LOC)src/main/java/live/yurii/autocatalog/application/transmission/TransmissionService.java
public List<Transmission> getAll() {
return transmissionRepository.findAll();
}Repobility · severity-and-effort ranking · https://repobility.com
getByType method · java · L34-L36 (3 LOC)src/main/java/live/yurii/autocatalog/application/transmission/TransmissionService.java
public List<Transmission> getByType(TransmissionType type) {
return transmissionRepository.findByType(type);
}VariantService class · java · L17-L79 (63 LOC)src/main/java/live/yurii/autocatalog/application/variant/VariantService.java
public class VariantService {
private final VariantRepository variantRepository;
private final BodyRepository bodyRepository;
private final EngineRepository engineRepository;
private final TransmissionRepository transmissionRepository;
public VariantService(VariantRepository variantRepository,
BodyRepository bodyRepository,
EngineRepository engineRepository,
TransmissionRepository transmissionRepository) {
this.variantRepository = variantRepository;
this.bodyRepository = bodyRepository;
this.engineRepository = engineRepository;
this.transmissionRepository = transmissionRepository;
}
public Variant create(BodyId bodyId, TransmissionId transmissionId,
Drivetrain drivetrain, int curbWeightKg,
Integer groundClearanceMm, Integer systemPowerKw) {
if (bodyRepository.findById(bodyId).isEmpty())
throw new EntityNotFoundException("BodyVariantService method · java · L24-L32 (9 LOC)src/main/java/live/yurii/autocatalog/application/variant/VariantService.java
public VariantService(VariantRepository variantRepository,
BodyRepository bodyRepository,
EngineRepository engineRepository,
TransmissionRepository transmissionRepository) {
this.variantRepository = variantRepository;
this.bodyRepository = bodyRepository;
this.engineRepository = engineRepository;
this.transmissionRepository = transmissionRepository;
}create method · java · L34-L50 (17 LOC)src/main/java/live/yurii/autocatalog/application/variant/VariantService.java
public Variant create(BodyId bodyId, TransmissionId transmissionId,
Drivetrain drivetrain, int curbWeightKg,
Integer groundClearanceMm, Integer systemPowerKw) {
if (bodyRepository.findById(bodyId).isEmpty())
throw new EntityNotFoundException("Body not found: " + bodyId.value());
if (transmissionRepository.findById(transmissionId).isEmpty())
throw new EntityNotFoundException("Transmission not found: " + transmissionId.value());
if (variantRepository.existsByBodyIdAndTransmissionIdAndDrivetrain(bodyId, transmissionId, drivetrain))
throw new IllegalStateException(
"Variant already exists for body " + bodyId.value()
+ " with transmission " + transmissionId.value()
+ " and drivetrain " + drivetrain);
var variant = Variant.create(bodyId, transmissionId, drivetrain, curbWeightKg);
if (groundClearanceMm != null) variant.setGroundClearanceMm(groundClearanceMm);
if (systemPowergetById method · java · L52-L55 (4 LOC)src/main/java/live/yurii/autocatalog/application/variant/VariantService.java
public Variant getById(VariantId id) {
return variantRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("Variant not found: " + id.value()));
}getByBody method · java · L57-L59 (3 LOC)src/main/java/live/yurii/autocatalog/application/variant/VariantService.java
public List<Variant> getByBody(BodyId bodyId) {
return variantRepository.findByBodyId(bodyId);
}addEngine method · java · L61-L67 (7 LOC)src/main/java/live/yurii/autocatalog/application/variant/VariantService.java
public Variant addEngine(VariantId variantId, EngineId engineId) {
var variant = getById(variantId);
if (engineRepository.findById(engineId).isEmpty())
throw new EntityNotFoundException("Engine not found: " + engineId.value());
variant.addEngine(engineId);
return variantRepository.save(variant);
}addMarket method · java · L69-L73 (5 LOC)src/main/java/live/yurii/autocatalog/application/variant/VariantService.java
public Variant addMarket(VariantId variantId, String market) {
var variant = getById(variantId);
variant.addMarket(market);
return variantRepository.save(variant);
}Same scanner, your repo: https://repobility.com — Repobility
deleteById method · java · L75-L78 (4 LOC)src/main/java/live/yurii/autocatalog/application/variant/VariantService.java
public void deleteById(VariantId id) {
getById(id);
variantRepository.deleteById(id);
}AutocatalogApplication class · java · L7-L13 (7 LOC)src/main/java/live/yurii/autocatalog/AutocatalogApplication.java
public class AutocatalogApplication {
public static void main(String[] args) {
SpringApplication.run(AutocatalogApplication.class, args);
}
}main method · java · L9-L11 (3 LOC)src/main/java/live/yurii/autocatalog/AutocatalogApplication.java
public static void main(String[] args) {
SpringApplication.run(AutocatalogApplication.class, args);
}BodyId class · java · L6-L18 (13 LOC)src/main/java/live/yurii/autocatalog/domain/body/BodyId.java
public record BodyId(UUID value) {
public BodyId {
Objects.requireNonNull(value, "BodyId value must not be null");
}
public static BodyId generate() {
return new BodyId(UUID.randomUUID());
}
public static BodyId of(String value) {
return new BodyId(UUID.fromString(value));
}
}BodyId function · java · L6-L18 (13 LOC)src/main/java/live/yurii/autocatalog/domain/body/BodyId.java
public record BodyId(UUID value) {
public BodyId {
Objects.requireNonNull(value, "BodyId value must not be null");
}
public static BodyId generate() {
return new BodyId(UUID.randomUUID());
}
public static BodyId of(String value) {
return new BodyId(UUID.fromString(value));
}
}generate method · java · L11-L13 (3 LOC)src/main/java/live/yurii/autocatalog/domain/body/BodyId.java
public static BodyId generate() {
return new BodyId(UUID.randomUUID());
}of method · java · L15-L17 (3 LOC)src/main/java/live/yurii/autocatalog/domain/body/BodyId.java
public static BodyId of(String value) {
return new BodyId(UUID.fromString(value));
}Body class · java · L7-L94 (88 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public class Body {
private BodyId id;
private GenerationId generationId;
private BodyStyle bodyStyle;
private int lengthMm;
private int widthMm;
private int heightMm;
private int wheelbaseMm;
private Integer trunkVolumeLitres;
private Body() {
}
public static Body create(GenerationId generationId, BodyStyle bodyStyle,
int lengthMm, int widthMm, int heightMm, int wheelbaseMm) {
validateDimensions(lengthMm, widthMm, heightMm, wheelbaseMm);
var b = new Body();
b.id = BodyId.generate();
b.generationId = Objects.requireNonNull(generationId, "generationId must not be null");
b.bodyStyle = Objects.requireNonNull(bodyStyle, "bodyStyle must not be null");
b.lengthMm = lengthMm;
b.widthMm = widthMm;
b.heightMm = heightMm;
b.wheelbaseMm = wheelbaseMm;
return b;
}
public static Body reconstitute(BodyId id, GenerationId generationId, BodyStyle bodyStyle,
int lengthMm,Repobility analyzer · published findings · https://repobility.com
create method · java · L21-L33 (13 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public static Body create(GenerationId generationId, BodyStyle bodyStyle,
int lengthMm, int widthMm, int heightMm, int wheelbaseMm) {
validateDimensions(lengthMm, widthMm, heightMm, wheelbaseMm);
var b = new Body();
b.id = BodyId.generate();
b.generationId = Objects.requireNonNull(generationId, "generationId must not be null");
b.bodyStyle = Objects.requireNonNull(bodyStyle, "bodyStyle must not be null");
b.lengthMm = lengthMm;
b.widthMm = widthMm;
b.heightMm = heightMm;
b.wheelbaseMm = wheelbaseMm;
return b;
}reconstitute method · java · L35-L48 (14 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public static Body reconstitute(BodyId id, GenerationId generationId, BodyStyle bodyStyle,
int lengthMm, int widthMm, int heightMm, int wheelbaseMm,
Integer trunkVolumeLitres) {
var b = new Body();
b.id = id;
b.generationId = generationId;
b.bodyStyle = bodyStyle;
b.lengthMm = lengthMm;
b.widthMm = widthMm;
b.heightMm = heightMm;
b.wheelbaseMm = wheelbaseMm;
b.trunkVolumeLitres = trunkVolumeLitres;
return b;
}setTrunkVolumeLitres method · java · L50-L54 (5 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public void setTrunkVolumeLitres(int trunkVolumeLitres) {
if (trunkVolumeLitres <= 0)
throw new IllegalArgumentException("trunkVolumeLitres must be > 0");
this.trunkVolumeLitres = trunkVolumeLitres;
}id method · java · L56-L58 (3 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public BodyId id() {
return id;
}generationId method · java · L60-L62 (3 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public GenerationId generationId() {
return generationId;
}bodyStyle method · java · L64-L66 (3 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public BodyStyle bodyStyle() {
return bodyStyle;
}lengthMm method · java · L68-L70 (3 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public int lengthMm() {
return lengthMm;
}widthMm method · java · L72-L74 (3 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public int widthMm() {
return widthMm;
}Repobility (the analyzer behind this table) · https://repobility.com
heightMm method · java · L76-L78 (3 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public int heightMm() {
return heightMm;
}wheelbaseMm method · java · L80-L82 (3 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public int wheelbaseMm() {
return wheelbaseMm;
}trunkVolumeLitres method · java · L84-L86 (3 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
public Integer trunkVolumeLitres() {
return trunkVolumeLitres;
}validateDimensions method · java · L88-L93 (6 LOC)src/main/java/live/yurii/autocatalog/domain/body/Body.java
private static void validateDimensions(int length, int width, int height, int wheelbase) {
if (length <= 0) throw new IllegalArgumentException("lengthMm must be > 0");
if (width <= 0) throw new IllegalArgumentException("widthMm must be > 0");
if (height <= 0) throw new IllegalArgumentException("heightMm must be > 0");
if (wheelbase <= 0) throw new IllegalArgumentException("wheelbaseMm must be > 0");
}EngineId class · java · L6-L18 (13 LOC)src/main/java/live/yurii/autocatalog/domain/engine/EngineId.java
public record EngineId(UUID value) {
public EngineId {
Objects.requireNonNull(value, "EngineId value must not be null");
}
public static EngineId generate() {
return new EngineId(UUID.randomUUID());
}
public static EngineId of(String value) {
return new EngineId(UUID.fromString(value));
}
}EngineId function · java · L6-L18 (13 LOC)src/main/java/live/yurii/autocatalog/domain/engine/EngineId.java
public record EngineId(UUID value) {
public EngineId {
Objects.requireNonNull(value, "EngineId value must not be null");
}
public static EngineId generate() {
return new EngineId(UUID.randomUUID());
}
public static EngineId of(String value) {
return new EngineId(UUID.fromString(value));
}
}generate method · java · L11-L13 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/EngineId.java
public static EngineId generate() {
return new EngineId(UUID.randomUUID());
}of method · java · L15-L17 (3 LOC)src/main/java/live/yurii/autocatalog/domain/engine/EngineId.java
public static EngineId of(String value) {
return new EngineId(UUID.fromString(value));
}Repobility · severity-and-effort ranking · https://repobility.com
Engine class · java · L5-L122 (118 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public class Engine {
private EngineId id;
private String code;
private String name;
private FuelType fuelType;
private int displacementCc;
private int powerKw;
private int torqueNm;
private Integer cylinderCount;
private String configuration;
private Integer systemPowerKw;
private Engine() {
}
public static Engine create(String code, String name, FuelType fuelType,
int displacementCc, int powerKw, int torqueNm) {
validate(displacementCc, powerKw, torqueNm);
var e = new Engine();
e.id = EngineId.generate();
e.code = requireNonBlank(code, "code");
e.name = requireNonBlank(name, "name");
e.fuelType = Objects.requireNonNull(fuelType);
e.displacementCc = displacementCc;
e.powerKw = powerKw;
e.torqueNm = torqueNm;
return e;
}
public static Engine reconstitute(EngineId id, String code, String name, FuelType fuelType,
int displacementCc, int powerKw, int create method · java · L21-L33 (13 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public static Engine create(String code, String name, FuelType fuelType,
int displacementCc, int powerKw, int torqueNm) {
validate(displacementCc, powerKw, torqueNm);
var e = new Engine();
e.id = EngineId.generate();
e.code = requireNonBlank(code, "code");
e.name = requireNonBlank(name, "name");
e.fuelType = Objects.requireNonNull(fuelType);
e.displacementCc = displacementCc;
e.powerKw = powerKw;
e.torqueNm = torqueNm;
return e;
}reconstitute method · java · L35-L51 (17 LOC)src/main/java/live/yurii/autocatalog/domain/engine/Engine.java
public static Engine reconstitute(EngineId id, String code, String name, FuelType fuelType,
int displacementCc, int powerKw, int torqueNm,
Integer cylinderCount, String configuration,
Integer systemPowerKw) {
var e = new Engine();
e.id = id;
e.code = code;
e.name = name;
e.fuelType = fuelType;
e.displacementCc = displacementCc;
e.powerKw = powerKw;
e.torqueNm = torqueNm;
e.cylinderCount = cylinderCount;
e.configuration = configuration;
e.systemPowerKw = systemPowerKw;
return e;
}