您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > 基于cms文章音频视频等功能实现UI相关扩展
基于cms文章、音频、视频等功能实现UI相关扩展当cms的扩展模型满足不了客户需求时,我们需要在cms的文章、视频、音频等功能的基础上扩展一些功能,以保证扩展功能可以和视频、音频、文章密切关联来实现客户的需求。开发实例如下:1.设计表结构,关联视频、文章、音频的ID,以视频为例:2.添加扩展项,继承扩展点com.zving.contentcore.ContentExtendUIjava代码如下:1234567891011121314151617packagecom.zving.wskxly.extend;importcom.zving.framework.extend.ExtendException;importcom.zving.framework.extend.action.ZhtmlContext;importcom.zving.framework.extend.action.ZhtmlExtendAction;publicclassVideoRelaQuestionActionextendsZhtmlExtendAction{publicbooleanisUsable(){//TODOAuto-generatedmethodstubreturntrue;}@Overridepublicvoidexecute(ZhtmlContextcontext)throwsExtendException{context.include(videorela/videoRelaQuestion.zhtml);context.include(videorela/videoRelaGame.zhtml);181920}}页面代码如下:3.添加class类,实现和视频、音频、文章关联关系处理,继承扩展点:com.zving.contentcore.BeforeContentSave关联关系处理事例如下:1234567891011packagecom.zving.wskxly.extend;importjava.util.Date;importcom.zving.contentcore.IContent;importcom.zving.contentcore.extend.BeforeContentSave;importcom.zving.framework.User;importcom.zving.framework.collection.Mapx;importcom.zving.framework.data.Transaction;importcom.zving.framework.orm.DAOSet;importcom.zving.framework.utility.LogUtil;1213141516171819202122232425262728importcom.zving.framework.utility.ObjectUtil;importcom.zving.platform.pub.NoUtil;importcom.zving.schema.ZWVideoGame;publicclassVideoRelaGameSaveextendsBeforeContentSave{publicbooleanisUsable(){returntrue;}@Overridepublicvoidexecute(Transactiontran,IContentcontent){StringcontentType=content.getContentTypeID();if(!Video.equals(contentType)){return;}2930313233343536373839404142434445longVideoID=content.getID();if(ObjectUtil.empty(VideoID)||VideoID==0){LogUtil.info(视频ID为空,无法向数据库中插入视频相关游戏记录。);return;}MapxString,ObjectdataMap=content.getValues();StringGameDescription=dataMap.getString(GameDescription);StringGameInfo=dataMap.getString(GameInfo);StringGameGoal=dataMap.getString(GameGoal);ZWVideoGamezwVideoGame=newZWVideoGame();zwVideoGame.setVideoID(VideoID);DAOSetZWVideoGameset=zwVideoGame.query();if(ObjectUtil.empty(set)||set.size()=0){zwVideoGame.setID(NoUtil.getMaxID(ZWVideoGameID));zwVideoGame.setVideoID(VideoID);zwVideoGame.setGameDescription(GameDescription);zwVideoGame.setGameInfo(GameInfo);46474849505152535455565758596061zwVideoGame.setGameGoal(GameGoal);zwVideoGame.setAddUser(User.getUserName());zwVideoGame.setAddTime(newDate());tran.add(zwVideoGame,Transaction.INSERT);}else{zwVideoGame=set.get(0);zwVideoGame.setGameDescription(GameDescription);zwVideoGame.setGameInfo(GameInfo);zwVideoGame.setGameGoal(GameGoal);zwVideoGame.setAddUser(User.getUserName());zwVideoGame.setModifyTime(newDate());zwVideoGame.setModifyUser(User.getUserName());tran.add(zwVideoGame,Transaction.UPDATE);}}}要点:视频的ID从上下文获取,获取方式如下:content.getID();注意:该class的Transaction事务不能提交,该事务会统一在BeforeContentSave扩展点提交。文章源于泽元软件知识库,以上文章只是做一些专业知识的交流不能用于商业应用。
本文标题:基于cms文章音频视频等功能实现UI相关扩展
链接地址:https://www.777doc.com/doc-2569091 .html