What is nonpersistent entity in guidewire and how can we create it? - guidewire

How many types of entities we have in PolicyCenter? What are those?
What is nonpersistent entity in policyCenter?
How can we create it?
Please explain me.

Non-persistent entity is a temporary entity that PC creates and uses only during the time that the PC server is running. When the server shuts down, PC discards the entity data. It is not possible to commit a non-persistent entity object to the database.
A non-persistent entity has to live in a bundle and can only live in one bundle. To create a temporary entity, it is marked with an attribute of temporary="true".
Hope, it helps.

Related

Liferay Service Builder : how to use hibernate session factory for relation

In my project i have multiple liferay plugin portlets. I have used single plugin in portlet having service builder. All other plugin portlets are using same service builder portlet.
Ex:
Portlet1, Poertlet2, Portlet3 and ServiceBuilder portlet. Portlet1, Poertlet2, Portlet3 are using same ServiceBuilder portlet.
This service builder is connected to external database. And i am inserting/fetching data from this external database. There are one to many and many to one relationship structure in database. I want to use hibernate relationship model for these relationship and run complex queries to fetch data. So i want to use hibernate session factory in my service builder.
Please give your valuable advice or code so that i can do this as per the requirement.
Please note:
1. I have read about liferay relationship in tables. But this has not work as per my requirement.
2. Most of tables are managed by other application. I am using their data only.
Service builder does not work this way and if you want the relation you should not use it.
The idea behind service builder is to have an easy DB access layer - entity at a time and the relations are resolved in the business logic.
If you want that the relations are handled by the persistence layer you need to use plain hibernate.

How to sync records between Core Data and CloudKit efficiently

I'm currently learning how to use CloudKit Framework and lack of documentation or examples showing how to sync Core Data and CloudKit.
I have watched all WWDC videos (2014, 2015, 2016) Dedicated to CloudKit, but none of them telling us how to implement syncing with Core Data. I can't find any fresh examples, tutorial or books, showing how to implement this syncing.
I know that it is effective to use Operations API by CloudKit (not Convenience API) and to Subscribe to changes as it said in the new WWDC 2016 videos, dedicated to CloudKit, but mapping with CoreData is a real problem.
For example, let's say I would like to create an app similar to Notes app. while offline, user can create his notes and work with them saving them to his core data database. When the device going online the app checks what changed on the server and saves newly created records to server (CloudKit).
When the app starts, it also fetches for changes from the CloudKit and if there are changes , it updates local cache (Core Data) with the new changes.
I would appreciate to have a common pattern of syncing. Where to place syncing with Core Data methods and how they should look like?
Would appreciate any information or help about this.
I'm using Swift 3, Xcode 8 , iOS 10.
As of iOS 13, there are new API's that simplify this synchronization for developers. I would recommend you to watch the WWDC19 session about the new synchronization between CoreData and CloudKit. Please note that these new API's only work for iOS 13+.
Video: https://developer.apple.com/videos/play/wwdc2019/202/
In short, you need to start using NSPersistentCloudKitContainer instead of NSPersistentContainer. This will let the syncing work automatically using automatic conflict resolution with a last-writer-wins merge strategy. If you want to build a good working app, you'll also need to do some modifications to improve the syncing for your app.
Official documentation can be found at:
Setting Up Core Data with CloudKit
Syncing a Core Data Store with CloudKit
Data modeling for collaboration (conflict-free replicated data type)
At the end of the session they also demonstrated an example of better sync merging than the default 'last-writer-wins merge strategy'. The usage of Causal Trees allow multiple users to edit the same string (and to some extend other types of data) without losing any data. I would really recommend everyone to read this article from Archagon that describes how this works and how to implement it (also with CloudKit syncing, but not the new automatic one). As demonstrated in the session, you can also implement this with the new automatic syncing between CoreData and CloudKit.
Core Data already provides the user with the ability to sync to iCloud. There's no need to use CloudKit.
Design For Core Data In iCloud
But yes, Core Data with iCloud has been deprecated. Even so, it has not been discontinued, and there are no immediate plans at apple to discontinue it, they just want to discourage its use. But it also has problems with rationalising updates from multiple devices.
In any case, I have been looking into the question of how to do this with cloud kit myself. Two answers; the first is to use the following;
Seam in GitHub
The second is to do it manually;
Designing for CloudKit
The key here is that Cloud Kit needs the record metadata to be able to handle record updates reliably, so you have to save that metadata in your Core Data database. The CKRecord class includes a method encodeSystemFields(with:) which will encode those fields into a Data record that can be stored in your database, and then your can use the appropriate decoder when you need to restore the CKRecord.
Anyway, I am about to start doing this myself. I'll update this with more information when I have it.
Apple has recently published a guide that seems to answer this question. Check out Apple's Maintaining a Local Cache of CloudKit Records to see how to store CloudKit data on device.
While this guide doesn't provide sample code to write to the device, it does answer the rest of the question. This tells you how to fetch changes from CloudKit and create data which can be stored on the device.

