public class

ServiceSourceConnector

extends Object
java.lang.Object
   ↳ org.mule.module.servicesource.ServiceSourceConnector
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

ServiceSource Cloud Connector. The ServiceSource Connector will allow to use the ServiceSource REST API. Almost every operation that can be done via the API can be done through this connector.

Summary

Fields
private WebResource analysisResource
private RestCaller analysisRestCaller
private String analysisUrl The relative URL where the analysis API calls are made
private WebResource apiResource
private RestCaller apiRestCaller
private String apiUrl The relative URL where the main API calls are made.
private Client client Jersey Client
private String csrfToken CSRF Token
private Gson gson Gson instance to handle json marshalling/unmarshalling
private String loginUrl The relative url of the endpoint that handles login
private String password Application password
private String server URL of the ServiceSource server API
private String tenantName Name of the tenant
private String username Application username
Public Constructors
ServiceSourceConnector()
Public Methods
AnalysisObject analysisSearch(AnalysisCollection collection, Map<String, Object> filters)
This method allows searching on the analysis API.
void completeDataLoad(CollectionSummary summary, String dataLoadJobId)
This processor must be invoked to indicatethat the data load job has completed.
void connect(String username, String password, String server, String tenantName)
Connect
String connectionId()
Connection Identifier
ServiceSourceEntity create(ServiceSourceCollection collection, ServiceSourceEntity entity)
Generic method to create entities in dynamic collections
Address createAddress(Address address)
Creates new address
Asset createAsset(Asset asset)
Creates a new Asset
Booking createBooking(Booking booking)
Creates a new Booking
Contact createContact(Contact contact)
Creates new contact
Forecast createForecast(Forecast forecast)
Creates a new forecast
Lookup createLookup(Lookup lookup)
Creates a new lookup
Note createNote(Note note)
Creates a new note
Offer createOffer(Offer offer)
Creates new offer
Opportunity createOpportunity(Opportunity opportunity)
Creates a new opportunity
Product createProduct(Product product)
Creates a new Product
Quote createQuote(Quote quote)
Creates a new Quote
Task createTask(Task task)
Creates a new Task
void delete(ServiceSourceCollection collection, String objectId)
Removes the object from the collection, permitting reference checks.
void disconnect()
Disconnect
List<ServiceSourceEntity> export(ServiceSourceCollection collection, boolean streaming, List<String> columns)
Export a collection.
String getAnalysisUrl()
String getApiUrl()
String getCsrfToken()
List<Map<String, Object>> getExtensionAttributes()
Returns metadata about the tenant's extensions Provides the extension attributes for the tenant.
List<String> getListOfCollections()
Get the List of Collections Provides a list of collections available for the tenant along with the model metadata that describes the properties and methods.
List<Map<String, Object>> getListOfModels()
Get the List of Models Provides a list of all models for the tenant that describes the properties and methods.
String getLoginUrl()
List<Map<String, Object>> getModelSchema(ServiceSourceCollection collection)
Get the Model Schema Provides the properties of the input model for the tenant.
String getPassword()
String getServer()
String getTenantName()
String getUsername()
void init()
This method initiates the ServiceSource client and gson
List<Object> invokeObjectMethod(ServiceSourceCollection collection, String objectId, String method, Map<String, Object> parameters)
Executes a method on the object of a collection.
List<Object> invokeStaticMethod(ServiceSourceCollection collection, String method, Map<String, Object> parameters)
Invoke Static Method Executes a static method on the collection.
boolean isConnected()
Are we connected
List<ServiceSourceEntity> loadData(List<ServiceSourceEntity> objects, ServiceSourceCollection collection, String dataLoadJobId)
Pushes data through the load API.
List<ServiceSourceEntity> query(ServiceSourceCollection collection, String query)
This method provides basic search capabilities through a collection by providing a mongo formatted query.
ServiceSourceEntity read(ServiceSourceCollection collection, String objectId)
Generic method to read entities from dynamic collections
Address readAddress(String objectId)
Fetches the address identified by the object id.
Asset readAsset(String objectId)
Fetches the Asset identified by the object id.
Booking readBooking(String objectId)
Fetches the Booking identified by the object id.
Contact readContact(String objectId)
Fetches the contact identified by the object id.
Forecast readForecast(String objectId)
Fetches the forecast identified by the object id.
Note readNote(String objectId)
Fetches the note identified by the object id.
Offer readOffer(String objectId)
Fetches the offer identified by the object id.
Opportunity readOpportunity(String objectId)
Fetches the opportunity identified by the object id.
Product readProduct(String objectId)
Fetches the Product identified by the object id.
Quote readQuote(String objectId)
Fetches the Quote identified by the object id.
Task readTask(String objectId)
Fetches the Task identified by the object id.
List<ServiceSourceEntity> search(ServiceSourceCollection collection, Map<String, Object> filters, boolean streaming, List<String> columns, int limit)
This method provides search capabilities by specifying filters through a map.
void setAnalysisUrl(String analysisUrl)
void setApiUrl(String apiUrl)
void setCsrfToken(String csrfToken)
void setLoginUrl(String loginUrl)
void setPassword(String password)
void setServer(String server)
void setTenantName(String tenantName)
void setUsername(String username)
DataLoad startDataLoad(DataLoad dataLoad)
Starts a Data Load by creating an entry in the data load collection.
ServiceSourceEntity update(ServiceSourceCollection collection, String objectId, ServiceSourceEntity entity)
Generic method to update entities from dynamic collections
Address updateAddress(String objectId, Address address)
Updates an address
Asset updateAsset(String objectId, Asset asset)
Updates an Asset
Booking updateBooking(String objectId, Booking booking)
Updates a Booking
Contact updateContact(String objectId, Contact contact)
Updates a given contact
Forecast updateForecast(String objectId, Forecast forecast)
Updates a forecast
Note updateNote(String objectId, Note note)
Updates a given note
Offer updateOffer(String objectId, Offer offer)
Updates an offer
Opportunity updateOpportunity(String objectId, Opportunity opportunity)
Updates an opportunity
Product updateProduct(String objectId, Product product)
Updates a Product
Quote updateQuote(String objectId, Quote quote)
Updates a Quote
Task updateTask(String objectId, Task task)
Updates a Task
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private WebResource analysisResource

