Interface ProvenanceAPI

  • All Known Implementing Classes:
    ProvenanceImpl

    public interface ProvenanceAPI
    Exposes the Public API related with Provenance
    • Method Detail

      • used

        boolean used​(String provenanceId,
                     DID did,
                     String agentId,
                     String activityId,
                     String signature,
                     String attributes)
              throws ProvenanceException
        Implements the W3C PROV Usage action
        Parameters:
        provenanceId - Provenance ID
        did - Identifier of the entity created
        agentId - Agent Identifier
        activityId - Identifier of the activity creating the new entity
        signature - Signature (optional) provided by the agent involved
        attributes - Attributes associated with the action
        Returns:
        true if the provenance event was registered correctly
        Throws:
        ProvenanceException - Error registering the event
      • wasDerivedFrom

        boolean wasDerivedFrom​(String provenanceId,
                               DID newEntityDid,
                               DID usedEntityDid,
                               String agentId,
                               String activityId,
                               String attributes)
                        throws ProvenanceException
        Implements the W3C PROV Derivation action
        Parameters:
        provenanceId - Provenance ID
        newEntityDid - Identifier of the new entity derived
        usedEntityDid - Identifier of the entity used to derive the new entity
        agentId - Agent Identifier
        activityId - Identifier of the activity creating the new entity
        attributes - Attributes associated with the action
        Returns:
        true if the provenance event was registered correctly
        Throws:
        ProvenanceException - Error registering the event
      • wasAssociatedWith

        boolean wasAssociatedWith​(String provenanceId,
                                  DID did,
                                  String agentId,
                                  String activityId,
                                  String attributes)
                           throws ProvenanceException
        Implements the W3C PROV Association action
        Parameters:
        provenanceId - Provenance ID
        did - Identifier of the entity created
        agentId - Agent Identifier
        activityId - Identifier of the activity creating the new entity
        attributes - Attributes associated with the action
        Returns:
        true if the provenance event was registered correctly
        Throws:
        ProvenanceException - Error registering the event
      • actedOnBehalf

        boolean actedOnBehalf​(String provenanceId,
                              DID did,
                              String delegateAgentId,
                              String responsibleAgentId,
                              String activityId,
                              String signature,
                              String attributes)
                       throws ProvenanceException
        Implements the W3C PROV Delegation action
        Parameters:
        provenanceId - Provenance ID
        did - Identifier of the entity created
        delegateAgentId - Delegate Agent Identifier
        responsibleAgentId - Responsible Agent Identifier
        activityId - Identifier of the activity creating the new entity
        signature - Signature provided by the delegated agent
        attributes - Attributes associated with the action
        Returns:
        true if the provenance event was registered correctly
        Throws:
        ProvenanceException - Error registering the event
      • getProvenanceEntry

        ProvenanceEntry getProvenanceEntry​(String provenanceId)
                                    throws ProvenanceException
        Fetch from the on-chain Provenance registry the information about one provenance event, given a provenance id
        Parameters:
        provenanceId - unique identifier of the provenance entry
        Returns:
        ProvenanceEntry object with all the information stored on-chain
        Throws:
        ProvenanceException - Error fetching the data
      • isProvenanceDelegate

        boolean isProvenanceDelegate​(DID did,
                                     String delegate)
                              throws ProvenanceException
        Indicates if an address is a provenance delegate for a given DID
        Parameters:
        did - Identifier of the asset
        delegate - address of the delegate
        Returns:
        true if the address is a provenance delegate
        Throws:
        ProvenanceException - Error fetching the data
      • addDIDProvenanceDelegate

        boolean addDIDProvenanceDelegate​(DID did,
                                         String delegate)
                                  throws ProvenanceException
        Adds an address as delegate for a given DID
        Parameters:
        did - Identifier of the asset
        delegate - address of the delegate
        Returns:
        true if the address was added as a delegate for the DID given
        Throws:
        ProvenanceException - Error fetching the data
      • removeDIDProvenanceDelegate

        boolean removeDIDProvenanceDelegate​(DID did,
                                            String delegate)
                                     throws ProvenanceException
        Remove an address as delegate for a given DID
        Parameters:
        did - Identifier of the asset
        delegate - address of the delegate
        Returns:
        true if the address was removed as a delegate for the DID given
        Throws:
        ProvenanceException - Error fetching the data
      • getProvenanceOwner

        String getProvenanceOwner​(String provenanceId)
                           throws ProvenanceException
        Adds an address as delegate for a given DID
        Parameters:
        provenanceId - unique identifier of the provenance entry
        Returns:
        String with the address owning the provenance entry
        Throws:
        ProvenanceException - Error fetching the data
      • getDIDProvenanceEvents

        List<ProvenanceEvent> getDIDProvenanceEvents​(DID did)
                                              throws ProvenanceException
        Search for ProvenanceAttributeRegistered events related with a specific DID
        Parameters:
        did - Identifier of the entity we are looking provenance events
        Returns:
        List of ProvenanceEvents found
        Throws:
        ProvenanceException - DDOException