ASP.NET MVC & Entity Framework

We have a SQL Server with multiple database (different schema) and i need to develop an application in ASP.NET MVC & Entity Framework to connect to any of these database in runtime and perform DML operations. If a new database is added to the SQL Server then the application should able to connect to this new database without any configuration/code change. I am exactly looking for DML operation handled by myLittleAdmin
Can anyone advice me on this please
Unfortunately you won't be able to do this with Entity Framework. Entity Framework operates in two different instances, Code-first & Database-first.
The former being writing your relevant model classes for your data first and then Entity Framework will work out a database schema based upon those classes handling foreign key references etc automatically based on the references between models.
The latter is effectively the opposite, you define the database schema and Entity Framework produces the model classes from this. I have always found this method to be cleaner as you have more control over the database structure and I find it more difficult to make mistakes.
In your situation Entity Framework needs to know before hand the structure of the database to enable it to read from it so it cannot "connect to this new database without any configuration/code change". If you can provide more information about what you are wanting then I may be able to help.
I recently created an asset management system which could store generic assets which would traditionally be stored in separate tables, this solution was developed using Entity Framework but the database was designed in such a way that it could handle generic asset objects and store them i.e. if we created a new asset type then no database change was required hence there was no code change for Entity Framework either.

Checking iCloud for existing content

What is the best way to check iCloud for existing data?
I need to check that data doesn't exist on the local device, or iCloud so I can then download it.
Since you included the core-data tag I'm assuming you mean that you're using Core Data rather than iCloud file APIs or the ubiquitous key-value store.
With Core Data's built-in iCloud support, you check on existing data in exactly the same way as if you were not using iCloud. Once you create your Core Data stack, you check what data exists by doing normal Core Data fetches. There's no (exposed) concept of local vs. cloud data, there's just one data store that happens to know how to communicate with iCloud. You don't explicitly initiate downloads-- they happen automatically.
At app launch time when you call addPersistentStoreWithType:configuration:URL:options:error:, Core Data internally initiates the download of any data that's not available locally yet. As a result this method may block for a while. If it returns successfully, then all current downloads can be assumed to be complete.
If new changes appear while your app is running, Core Data will download and import them and, when it's finished, will post NSPersistentStoreDidImportUbiquitousContentChangesNotification to tell you what just happened.
This all describes how Core Data's iCloud is supposed to work. In practice you'll probably find that it doesn't always work as intended.
Thanks to #Tom Harrington for pointing out, this error is nothing to do with the developer/coding - it's purely to do with iCloud/Apple/connection issues.
More on this SO answer I found.

UIDocument or UIManagedDocument when the application's backing store is both file & core data database

I am bit confused regarding which class I should inherit from. My application currently creates files in the "Documents" folder and also has Core Data based data models. These data models contains more information about the files.
Now I am thinking to migrate the app to the document architecture and thereby integrating with iCloud at one of time.
I have started to think in the direction of using both i.e. using UIDocument to manage the files and UIManagedDocument to manage the Core Data.
Would appreciate if someone could guide me.
It is perfectly acceptable to use both at the same time, as you said, for different purposes.
But consider, if those files are real documents and not just some data files of an internal implementation, I personally would not store any critical data about the documents separate from the documents though. Since documents from user perspective are meant to be self-sustaining - user may create, delete or move them around freely without fearing any interdependency with some other documents or objects. User expects all necessary meta-data to move with the document.
Then again if there is some "house-keeping" metadata that you can always re-create about your documents in the database, that is just fine.

Resources