Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

This blog is a continuation of my previous blog [UWL Custom Connector Approach | ] (Part1) which gives the complete technical details regarding the development & integration steps involved in the UWL custom connectors.

*Procedure to Develop custom connector: </p><p align="justify">In NWDS, create a project of type UWL Custom Connector as shown in the following figure. </p><p align="justify">!https://weblogs.sdn.sap.com/weblogs/images/251804989/NewUWLPrj.JPG|height=469|alt=Project Creation|width=472|src=https://weblogs.sdn.sap.com/weblogs/images/251804989/NewUWLPrj.JPG|border=0!</p><p align="justify"> </p><p align="justify">After creating the project Project is created and the default skeleton of the code along with UWL Configuration (xml) file will be created as shown in the following figure.</p><p align="justify">!https://weblogs.sdn.sap.com/weblogs/images/251804989/UWLCode.JPG|height=375|alt=Code Skeleton|width=603|src=https://weblogs.sdn.sap.com/weblogs/images/251804989/UWLCode.JPG|border=0!</p><p align="justify">Place the 3<sup>rd</sup> party provider files in the lib folder of the project shown below. </p><p align="justify">!https://weblogs.sdn.sap.com/weblogs/images/251804989/UWLStruct.JPG|height=355|alt=Add Libraries|width=329|src=https://weblogs.sdn.sap.com/weblogs/images/251804989/UWLStruct.JPG|border=0</p><p align="justify">Define the types, views and actions in the UWL Configuration file as below.</p><p align="justify"> </p><p align="justify"><View name="ConnectorView" selectionMode="MULTISELECT" width="98%" supportedItemTypes="uwl.task.mytask" columnOrder="detailIcon, subject, creatorId, createdDate, status" sortby="creatorId:ascend, createdDate:descend" tableDesign="STANDARD" visibleRowCount="10" headerVisible="yes" queryRange="undefined" tableNavigationFooterVisible="yes" tableNavigationType="CUSTOMNAV" actionRef="" refresh="-1" dueDateSevere="0" dueDateWarning="0" emphasizedItems="new" displayOnlyDefinedAttributes="yes" dynamicCreationAllowed="yes" actionPosition="bottom"></p><p align="left"><Descriptions default="Connector View"/></p><p align="left"><DisplayAttributes/></p><p align="left"></View></p><p align="justify"> </p><p align="justify"> </p><p align="justify">UWL Connector Implementation:</p><p align="justify"> </p><p align="justify">public class UwlConnector implements IProviderConnector {</p><p align="left">private static final String CONNECTOR_ID = "ConnectorName";</p><p align="left">public String getId() {</p><p align="left">return ConnectorName.CONNECTOR_ID;</p><p align="left">}</p><p align="left">}</p><p align="justify"> </p><p align="justify">public ConnectorResult getItems(...) throws ConnectorException {</p><p align="left">ConnectorResult result = null;</p><p align="left">List items = null;</p><p align="left">if(ItemType.matchType(CONNECTOR_ITEM_TYPE,itemType)){</p><p align="left">Hashtable feeds = getTasks(context.getUserId()); // In this function definition implement the //logic to fetch the tasks from the provider </p><p align="left">// and map to UWL Item types</p><p align="left">items = ...; // fetch items from backend and map them ...</p><p align="left">} else if(ItemType.matchType(COMPLETED_ITEM_TYPE,itemType)){</p><p align="left">items = new ArrayList();</p><p align="left">}</p><p align="left">ProviderStatus status = new ProviderStatus(true, system,</p><p align="left">UwlConnector.CONNECTOR_ID);</p><p align="justify"> </p><p align="justify">When the UWL tries to fetch the tasks from the connector above getItems() method will be called. So we have to implement our logic here to fetch the tasks from the provider application and map the provider tasks to the UWL Item type.</p><p align="justify"> </p><p align="justify">Item uwlItem = new Item(</p><p align="left">UwlRssConnector.CONNECTOR_ID, //connectorId</p><p align="left">system, //systemId</p><p align="left">entry.getUri(), //externalId</p><p align="left">context.getUserId(), //userId</p><p align="left">-1, //attachment count</p><p align="left">entry.getPublishedDate(), //date created</p><p align="left">entry.getAuthor(), //creator id</p><p align="left">null, //due date</p><p align="left">null, //external object id</p><p align="left">ITEM_TYPE, //external type</p><p align="left">ITEM_TYPE, //item type</p><p align="left">PriorityEnum.LOW, //priority</p><p align="left">(itemStatus==null) ? StatusEnum.NEW : itemStatus, //status</p><p align="left">entry.getTitle() //subject</p><p align="left">);</p><p align="justify"> </p><p align="justify">Build and Deployment:</p><p align="justify">After implementing the logic, build the project and export the project as a PAR. Deploy the exported PAR file into the portal. </p><p align="justify">!https://weblogs.sdn.sap.com/weblogs/images/251804989/UWL Deploy.JPG|height=229|alt=Deploy PAR|width=690|src=https://weblogs.sdn.sap.com/weblogs/images/251804989/UWL Deploy.JPG|border=0!</body>

5 Comments