private RestCaller analysisRestCaller

private String analysisUrl

The relative URL where the analysis API calls are made

private WebResource apiResource

private RestCaller apiRestCaller

private String apiUrl

The relative URL where the main API calls are made.

private Client client

Jersey Client

private String csrfToken

CSRF Token

private Gson gson

Gson instance to handle json marshalling/unmarshalling

private String loginUrl

The relative url of the endpoint that handles login

private String password

Application password

private String server

URL of the ServiceSource server API

private String tenantName

Name of the tenant

private String username

Application username

Public Constructors

public ServiceSourceConnector ()

Public Methods

public AnalysisObject analysisSearch (AnalysisCollection collection, Map<String, Object> filters)

This method allows searching on the analysis API.

Parameters
collection The collection to query
filters Map that includes filters
Returns
  • the actual type of the return value depends on the provided collection, but it will be an implementation of AnalysisObject

public void completeDataLoad (CollectionSummary summary, String dataLoadJobId)

This processor must be invoked to indicatethat the data load job has completed. This call must be made after all the in-progress load calls complete. The done API can optionally contain summary statistics about the loaded data organized by input source.

Parameters
summary An instance of CollectionSummary with optional summary information about the data loaded
dataLoadJobId The id of the data load job.

public void connect (String username, String password, String server, String tenantName)

Connect

Parameters
username Application username
password Application password
server URL of the SRPS server API
tenantName Name of the tenant
Throws
ConnectionException .

public String connectionId ()

Connection Identifier

public ServiceSourceEntity create (ServiceSourceCollection collection, ServiceSourceEntity entity)

Generic method to create entities in dynamic collections

