use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class IncomingInvoice_reject method act.
@Action(domainEvent = IncomingInvoice_next.ActionDomainEvent.class, semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(cssClassFa = "fa-thumbs-o-down", cssClass = "btn-warning")
public Object act(final String role, @Nullable final Person personToAssignNextTo, final String reason) {
final List<PaymentLine> paymentLines = paymentLineRepository.findByInvoice(incomingInvoice);
// because of the disableXxx guard, this should return either 0 or 1 lines.
for (PaymentLine paymentLine : paymentLines) {
final PaymentBatch paymentBatch = paymentLine.getBatch();
paymentBatch.removeLineFor(incomingInvoice);
}
trigger(personToAssignNextTo, reason, reason);
return objectToReturn();
}
use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class ProjectItem method amendAmount.
@Action(semantics = SemanticsOf.IDEMPOTENT)
public ProjectItem amendAmount(@Parameter(optionality = Optionality.OPTIONAL) final BigDecimal add, @Parameter(optionality = Optionality.OPTIONAL) final BigDecimal subtract) {
BigDecimal newAmount = getBudgetedAmount() != null ? getBudgetedAmount() : BigDecimal.ZERO;
if (add != null) {
newAmount = newAmount.add(add);
}
if (subtract != null) {
newAmount = newAmount.subtract(subtract);
}
setBudgetedAmount(newAmount);
return this;
}
use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class InvoiceImportManager method getLines.
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(contributed = Contributed.AS_ASSOCIATION)
public List<InvoiceImportLine> getLines() {
List<InvoiceImportLine> result = new ArrayList<>();
for (Lease lease : leaseRepository.findByAssetAndActiveOnDate(getProperty(), clockService.now())) {
PaymentMethod paymentMethod = null;
Unit unit = lease.primaryOccupancy().get().getUnit();
if (lease.getItems().size() > 0) {
if (leaseItemRepository.findLeaseItemsByType(lease, LeaseItemType.RENT).size() > 0) {
paymentMethod = leaseItemRepository.findLeaseItemsByType(lease, LeaseItemType.RENT).get(0).getPaymentMethod();
} else {
paymentMethod = lease.getItems().first().getPaymentMethod();
}
result.add(new InvoiceImportLine(lease.getReference(), null, paymentMethod.name(), null, null, null, null, null, unit.getReference()));
} else {
result.add(new InvoiceImportLine(lease.getReference(), null, null, null, null, null, null, null, unit.getReference()));
}
}
return result;
}
use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class InvoiceImportManager method downloadTemplate.
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa = "fa-download")
public Blob downloadTemplate() {
final String fileName = "template.xlsx";
WorksheetSpec spec = new WorksheetSpec(InvoiceImportLine.class, "invoiceImportLine");
WorksheetContent worksheetContent = new WorksheetContent(getLines(), spec);
return excelService.toExcel(worksheetContent, fileName);
}
use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class Object_links method $$.
// endregion
@Action(semantics = SemanticsOf.SAFE)
public URL $$(final Link link) throws MalformedURLException {
final Root root = new Root(domainObject) {
@SuppressWarnings("unused")
public String getReportServerBaseUrl() {
return reportServerSettingsService.fetchReportServerBaseUrl();
}
};
final String urlStr = stringInterpolator.interpolate(root, link.getUrlTemplate());
return new URL(urlStr);
}
Aggregations