@api
permission[pCorp] update(
meteringCode: Text,
usageType: UsageType,
medium: Medium,
powerMeterType: Optional<PowerMeterType>,
billableFrom: LocalDate,
newPricePackageId: Optional<Number>
) | DRAFT, ACTIVE {
if (this.activeState().getOrFail() == States.DRAFT) {
this.private_updateDraft[pCorp](meteringCode, usageType, medium, powerMeterType, billableFrom, newPricePackageId);
} else {
this.private_updateActive[pCorp](meteringCode, usageType, medium, powerMeterType, billableFrom, newPricePackageId);
};
};
Produces 2 warnings both of which are incorrect because the conditional is not taken into account
NPL: Warning: W0007: Action 'update' calls 'private_updateDraft', but 'ACTIVE' cannot access it
NPL: Warning: W0007: Action 'update' calls 'private_updatePricePackageId', but 'DRAFT' cannot access it
The conditional assures that both these things cannot happen