Add CpuAsset model and CpuRepository for CPU asset management

This commit is contained in:
2025-06-09 08:46:04 +02:00
parent 54231df858
commit ab06c37a71
2 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
package be.seeseepuff.pcinv.models;
import be.seeseepuff.pcinv.meta.*;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
/**
* Represents a CPU or similar device.
*/
@Getter
@Setter
@Entity
@AssetInfo(
displayName = "Central Processing Unit",
pluralName = "Central Processing Units",
type = "cpu"
)
@Table(name = "cpu_assets")
public class CpuAsset implements Asset
{
@Id
@GeneratedValue
private long id;
@OneToOne(orphanRemoval = true)
private GenericAsset asset;
@Description("The number of cores in the CPU.")
@Property("Cores")
private int cores;
@Description("The number of threads in the CPU.")
@Property("Threads")
private int threads;
@Description("The base clock speed of the CPU in MHz.")
@Property("Base Clock Speed (MHz)")
private int baseClockSpeed;
@Description("The boost clock speed of the CPU in MHz.")
@Property("Boost Clock Speed (MHz)")
@HideInOverview
private int boostClockSpeed;
@Description("The thermal design power (TDP) of the CPU in watts.")
@Property("Thermal Design Power (TDP) (W)")
private int tdp;
@Description("The socket type of the CPU.")
@Property("Socket Type")
@InputList
private String socketType;
@Description("The architecture of the CPU, e.g., x86, ARM, etc.")
@Property("Architecture")
@HideInOverview
@InputList
private String architecture;
@Description("The manufacturing process of the CPU in nanometers.")
@Property("Manufacturing Process (nm)")
@HideInOverview
private int manufacturingProcess;
}

View File

@@ -0,0 +1,12 @@
package be.seeseepuff.pcinv.repositories;
import be.seeseepuff.pcinv.models.CpuAsset;
import org.springframework.data.jpa.repository.JpaRepository;
@SuppressWarnings("unused")
public interface CpuRepository extends JpaRepository<CpuAsset, Long>, AssetRepository<CpuAsset> {
@Override
default Class<CpuAsset> getAssetType() {
return CpuAsset.class;
}
}