- 浏览: 168800 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (173)
- Cocos2d-X (11)
- ubuntu (17)
- ofbiz (7)
- freemarker (1)
- nginx (9)
- redHat (7)
- SpringBoot (13)
- C# (0)
- PHP (2)
- Android (0)
- 咖啡豆 (7)
- Python (21)
- IONIC (8)
- AngularJS (1)
- 大鲸鱼 (10)
- 好玩的东西 (11)
- mysql 占用 (5)
- kelude (1)
- jS (0)
- Wx (1)
- H5-M500 (3)
- 开发即运维 (4)
- ReactNative (11)
- C++ (0)
- 其他杂项 (2)
- Truffle (1)
- WebLogic (0)
- Unity3D (0)
- WeChatMiniProgram (0)
- 小程序 (3)
- OLAP (1)
- ceb (1)
- 微信小程序 (2)
- 小程序undefined (1)
- 小程序机型问题 (1)
- Olingo (1)
- Cocos Creator (2)
- kylin (1)
- docker network (1)
最新评论
-
沈寅麟:
如果:[MySQL] specified key was to ...
OFBiz使用utf8mb4保存emoji -
沈寅麟:
从主机复制文件到容器里主机–>容器1,获取容器ID使用s ...
退出不关闭容器 -
沈寅麟:
conf.d/default.config---------- ...
Nginx配置AJP -
沈寅麟:
配置完nginx,在启动的时候遇到如下问题:nginx: [e ...
Nginx配置AJP -
沈寅麟:
docker commit [OPTIONS] CONTAIN ...
退出不关闭容器
Deep Inserts
OData already supports 'deep inserts'. A 'deep insert' creates an entity and builds a link to an existing entity. So posting here:
~/People(6)/Friends
Inserts a new person and creates a 'friends' link with Person 6.
The same type specification rules apply for deep inserts too, so posting here:
~/People(6)/Friends/HR.Employee
Will succeed only if the type is unambiguous and allowed (i.e. it is an Employee or derived from Employee).
如果你想寻找灵感,可以参考以下代码片段
OData already supports 'deep inserts'. A 'deep insert' creates an entity and builds a link to an existing entity. So posting here:
~/People(6)/Friends
Inserts a new person and creates a 'friends' link with Person 6.
The same type specification rules apply for deep inserts too, so posting here:
~/People(6)/Friends/HR.Employee
Will succeed only if the type is unambiguous and allowed (i.e. it is an Employee or derived from Employee).
如果你想寻找灵感,可以参考以下代码片段
public void simpleDeepInsert() throws Exception { final ODataClient client = getEdmEnabledClient(); final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build(); final ClientObjectFactory factory = getFactory(); final ClientEntity entity = factory.newEntity(ET_KEY_NAV); // Prepare entity(EntitySet: ESKeyNav, Type: ETKeyNav) entity.getProperties() .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42))); entity.getProperties() .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42"))); entity.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42))))); entity.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP_ALL_PRIM, factory.newComplexValue(CT_ALL_PRIM) .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42"))))); entity.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42))) .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42"))))); entity.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP) .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42"))) .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42))))))); // Non collection navigation property // Create related entity(EntitySet: ESTwoKeyNav, Type: ETTwoKeyNav, Nav. Property: NavPropertyETTwoKeyNavOne) final ClientEntity inlineEntitySingle = factory.newEntity(ET_TWO_KEY_NAV); inlineEntitySingle.getProperties() .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 43))); inlineEntitySingle.getProperties() .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("43"))); inlineEntitySingle.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 430))))); inlineEntitySingle.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 431))))); inlineEntitySingle.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 432))) .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("432"))))); // Collection navigation property // The navigation property has a partner navigation property named "NavPropertyETKeyNavOne" // Create related entity(EntitySet: ESTwoKeyNav, Type: NavPropertyETTwoKeyNavMany final ClientEntity inlineEntityCol1 = factory.newEntity(ET_TWO_KEY_NAV); inlineEntityCol1.getProperties() .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 44))); inlineEntityCol1.getProperties() .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("44"))); inlineEntityCol1.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 441))))); inlineEntityCol1.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 440))))); inlineEntityCol1.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 442))) .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("442"))))); final ClientEntity inlineEntityCol2 = factory.newEntity(ET_TWO_KEY_NAV); inlineEntityCol2.getProperties() .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 45))); inlineEntityCol2.getProperties() .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("45"))); inlineEntityCol2.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 451))))); inlineEntityCol2.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 450))))); inlineEntityCol2.getProperties() .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM) .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 452))) .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("452"))))); final ClientInlineEntity newDeepInsertEntityLink = factory.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntitySingle); final ClientEntitySet newDeepInsertEntitySet = factory.newEntitySet(); newDeepInsertEntitySet.getEntities().add(inlineEntityCol1); newDeepInsertEntitySet.getEntities().add(inlineEntityCol2); final ClientInlineEntitySet newDeepInsertEntitySetLink = factory.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, newDeepInsertEntitySet); entity.addLink(newDeepInsertEntityLink); entity.addLink(newDeepInsertEntitySetLink); // Perform create request final ODataEntityCreateResponse<ClientEntity> responseCreate = client.getCUDRequestFactory() .getEntityCreateRequest(createURI, entity) .execute(); assertEquals(HttpStatusCode.CREATED.getStatusCode(), responseCreate.getStatusCode()); final String cookie = responseCreate.getHeader(HttpHeader.SET_COOKIE).toString(); // Fetch ESKeyNav entity with expand of NavPropertyETTwoKeyNavOne nav. property ClientProperty propertyInt16 = responseCreate.getBody().getProperty(PROPERTY_INT16); final URI esKeyNavURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment( propertyInt16.getPrimitiveValue().toValue()).expand(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).build(); final ODataEntityRequest<ClientEntity> esKeyNavRequest = client.getRetrieveRequestFactory() .getEntityRequest(esKeyNavURI); esKeyNavRequest.addCustomHeader(HttpHeader.COOKIE, cookie); final ODataRetrieveResponse<ClientEntity> esKeyNavResponse = esKeyNavRequest.execute(); final ClientEntity clientEntity = esKeyNavResponse.getBody(); // Check nav. property NavPropertyETTwoKeyNavOne assertNotNull(clientEntity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE)); ClientInlineEntity navOne = ((ClientInlineEntity) clientEntity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE)); assertShortOrInt(431, navOne.getEntity().getProperty(PROPERTY_COMP_NAV).getComplexValue() .get(PROPERTY_INT16).getPrimitiveValue().toValue()); // Check nav. property NavPropertyETTwoKeyNavMany assertNotNull(clientEntity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)); ClientInlineEntitySet navMany = (ClientInlineEntitySet) clientEntity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY); assertEquals(2, navMany.getEntitySet().getEntities().size()); assertShortOrInt(441, navMany.getEntitySet().getEntities().get(0).getProperty(PROPERTY_COMP_NAV) .getValue().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue()); assertShortOrInt(451, navMany.getEntitySet().getEntities().get(1).getProperty(PROPERTY_COMP_NAV) .getValue().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue()); // Fetch ESTwoKeyNav entities and check if available and the partner relation have been set up // Check ESTwoKeyNav(Created via NavPropertyETTwoKeyNavOne) Map<String, Object> composedKey = new HashMap<String, Object>(); composedKey.put(PROPERTY_INT16, navOne.getEntity().getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); composedKey.put(PROPERTY_STRING, navOne.getEntity().getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); final URI esTwoKeyNavEntitySingleURI = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_TWO_KEY_NAV) .appendKeySegment(composedKey) .build(); final ODataEntityRequest<ClientEntity> esTwoKeyNavSingleRequest = client.getRetrieveRequestFactory() .getEntityRequest(esTwoKeyNavEntitySingleURI); esTwoKeyNavSingleRequest.addCustomHeader(HttpHeader.COOKIE, cookie); final ODataRetrieveResponse<ClientEntity> esTwoKeyNavSingleResponse = esTwoKeyNavSingleRequest.execute(); assertShortOrInt(431, esTwoKeyNavSingleResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue() .get(PROPERTY_INT16).getPrimitiveValue().toValue()); // Check ESTwoKeyNav(Created via NavPropertyETTwoKeyNavMany(0)) composedKey.clear(); composedKey.put(PROPERTY_INT16, navMany.getEntitySet().getEntities().get(0).getProperty(PROPERTY_INT16) .getPrimitiveValue().toValue()); composedKey.put(PROPERTY_STRING, navMany.getEntitySet().getEntities().get(0).getProperty(PROPERTY_STRING) .getPrimitiveValue().toValue()); URI esTwoKeyNavEntityManyOneURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(composedKey) .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build(); final ODataEntityRequest<ClientEntity> esTwoKeyNavManyOneRequest = client.getRetrieveRequestFactory().getEntityRequest(esTwoKeyNavEntityManyOneURI); esTwoKeyNavManyOneRequest.addCustomHeader(HttpHeader.COOKIE, cookie); final ODataRetrieveResponse<ClientEntity> esTwoKeyNavManyOneResponse = esTwoKeyNavManyOneRequest.execute(); assertShortOrInt(441, esTwoKeyNavManyOneResponse.getBody().getProperty(PROPERTY_COMP_NAV) .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue()); assertNotNull(esTwoKeyNavManyOneResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)); ClientInlineEntity nvLink = (ClientInlineEntity)esTwoKeyNavManyOneResponse.getBody() .getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE); assertEquals(propertyInt16.getPrimitiveValue().toValue(), nvLink.getEntity().getProperty(PROPERTY_INT16) .getPrimitiveValue().toValue()); // Check ESTwoKeyNav(Created via NavPropertyETTwoKeyNavMany(1)) composedKey.clear(); composedKey.put(PROPERTY_INT16, navMany.getEntitySet().getEntities().get(1).getProperty(PROPERTY_INT16) .getPrimitiveValue().toValue()); composedKey.put(PROPERTY_STRING, navMany.getEntitySet().getEntities().get(1).getProperty(PROPERTY_STRING) .getPrimitiveValue().toValue()); URI esTwoKeyNavEntityManyTwoURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(composedKey) .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build(); final ODataEntityRequest<ClientEntity> esTwoKeyNavManyTwoRequest = client.getRetrieveRequestFactory().getEntityRequest(esTwoKeyNavEntityManyTwoURI); esTwoKeyNavManyTwoRequest.addCustomHeader(HttpHeader.COOKIE, cookie); final ODataRetrieveResponse<ClientEntity> esTwoKeyNavManyTwoResponse = esTwoKeyNavManyTwoRequest.execute(); assertShortOrInt(451, esTwoKeyNavManyTwoResponse.getBody().getProperty(PROPERTY_COMP_NAV) .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue()); assertNotNull(esTwoKeyNavManyTwoResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)); nvLink = (ClientInlineEntity)esTwoKeyNavManyTwoResponse.getBody() .getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE); assertEquals(propertyInt16.getPrimitiveValue().toValue(), nvLink.getEntity().getProperty(PROPERTY_INT16) .getPrimitiveValue().toValue()); }
相关推荐
基于Qt开发的截图工具.zip 截图工具(QScreenShot) Qt编写的一款截图工具。 特点 - 支持全屏截图 - 支持自定义截图 - 支持捕获窗口截图 - 支持固定大小窗口截图 - 颜色拾取 - 图片编辑 - 图片上传到wordpress 环境 Qt6.2 QtCreate 8
该资源内项目源码是个人的课程设计、毕业设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过严格测试运行成功才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。
基于ASP.NET技术的班级展示网站构建资源,是一套针对教育机构或学生团体,旨在通过ASP.NET框架开发班级风采展示平台的指导资料或教程。此资源详细介绍了如何利用ASP.NET的强大功能,快速搭建一个功能完善、界面友好的在线班级展示平台。 该资源涵盖了从需求分析、数据库设计、前端页面制作到后端逻辑实现的全过程。通过实例演示,指导用户如何设置班级信息、学生风采展示、活动公告、图片上传与浏览等核心功能模块。同时,结合ASP.NET的MVC架构,实现了前后端分离,提高了代码的可维护性和可扩展性。 此外,该资源还提供了丰富的代码示例和注释,帮助开发者深入理解ASP.NET框架的工作原理,掌握如何运用其强大的数据库操作、用户认证与授权等特性。对于初学者来说,这是一份难得的入门教程;而对于有一定经验的开发者,则是一份提升技能的参考资料。 总之,基于ASP.NET技术的班级展示网站构建资源,是教育机构和学生团体实现班级风采在线展示的理想选择,也是开发者学习ASP.NET框架应用的宝贵资源。
基于springboot的流浪动物管理系统源码数据库文档.zip
基于springboot+vue的实践性教学系统源码数据库文档.zip
基于Python+Django家居全屋定制系统源码数据库文档.zip
Umi-OCR-main.zip
基于springboot复兴村医疗管理系统源码数据库文档.zip
基于springboot二手物品交易系统源码数据库文档.zip
2024年西安外事学院数学建模校赛题目.zip
基于springboot医疗废物管理系统源码数据库文档.zip
GEE训练教程
内容概要:本文详细介绍了Spring Boot的设计和应用,涵盖了从基本概念到高级用法的全方位教学。首先通过环境搭建、首个项目创建、核心概念解析等步骤帮助读者快速上手。接着阐述了Spring Boot的设计原则与最佳实践,强调代码整洁和系统可维护性。最后,提供了两个实战案例:构建简单的RESTful API和电商网站后台管理系统,涉及项目结构、依赖配置、数据库设计、实体类与控制器的创建等内容,指导读者进行真实项目的开发。 适合人群:适合初学者到中级开发者的Java开发人员,尤其是对企业级应用开发感兴趣的人士。 使用场景及目标:①帮助开发者全面掌握Spring Boot的基本用法及其设计理念;②提供实用的实战案例和资源,使读者能够在实际项目中熟练应用Spring Boot技术。 阅读建议:跟随文章提供的步骤逐步操作,并结合实际开发需求灵活运用所学知识。建议多动手练习,加强对Spring Boot的理解和掌握。
该资源内项目源码是个人的课程设计、毕业设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过严格测试运行成功才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。
内容概要:本文详细介绍了一个课程考试系统的设计与开发过程,涵盖语言教程、实战案例和项目资源。主要内容包括:选择Java作为开发语言,详细讲解Java基础语法和Web开发基础;实战案例包括用户管理、课程管理和考试管理模块的实现;提供了项目结构、数据库设计和依赖管理的详细示例。 适合人群:适用于初学者和有一定经验的开发者,希望通过实际项目掌握课程考试系统的设计与开发。 使用场景及目标:帮助学习者全面提升从理论到实践的能力,最终能够独立完成一个完整的课程考试系统。无论是学习编程基础还是进阶实战,本文都提供了全面的指导。 其他说明:项目涉及多个关键技术和知识点,如Servlet、JSP、JDBC、MVC模式等,有助于深入理解和应用这些技术。此外,还包括项目部署和运行的具体步骤,方便学习者快速搭建和测试系统。
《伯牙鼓琴》教学课件.pptx
基于springboot面向社区的智能化健康管理系统研究源码数据库文档.zip
基于springboot+javaweb宿舍管理系统源码数据库文档.zip
基于SpringBoot的遥感影像共享系统源码数据库文档.zip
门禁系统方案