on 05-12-2008 5:43 AM
Hi,
I have tried to set the value retrieved from IGPStructureInfo into the ContextElement in execute method.
However, when I tried to retrieve the value in other method, I get a null.
For example:
execute (... ) {
this.executionContext = executionContext;
//Process the input parameters
IGPStructure input = executionContext.getInputStructure();
IGPStructure recommendStructure = input.getStructure("GP_IN");
//Retrieve data and set new values in the context
String A= recommendStructure.getAttributeAsString("I_A");
contextElement.setA(A);
}
Then In
public void wdDoInit()
{
...
String A = contextElement.getA("A");
// when i print the string A at this point, it is null
}
I am currently using CE7.1
Can help??? Thanks in advance
Please provide full code inside wdDoInit(). Has the execute() method already been called when you access the context attribute?
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
The full code is something like this:
public void wdDoInit()
{
//@@begin wdDoInit()
IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
// Retrieve user id in the Enterprise portal
String epUserId= this.getUserId();
// Retrieve Name from Enterprise Portal
wdContext.currentContextElement().setRoNric(epUserId);
try {
// 1. create model objects
resignationModel = new MResignationWS();
Request_RequestDetail requestDetailModel = new Request_RequestDetail(resignationModel);
// 2. associate model objects
String roNric = contextElement.getRoNric();
String requestId = contextElement.getRequestId();
requestDetailModel.setRoNric(roNric);
requestDetailModel.setRequestId(requestId);
// 3. bind executable model object to context node
wdContext.nodeRequest_ReqDetail().bind(requestDetailModel);
// 4. invoke ResignationService <<Web Service>>
logger.logT(Severity.INFO, "invocaing resignation services for Recommendation Request Details ");
requestDetailModel.execute();
wdContext.nodeResponse().invalidate();
}catch(WDWSModelExecuteException e ) {
msgMgr.reportException(textAccessor.getText("RESIGNATION_DETAILS_ERROR"));
msgMgr.reportException(e.getStackTraceString());
logger.logT(Severity.ERROR, e.getStackTraceString());
}catch (Throwable e) {
msgMgr.reportException(textAccessor.getText("SYSTEM_ERROR"));
msgMgr.reportException(e.getLocalizedMessage());
logger.logT(Severity.ERROR, e.getLocalizedMessage());
}
//@@end
}
execute method does invoke since i have place the value to the context and do a print in the method. At that point in time, there value still exist, however when it is retrieve from the wdDoInit method, it is null
For execute method :
execute (... ) {
this.executionContext = executionContext;
//Process the input parameters
IGPStructure input = executionContext.getInputStructure();
IGPStructure recommendStructure = input.getStructure("GP_IN");
//Retrieve data and set new values in the context
String requestId= recommendStructure.getAttributeAsString("I_RequestId");
contextElement.setRequestId( requestID); // I set this request id to the context element in WD
// i have tried retrieve from this requestId from contextElement using contextElement.getRequestId and there is value here.
}
public void wdDoInit()
{
//@@begin wdDoInit()
IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
// Retrieve user id in the Enterprise portal
String epUserId= this.getUserId();
// Retrieve Name from Enterprise Portal
wdContext.currentContextElement().setRoNric(epUserId);
try {
// 1. create model objects
resignationModel = new MResignationWS();
Request_RequestDetail requestDetailModel = new Request_RequestDetail(resignationModel);
// 2. associate model objects
String roNric = contextElement.getRoNric();
String requestId = contextElement.getRequestId(); // Here i retrieved, but it is null
requestDetailModel.setRoNric(roNric);
requestDetailModel.setRequestId(requestId);
// 3. bind executable model object to context node
wdContext.nodeRequest_ReqDetail().bind(requestDetailModel);
// 4. invoke ResignationService <<Web Service>>
logger.logT(Severity.INFO, "invocaing resignation services for Recommendation Request Details ");
requestDetailModel.execute();
wdContext.nodeResponse().invalidate();
}catch(WDWSModelExecuteException e ) {
msgMgr.reportException(textAccessor.getText("RESIGNATION_DETAILS_ERROR"));
msgMgr.reportException(e.getStackTraceString());
logger.logT(Severity.ERROR, e.getStackTraceString());
}catch (Throwable e) {
msgMgr.reportException(textAccessor.getText("SYSTEM_ERROR"));
msgMgr.reportException(e.getLocalizedMessage());
logger.logT(Severity.ERROR, e.getLocalizedMessage());
}
//@@end
}
Hi,
Why are you fetching value this way:
String A = contextElement.getA("A");
Try this :
String A = contextElement.getA();
regards,
amit bagati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
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.