package gw.job.sxs uses gw.api.match.MatchableTreeTraverserUtils uses gw.lang.reflect.IType uses java.util.Map uses java.util.Set uses gw.util.concurrent.LocklessLazyVar uses gw.entity.IEntityType uses java.util.List /** * PersonalAutoSideBySideBaseDataConfig * Configuration that controls which entities and properties are considered Side By Side Data. * Provides access to entities that are created, updated or removed as a result of base * data copy when accessing Side By Side data. */ @Export class PersonalAutoSideBySideBaseDataConfig extends AbstractSideBySideBaseDataConfig { private var _src : PolicyPeriod as Src private var _dst : PolicyPeriod as Dst static private var sideBySideTypes = new LocklessLazyVar>() { override function init() : Set { return MatchableTreeTraverserUtils.getSubAndImplementingTypes({ // Types that are side by side should be added here: // Strongly suggested exclusions VehicleDriver, PAVhcleAddlInterest, // OOB configured exclusions PersonalAutoCov, PersonalVehicle, // For Billing Payment PolicyBillingContact // Note: The above exclusions assume that certain types are excluded in AbstractSideBySideBaseDataConfig, including: // Coverage, Exclusion, PolicyCondition, CoverageSymbol, CoverageSymbolGroup, Form, FormAssociation, FormEdgeTable, // Reinsurable, and UWIssue. If any of those types is removed from that class, they may need to be added here to // make this code work correctly. }) } } // The list of properties below will be checked against for all types of properties (e.g. - FKs, arrays, scalars) // during base data copy. If the Type->Property is in this map, it will be considered side by side and NOT copied // during base data copy. To exclude multiple properties for the same type, be sure to use a single [type]->[property set>] entry. // e.g. - make typeA.prop1 and typeA.prop2 side-by-side: // Correct: prop1 and prop2 will be excluded // -> {, } // Incorrect: only prop2 will be excluded (previous definition is over written) // -> {} // -> {} // static private var sideBySideProperties = new LocklessLazyVar>>() { override function init() : Map> { var superTypeToPropertiesMap : Map> = { // Properties that are side by side should be added here: // Strongly suggested exclusions entity.PersonalAutoLine -> {"ReferenceDateInternal", "PolicyDrivers"}, PersonalVehicle -> {"ReferenceDateInternal", "QuickQuoteNumber"}, PolicyDriver -> {"QuickQuoteNumber"}, // Configured exclusions EffectiveDatedFields -> {"OfferingCode"} // Note: The above exclusions assume that certain properties are excluded in AbstractSideBySideBaseDataConfig, including: // Coverable: InitialCoveragesCreated, InitialExclusionsCreated, and InitialConditionsCreated // PolicyPeriod: RIRiskVersionList, QuoteHidden, EditLocked, DepositCollected, InvoiceStreamCode, NewInvoiceStream, // ReportingPatternCode, SingleCheckingPatternCode, SeriesCheckingPatternCode, OverrideBillingAllocation, // BillImmediatelyPercentage, DepositOverridePct, DepositAmount, WaiveDepositChange, SelectedPaymentPlan, // AltBillingAccountNumber, AllocationOfRemainder, RefuncCalcMethod, BillingMethod, // TotalCostRPT, TotalPremiumRPT, TransactionCostRPT, TransactionPremiumRPT, BaseState, and WrittenDate // Coverage, Exclusion, and Modifier: ReferenceDateInternal // PolicyLine: NumAddlInsured // If any of those types is removed from that class, they may need to be added here to // make this code work correctly. } // Confirm all Property names refer to real properties and include subtypes superTypeToPropertiesMap.eachKeyAndValue(\ type, props -> props.each(\ prop -> checkPropertyName(type, prop))) return MatchableTreeTraverserUtils.associateAllSubTypesWithPropertySet(superTypeToPropertiesMap) } } override function shouldCopyBean(parentBean : KeyableBean, targetBean : KeyableBean) : boolean { if ((parentBean typeis PersonalAutoLine) and (targetBean typeis PAModifier)) { return (not targetBean.PatternCode.equals("PAMultiCarDiscount")) } return true } override function supportsPolicies(policyPeriods : List) : boolean { return policyPeriods.allMatch(\pp -> (not pp.MultiLine) and pp.PersonalAutoLineExists) } override function getLineSpecificPropertyExclusions() : Map> { return sideBySideProperties.get() } override function getLineSpecificTypeExclusions() : Set { return sideBySideTypes.get() } }