portal编译同步在home中生成前台文件目录
nchome9810\hotwebs\portal\sync
注: 如果这个目录下没生成相应文件的话会提示找不到app或者win或list窗口
打开节点
nc.uap.lfw.core.servlet.CoreServlet.doPost(HttpServletRequest, HttpServletResponse)
接口实现类查找
- 查找实现类
nc.bs.framework.core.AbstractMeta.SingletonInstantiator.instantiate(Context, String, Object[])
- 具体实例化实现类的地方:
nc.bs.framework.instantiator.CtorInstantiator.instantiate(Class<?>, Object[], String)
Portal流程插件类
nc.uap.wfm.exetask.ExeTaskMainCtrl
Portal参数共享
- 获取url后面参数
LfwRuntimeEnvironment.getWebContext().getOriginalParameter(ProjectSubcontract.PK_PROJECTSUBCONTRACT);
LfwRuntimeEnvironment.getWebContext().getParameter(SubcontractEditWinCtrl.APPLY_TASK);
- 获取域空间参数
Object obj = AppLifeCycleContext.current().getWindowContext().getAppAttribute(key);
if(obj == null)
obj = AppLifeCycleContext.current().getApplicationContext().getAppAttribute(key);
主子表页面数据加载
- 主子表数据获取
Dataset dsh = getDS(SubcontractEditConstants.CARDVIEW, SubcontractEditConstants.DSNAME_HEAD);
Dataset dsb = getDS(SubcontractEditConstants.CARDVIEW, SubcontractEditConstants.DSNAME_BODY);
AggregatedValueObject aggvo = new Datasets2AggVOSerializer().serialize(dsh, new Dataset[] { dsb }, AggProjectSubcontract.class.getName());
aggvo = getDetailVOFromDS((AggProjectSubcontract) aggvo);
- 主子表数据赋值(主子表分别赋值)
ProjectSubcontract[] vos = new ProjectSubcontract[]{subcontract};
new SuperVO2DatasetSerializer().serialize(vos, ds);
单表页面数据加载
- 单表页面数据获取
Dataset dsh = getDS(SubcontractEditConstants.CARDVIEW, SubcontractEditConstants.DSNAME_HEAD);
ProjectSubcontract vo = (ProjectSubcontract) new Dataset2SuperVOSerializer<SuperVO>().serialize(dsh)[0];
- 通过row行获取
Row row = ds.getSelectedRow();
row.getString(ds.nameToIndex(ProjectSubcontract.PK_PROJECTSUBCONTRACT))
private ProjectSubcontract ConvertRowToVO(Dataset ds, Row row) {
Dataset2SuperVOSerializer<ProjectSubcontract> s = new Dataset2SuperVOSerializer<ProjectSubcontract>();
SuperVO[] vos = s.serialize(ds, row);
if (vos != null && vos.length > 0) {
return (ProjectSubcontract) vos[0];
}
return null;
}
ProjectSubcontract vo = (ProjectSubcontract) new Dataset2SuperVOSerializer<SuperVO>().serialize(dsh)[0];
- 表体获取多行数据
获取全部数据,需要在页面配置多行的标记,前台的每一个操作对应后台的方法(按钮,编辑事件,插件里面):
<SubmitRule>
<Widget id="cardView">
<Dataset id="listDS" type="ds_current_line">
</Dataset>
<Dataset id="editbDS" type="ds_all_line">
</Dataset>
</Widget>
</SubmitRule>
- 给表体行赋值,控制编辑性
Dataset dsbody = ConsHelper.getDataSetById(SubcontractEditConstants.DSNAME_BODY);
Row[] rows = dsbody.getAllRow();
for(Row r:rows){
r.setValue(dsbody.nameToIndex(ProjectSubcontractB.PK_PROJECTTASK), (String)row.getValue(ds.nameToIndex(ProjectSubcontract.PK_PROJECTTASK)));
}
ConsHelper.setElementEditable("editbForm", "pk_projecttask_wbs_name", false);
提示框
- 是否提示框
boolean dialogRet = OAInteractionUtil.showDelDefaultConfirmDialog();
- 提示信息提示框
AppInteractionUtil.showShortMessage("删除成功!");
Portal前端参照组件
- 参照加过滤条件
<NCRefNode allowInput="false" dataListener="nc.ref.oa.oapub.data.CurOrgPsndocReferenceDatasetListener" dialogHeight="" dialogWidth="" filterRefNodeNames="false" hrOrgs="false" i18nName="" id="refnode_editDS_pk_undertaker_name" langDir="" multiSel="false" orgs="true" pagemeta="reference" pagemodel="" read="true" readDs="masterDs" readFields="pk_psndoc,name" refId="" refcode="人员" refnodeDelegator="" relationRefNodeId="" selLeafOnly="false" text="工程分包_人员" usePower="false" writeDs="listDS" writeFields="pk_undertaker,pk_undertaker_name"> </NCRefNode>
nc.ui.bd.ref.AbstractRefModel
<FieldRelation id="pk_industrytype_rel" needProcess="true" refDataset="$refds_oacmfj_Defdoc_CQ002(合同管理)" useCache="true">
<MatchFields>
<Field readField="name" writeField="pk_industrytype_name"></Field>
</MatchFields>
<WhereField>
<Field key="pk_defdoc" value="pk_industrytype"></Field>
</WhereField>
</FieldRelation>
//id字段格式 $refds_模块名_元数据实体名称, caption为元数据实体显示名称
<RefMdDataset caption="合同行业类型(自定义档案CQ002)" controlwidgetopeStatus="false" enabled="false" id="$refds_oacmfj_Defdoc_CQ002(合同管理)" lazyLoad="true" notNullBody="false" objMeta="oacmfj.Defdoc-CQ002(合同管理)" voMeta="nc.vo.bd.defdoc.DefdocVO">
<Fields>
</Fields>
</RefMdDataset>
//refcode字段跟bd_refinfo表中参照记录的name字段相同,主要是这个,注意orgs这个属性
<NCRefNode allowInput="false" dataListener="" dialogHeight="" dialogWidth="" filterRefNodeNames="false" hrOrgs="false" i18nName="" id="refnode_editDS_pk_industrytype_name" langDir="" multiSel="false" orgs="false" pagemeta="reference" pagemodel="" read="false" readDs="masterDs" readFields="pk_defdoc,name" refId="" refcode="行业类别(自定义档案CQ002)" refnodeDelegator="" relationRefNodeId="" selLeafOnly="false" text="行业类别" usePower="false" writeDs="listDS" writeFields="pk_industrytype,pk_industrytype_name">
</NCRefNode>
<Element id="pk_industrytype" field="pk_industrytype" text="行业类型" visible="false" allowExtendValue="false" attachNext="false" canUpload="false" colSpan="1" editable="true" editorType="StringText" enabled="true" height="" imageOnly="false" langDir="" nextLine="false" nullAble="true" rowSpan="1" selectOnly="true" toolbarType="Custom" width="">
</Element>
<Element id="pk_industrytype_name" field="pk_industrytype_name" text="行业类型" refNode="refnode_editDS_pk_industrytype_name" allowExtendValue="false" attachNext="false" canUpload="false" colSpan="1" editable="true" editorType="Reference" enabled="true" height="" imageOnly="false" nextLine="false" nullAble="true" rowSpan="1" selectOnly="true" toolbarType="Custom" visible="true" width="">
</Element>
流程保存
- 插件流程关键类
保存类查找 :nc.uap.wfm.server.ProcessEngineExecutor.saveFormInfoCtx()
流程参数封装获取 :nc.uap.wfm.utils.WfmParamUtil.initWfmParams()
流程参数设置在进页面的pagemodel中 :nc.bs.oa.oapub.wfm.OAWfmUtil.WfmInit(String, String, String, String, String, String, String, String)
获取页面组件
- 获取页面空间,设置编辑性
LfwView view = LfwRuntimeEnvironment.getWebContext().getPageMeta().getView(viewname);
GridComp gridform = (GridComp) view.getViewComponents().getComponent(gridId);
GridColumn column = gridform.getElementById(columnname);
column.setEditable(false);
FormComp form = (FormComp) view.getViewComponents().getComponent(formId);
FormElement element = form.getElementById(elementname);
element.setEditable(false);
获取数据集
- 通过viewName,dsName
LfwView view = LfwRuntimeEnvironment.getWebContext().getPageMeta().getView(viewName);
if (view == null) {
view = AppLifeCycleContext.current().getApplicationContext().getCurrentWindowContext().getViewContext(viewName).getView();
}
Dataset ds = view.getViewModels().getDataset(dsName);
- 通过dsName获取
LfwView view = AppLifeCycleContext.current().getViewContext().getView()
portal关键类
nc.uap.lfw.core.ctx.AppLifeCycleContext
LfwView view = AppLifeCycleContext.current().getApplicationContext().getCurrentWindowContext().getViewContext(viewName).getView();
LfwView view = AppLifeCycleContext.current().getViewContext().getView();
ViewContext viewContext = AppLifeCycleContext.current().getViewContext();
WindowContext windowContext = AppLifeCycleContext.current().getWindowContext();
ApplicationContext appContext = AppLifeCycleContext.current().getApplicationContext();
AppLifeCycleContext appLifeCycleContext = AppLifeCycleContext.current();
WebContext webContext = LfwRuntimeEnvironment.getWebContext();
LfwWindow lfwWindow = AppLifeCycleContext.current().getWindowContext().getWindow();
LfwView lfwView = AppLifeCycleContext.current().getViewContext().getView();
nc.uap.lfw.core.LfwRuntimeEnvironment
LfwView view = LfwRuntimeEnvironment.getWebContext().getPageMeta().getView(viewName);
LfwWindow parentPm = LfwRuntimeEnvironment.getWebContext().getPageMeta();
String datasource = LfwRuntimeEnvironment.getDatasource();
前台页面目录结构及事件
- 目录结构
- applications目录下的是应用
- nodes目录下是window窗口
- 每个窗口下的叫视图
- 事件
事件可以配置在视图级别,Dataset级别,及按钮内部
<Event async="true" methodName="beforeShowCardView" name="beforeShow" onserver="true">
<SubmitRule>
<Widget id="cardView">
<Dataset id="listDS" type="ds_current_line">
</Dataset>
<Dataset id="editbDS" type="ds_all_line">
</Dataset>
</Widget>
</SubmitRule>
<Params>
<Param>
<Name>dialogEvent</Name>
<Value>
</Value>
<Desc> <![CDATA[nc.uap.lfw.core.event.DialogEvent]]>
</Desc>
</Param>
</Params>
<Action>
</Action>
</Event>
<Event async="true" methodName="pluginwf_plugin" onserver="true">
<Params>
<Param>
<Name>keys</Name>
<Value>
</Value>
<Desc> <![CDATA[java.util.Map]]>
</Desc>
</Param>
</Params>
<Action>
</Action>
</Event>
<Event async="true" methodName="onAfterDataChange" name="onAfterDataChange" onserver="true">
<Params>
<Param>
<Name>datasetCellEvent</Name>
<Value>
</Value>
<Desc> <![CDATA[nc.uap.lfw.core.event.DatasetCellEvent]]>
</Desc>
</Param>
</Params>
<Action>
</Action>
</Event>
<Event async="true" methodName="onDataLoad" name="onDataLoad" onserver="true">
<SubmitRule>
</SubmitRule>
<Params>
<Param>
<Name>dataLoadEvent</Name>
<Value>
</Value>
<Desc> <![CDATA[]]>
</Desc>
</Param>
</Params>
<Action>
</Action>
</Event>
获取节点信息
String nodecode = (String) this.getAppAttr(AppControlPlugin.NODECODE);
Portal登录过程
nc.uap.portal.login.listener.PortalLoginListener.onclick(MouseEvent<ButtonComp>)//点击登陆
nc.uap.portal.login.itf.LoginHelper.processLogin(AuthenticationUserVO)//登陆操作以及一些Cookie写入操作
nc.uap.portal.user.impl.PortalLoginHandler.afterLogin(LfwSessionBean)//登陆操作的一些具体处理类
nc.uap.portal.user.impl.PortalLoginHandler.loginPluginExecutor(Object, String)//执行登陆插件
- 登陆插件看到三个:[nc.bs.hrss.pub.plugin.LoginHandler, nc.ssc.task.jobmanage.SSCLoginPersonPortalPlug, uap.iweb.user.UserLoginForPt
------------登陆过程基本完成
uap.iweb.user.UserLoginForPt.afterLogin(PtSessionBean)//登陆完成后写入Cookie
//前台Cookie校验
ensureUserStateSecurity portal.js
getCookie PageUtil.js
//portal会话bean
nc.uap.portal.deploy.vo.PtSessionBean
nc.uap.lfw.login.vo.LfwSessionBean
//portal登陆执行插件必须实现接口
nc.uap.portal.user.itf.IUserLoginPlugin
网友评论