Class Component

java.lang.Object
domain.Component
Direct Known Subclasses:
Chassis, Cpu, Disk, Gpu, PowerSupply, Ram

public abstract class Component extends Object
Represents a generic hardware component This abstract class is the base for all specific components | Représente un composant matériel générique. Cette classe abstraite est la base de tous les composants spécifiques.
Author:
FIGUEIRAS Jossua
  • Constructor Summary

    Constructors
    Constructor
    Description
    Component(int id, String brand, String model, int mid, int tid)
    Creates a Component instance using explicit values | Crée une instance Component à partir de valeurs explicites.
    Creates a Component instance from a SQL result set | Crée une instance Component à partir d'un résultat SQL.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Compares two components based on their identifiers | Compare deux composants en fonction de leur identifiant.
    Returns the manufacturer brand | Retourne la marque du fabricant.
    static Component
    getById(int id)
    Retrieves a component by its unique identifier | Récupère un composant à partir de son identifiant unique.
    int
    Returns the unique identifier of the component | Retourne l'identifiant unique du composant.
    int
    Returns the associated machine identifier | Retourne l'identifiant de la machine associée.
    Returns the model reference | Retourne la référence du modèle.
    int
    Returns the associated ticket identifier | Retourne l'identifiant du ticket associé.
    void
    setTicketId(int ticketId)
    Updates the associated ticket identifier | Met à jour l'identifiant du ticket associé.
    void
    Persists the component updates to the database | Enregistre les modifications du composant dans la base de données.
    whoami(String alternative)
    Returns the component type as a string | Retourne le type du composant sous forme de chaîne.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Component

      public Component(int id, String brand, String model, int mid, int tid)
      Creates a Component instance using explicit values | Crée une instance Component à partir de valeurs explicites.
      Parameters:
      id - the unique identifier of the component | l'identifiant unique du composant
      brand - the manufacturer brand | la marque du fabricant
      model - the model reference | la référence du modèle
      mid - the identifier of the associated machine | l'identifiant de la machine associée
      tid - the identifier of the associated ticket | l'identifiant du ticket associé
    • Component

      public Component(ResultSet result)
      Creates a Component instance from a SQL result set | Crée une instance Component à partir d'un résultat SQL.
      Parameters:
      result - the SQL result set containing component data | le résultat SQL contenant les données du composant
  • Method Details

    • getId

      public int getId()
      Returns the unique identifier of the component | Retourne l'identifiant unique du composant.
      Returns:
      the component ID | l'identifiant du composant
    • getBrand

      public String getBrand()
      Returns the manufacturer brand | Retourne la marque du fabricant.
      Returns:
      the brand name | la marque
    • getModel

      public String getModel()
      Returns the model reference | Retourne la référence du modèle.
      Returns:
      the model name | le modèle
    • getMachineId

      public int getMachineId()
      Returns the associated machine identifier | Retourne l'identifiant de la machine associée.
      Returns:
      the machine ID | l'identifiant de la machine
    • getTicketId

      public int getTicketId()
      Returns the associated ticket identifier | Retourne l'identifiant du ticket associé.
      Returns:
      the ticket ID | l'identifiant du ticket
    • setTicketId

      public void setTicketId(int ticketId)
      Updates the associated ticket identifier | Met à jour l'identifiant du ticket associé.
      Parameters:
      ticketId - the new ticket identifier | le nouvel identifiant du ticket
    • updateComponent

      public void updateComponent()
      Persists the component updates to the database | Enregistre les modifications du composant dans la base de données.
    • whoami

      public String whoami(String alternative)
      Returns the component type as a string | Retourne le type du composant sous forme de chaîne.
      Parameters:
      alternative - the fallback value if the type is unknown | la valeur alternative si le type est inconnu
      Returns:
      the component type name | le nom du type de composant
    • getById

      public static Component getById(int id)
      Retrieves a component by its unique identifier | Récupère un composant à partir de son identifiant unique.
      Parameters:
      id - the ID of the component to retrieve | l'identifiant du composant à récupérer
      Returns:
      the component instance if found | l'instance du composant si elle est trouvée
    • compareComponentById

      public static boolean compareComponentById(Component c1, Component c2)
      Compares two components based on their identifiers | Compare deux composants en fonction de leur identifiant.
      Parameters:
      c1 - the first component | le premier composant
      c2 - the second component | le second composant
      Returns:
      true if both components have the same ID | true si les deux composants ont le même identifiant