on 06-10-2011 2:52 PM
Hi Everyone,
We are trying to get the task Items of a user from a custom webdynpro application, but while calling the itemManager.getItems(uwlContext, null, null) method... Web Dynpro application's sap.authentication setting is set to true and it do requires user logon.
One funny thing is, if we deploy&run the application from NWDS, logon using the provided screen we get the exception. But if we re-deploy&run the application from NWDS not closing the previews application tab on IE, it do work and give us the task Items of the user...
Thanks for your time and answers.
Best Regards,
Utku
try {
// lookup UWL service
IUWLService uwlService = (IUWLService) WDPortalUtils
.getServiceReference(IUWLService.ALIAS_KEY);
// create UWL context
UWLContext uwlContext = new UWLContext();
// find logged in user.
user = WDClientUser.getCurrentUser().getSAPUser();
Locale locale = Locale.getDefault();
if (user.getLocale() != null){
locale = user.getLocale();
}
uwlContext.setUser(user);
uwlContext.setLocale(locale);
// begin session
IUWLSession uwlSession;
uwlSession = uwlService.beginSession(uwlContext, sessionIdleTimeout);
uwlContext.setSession(uwlSession);
uwlContext.setAllowBackEndConnections(true);
// iterate over all UWL items
IUWLItemManager itemManager = uwlService.getItemManager(uwlContext);
QueryResult result = itemManager.getItems(uwlContext, null, null);
ItemCollection items = result.getItems();
Item item = null;
String foundItems = Integer.toString(items.size());
wdComponentAPI.getMessageManager().reportSuccess(foundItems);
for (int i = 0; i < items.size(); i++) {
item = items.get(i);
description = item.getDescription();
executionURL = WDURLGenerator.getApplicationURL(
BPM_TASK_COMP_NAME, BPM_TASK_PART_NAME, item
.getAttributes());
if (executionURL != null) {
wdComponentAPI.getMessageManager().reportSuccess(
messageString("Execution URL: ", executionURL));
}
}
// end session
uwlService.endSession(uwlContext);
} catch (UWLException e) {
e.printStackTrace();
}
Hello, dear!
I have implemented my own custom UWL list with task filter. Here you are source code:
public void getWorkItems( ) {
//@@begin getWorkItems()
try
{
IUWLService uwlService = (IUWLService)WDPortalUtils.getServiceReference(IUWLService.ALIAS_KEY);
UWLContext myContext = new UWLContext();
IWDClientUser user = WDClientUser.getLoggedInClientUser();
IUser currentUser = user.getSAPUser();
myContext.setUser(currentUser);
myContext.setLocale(user.getLocale());
uwlService.beginSession(myContext,60);
IUWLSession mySession = uwlService.getUwlSessionForWebDynproClient(myContext);
IUWLItemManager itemMan = uwlService.getItemManager(myContext);
//choose task by subject text
Expression exp = new Expression(Item.SUBJECT,"Fill Name Age OK", ComparatorEnum.EQUAL_TO);
ArrayList expList = new ArrayList();
expList.add(exp);
CompoundExpression compExp = new CompoundExpression(expList, null,null,false);
QueryResult result = itemMan.getItemsForItemType(myContext,ItemType.UWL_ITEM_TASK , null, compExp);
ItemCollection coll = result.getItems();
List l = coll.list();
Iterator iter = l.iterator();
while (iter.hasNext()) {
Item item = (Item)iter.next();
IPrivateASHYPKOV_CustomUWLCompView.IApprovalInboxElement data = wdContext.nodeApprovalInbox().createApprovalInboxElement();
data.setItem(item);
data.setDescription(item.getDescription());
data.setSubject(item.getSubject());
if(!(item.getStatus()!=null))
{
data.setStatus("NotAvailable");
}
else
{
data.setStatus(item.getStatus().getText());
}
data.setCreatedDate(item.getCreatedDate().toString());
data.setCreatorId(item.getCreatorId());
data.setLaunchItem(itemMan.getActionUrl(myContext, item.getInternalId(), "launchSAPAction"));
wdContext.nodeApprovalInbox().addElement(data);
}
}
catch(UWLException e) {
//printError(e.toString());
}
catch(Exception e){
//printError(e.toString());
}
//@@end
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.