All Implemented Interfaces:
Sendable, Serializable

public class IpRange extends DatalakeStorageItem implements Sendable, Serializable
IP range model.
Author:
Maxime ESCOURBIAC.
See Also:
  • Constructor Details

    • IpRange

      public IpRange()
      Default constructor.
    • IpRange

      public IpRange(String cidr)
      IpRange constructor.
      Parameters:
      cidr - Classless Inter-Domain Routing.
    • IpRange

      public IpRange(String cidr, String description, int serviceLevel, Date lastScanDate)
      IpRange constructor.
      Parameters:
      cidr - Classless Inter-Domain Routing.
      description - Ip range description.
      serviceLevel - Ip range service level.
      lastScanDate - Last scan date.
  • Method Details

    • isValid

      public boolean isValid()
      Check if CIDR is valid.
      Returns:
      True if CIDR is valid.
    • toIpList

      public List<String> toIpList()
      Get ip addresses from CIDR, including network and broadcast addresses.
      Returns:
      Ip addresses from CIDR, including network and broadcast addresses.
    • getCidr

      public String getCidr()
      Classless Inter-Domain Routing.
      Returns:
      Classless Inter-Domain Routing.
    • setCidr

      public void setCidr(String cidr)
      Classless Inter-Domain Routing.
      Parameters:
      cidr - Classless Inter-Domain Routing.
    • getDescription

      public String getDescription()
      Ip range description.
      Returns:
      Ip range description.
    • setDescription

      public void setDescription(String description)
      Ip range description.
      Parameters:
      description - Ip range description.
    • getLastScanDate

      public Date getLastScanDate()
      Last scan date.
      Overrides:
      getLastScanDate in class DatalakeStorageItem
      Returns:
      Last scan date.
    • setLastScanDate

      public void setLastScanDate(Date lastScanDate)
      Last scan date.
      Overrides:
      setLastScanDate in class DatalakeStorageItem
      Parameters:
      lastScanDate - Last scan date.
    • getServiceLevel

      public int getServiceLevel()
      Ip range service level.
      Returns:
      Ip range service level.
    • setServiceLevel

      public void setServiceLevel(int serviceLevel)
      Ip range service level.
      Parameters:
      serviceLevel - Ip range service level.
    • fromDatalake

      protected <T extends DatalakeStorageItem> T fromDatalake(kong.unirest.json.JSONObject object)
      Description copied from class: DatalakeStorageItem
      Create DatalakeStorageItem instance from Datalake data. Be careful to verify if the JSON object parameter is not null. If object is null => return null.
      Specified by:
      fromDatalake in class DatalakeStorageItem
      Type Parameters:
      T - DatalakeStorageItem children.
      Parameters:
      object - Datalake data.
      Returns:
      DatalakeStorageItem instantiated.
    • upsert

      public boolean upsert() throws DatalakeStorageException
      Description copied from class: DatalakeStorageItem
      Upsert the item in Elastic searchContent. This operation cannot be mutualized and must be defined in each children classes.
      Specified by:
      upsert in class DatalakeStorageItem
      Returns:
      True if the upsert is successful.
      Throws:
      DatalakeStorageException - Exception with the storage.
    • getId

      public String getId()
      Description copied from class: DatalakeStorageItem
      Item ID.
      Specified by:
      getId in class DatalakeStorageItem
      Returns:
      Item ID.
    • toJson

      public String toJson()
      Description copied from interface: Sendable
      Convert the object to json string.
      Specified by:
      toJson in interface Sendable
      Returns:
      The string representation of the json object.
    • fromJson

      public void fromJson(String json)
      Description copied from interface: Sendable
      Convert json string to object.
      Specified by:
      fromJson in interface Sendable
      Parameters:
      json - The string representation of the json object.
    • getFanoutExchangeName

      public String getFanoutExchangeName()
      Description copied from interface: Sendable
      Get Fanout exchange name.
      Specified by:
      getFanoutExchangeName in interface Sendable
      Returns:
      Fanout exchange name.