Copier classes
In many cases, PolicyCenter uses a copier as well as a matcher. For example, jobs other than submission jobs need
to do the following process, which is known as DuplicateAdd.
- Generate a policy difference between two branches to find added entity instances.
- Use matchers to check whether new entity instances have a match elsewhere in the graph.
- If a match exists, use copiers to ensure that the matches are fully synchronized, as defined by the entity type.
A copier class is able to completely duplicate an entity instance.
DuplicateAdd does not work as expected. PolicyCenter might extend an existing entity, but lose
new property values by not copying them.In a typical policy difference operation, the difference generation is read-only. The difference generation itself does not need to copy data from one entity to a duplicate of that entity.
Each entity type that uses a copier class extends that class from the abstract class gw.api.copy.Copier or one of its subclasses. For example, the copier class for the PersonalAuto entity type is PersonalVehicleCopier.
If you create a new entity type that the policy graph uses, you need to create a copier class for that entity type. Similarly, if you extend an existing entity, you must determine whether that extension affects the copier class. If your extension includes a database-backed property, you typically need to copy that property. For example, if you extend the PersonalAuto entity type, consider whether you need to modify the PersonalVehicleCopier class.
See also
