Quantcast
Channel: SCN : Popular Discussions - SAP Enterprise Portal: Content Management and Collaboration
Viewing all articles
Browse latest Browse all 1826

Procedurally create Collaboration Tasks

$
0
0

Hi

 

I am trying to create a Collaboration Task via Java, in a standard AbstractPortalComponent.

 

The code Iu2019ve adapted from this [page|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/EP/Creating%2ba%2bUWL%2btask%2bby%2bCode.], seems to create a UWL Task.

 

The UWL Tasks (as viewable from pcd:portal_content/com.sap.pct/every_user/general/iViews/com.sap.coll.iviews/com.sap.netweaver.coll.uwl.uwl_iview iView), seems to be different to the Collaboration Tasks (as visible from the pcd:portal_content/com.sap.pct/every_user/general/iViews/com.sap.coll.iviews/com.sap.netweaver.coll.uwl.ui.uwlCollaboration iView)...

 

I would really like to know just how to create a Collaboration Task, that a user could see in his My Tasks iView under Collaboration.

 

Iu2019ve been researching this for a few days now, scouring the SDN, this forum, SAP PDFs, UWL API JavaDocs; and Iu2019m still no closer. I would really appreciate any assistance!!

 

The code Iu2019m using:

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response) {     IUWLService uwlService = (IUWLService)PortalRuntime.getRuntimeResources().getService(IUWLService.ALIAS_KEY);     UWLContext myContext = new UWLContext();     IUser user = request.getUser();     try {          myContext.setUser(user);          myContext.setOriginRequest(request);          myContext.setLocale(user.getLocale());          uwlService.beginSession(myContext, 600);     } catch (UWLException e) {          response.write(e.getLocalizedMessage());     }          try {          IPushChannel pushchannel = uwlService.getPushChannel();          IProviderConnector connectors[] = uwlService.getRegisteredProviderConnectors();                    int thisconnector = 0;          for (int i = 0; i < connectors.length; i++) {               if (connectors<i>.getId().equals(IProviderConnector.ADHOC_WORKFLOW_CONNECTOR_ID)){                    thisconnector = i;                    break;               }          }                    if (thisconnector > 0) {               Item item = new Item(                         IProviderConnector.ADHOC_WORKFLOW_CONNECTOR_ID,                         IProviderConnector.ADHOC_WORKFLOW_SYSTEM,                         "" + new Date().getTime(),                         user.getUniqueID());                                        item.setDescription("This is a procedurally created task!");               item.setUser(user.getUniqueID());               item.setSubject("Procedurally created task - " + new Date().getTime());               item.setItemType(ItemType.UWL_ITEM_TASK);               item.setCreatedDate(new Date());               item.setDueDate(new Date(new Date().getTime() + 24*60*60*1000)); //+24h               item.setCreatorId(user.getUniqueID());               item.setStatus(StatusEnum.NEW);               Set users = new HashSet();               users.add(user.getUniqueID());               pushchannel.pushSharedItem(connectors[thisconnector], item, users);                              response.write("<br>UWL item created");          } else {               response.write("Can't find a connector for AdHoc Workflow");          }     } catch (UWLException ex) {          response.write(ex.getLocalizedMessage());     } catch (Throwable t) {          response.write(t.getLocalizedMessage());     } finally {          try {               uwlService.endSession(myContext);          } catch (UWLException e2) {               e2.printStackTrace();          }     }
}

 

 

JARs linked:

bc.uwl.service.api_api.jar

 

SharingReference:

SAPJ2EE::library:tckmcbc.uwl~api

 

 

 

I have tried different constants available on ItemType, and IProviderConnector, without success.

I'm not sure if adding sufficient attributes to an Item, via the Item.addAttribute(...) method will somehow change it into a Collaboration Task, instead of a UWL Task??

 

There seems to be very little information on this topic... the API JavaDocs are very shallow.

 

Please help!!


Viewing all articles
Browse latest Browse all 1826

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>