Skip to Content

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>

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Amit Bagati
    I have also a similar requirement of implementing the UWL for non SAP items.Your blog is very helpful but i am stuck after creation of the UWL connector project since the details for library files and logic to fetch the work items is not clear.Kindly throw some light on those areas.It would be great if you could share the source code of custom connector built by you.Many Thanks in advance.

    amit bagati

    (0) 
  2. xinjiang li
    Hi,Shyam,

    Thanks for blog,it is very helpful.
    We are now developing a connector,but after successfully deploying par file into portal,there are no items exist.We have regeisted the connector,and the connector status in uwl is successful.Below is the code of getItems(..).We didn’t connect the provider but use the hard code.
      ——————-
      …
              List items =  new ArrayList();     
              
              Item item = new Item(
              getId(), //connectorId
              system, //systemId
              “dfdfdf”, //externalId
              “context.getUserId()”, //userId
              -1, //attachment count
              null, //date created
              null, //creator id
              null, //due date
              null, //external object id
              “uwl.task.pms”, //external type
              “uwl.task.pms”, //item type
              PriorityEnum.HIGH, //priority
              StatusEnum.NEW, //status
              “my subject” //subject
              );
              item.setDescription(“to do item”);
              item.setExecutionUrl(“http://172.16.126.36/index.asp“);     

              items.add(item);     

    ——————-

    Very appreciate your help.THanks in advance.

    (0) 
      1. xinjiang li
        Hi,Shyam,
        Thanks for your reply.
        I found the reason through adding log to defaulttrace file.The reason is I wrongly added quote in this parameter:
        “context.getUserId()”.

        But now there is another question:
        I create a web service system in portal->system administration->system configuration,and relate this system to my custom connector in UWL administration.Then how can I get the WSDL of web service system in getItems(..) function? The parameter “system” is only the alias of the system.
        Thanks in advance.

        (0) 
  3. xinjiang li
    Hi,shyam,

    You mentioned about “Place the 3rd party provider files in the lib folder of the project”.
    Except that,which configuration file we should modify to let the portal runtime know the location of jar files?

    Thanks in advance.

    (0) 

Leave a Reply