Parameters
collection A member of the ServiceSourceCollection enum representing the collection that owns the entity
entity A subclass instance of ServiceSourceEntity
Returns

public Address createAddress (Address address)

Creates new address

Parameters
address A Address
Returns
  • a Address representing the newly created address

public Asset createAsset (Asset asset)

Creates a new Asset

Parameters
asset A org.mule.module.servicesource.model.Asset
Returns
  • a org.mule.module.servicesource.model.Asset representing the newly created Asset

public Booking createBooking (Booking booking)

Creates a new Booking

Parameters
booking A org.mule.module.servicesource.model.Booking
Returns
  • a org.mule.module.servicesource.model.Booking representing the newly created Booking

public Contact createContact (Contact contact)

Creates new contact

Parameters
contact A Contact
Returns
  • a Contact representing the newly created contact

public Forecast createForecast (Forecast forecast)

Creates a new forecast

Parameters
forecast A Forecast
Returns
  • a Forecast representing the newly created contact

public Lookup createLookup (Lookup lookup)

Creates a new lookup

Parameters
lookup A Lookup
Returns
  • a Lookup representing the newly created lookup

public Note createNote (Note note)

Creates a new note

Parameters
note A Note
Returns
  • a Contact representing the newly created note

public Offer createOffer (Offer offer)

Creates new offer

Parameters
offer A Offer
Returns
  • a Offer representing the newly created offer

public Opportunity createOpportunity (Opportunity opportunity)

Creates a new opportunity

Parameters
opportunity A Opportunity
Returns
  • a Opportunity representing the newly created opportunity

public Product createProduct (Product product)

Creates a new Product

Parameters
product A org.mule.module.servicesource.model.Product
Returns
  • a org.mule.module.servicesource.model.Product representing the newly created Product

public Quote createQuote (Quote quote)

Creates a new Quote

Parameters
quote A org.mule.module.servicesource.model.Quote
Returns
  • a org.mule.module.servicesource.model.Quote representing the newly created Quote

public Task createTask (Task task)

Creates a new Task

Parameters
task A org.mule.module.servicesource.model.Task
Returns
  • a org.mule.module.servicesource.model.Task representing the newly created task

public void delete (ServiceSourceCollection collection, String objectId)

Removes the object from the collection, permitting reference checks.

Parameters
collection The name of the collection
objectId Id of the object to delete.

public void disconnect ()

Disconnect

public List<ServiceSourceEntity> export (ServiceSourceCollection collection, boolean streaming, List<String> columns)

Export a collection. You can optionally specify the columns you want to export and whether or not to use streaming

Parameters
collection The collection to query
streaming Wether or not use streaming
columns List of string specifying the columns to return
Returns
  • A List of objects that matched the criteria. The actual type of those objects depends on the provided collection but will be a subclass of ServiceSourceEntity

public String getAnalysisUrl ()

public String getApiUrl ()

public String getCsrfToken ()

public List<Map<String, Object>> getExtensionAttributes ()

Returns metadata about the tenant's extensions Provides the extension attributes for the tenant.

Returns
  • The extension attributes metadata as a list of maps

public List<String> getListOfCollections ()

Get the List of Collections Provides a list of collections available for the tenant along with the model metadata that describes the properties and methods.

Returns
  • The list of collections

public List<Map<String, Object>> getListOfModels ()

Get the List of Models Provides a list of all models for the tenant that describes the properties and methods. The list includes models linked to method inputs as well as component models that are included in the collection models.

Returns
  • the metadata as a list of maps

public String getLoginUrl ()

public List<Map<String, Object>> getModelSchema (ServiceSourceCollection collection)

Get the Model Schema Provides the properties of the input model for the tenant.

Parameters
collection The name of the model
Returns
  • The model schema

public String getPassword ()

public String getServer ()

public String getTenantName ()

public String getUsername ()

public void init ()

This method initiates the ServiceSource client and gson

Throws
MuleException

public List<Object> invokeObjectMethod (ServiceSourceCollection collection, String objectId, String method, Map<String, Object> parameters)

