Package io.keyko.nevermined.api.impl
Class ProvenanceImpl
- java.lang.Object
-
- io.keyko.nevermined.api.impl.ProvenanceImpl
-
- All Implemented Interfaces:
ProvenanceAPI
public class ProvenanceImpl extends Object implements ProvenanceAPI
Implementation of AssetsAPI
-
-
Field Summary
Fields Modifier and Type Field Description private NeverminedManagerneverminedManagerprivate ProvenanceManagerprovenanceManager
-
Constructor Summary
Constructors Constructor Description ProvenanceImpl(NeverminedManager neverminedManager, ProvenanceManager provenanceManager)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanactedOnBehalf(String provenanceId, DID did, String delegateAgentId, String responsibleAgentId, String activityId, String signature, String attributes)Implements the W3C PROV Delegation actionbooleanaddDIDProvenanceDelegate(DID did, String delegate)Adds an address as delegate for a given DIDList<ProvenanceEvent>getDIDProvenanceEvents(DID did)Search for ProvenanceAttributeRegistered events related with a specific DIDProvenanceEntrygetProvenanceEntry(String provenanceId)Fetch from the on-chain Provenance registry the information about one provenance event, given a provenance idList<ProvenanceEvent>getProvenanceMethodEvents(ProvenanceEntry.ProvenanceMethod method, DID did)Search for provenance methods (used, wasGeneratedBy, etc.) given a DIDStringgetProvenanceOwner(String provenanceId)Adds an address as delegate for a given DIDbooleanisProvenanceDelegate(DID did, String delegate)Indicates if an address is a provenance delegate for a given DIDbooleanremoveDIDProvenanceDelegate(DID did, String delegate)Remove an address as delegate for a given DIDbooleanused(String provenanceId, DID did, String agentId, String activityId, String signature, String attributes)Implements the W3C PROV Usage actionbooleanwasAssociatedWith(String provenanceId, DID did, String agentId, String activityId, String attributes)Implements the W3C PROV Association actionbooleanwasDerivedFrom(String provenanceId, DID newEntityDid, DID usedEntityDid, String agentId, String activityId, String attributes)Implements the W3C PROV Derivation action
-
-
-
Field Detail
-
neverminedManager
private NeverminedManager neverminedManager
-
provenanceManager
private ProvenanceManager provenanceManager
-
-
Constructor Detail
-
ProvenanceImpl
public ProvenanceImpl(NeverminedManager neverminedManager, ProvenanceManager provenanceManager)
Constructor- Parameters:
neverminedManager- the neverminedManagerprovenanceManager- the provenanceManager
-
-
Method Detail
-
used
public boolean used(String provenanceId, DID did, String agentId, String activityId, String signature, String attributes) throws ProvenanceException
Description copied from interface:ProvenanceAPIImplements the W3C PROV Usage action- Specified by:
usedin interfaceProvenanceAPI- Parameters:
provenanceId- Provenance IDdid- Identifier of the entity createdagentId- Agent IdentifieractivityId- Identifier of the activity creating the new entitysignature- Signature (optional) provided by the agent involvedattributes- Attributes associated with the action- Returns:
- true if the provenance event was registered correctly
- Throws:
ProvenanceException- Error registering the event
-
wasDerivedFrom
public boolean wasDerivedFrom(String provenanceId, DID newEntityDid, DID usedEntityDid, String agentId, String activityId, String attributes) throws ProvenanceException
Description copied from interface:ProvenanceAPIImplements the W3C PROV Derivation action- Specified by:
wasDerivedFromin interfaceProvenanceAPI- Parameters:
provenanceId- Provenance IDnewEntityDid- Identifier of the new entity derivedusedEntityDid- Identifier of the entity used to derive the new entityagentId- Agent IdentifieractivityId- Identifier of the activity creating the new entityattributes- Attributes associated with the action- Returns:
- true if the provenance event was registered correctly
- Throws:
ProvenanceException- Error registering the event
-
wasAssociatedWith
public boolean wasAssociatedWith(String provenanceId, DID did, String agentId, String activityId, String attributes) throws ProvenanceException
Description copied from interface:ProvenanceAPIImplements the W3C PROV Association action- Specified by:
wasAssociatedWithin interfaceProvenanceAPI- Parameters:
provenanceId- Provenance IDdid- Identifier of the entity createdagentId- Agent IdentifieractivityId- Identifier of the activity creating the new entityattributes- Attributes associated with the action- Returns:
- true if the provenance event was registered correctly
- Throws:
ProvenanceException- Error registering the event
-
actedOnBehalf
public boolean actedOnBehalf(String provenanceId, DID did, String delegateAgentId, String responsibleAgentId, String activityId, String signature, String attributes) throws ProvenanceException
Description copied from interface:ProvenanceAPIImplements the W3C PROV Delegation action- Specified by:
actedOnBehalfin interfaceProvenanceAPI- Parameters:
provenanceId- Provenance IDdid- Identifier of the entity createddelegateAgentId- Delegate Agent IdentifierresponsibleAgentId- Responsible Agent IdentifieractivityId- Identifier of the activity creating the new entitysignature- Signature provided by the delegated agentattributes- Attributes associated with the action- Returns:
- true if the provenance event was registered correctly
- Throws:
ProvenanceException- Error registering the event
-
getProvenanceEntry
public ProvenanceEntry getProvenanceEntry(String provenanceId) throws ProvenanceException
Description copied from interface:ProvenanceAPIFetch from the on-chain Provenance registry the information about one provenance event, given a provenance id- Specified by:
getProvenanceEntryin interfaceProvenanceAPI- 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
public boolean isProvenanceDelegate(DID did, String delegate) throws ProvenanceException
Description copied from interface:ProvenanceAPIIndicates if an address is a provenance delegate for a given DID- Specified by:
isProvenanceDelegatein interfaceProvenanceAPI- Parameters:
did- Identifier of the assetdelegate- address of the delegate- Returns:
- true if the address is a provenance delegate
- Throws:
ProvenanceException- Error fetching the data
-
addDIDProvenanceDelegate
public boolean addDIDProvenanceDelegate(DID did, String delegate) throws ProvenanceException
Description copied from interface:ProvenanceAPIAdds an address as delegate for a given DID- Specified by:
addDIDProvenanceDelegatein interfaceProvenanceAPI- Parameters:
did- Identifier of the assetdelegate- 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
public boolean removeDIDProvenanceDelegate(DID did, String delegate) throws ProvenanceException
Description copied from interface:ProvenanceAPIRemove an address as delegate for a given DID- Specified by:
removeDIDProvenanceDelegatein interfaceProvenanceAPI- Parameters:
did- Identifier of the assetdelegate- 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
public String getProvenanceOwner(String provenanceId) throws ProvenanceException
Description copied from interface:ProvenanceAPIAdds an address as delegate for a given DID- Specified by:
getProvenanceOwnerin interfaceProvenanceAPI- Parameters:
provenanceId- unique identifier of the provenance entry- Returns:
- String with the address owning the provenance entry
- Throws:
ProvenanceException- Error fetching the data
-
getDIDProvenanceEvents
public List<ProvenanceEvent> getDIDProvenanceEvents(DID did) throws ProvenanceException
Description copied from interface:ProvenanceAPISearch for ProvenanceAttributeRegistered events related with a specific DID- Specified by:
getDIDProvenanceEventsin interfaceProvenanceAPI- Parameters:
did- Identifier of the entity we are looking provenance events- Returns:
- List of ProvenanceEvents found
- Throws:
ProvenanceException- DDOException
-
getProvenanceMethodEvents
public List<ProvenanceEvent> getProvenanceMethodEvents(ProvenanceEntry.ProvenanceMethod method, DID did) throws ProvenanceException
Description copied from interface:ProvenanceAPISearch for provenance methods (used, wasGeneratedBy, etc.) given a DID- Specified by:
getProvenanceMethodEventsin interfaceProvenanceAPI- Parameters:
method- Provenance methods to fetchdid- Identifier of the entity we are looking provenance events- Returns:
- List of ProvenanceEvents found
- Throws:
ProvenanceException- DDOException
-
-