如何正确处理SAP Kapsel Offline应用程序OData冲突? [英] How to handle SAP Kapsel Offline app OData conflicts properly?

查看:100
本文介绍了如何正确处理SAP Kapsel Offline应用程序OData冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个能够使用SAP Kapsel插件离线存储OData的应用程序. 在此示例中,它或多或少与WEB ID生成的或与应用类似的内容相同: https://blogs.sap.com/2017/01/24/getting-started-with-kapsel-part-10-offline-odatasp13/

I build an app that is able to store OData offline by using SAP Kapsel Plugins. More or less it's the same as generated by WEB ID or similer to the apps in this example: https://blogs.sap.com/2017/01/24/getting-started-with-kapsel-part-10-offline-odatasp13/

现在我要检查潜在的错误解决方案.我创建了一个同步冲突(在存储了脱机数据库并更改了应用程序的某些内容并开始刷新后,在服务器上更改了数据).

Now I am at the point to check the error resolution potential. I created a sync conflict (chaning data on the server after the offline database was stored and changed something on the app and started a flush).

如文档中所述,我可以在ErrorArchive中看到错误,还可以看到一些详细信息.但是我缺少的是数据库中当前"数据的信息.

As mentioned in the documentation I can see the error in ErrorArchive and could also see some details. But what I am missing is the information of the "current" data on the database.

在错误详细信息中,我只能看到设备上的数据,而不能看到服务器上已更改的数据.

In the error details I can just see the data on the device but not the data changed on the server.

例如:

  1. 设备正在将一些名称加载到离线商店中
  2. 设备离线
  3. 用户A更改了一些名称
  4. 用户B直接在线更改了其中一个名称
  5. 用户A再次在线并开始同步
  6. 现在,
  7. 用户A被告知有关已更改实体的信息,但:
    • 未输入内容用户B
  1. Device is loading some names into offline store
  2. Device is offline
  3. User A is changing some names
  4. User B is changing one of this names directly online
  5. User A is online again and starts a sync
  6. User A is now informend about the entity that was changed BUT:
    • not the content user B entered

我只看到离线"数据.

有没有一种解决方案可以在一种比较视图中看到当前"和离线"?

Is there a solution to see the "current" and the "offline" one in a kind of compare view?

还请注意,服务器通信是通过Kapsel插件完成的,而不是通过常规AJAX调用进行的.这可能是一种替代方法,但我想知道API是否没有更智能的方法支持?

Please also note that the server communication is done by the Kapsel Plugin and not with normal AJAX calls. This could be an alternative but I am wondering if there is no smarter way supported by the API?

与此同时,我弄清楚了如何(手动)加载在线数据. 这可以通过将http处理程序切换回普通处理程序来完成.

Meanwhile I figured out how to load the online data (manually). This could be done by switching http handler back to normal one.

sap.OData.removeHttpClient();
sap.OData.applyHttpClient();

无论如何,这似乎不是一个合适的解决方案,并且冲突日志本身也存在问题.必须先将其删除,然后才能应用任何刷新.

Anyhow this does not look like a proper solution and I also have the issue with the conflict log itself. It must be deleted before any refresh could be applied.

我找不到与此相关的任何文档.另外,SAPUI5和SAP Kapsel文档中几乎没有描述ETag处理.

I could not find any proper documentation for that. Also ETag handling is hardly described in SAPUI5 and SAP Kapsel documentation.

推荐答案

默认解决方案是SMP或HCPms通过ETag检测错误.在客户端,没有API可以在发生冲突的情况下操纵ETag.在设备上实现一种差异视图的潜在解决方案将像这样工作:

The default solution is that SMP or HCPms is detecting errors by ETags. At client side there is no API to manipulate ETags in case of conflicts. A potential solution to implement a kind of diff view on the device would work like this:

  1. 显示错误
  2. 缓存错误(可能仅在内存中?)
  3. 删除错误
  4. 刷新数据库
  5. 使用当前数据和缓存的错误构建差异视图

这个主意

sap.OData.removeHttpClient();
sap.OData.applyHttpClient();

也可以工作,但可能非常棘手,并且可能会带来副作用. 也许针对错误的"后端触发了一些请求.

could also work but could be very tricky and may introduce side effects. Maybe some requests are triggered against the "wrong" backend.

这篇关于如何正确处理SAP Kapsel Offline应用程序OData冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