BlockMonitoring.java

  1. /*
  2.  * The coLAB project
  3.  * Copyright (C) 2022-2023 AlbaSim, MEI, HEIG-VD, HES-SO
  4.  *
  5.  * Licensed under the MIT License
  6.  */
  7. package ch.colabproject.colab.api.microchanges.live.monitoring;

  8. import ch.colabproject.colab.generator.model.annotations.ExtractJavaDoc;
  9. import ch.colabproject.colab.generator.model.interfaces.WithJsonDiscriminator;
  10. import javax.validation.constraints.NotNull;

  11. /**
  12.  * Admin tool to monitor live block changes
  13.  *
  14.  * @author maxence
  15.  */
  16. @ExtractJavaDoc
  17. public class BlockMonitoring implements WithJsonDiscriminator {

  18.     private static final long serialVersionUID = 1L;

  19.     /**
  20.      * Status of the block
  21.      */
  22.     public enum BlockStatus implements WithJsonDiscriminator {
  23.         /** everything looks fine */
  24.         HEALTHY,
  25.         /** pending changes are inconsistent */
  26.         UNHEALTHY,
  27.         /** unable to restore data from live cache */
  28.         DATA_ERROR,
  29.         /** no pending changes */
  30.         PROCESSED,
  31.         /**
  32.          * some pending changes exist but block has been deleted in the meantime
  33.          */
  34.         DELETED;
  35.     }

  36.     /** Id of the block being live-edited */
  37.     @NotNull
  38.     private Long blockId;

  39.     /** Human readable description */
  40.     @NotNull
  41.     private String title;

  42.     /** Status of the live edition */
  43.     @NotNull
  44.     private BlockStatus status;

  45.     /**
  46.      * Get id
  47.      *
  48.      * @return the id of the block
  49.      */
  50.     public Long getBlockId() {
  51.         return blockId;
  52.     }

  53.     /**
  54.      * set block id
  55.      *
  56.      * @param blockId new block id
  57.      */
  58.     public void setBlockId(Long blockId) {
  59.         this.blockId = blockId;
  60.     }

  61.     /**
  62.      * status of the live-edition
  63.      *
  64.      * @return the status
  65.      */
  66.     public BlockStatus getStatus() {
  67.         return status;
  68.     }

  69.     /**
  70.      * set status
  71.      *
  72.      * @param status the status
  73.      */
  74.     public void setStatus(BlockStatus status) {
  75.         this.status = status;
  76.     }

  77.     /**
  78.      * Get human description
  79.      *
  80.      * @return the description
  81.      */
  82.     public String getTitle() {
  83.         return title;
  84.     }

  85.     /**
  86.      * Set human description
  87.      *
  88.      * @param title new text
  89.      */
  90.     public void setTitle(String title) {
  91.         this.title = title;
  92.     }
  93. }