In this article, you will gain an understanding of how you can synchronize IBM Connections V5.0 community files and folders to client devices programmatically, by which you can broadcast files of various types. You will also learn how you can use IBM Connections APIs to fetch desired atom feed from its components and achieve the desired result
In our use case we will take an example of broadcast requirement of Branding & Marketing (customer stories/employee stories etc.), e-Learning and disseminating information on organization-wide initiatives in branches on large scrolling screens and videos on large-screen displays from bank head office based on the branch local language and business preferences.
Before you start, you must have following software installed:
- IBM Connections V5.0
- Eclipse IDE
- Social Business Toolkit
Consider following broadcast structure where we have IBM Connections community’s setup for different languages and need to synchronize files and folders from these communities to the specific branches.
To achieve this we will create an application which will be scheduled in the branch offices to run at specific time and synchronize the files and folders from the community.
Steps we will follow:
- Fetch my communities feed from IBM Connections
- Fetch files and folders feed from the individual community
- Download the files and folders to the device
- Fetch my communities feed from IBM Connections
The Social Business Toolkit SDK is a set of libraries and code samples that you use for connecting to the IBM Social Platform. We will use Social Business Toolkit for our development purpose.
Constructor for our class
public CommunityFilesDownload(String user, String password) throws ClientServicesException{
BasicEndpoint endpoint = createEndpoint(Messages.getString("CommunityFilesDownload.hostname"), user, password);
this.communityService = new CommunityService();
this.communityService.setEndpoint(endpoint);
}
Endpoint for the connections
private BasicEndpoint createEndpoint(String url, String user, String password) {
BasicEndpoint endpoint = new ConnectionsBasicEndpoint();
endpoint.setUrl(url);
endpoint.setUser(user);
endpoint.setPassword(password);
endpoint.setForceTrustSSLCertificate(true);
return endpoint;
}
CommunityFilesDownload connectionsService = new CommunityFilesDownload(userid, password);
application=runtimeFactory.initApplication("CommunityFilesDownload");
context = Context.init(application, null, null);
First get my communities
Map pageParameters = new HashMap(2);
int itemsPerPage = 10;
pageParameters.put("page", page + "");
pageParameters.put("ps", itemsPerPage + "");
EntityListcommunityList = connectionsService.getCommunityService().getMyCommunities(pageParameters);
|
- Fetch files and folders feed from the individual community
To fetch community folders feed you need to construct following URI
https://{connections-host}/files/basic/api/communitycollection/{community-id}/feed
To fetch individual community folder content you need to construct following URI
https://{connections-host}/files/basic/api/collection/{folder-uuid}/feed
for(Community community : communityList){
String folderFeedURL = communityFilesCollectionURL + community.getCommunityUuid() + "/feed?sK=updated&sO=dsc&category=collection&type=all";
…..
…..
…..
List entries = feed.getData().getEntries();
for(AtomEntry entry : entries){
…..
…..
Get the folder contents
String folderContents = connectionsHost + "/files/basic/api/collection/" + entry.getAsString("td:uuid") + "/feed?sK=added&sO=dsc&acls=true&collectionAcls=true&includeNotification=true&includePolicy=true";
…..
…..
Fetch atom feed using folderContents URI
…..
fetch media download URL from the feed
}
}
|
- Download the files and folders to the device
InputStream inputStream = filedownload.doGet(downloadURL).response().getResponse().getEntity().getContent();
IOUtils.copy(inputStream, output);
|
For more details on APIs and Query parameters used refer
http://www-10.lotus.com/ldd/lcwiki.nsf/xpViewCategories.xsp?lookupName=IBM%20Connections%205.0%20API%20Documentation
You can schedule this code to run at specific intervals from the branch offices and trigger the sync.
Additionally, you can also check for failed downloads as well as files which are deleted on the server side and take actions programmatically.
Overall architecture of the solution is as below:
You can schedule this code on PC on stick, which will trigger at the scheduled time and sync the community content to the device, which can be played on wide screen TV sets present at the branch offices.
These IBM Connections API as well as same logic can be used to develop an application to run on Android which you can run it on Android on stick which can be plugged to television sets.
For working sample code please refer the link here code
About author:
Sushant Naik is an IBM certified senior IT specialist (Portal and Collaboration) working with Lab services division of India Software Labs. His skills and interests include WebSphere Portal, Web Experience Factory, Lotus® Forms, Lotus® Connections, Lotus Sametime®, Java / JEE and Eclipse development. You can reach him at sushnaik@in.ibm.com.
References: