Class AgreementsManager

    • Field Detail

      • log

        private static final org.apache.logging.log4j.Logger log
    • Constructor Detail

      • AgreementsManager

        public AgreementsManager​(io.keyko.common.web3.KeeperService keeperService,
                                 MetadataApiService metadataApiService)
    • Method Detail

      • getInstance

        public static AgreementsManager getInstance​(io.keyko.common.web3.KeeperService keeperService,
                                                    MetadataApiService metadataApiService)
        Given the KeeperService and MetadataApiService, returns a new instance of AgreementsManager using them as attributes
        Parameters:
        keeperService - Keeper Dto
        metadataApiService - Provider Dto
        Returns:
        AgreementsManager
      • createAccessAgreement

        public Boolean createAccessAgreement​(String agreementId,
                                             DDO ddo,
                                             List<byte[]> conditionIds,
                                             String accessConsumer,
                                             Service service)
                                      throws Exception
        Create an agreement using the escrowAccessSecretStoreTemplate. This method should be more specific in the future when we have more than one template.
        Parameters:
        agreementId - the agreement id
        ddo - the ddo
        conditionIds - list with the conditions ids
        accessConsumer - eth address of the consumer of the agreement.
        service - an instance of Service
        Returns:
        a flag that is true if the agreement was successfully created.
        Throws:
        Exception - exception
      • createComputeAgreement

        public Boolean createComputeAgreement​(String agreementId,
                                              DDO ddo,
                                              List<byte[]> conditionIds,
                                              String accessConsumer,
                                              Service service)
                                       throws Exception
        Create an agreement using the escrowComputeExecutionTemplate. This method should be more specific in the future when we have more than one template.
        Parameters:
        agreementId - the agreement id
        ddo - the ddo
        conditionIds - list with the conditions ids
        accessConsumer - eth address of the consumer of the agreement.
        service - an instance of Service
        Returns:
        a flag that is true if the agreement was successfully created.
        Throws:
        Exception - exception
      • getAgreement

        public Agreement getAgreement​(String agreementId)
                               throws Exception
        Retrieve the agreement for a agreement_id.
        Parameters:
        agreementId - id of the agreement
        Returns:
        Agreement
        Throws:
        Exception - Exception
      • getStatus

        public AgreementStatus getStatus​(String agreementId)
                                  throws Exception
        Get the status of a service agreement.
        Parameters:
        agreementId - id of the agreement
        Returns:
        AgreementStatus with condition status of each of the agreement's conditions.
        Throws:
        Exception - Exception
      • getConditionNameByAddress

        private String getConditionNameByAddress​(String address)
                                          throws Exception
        Auxiliar method to get the name of the different conditions address.
        Parameters:
        address - contract address
        Returns:
        string
        Throws:
        Exception - exception
      • getConsumerAssets

        public List<DID> getConsumerAssets​(String consumerAddress)
                                    throws ServiceException
        List of Asset objects purchased by consumerAddress
        Parameters:
        consumerAddress - ethereum address of consumer
        Returns:
        list of dids
        Throws:
        ServiceException - ServiceException