Executes a method on the object of a collection.

Parameters
collection The collection the object belongs to
objectId Id of the object.
method The object method to be invoked.
parameters The parameters for the specified method.
Returns
  • a list of objects returned by the invokation

public List<Object> invokeStaticMethod (ServiceSourceCollection collection, String method, Map<String, Object> parameters)

Invoke Static Method Executes a static method on the collection. These methods can perform actions across multiple objects.

Parameters
collection The name of the collection
method The static method to be invoked.
parameters The parameters for the specified method.
Returns
  • a list of objects returned by the invokation

public boolean isConnected ()

Are we connected

public List<ServiceSourceEntity> loadData (List<ServiceSourceEntity> objects, ServiceSourceCollection collection, String dataLoadJobId)

Pushes data through the load API. The ID of the data load job must be included as input. Each invocation of the load API provides data for a single collection and parallel calls can be made to push data to multiple collections. The object content can be deduced from the data dictionary, metadata API or by fetching a pre-existing object using the object fetch API.

Parameters
objects A list with instances of ServiceSourceEntity all belonging to the same collection
collection A member of the ServiceSourceCollection enum representing the collection that owns the entities
dataLoadJobId The id of the data load job.
Returns

public List<ServiceSourceEntity> query (ServiceSourceCollection collection, String query)

This method provides basic search capabilities through a collection by providing a mongo formatted query. Take in count that the query is sent as a query param so per http protocol limitations there's a limit on the amount of characters that it can have. To post large filters use search instead.

Parameters
collection The collection to query
query A mongo formatted query
Returns
  • A List of objects that matched the query. The actual type of those objects depends on the provided collection but will be a subclass of ServiceSourceEntity

public ServiceSourceEntity read (ServiceSourceCollection collection, String objectId)

Generic method to read entities from dynamic collections

Parameters
collection A member of the ServiceSourceCollection enum representing the collection that owns the entity
objectId The id of the entity you want to get
Returns

public Address readAddress (String objectId)

Fetches the address identified by the object id.

Parameters
objectId Id of the object to read.
Returns

public Asset readAsset (String objectId)

Fetches the Asset identified by the object id.

Parameters
objectId Id of the object to read.
Returns
  • an instance of org.mule.module.servicesource.model.forecast.Asset

public Booking readBooking (String objectId)

Fetches the Booking identified by the object id.

Parameters
objectId Id of the object to read.
Returns
  • an instance of org.mule.module.servicesource.model.forecast.Booking

public Contact readContact (String objectId)

Fetches the contact identified by the object id.

Parameters
objectId Id of the object to read.
Returns

public Forecast readForecast (String objectId)

Fetches the forecast identified by the object id.

Parameters
objectId Id of the object to read.
Returns

public Note readNote (String objectId)

Fetches the note identified by the object id.

Parameters
objectId Id of the object to read.
Returns
  • an instance of Note

public Offer readOffer (String objectId)

Fetches the offer identified by the object id.

Parameters
objectId Id of the object to read.
Returns

public Opportunity readOpportunity (String objectId)

Fetches the opportunity identified by the object id.

Parameters
objectId Id of the object to read.
Returns

public Product readProduct (String objectId)

Fetches the Product identified by the object id.

Parameters
objectId Id of the object to read.
Returns
  • an instance of org.mule.module.servicesource.model.forecast.Product

public Quote readQuote (String objectId)

Fetches the Quote identified by the object id.

Parameters
objectId Id of the object to read.
Returns
  • an instance of org.mule.module.servicesource.model.forecast.Quote

public Task readTask (String objectId)

Fetches the Task identified by the object id.

Parameters
objectId Id of the object to read.
Returns
  • an instance of org.mule.module.servicesource.model.forecast.Task

public List<ServiceSourceEntity> search (ServiceSourceCollection collection, Map<String, Object> filters, boolean streaming, List<String> columns, int limit)

