public PlanChangeResult planChange(final PlanPhaseSpecifier from, PlanSpecifier to, final StandaloneCatalog catalog) throws CatalogApiException {
final DefaultPriceList toPriceList;
if (to.getPriceListName() == null) {
toPriceList = findPriceList(from.toPlanSpecifier(), catalog);
to = new PlanSpecifier(to.getProductName(), to.getProductCategory(), to.getBillingPeriod(), toPriceList.getName());
} else {
toPriceList = catalog.findCurrentPriceList(to.getPriceListName());
}
final BillingActionPolicy policy = getPlanChangePolicy(from, to, catalog);
if (policy == BillingActionPolicy.ILLEGAL) {
throw new IllegalPlanChange(from, to);
}
final PlanAlignmentChange alignment = getPlanChangeAlignment(from, to, catalog);
return new PlanChangeResult(toPriceList, policy, alignment);
}