zipo2008
初级会员
注册时间: 2011-10-11 05:20:32
文章: 1
离线
|
项目升级由8升到9,出现一个问题:mstrWeb返回的文档页面上的链接&选项卡按钮无效了。
发现是addon的问题。请教高手帮忙解决下。
pageconfig.xml:
<page desc="Report Writing Documents" desc-id="" feature-id="" class="com.microstrategy.web.app.beans.RWPageComponentImpl" login-required="true" name="rwd" useResourceMgr="on" persist-mode="8" title-bean="rwframe.rwb" track="true">
<addons>
<addon name="com.microstrategy.web.app.addons.RWDesignModeAddOn" XMLmerge_id="2">
<properties>
<property name="BeanName" source="const" type="string" value="rwframe"/>
</properties>
</addon>
<addon name="com.microstrategy.web.app.addons.FolderProjectBrowserAddOn" XMLmerge_id="5">
<properties>
<property name="beanName" source="const" type="string" value="metricQualLevel.fbpb"/>
<property name="contextID" source="const" type="int" value="3"/>
<property name="typeRestriction" source="const" type="string" value="2048,3072,18"/>
</properties>
</addon>
<addon name="com.microstrategy.web.app.addons.RWSetFlagsAddOn" XMLmerge_id="6">
<properties>
<property name="BeanName" source="const" type="string" value="rwframe.rwb"/>
<property name="ViewModeFlags" source="const" type="string" value="50:8790560,51:8790560"/>
<property name="useTerseElementIDs" source="const" type="boolean" value="true"/>
<property name="visThresholdEditorName" source="const" type="string" value="edtSimpleThresholds"/>
<property name="advThresholdEditorName" source="const" type="string" value="edtAdvancedThresholds"/>
<property name="currentSelectedGridKey" source="request" type="string" value="docSelections"/>
</properties>
</addon>
<addon name="com.microstrategy.web.app.addons.PageFullScreenModeAddOn" XMLmerge_id="7">
<properties>
<property name="BeanName" source="const" type="string" value="rwframe"/>
</properties>
</addon>
<addon name="com.microstrategy.web.app.addons.IFrameUpdateFilterAddon" XMLmerge_id="8">
<properties>
<property name="BeanName" source="const" type="string" value="rwframe.rwb"/>
<property name="EventFilterConfigurationFile" source="const" type="String" value="/WEB-INF/xml/config/rwIFrameUpdateFilter.xml"/>
</properties>
</addon>
<addon name="com.fbi.DocumentAddOnPrompt"/>
</addons>
DocumentAddOnPrompt.java:
package com.fbi;
import com.microstrategy.web.app.addons.AbstractAppAddOn;
import com.microstrategy.web.app.beans.AppContext;
import com.microstrategy.web.app.beans.PageComponent;
import com.microstrategy.web.beans.EnumPromptsBeanTypes;
import com.microstrategy.web.beans.PromptsBean;
import com.microstrategy.web.beans.RWBean;
import com.microstrategy.web.beans.RequestKeys;
import com.microstrategy.web.beans.WebBeanException;
import com.microstrategy.web.beans.WebComponent;
import com.microstrategy.web.objects.WebObjectsException;
import com.microstrategy.web.objects.WebPrompt;
import com.microstrategy.web.objects.WebPrompts;
import com.microstrategy.web.objects.rw.RWInstance;
import com.microstrategy.webapi.EnumDSSXMLStatus;
public class DocumentAddOnPrompt extends AbstractAppAddOn {
public String getAddOnDescription() {
// TODO Auto-generated method stub
return null;
}
RWBean rwb;
PromptsBean pb;
public DocumentAddOnPrompt(){
}
public void preCollectData(PageComponent page) {
// System.out.println("enter preCollectData");
// This method is defined below
rwb = getDocumentBean(page);
AppContext appContext = page.getAppContext();
RequestKeys keys = appContext.getRequestKeys();
// Exit the add-on if no report has been defined yet.
if (rwb == null)
return;
try {
pb = rwb.getPromptsBean();
if ((pb != null)
&& (pb.getCount(EnumPromptsBeanTypes.PromptsBeanTypeAll) > 0)) {
if (rwb.getObjectID()!=null) {
specificReportAnswer(keys, rwb);
} else {
return;
}
} else {
// System.out.println("PromptsBean is null or empty");
}
} catch (WebBeanException ex) {
ex.printStackTrace();
}
}
private void specificReportAnswer(RequestKeys keys, RWBean rwb) {
try {
// now get the report instance object from the bean and
// obtain the prompts collection from the instance
RWInstance DocumentInstance = rwb.getRWInstance();
while (true) {
int status = DocumentInstance.pollStatus();
//System.out.println("Status is " + status);
if ((status == EnumDSSXMLStatus.DssXmlStatusPromptXML)
|| (status == EnumDSSXMLStatus.DssXmlStatusResult)
|| (status == EnumDSSXMLStatus.DssXmlStatusXMLResult)
|| (status == EnumDSSXMLStatus.DssXmlStatusErrMsgXML))
break;
}
if (DocumentInstance.pollStatus() != EnumDSSXMLStatus.DssXmlStatusPromptXML) {
return;
}//没有返回报表提示问题
WebPrompts prompts = DocumentInstance.getPrompts();
int index = 0;
while (index < prompts.size()) {
WebPrompt prompt = prompts.get(index);
if (prompt == null)
continue;
if(prompt.isRequired() && prompt.hasAnswer() == false){
try {
throw new Exception("报表必须输入的提示答案为空:ReportAddOnPrompt.java");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
prompts.validate();
prompts.answerPrompts();
}
index++;
}
// we've populated the answers, so now submit them to the
// Intelligence Server
} catch (WebObjectsException ex) {
// System.out.println("WebObjectsException in PromptAutoAnswerAddon");
ex.printStackTrace();
return;
} catch (WebBeanException ex1) {
// System.out.println("RWBeanException in PromptAutoAnswerAddon");
ex1.printStackTrace();
return;
}
}
/*
* Checks whether a web component is a report bean and returns that bean if
* found, returning null otherwise.
*/
private static RWBean getDocumentBean(WebComponent wc) {
RWBean result = null;
// if the current web component is a RWBean then return it
if (wc instanceof RWBean) {
result = (RWBean) wc;
// otherwise, try to find a report bean amongst the page children
} else {
for (int i = 0; i < wc.getChildCount(); i++) {
// search recursively through all children
result = getDocumentBean(wc.getChild(i));
if (result != null)
break;
}
}
return result;
}
}
|