Class SocialAgentRegistration.Builder
java.lang.Object
com.janeirodigital.sai.core.resources.ReadableResource.Builder<T>
com.janeirodigital.sai.core.resources.CRUDResource.Builder<T>
com.janeirodigital.sai.core.agents.AgentRegistration.Builder<SocialAgentRegistration.Builder>
com.janeirodigital.sai.core.agents.SocialAgentRegistration.Builder
- Enclosing class:
- SocialAgentRegistration
public static class SocialAgentRegistration.Builder
extends AgentRegistration.Builder<SocialAgentRegistration.Builder>
Builder for
SocialAgentRegistration
instances.-
Field Summary
Fields inherited from class com.janeirodigital.sai.core.agents.AgentRegistration.Builder
accessGrantUri, registeredAgent, registeredAt, registeredBy, registeredWith, updatedAt
Fields inherited from class com.janeirodigital.sai.core.resources.ReadableResource.Builder
contentType, dataset, exists, jsonLdContext, resource, saiSession, unprotected, uri
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder
(URI uri, SaiSession saiSession) Initialize builder withuri
andsaiSession
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build theSocialAgentRegistration
using attributes from the Builder.getThis()
Ensures that we don't get an unchecked cast warning when returning from settersprotected void
Populates the Jena dataset graph with the attributes from the Builderprotected void
Populates the fields of theSocialAgentRegistration.Builder
based on the associated Jena resource.setDataset
(org.apache.jena.rdf.model.Model dataset) Set the Jena model and use it to populate attributes of theSocialAgentRegistration.Builder
.setReciprocalRegistration
(URI registrationUri) Set the Reciprocal Registration thatregisteredAgent
maintains for the social agent that owns the agent registry.Methods inherited from class com.janeirodigital.sai.core.agents.AgentRegistration.Builder
setAccessGrant, setRegisteredAgent, setRegisteredAt, setRegisteredBy, setRegisteredWith, setUpdatedAt
Methods inherited from class com.janeirodigital.sai.core.resources.ReadableResource.Builder
setContentType, setDataset, setJsonLdContext, setUnprotected
-
Constructor Details
-
Builder
Initialize builder withuri
andsaiSession
- Parameters:
uri
- URI of theSocialAgentRegistration
to buildsaiSession
-SaiSession
to assign
-
-
Method Details
-
getThis
Ensures that we don't get an unchecked cast warning when returning from setters- Specified by:
getThis
in classReadableResource.Builder<SocialAgentRegistration.Builder>
- Returns:
SocialAgentRegistration.Builder
-
setDataset
public SocialAgentRegistration.Builder setDataset(org.apache.jena.rdf.model.Model dataset) throws SaiException Set the Jena model and use it to populate attributes of theSocialAgentRegistration.Builder
. Assumption is made that the corresponding resource exists.- Overrides:
setDataset
in classReadableResource.Builder<SocialAgentRegistration.Builder>
- Parameters:
dataset
- Jena model to populate the Builder attributes with- Returns:
SocialAgentRegistration.Builder
- Throws:
SaiException
-
setReciprocalRegistration
Set the Reciprocal Registration thatregisteredAgent
maintains for the social agent that owns the agent registry.- Parameters:
registrationUri
- URI of the reciprocal social agent registration- See Also:
-
populateFromDataset
Populates the fields of theSocialAgentRegistration.Builder
based on the associated Jena resource.- Overrides:
populateFromDataset
in classAgentRegistration.Builder<SocialAgentRegistration.Builder>
- Throws:
SaiException
-
populateDataset
protected void populateDataset()Populates the Jena dataset graph with the attributes from the Builder- Overrides:
populateDataset
in classAgentRegistration.Builder<SocialAgentRegistration.Builder>
-
build
Build theSocialAgentRegistration
using attributes from the Builder. If no Jena dataset has been provided, then the dataset will be populated using the attributes from the Builder withpopulateDataset()
.- Returns:
DataGrant
- Throws:
SaiException
-