use of org.estatio.module.budgetassignment.dom.override.BudgetOverrideForFlatRate in project estatio by estatio.
the class BudgetOverrideForFlatRateBuilder method execute.
@Override
protected void execute(final ExecutionContext executionContext) {
checkParam("lease", executionContext, Lease.class);
checkParam("invoiceCharge", executionContext, Charge.class);
checkParam("valuePerM2", executionContext, BigDecimal.class);
checkParam("weightedArea", executionContext, BigDecimal.class);
defaultParam("budgetCalculationType", executionContext, BudgetCalculationType.BUDGETED);
defaultParam("reason", executionContext, BudgetOverrideType.FLATRATE.reason);
BudgetOverrideForFlatRate budgetOverride = budgetOverrideRepository.newBudgetOverrideForFlatRate(valuePerM2, weightedArea, lease, startDate, endDate, invoiceCharge, incomingCharge, budgetCalculationType, reason);
executionContext.addResult(this, budgetOverride);
object = budgetOverride;
}
use of org.estatio.module.budgetassignment.dom.override.BudgetOverrideForFlatRate in project estatio by estatio.
the class BudgetImportExportService method createOverrides.
private List<BudgetOverrideImportExport> createOverrides(final BudgetOverride override, final BudgetImportExportManager manager) {
List<BudgetOverrideImportExport> result = new ArrayList<>();
String incomingChargeRef;
if (override.getIncomingCharge() == null) {
incomingChargeRef = null;
} else {
incomingChargeRef = override.getIncomingCharge().getReference();
}
String typeName;
if (override.getType() == null) {
typeName = null;
} else {
typeName = override.getType().name();
}
BigDecimal maxValue = BigDecimal.ZERO;
if (override.getClass() == BudgetOverrideForMax.class) {
BudgetOverrideForMax o = (BudgetOverrideForMax) override;
maxValue = maxValue.add(o.getMaxValue());
}
BigDecimal fixedValue = BigDecimal.ZERO;
if (override.getClass() == BudgetOverrideForFixed.class) {
BudgetOverrideForFixed o = (BudgetOverrideForFixed) override;
fixedValue = fixedValue.add(o.getFixedValue());
}
BigDecimal valuePerM2 = BigDecimal.ZERO;
BigDecimal weightedArea = BigDecimal.ZERO;
if (override.getClass() == BudgetOverrideForFlatRate.class) {
BudgetOverrideForFlatRate o = (BudgetOverrideForFlatRate) override;
valuePerM2 = valuePerM2.add(o.getValuePerM2());
weightedArea = weightedArea.add(o.getWeightedArea());
}
result.add(new BudgetOverrideImportExport(override.getLease().getReference(), override.getStartDate(), override.getEndDate(), override.getInvoiceCharge().getReference(), incomingChargeRef, typeName, override.getReason(), override.getClass().getSimpleName(), maxValue, fixedValue, valuePerM2, weightedArea));
return result;
}
Aggregations