NC portal 开发的一些总结

354 篇文章 101 订阅

1、NC portal获取当前登录者vo数据:

LfwRuntimeEnvironment.getLfwSessionBean().getUserObj(CpUserVO.class);//获取当前登录者vo数据

2、NC portal给参照设置条件(添加过滤条件):

给参照设置值(过滤参照),先给参照设置监听


IRefNoderefNode =this.getCurrentView().getViewModels().getRefNode("phoneBvodef1_hrhi_0001Z7HI10PSN0000ZJ2");

NCRefNodencModel = ((NCRefNode) refNode);

ncModel.setDataListener(HrDeptRefModel.class.getName());


写一个过滤类,继承AppReferenceController这个类

packagenc.hrss.pe.phone.view;

importnc.bs.hrss.pub.tool.SessionUtil;
importnc.hr.utils.ResHelper;
importnc.pub.tools.HiSQLHelper;
importnc.uap.ad.ref.NcAdapterTreeGridRefModel;
importnc.uap.lfw.core.data.Dataset;
importnc.uap.lfw.core.refnode.RefNode;
importnc.uap.lfw.reference.ILfwRefModel;
importnc.uap.lfw.reference.app.AppReferenceController;
import nc.ui.bd.ref.AbstractRefGridTreeModel;
importnc.ui.bd.ref.AbstractRefTreeModel;
importnc.ui.pub.beans.ValueChangedEvent;
importnc.vo.om.pub.SQLHelper;

public classHrDeptRefModel extends AppReferenceController{

   @Override

   protected void processSelfWherePart(Datasetds, RefNode rfnode, String filterValue, ILfwRefModelrefModel) {
      resetRefnode(rfnode, refModel);

   }

   @Override
   protected voidprocessTreeSelWherePart(Dataset ds, RefNode rfnode, ILfwRefModel refModel) {
      resetRefnode(rfnode, refModel);
   }

   /**
    * 重新设置RefNode的值
    *
    *@param refModel
    */

   private void resetRefnode(RefNode rfnode,ILfwRefModel refModel) {
      String pkorgs =SessionUtil.getPk_org();
      NcAdapterTreeGridRefModelncmodel=(NcAdapterTreeGridRefModel)refModel;
      ncmodel.setClassWherePart(" pk_group= '"+SessionUtil.getPk_group()+"' and pk_org='"+pkorgs+"'");//过滤树型参照
 //ncmodel.setClassWherePart(" pk_group= '"+SessionUtil.getPk_group()+"' and pk_org='"+pkorgs+"'");//过非树型参照
   }
}

3、NC portal关闭当前窗口

//WindowContext windowContext =AppLifeCycleContext.current().getWindowContext();

//windowContext.closeView(""); // 关闭当前窗口 

AppLifeCycleContext.current().getApplicationContext().closeWinDialog();

4、NC portal 获取当前界面主表(子表)的值

LfwView main = AppLifeCycleContext.current().getViewContext().getView();

//主表
Dataset datasParent=main.getViewModels().getDataset("headid");//获取当前视图某个表的数据集

Row row=datasParent.getSelectedRow();//获取当前行的数据(卡片型只有一行,获取当前行即可)

Object dataValue =row.getValue(datasParent.nameToIndex("djrq"));//获取对应字段

//子表
Dataset datasChild=main.getViewModels().getDataset("bodyid");//获取当前视图某个表的数据集

Row row=datasChild.getSelectedRow();//获取当前行的数据(卡片型只有一行,获取当前行即可)

Row[] rows=dataset.getAllRow();//获取所有行数据

Object dataValue =row.getValue(datasParent.nameToIndex("djrq"));//获取对应字段

5、NC portal获取按钮控件,控制其显示与隐藏

获取按钮控件,控制其显示与隐藏

LfwView main=LfwRuntimeEnvironment.getWebContext().getPageMeta().getView("main");

GridComp gridb=(GridComp) main.getViewComponents().getComponent("phoneBvo_grid");

MenubarComp mc=gridb.getMenuBar();

mc.getItem("phoneBvo_grid$HeaderBtn_Import").setVisible(true);//设置按钮的显示与隐藏,“phoneBvo_grid$HeaderBtn_Import”可在配置文件中找到对应的ID

6、NC portal保存只能获取当前子表选中行的数据集问题

保存是获取子表数据只能获取到当前选中的行

代码如下:

LfwViewmain=LfwRuntimeEnvironment.getWebContext().getPageMeta().getView("main");

Dataset bodyds =main.getViewModels().getDataset("phoneBvo");

Row[] bodyRows =bodyds.getAllRow();

解决:

上面代码不变,在对应节点配置文件保存按钮处增加一下配置

