Skip to main content

Simflofy Services Java Client

The Simflofy Services Java Client is used for connecting to and interact with Simflofy outside the application. This documentation will walk through the basics of the client, as well as provide examples of how to use it. The client is available in the Downloads section of Simflofy Launch.


Simflofy Client Components

These are the main two components for interacting with the Java Client Services.

Simflofy Config

Parameters
The Simflofy Config object provides the connection information and credentials to be used with the connection client. It can be configured with timeouts set or without.

Simflofy URL
String - The url to connect to the Simflofy Admin webapp (Default is http://localhost:8080/simflofy-admin)

Simflofy Username
String - The Username of the User to Authenticate to Simflofy Admin with (Default is "admin")

Simflofy Password
String - The Password of the User to Authenticate to Simflofy Admin with (Default is "admin")

Read Timeout
Int - The Amount of time in Milliseconds to wait before a read connection is terminated (Optional)

Connect Timeout
Int - The amount of time in Millisecond to wait before an attempted connection is terminated (Optional)

Simflofy Connection

Parameters
The Main Connection for the client. Used to get various information from the application as well as providing the underlying connection to the application for the other services.

Simflofy Config
SimflofyConfig - The Config Object use to determine connection and authentication information to connect to the application (Optional, as it can be set after creating the connection object)

User Agent
String - The User Agent Header Value to use when making requests (Optional: Default is "Mozilla/5.0")


Simflofy Client Services Components

These Service Components All take a Simflofy Connection Object as their parameter in order to make calls back to Simflofy.

Simflofy Connection
Can List Content Service Connections and their information as well as TSearch Templates and View Information.

Simflofy Admin
This Service Allows for Importing and Exporting Configuration to/from Simflofy. See the Documentation for examples of the Config objects.

Simflofy Analytics
This service allows for the retrieval of Search Audit Reports

Simflofy Repository
This Service interacts with Simflofy Content Service Connectors and provides access to the Content Services APIs. In addition to the Simflofy Connection Object, this takes a Simflofy Repository Info Object or a String of the intended Content Service Connector ID to use.

Simflofy Event Service
This Service allows for the pushing of a document ID to an event job.

Simflofy Job Service
This Services Allows for the interaction with Jobs. Starting, Stopping, Retrieval of Job status, and other operations

Simflofy Policy Service
This Service Allows for assigning Policies on an object in a Content Service Connector


Simflofy Objects

These Objects are used in the interaction with the services and client.

Document Version
This Object Represents a Document Version. It provides the Document ID of that Document, The Version ID, and The Version Series ID. It is used when interacting with the Simflofy Repository Service, for Content Services.

Simflofy Capability
This Enum provides the list of capabilities a Content Service Connector may have, when interacting with its source, through Simflofy. Not All Content Service Connectors may perform all actions available, so checking whether a Repository Object has the capability to perform the action first is important.

Simflofy Content Service Connection
This object is used as a cursory object when listing content service connection information from the Simflofy Connection Object.

Simflofy Edit Property
This Object is a representation of the property fields an object has. It is also used to update properties in their source system.

Simflofy File Item
This Object is a representation of an Object available from Content Services, and provides various metadata of the object from its source repository.

Simflofy Job Status
This Object is the representation of a Job in Simflofy, as well as the capabilities for interacting with a job.

Simflofy Property
This Object is returned from the content services get properties calls, for both document versions and get object properties.

Simflofy Repository Info
This Object contains the specific information about a content service connection, as well as its Capabilities and parameters.

Simflofy TSearch Template Info
This Object contains information about a TSearch template, including the page title, sections, widgets, display, and short name.

Simflofy TSearch View Info
This Object contains information about a TSearch view, including the content service connector id it uses, the template, owner, roles, display, and short name.


Exceptions

Simflofy Service Exception - If an error has occurred during the use of the java client, this Exception will be thrown.


Setting Up

Examples: Here are some example of how to set up and use the Simflofy Services Java Client.

Creating Simflofy Connection Object:

String simflofyUrl = "http://www.example.com/simflofy-admin";
String simflofyUserName = "accessUser";
String simflofyUserPassword = "accessUserPassword";

SimflofyConfig simflofyConfig = new SimflofyConfig(simflofyUrl, simflofyUserName, simflofyUserPassword);
SimflofyConnection simflofyConnection = new SimflofyConnection(simflofyConfig);

Getting Content Service Connection Information:
// Throws SimflofyServiceException

List(SimflofyContentServiceConnectionInfo) allContentServiceConnections = simflofyConnection.getContentServiceConnectionInfos();

SimflofyContentServiceConnectionInfo info = allContentServiceConnections.get(0);

[your code here to determine which info from the list to use]

// Throws SimflofyServiceException

SimflofyRepositoryInfo repositoryInfo = simflofyConnection.getRepositoryInfo(info.getConnectorId());


Content Services

Updating a File:

SimflofyRepository repository = new SimflofyRepository(repositoryInfo, simflofyConnection);

String fileName; // Name of file to update

String fileId; // ID of File Object to update

InputStream is; // Input Stream of Content to update file with

// In some cases the returned fileId will be a new file ID or the old file ID depending on how the source system handles updates.

String returnedFileId = repository.updateFile(fileName, fileId, is); //Throws SimflofyServiceException

Deleting a File:

String fileId; //ID of File to delete

repository.deleteFileAndVersionsById(fileId); // Throws SimflofyServiceException

// OR

repository.deleteFileById(fileId); // Throws SimflofyServiceException

Creating a File:

String fileName; //Name of file to create

String folderId; // ID of folder to create file in

String type; // Type of file to create

InputStream is; // Input Stream of content of file

String newFileId = repository.createFile(fileName, folderId, type, is); // Throws SimflofyServiceException

Getting a File's Content:

String fileId; // The id of the file whose content you want.

OutputStream outputStream; // Output Stream where the downloaded content is sent to.

repository.download(fileId, outputStream); // Throws Simflofy Service Exception

Getting a File's Properties:

String objectId; // The ID of the file/object to get properties from

List(SimflofyProperty) objectPropertyList = repository.getObjectProperties(objectId); //Throws SimflofyServiceException


Admin Service

Importing Config:

SimflofyAdmin simflofyAdmin = new SimflofyAdmin(simflofyConnection);

JSONObject importJSON; // The JSON Configuration to import (See Documentation for examples Configuration Tools)

simflofyAdmin.importBootstrapJSON(importJSON); //Throws SimflofyServiceException

// OR

String orgId; // The Org ID to import to

simflofyAdmin.importBootstrapJSON(importJSON, orgId); //Throws SimflofyServiceException

Exporting Config:

SimflofyAdmin simflofyAdmin = new SimflofyAdmin(simflofyConnection);

String orgId = "orgId"; // The Org ID to export

long jobId = 0L; // ID of Job to export

JSONObject exportJsonFull = simflofyAdmin.exportBootstrapJSON(); // Throws SimflofyServiceException

// OR

JSONObject exportJsonOrg = simflofyAdmin.exportBootstrapJSON(orgId); // Throws SimflofyServiceException

// OR

JSONObject exportJsonJob = simflofyAdmin.exportBootstrapJSON(jobId); // Throws SimflofyServiceException

// OR

JSONObject exportJsonOrgJob = simflofyAdmin.exportBootstrapJSON(orgId, jobId); // Throws SimflofyServiceException


Job Service

Starting a Job:

SimflofyJobService jobService = new SimflofyJobService(simflofyConnection);

long jobId; // Job ID of Job to start

boolean successfullStart = jobService.startJob(jobId); // Throws SimflofyServiceException

Getting a Job Status:

SimflofyJobService jobService = new SimflofyJobService(simflofyConnection);

long jobId; // Job ID of Job to get Status of

SimflofyJobStatus jobStatus = jobService.getJobStatus(jobId); // Throws SimflofyServiceException