Hi,
I write the code for create new tasks:
package com.sap.uwl;
import com.sapportals.portal.prt.component.*;
import com.sap.netweaver.bc.uwl.*;
import com.sapportals.portal.prt.runtime.PortalRuntime;
import com.sap.security.api.IUser;
import com.sap.netweaver.bc.uwl.connect.*;
import java.util.*;
public class UWL_test_task extends AbstractPortalComponent
{
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
{
IUWLService uwlService = (IUWLService) PortalRuntime.getRuntimeResources().getService(IUWLService.ALIAS_KEY);
UWLContext myContext = new UWLContext();
try {
IUser user = request.getUser();
myContext.setUser(user);
uwlService.beginSession(myContext,600);
}catch (UWLException e) {
response.write(e.getLocalizedMessage());
}
try {
IPushChannel pushchannel = uwlService.getPushChannel();
IProviderConnector procon = uwlService.getRegisterProviderConnector(IProviderConnector.ADHOC_WORKFLOW_CONNECTOR_ID);
Item item =new Item(
IProviderConnector.ADHOC_WORKFLOW_CONNECTOR_ID,
IProviderConnector.ADHOC_WORKFLOW_SYSTEM,""+new Date().getTime(),
request.getUser().getUniqueID()
);
item.setDescription("Descripcion");
item.setUser(request.getUser().getUniqueID());
item.setSubject("Subject");
item.setItemType(ItemType.UWL_ITEM_NOTIFICATION);
item.setCreatedDate(new Date());
item.setCreatorId(request.getUser().getUniqueID());
item.setStatus(StatusEnum.NEW);
Set users = new HashSet();
users.add(request.getUser().getUniqueID());
pushchannel.pushSharedItem(procon, item, users);
response.write("<br>UWL item created");
} catch (UWLException ex) {
response.write(ex.getLocalizedMessage());
} catch(PortalComponentException exp) {
response.write("I think now I caught you :(");
}
}
}
You can see new tasks in the tab Notification...
But... there is a problem, i can delete it... why?
Thanks in advance,
Regards,