<Menus>

        <MenuBarCompid="menubar">

            <MenuItemid="save" modifiers="2" showModel="1" text="保存">

               <Events>

                    <Event async="true"methodName="onSave" name="onclick"onserver="true">

                 <SubmitRule>

                    <Widgetid="main">

                   <Dataset id="phoneHvo" type="ds_current_line">

                   </Dataset>

                   <Dataset id="phoneBvo" type="ds_all_line">

                   </Dataset>

                   </Widget>

                 </SubmitRule>

                   </Event>

               </Events>

           </MenuItem>

            <MenuItemid="sep3" modifiers="2" sep="true"showModel="1">

           </MenuItem>

            <MenuItemid="back" modifiers="2" showModel="1" text="取消">

               <Events>

                   <Event async="true" methodName="onBack"name="onclick" onserver="true">

                       <Action>

                       </Action>

                   </Event>

               </Events>

           </MenuItem>

        </MenuBarComp>

</Menus>

7、NC portal设置表头表体编辑性

LfwView main=LfwRuntimeEnvironment.getWebContext().getPageMeta().getView("main");

//表体

GridComp gridb=(GridComp) main.getViewComponents().getComponent("phoneBvo_grid");

GridColumn phoneno=(GridColumn) gridb.getColumnById("phoneno");

phoneno.setEditable(true);

//表头

FormComp formCompHead = (FormComp)main.getViewComponents().getComponent("phoneHvo_form");

formCompHead.getElementById("def3").setEnabled(false);//设置表格单元格编辑性

8、NC portal通过接口调用vo集(可以是aggvo)

IMDPersistenceQueryService service = NCLocator.getInstance().lookup(
IMDPersistenceQueryService.class);

NCObject ncObject1 =service.queryBillOfNCObjectByPK(PsndocAggVO.class, pk); //通过此接口可调用vo集数据(可以是aggvo),只需要主键即可

9、NC portal通过表头主键查询子表vo数据集合

//单据主键

 String pk = (String)headrow.getValue(ds.nameToIndex(ds.getPrimaryKeyField()));
 List<PhoneBvo>listvo=null;
 try {
     listvo = (List<PhoneBvo>)new BaseDAO().executeQuery("select *from hrss_phonefee_b where nvl(dr,0)=0 and pk_phonefee_h= '"+pk+"'", newBeanListProcessor(PhoneBvo.class) );

 } catch(BusinessException e) {

     e.printStackTrace();

 }

10、NC portal获取按钮控件,控制其显示与置灰

获取按钮控件,控制其显示与置灰

MenubarComp comp = (MenubarComp) ViewUtil.getCurrentView().getViewMenus().getMenuBar("menubar");

comp.getElementById("edit").setEnabled(false);

原文链接:https://blog.csdn.net/qq_35532919/category_6779038.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SSO(Single sign-on)即单点登录技术。它是指在多个子系统的大型应用中,用户在子系统之间进行切换时,不需要每次都重新输入用户的身份信息,从而做到一处认证,整个应用系统都能有效识别。单点登录技术的系统集成功能为当前企事业单位尤其是大型多子系统企业系统集成提供了完美的解决方案。它使得这些原有系统能够合理的集成起来,对外提供统一的界面风格和唯一的登录入口。单点登录只是一种功能概念,并没有对具体的实现方式进行定义和限制。NC-Portal的单点登录方案,就是SSO技术的一种实现方式。 NC-Portal的SSO方案是基于凭证的思想设计。对于NC-Portal集成的每个第三方系统都有一个制作凭证的页面,该页面用于当前登录的portal用户输入对应的第三方系统的用户信息,在正常情况下,该制作凭证的页面最多出现一次。当用户输入的第三方系统登录信息进行验证后,会自动在portal系统的数据库中建立一对凭证槽和凭证信息,这对信息记录了portal用户在特定的portal布局和特定的portlet下,与该第三方系统的身份对应关系。当该用户之后登录portal并进入被集成第三方系统时,portal系统负责获取之前成功建立的对应第三方系统身份信息,并用该身份信息进行第三方系统的身份认证。这一切的操作对当前登录用户来说都是透明的,他们看到的是没有输入任何身份信息而以正确的身份进入了第三方系统。另外,在用户每次登录第三方系统时,都会根据第三方系统的要求进行身份认证,因此这个登录过程是安全的。 对于NC-Portal来说,对Web系统的集成提供了完善的支持和解决,对Web系统的集成,目前有大小之分。集成一个单独的系统如NC、IUFO、BO、OA系统采用单独的一个布局存放(当然,该布局也是由一个portlet组成),这些Web系统称为“大”系统。另外,还存在一些集成第三方系统的“小”portlet,如NC待办事务Portlet、NC报表Portlet、IUFO报表Portlet等,这些是以“小”Portlet的形式出现的。他们主要提供一些对集成系统的辅助功能,如对NC待办事务的提取、对IUFO报表信息的提取,这两种方式功能侧重点略有不同。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值