This method provides search capabilities by specifying filters through a map. The advantage of using this processor over query is that you can now use a map to visually add the filters and you don't risk exceeding the max length of the query params since the filters are sent as a post.

Parameters
collection The collection to query
filters Map that includes filters
streaming Wheter or not to do streaming
columns An optional list of columns to return. Use this to only return the fields you're interested while reducing network traffic
limit The max number of results to return. If you want to have no limit then pass -1
Returns
  • A List of objects that matched the criteria. The actual type of those objects depends on the provided collection but will be a subclass of ServiceSourceEntity

public void setAnalysisUrl (String analysisUrl)

Parameters
analysisUrl

public void setApiUrl (String apiUrl)

Parameters
apiUrl

public void setCsrfToken (String csrfToken)

Parameters
csrfToken

public void setLoginUrl (String loginUrl)

Parameters
loginUrl

public void setPassword (String password)

Parameters
password

public void setServer (String server)

Parameters
server

public void setTenantName (String tenantName)

Parameters
tenantName

public void setUsername (String username)

Parameters
username

public DataLoad startDataLoad (DataLoad dataLoad)

Starts a Data Load by creating an entry in the data load collection. The returned data load object contains an id field and the content of this field must be used in the load and done API call URLs.

Parameters
dataLoad An instance of DataLoad which specifies the name and relationships for the dataLoad
Returns
  • another instance of DataLoad which represents the created DataLoad object. It also includes the id you need to provide later on.

public ServiceSourceEntity update (ServiceSourceCollection collection, String objectId, ServiceSourceEntity entity)

Generic method to update entities from dynamic collections

Parameters
collection A member of the ServiceSourceCollection enum representing the collection that owns the entity
objectId The id of the entity you want to get
entity A subclass instance of ServiceSourceEntity with the entitie's new state
Returns

public Address updateAddress (String objectId, Address address)

Updates an address

Parameters
objectId Id of the object to update.
address The new state of the note as an instance of Address
Returns
  • The updated address as an instance of Address.

public Asset updateAsset (String objectId, Asset asset)

Updates an Asset

Parameters
objectId Id of the object to update.
asset The new state of the asset as an instance of Asset
Returns
  • The updated asset as an instance of Asset

public Booking updateBooking (String objectId, Booking booking)

Updates a Booking

Parameters
objectId Id of the object to update.
booking The new state of the booking as an instance of Booking
Returns
  • The updated booking as an instance of Booking

public Contact updateContact (String objectId, Contact contact)

Updates a given contact

Parameters
objectId Id of the object to update.
contact The new state of the contact as an instance of Contact
Returns
  • The updated contact as an instance of Contact

public Forecast updateForecast (String objectId, Forecast forecast)

Updates a forecast

Parameters
objectId Id of the object to update.
forecast The new state of the forecast as an instance of Forecast
Returns
  • The updated forecast as an instance of Forecast

public Note updateNote (String objectId, Note note)

Updates a given note

Parameters
objectId Id of the no to update.
note The new state of the note as an instance of Note
Returns
  • The updated note as an instance of Note.

public Offer updateOffer (String objectId, Offer offer)

Updates an offer

Parameters
objectId Id of the object to update.
offer The new state of the offer as an instance of Offer
Returns
  • The updated offer as an instance of Offer

public Opportunity updateOpportunity (String objectId, Opportunity opportunity)

Updates an opportunity

Parameters
objectId Id of the object to update.
opportunity The new state of the note as an instance of Opportunity
Returns

public Product updateProduct (String objectId, Product product)

Updates a Product

Parameters
objectId Id of the object to update.
product The new state of the product as an instance of Product
Returns
  • The updated product as an instance of Product

public Quote updateQuote (String objectId, Quote quote)

Updates a Quote

Parameters
objectId Id of the object to update.
quote The new state of the quote as an instance of Quote
Returns
  • The updated quote as an instance of Quote

public Task updateTask (String objectId, Task task)

Updates a Task

Parameters
objectId Id of the object to update.
task The new state of the task as an instance of Task
Returns
  • The updated task as an instance of Task