简体   繁体   English

导丝政策中心有多少种捆绑

[英]How many types of bundle in guidewire policy centre

Explain bundle types like current bundle new bundle.解释捆绑类型,如当前捆绑新捆绑。 When we will use & how it will act on my transaction.我们何时使用以及它将如何对我的交易产生影响。 Explain with example please.请举例说明。

Caution: Don't run below Gosu Script in Production注意:不要在生产环境下运行 Gosu Script

A "current" bundle is a bundle that contains objects available to the current code context. “当前”包是包含可用于当前代码上下文的对象的包。 This includes, but is not limited to, the user interface and plugins.这包括但不限于用户界面和插件。 These bundles are created automatically by the Guidewire application to create, modify, or edit data.这些捆绑包由 Guidewire 应用程序自动创建,以创建、修改或编辑数据。 Integration developers can reference entities in the current bundle.集成开发人员可以引用当前包中的实体。 They can also commit current bundles, though in some situations this is not advisable.他们也可以提交当前的捆绑包,尽管在某些情况下这是不可取的。

var bundleVar = gw.transaction.Transaction.getCurrent()
bundle.Commit()

A read-only bundle is a bundle that contains entities retrieved from the database.只读包是包含从数据库检索的实体的包。 This includes both entities returned as the result of a query, and entities referenced by the foreign key of a related entity when the related entity is in a read-only bundle.这包括作为查询结果返回的实体,以及当相关实体位于只读包中时相关实体的外键引用的实体。 The entities in a read-only bundle cannot be modified.只读包中的实体无法修改。 However, you can copy entities from a read-only bundle into a writeable bundle.但是,您可以将实体从只读包复制到可写包中。

Example: Querying示例:查询

在此处输入图像描述

A new bundle is a bundle created explicitly by integration code.新捆绑包是由集成代码显式创建的捆绑包。 Unlike a read-only bundle, you can modify and commit data in a new bundle.与只读包不同,您可以在新包中修改和提交数据。 Unlike a current bundle, you can commit a new bundle without having to worry about later interaction occurring in the bundle.与当前捆绑包不同,您可以提交新捆绑包,而不必担心捆绑包中发生以后的交互。

•Creating a new bundle (no user specified): •创建一个新包(未指定用户):

gw.transaction.Transaction.runWithNewBundle(\ newBundle -> {
  CodeBlock } )

Example: Updatoing the Vin Number示例:更新 Vin 编号

//Getting the peopicy period by Job number
var period=Job.finder.findJobByJobNumber("12345").LatestPeriod
gw.transaction.Transaction.runWithNewBundle(\ newBundle -> {
  //Adding present object to the bundle
  
  newBundle.add(period)
  period.PersonalAutoLine.Vehicles.each(\ veh -> {
       print("before script ="+veh.Vin)
       veh.Vin="12345678"
       print("After script ="+veh.Vin)
  }
  } )

• •Creating a new bundle (as specified user): • • 创建一个新的捆绑包(作为指定的用户):

gw.transaction.Transaction.runWithNewBundle(\ newBundle -> {
  CodeBlock } , user )

Example: Updating the Vin Number by User- Super User示例:按用户-超级用户更新 Vin 编号

gw.transaction.Transaction.runWithNewBundle(\ newBundle -> {
  //Adding present object to the bundle
  period.PersonalAutoLine.Vehicles.each(\ veh -> {
       veh.Vin="12345678"
  }
  } , "su")

•The runWithNewBundle() method inherently commits the bundle at the end of the method • runWithNewBundle() 方法固有地在方法末尾提交包

There are mainly 3 types of Bundles. Bundles主要有3种类型。

  1. Current Bundle (Example: If a transaction is initiated in Guidewire UI, then automatically Current Bundle will be created by Guidewire itself)当前捆绑包(例如:如果在 Guidewire UI 中发起交易,则 Guidewire 将自动创建当前捆绑包)

  2. Read Only Bundle (Example: If you select any results from Database, then the results fetched using the Gosu Query will be available in Read Only Bundle. To make it writeable bundle then add the results to New Bundle)只读包(例如:如果您 select 数据库中的任何结果,那么使用 Gosu 查询获取的结果将在只读包中可用。要使其可写包,然后将结果添加到新包)

  3. New Bundle (Example: This bundle is used for committing data or Entities, when you work with Batch Process, Webservice the Guidewire will not create any bundle, where in the developer has to create a new Bundle (run with new bundle) to commit the data to DB)新捆绑包(示例:此捆绑包用于提交数据或实体,当您使用批处理时,Webservice Guidewire 不会创建任何捆绑包,开发人员必须创建一个新捆绑包(使用新捆绑包运行)来提交数据到数据库)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM