Class TenantService

java.lang.Object
io.meeds.deeds.common.service.TenantService

@Component public class TenantService extends Object
  • Constructor Details

    • TenantService

      public TenantService()
  • Method Details

    • getDeedTenant

      public DeedTenant getDeedTenant(String address, long nftId) throws UnauthorizedOperationException
      Retrieves the DeedTenant information
      Parameters:
      nftId - DEED NFT id in the blockchain
      address - wallet address
      Returns:
      DeedTenant
      Throws:
      UnauthorizedOperationException - when the wallet isn't the DEED manager nor the owner
    • getCardType

      public short getCardType(long nftId) throws io.meeds.wom.api.constant.ObjectNotFoundException
      Parameters:
      nftId - DEED NFT id in the blockchain
      Returns:
      Deed Card Type
      Throws:
      io.meeds.wom.api.constant.ObjectNotFoundException - when NFT with selected identifier doesn't exists
    • getDeedTenant

      public DeedTenant getDeedTenant(long nftId)
      Retrieves the DeedTenant information
      Parameters:
      nftId - DEED NFT id in the blockchain
      Returns:
      DeedTenant
    • getDeedTenants

      public List<DeedTenant> getDeedTenants(String ownerAddress)
      Retrieve list of DeedTenant of NFT owner
      Parameters:
      ownerAddress - Deed Owner Address
      Returns:
      List of associated Deed provisioning information
    • saveEmail

      public void saveEmail(String managerAddress, long nftId, String email) throws UnauthorizedOperationException, io.meeds.wom.api.constant.ObjectNotFoundException
      Stores User Email to allow support Team Contact him and notify him about Tenant Status
      Parameters:
      nftId - DEED NFT id in the blockchain
      managerAddress - DEED Provisioning Manager wallet address
      email - Email of the manager
      Throws:
      UnauthorizedOperationException - when the wallet isn't the DEED manager
      io.meeds.wom.api.constant.ObjectNotFoundException - when NFT with selected identifier doesn't exists
    • getDeedTenantOrImport

      public DeedTenant getDeedTenantOrImport(String managerAddress, Long nftId, boolean refreshFromBlockchain) throws io.meeds.wom.api.constant.ObjectNotFoundException
      Throws:
      io.meeds.wom.api.constant.ObjectNotFoundException
    • getDeedTenantOrImport

      public DeedTenant getDeedTenantOrImport(String managerAddress, Long nftId) throws io.meeds.wom.api.constant.ObjectNotFoundException
      Throws:
      io.meeds.wom.api.constant.ObjectNotFoundException
    • getDeedTenantOrImport

      public DeedTenant getDeedTenantOrImport(Long nftId) throws io.meeds.wom.api.constant.ObjectNotFoundException
      Throws:
      io.meeds.wom.api.constant.ObjectNotFoundException
    • markDeedAsAcquired

      public void markDeedAsAcquired(long nftId, String newManager) throws io.meeds.wom.api.constant.ObjectNotFoundException, UnauthorizedOperationException
      Changes the DeedTenant Manager when an offer was acquired.
      Parameters:
      nftId - Deed NFT blockchain identifier
      newManager - New Manager Address
      Throws:
      io.meeds.wom.api.constant.ObjectNotFoundException - when Deed doesn't exist
      UnauthorizedOperationException - when the address isn't the manager on blockchain
    • startTenant

      public void startTenant(String managerAddress, String transactionHash, long nftId, String email) throws UnauthorizedOperationException, io.meeds.wom.api.constant.ObjectNotFoundException
      Stores User Email to allow support Team Contact him and notify him about Tenant Status. In addition, this will collect information about DEED Nft and transaction hash to command Tenant startup.
      Parameters:
      nftId - DEED NFT id in the blockchain
      managerAddress - DEED Provisioning Manager wallet address
      transactionHash - Ethereum Blockchain Deed Start command Transaction Hash
      email - Email of the manager
      Throws:
      UnauthorizedOperationException - when the wallet isn't the DEED manager
      io.meeds.wom.api.constant.ObjectNotFoundException - when NFT with selected identifier doesn't exists
    • stopTenant

      public void stopTenant(String managerAddress, String transactionHash, long nftId) throws UnauthorizedOperationException, io.meeds.wom.api.constant.ObjectNotFoundException
      Collects information about DEED Nft and transaction hash to command Tenant shutdown.
      Parameters:
      nftId - DEED NFT id in the blockchain
      managerAddress - DEED Provisioning Manager wallet address
      transactionHash - Ethereum Blockchain Deed Start command Transaction Hash
      Throws:
      UnauthorizedOperationException - when the wallet isn't the DEED manager
      io.meeds.wom.api.constant.ObjectNotFoundException - when NFT with selected identifier doesn't exists
    • buildDeedTenantFromBlockchain

      public DeedTenant buildDeedTenantFromBlockchain(long nftId) throws io.meeds.wom.api.constant.ObjectNotFoundException
      Retrieve Deed Tenant information from blockchain
      Parameters:
      nftId - DEED NFT id in the blockchain
      Returns:
      DeedTenant
      Throws:
      io.meeds.wom.api.constant.ObjectNotFoundException - when Deed NFT id is not recognized on blockchain
    • isDeedManager

      public boolean isDeedManager(String address, long nftId)
      Checks if address is the provisioning manager of the DEED
      Parameters:
      nftId - DEED NFT identifier
      address - Wallet or Contract Ethereum address
      Returns:
      true if address is the provisioning manager of the DEED Tenant
    • isDeedOwner

      public boolean isDeedOwner(String address, long nftId)
      Checks if address is the DEED owner
      Parameters:
      nftId - DEED NFT identifier
      address - Wallet or Contract Ethereum address
      Returns:
      true if address is the owner of the DEED Tenant
    • isTenantCommandStop

      public boolean isTenantCommandStop(long nftId)
      Check if Deed Tenant is started or commanded to be started
      Parameters:
      nftId - DEED NFT identifier
      Returns:
      true if the Tenant Provisioning status is START_CONFIRMED or START_IN_PROGRESS
    • isBlockchainNetworkValid

      public boolean isBlockchainNetworkValid(long networkId)
      Parameters:
      networkId - Blockchain Network identifier to check
      Returns:
      true if Network is valid else return false
    • getBlockchainNetworkId

      public long getBlockchainNetworkId()
      Returns:
      Blockchain network identifier
    • saveDeedTenant

      public DeedTenant saveDeedTenant(DeedTenant deedTenant)
      Stores Tenant information
      Parameters:
      deedTenant - DeedTenant
      Returns:
      DeedTenant