use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.
the class IncomingInvoice_switchView method act.
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(contributed = Contributed.AS_ACTION, // not sure why this isn't being picked up from isis-non-changing.properties
cssClassFa = "fa-exchange")
@MemberOrder(sequence = "1")
public IncomingDocAsInvoiceViewModel act() {
Optional<Document> documentIfAny = lookupAttachedPdfService.lookupIncomingInvoicePdfFrom(incomingInvoice);
// guaranteed to return, hidden if none
Document document = documentIfAny.get();
final IncomingDocAsInvoiceViewModel viewModel = new IncomingDocAsInvoiceViewModel(incomingInvoice, document);
serviceRegistry2.injectServicesInto(viewModel);
viewModel.init();
return viewModel;
}
use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.
the class IncomingInvoice_LinkedOrderItems method linkedOrderItems.
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(contributed = Contributed.AS_ASSOCIATION)
public List<LinkedOrderItemViewModel> linkedOrderItems() {
List<LinkedOrderItemViewModel> result = new ArrayList<>();
for (OrderItemInvoiceItemLink link : orderItemInvoiceItemLinkRepository.findByInvoice(incomingInvoice)) {
OrderItem item = link.getOrderItem();
BigDecimal netAmount = item.getNetAmount();
BigDecimal netAmountInvoiced = orderItemInvoiceItemLinkRepository.calculateNetAmountLinkedToOrderItem(item);
result.add(new LinkedOrderItemViewModel(item, netAmount, netAmountInvoiced));
}
return result;
}
use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.
the class Task_categoriseDocumentAsOrder method act.
@Action(domainEvent = ActionDomainEvent.class, semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(contributed = Contributed.AS_ACTION, cssClassFa = "folder-open-o")
public Object act(@Nullable final Property property, @Nullable final String comment, final boolean goToNext) {
final Object nextTaskIfAny = nextTaskOrWarnIfRequired(goToNext);
Object mixinResult = mixin().act(property, comment);
if (mixinResult instanceof IncomingDocViewModel) {
IncomingDocViewModel viewModel = (IncomingDocViewModel) mixinResult;
// to support 'goToNext' when finished with the view model
viewModel.setOriginatingTask(task);
}
return coalesce(nextTaskIfAny, mixinResult);
}
use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.
the class Task_categoriseDocumentAsPropertyInvoice method act.
@Action(domainEvent = Task_categoriseDocumentAsOrder.ActionDomainEvent.class, semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(contributed = Contributed.AS_ACTION, cssClassFa = "folder-open-o")
public Object act(final Property property, @Nullable final String comment, final boolean goToNext) {
final Object nextTaskIfAny = nextTaskOrWarnIfRequired(goToNext);
Object mixinResult = mixin().act(property, comment);
if (mixinResult instanceof IncomingDocViewModel) {
IncomingDocViewModel viewModel = (IncomingDocViewModel) mixinResult;
// to support 'goToNext' when finished with the view model
viewModel.setOriginatingTask(task);
}
return coalesce(nextTaskIfAny, mixinResult);
}
use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.
the class IncomingDocViewModel method createSeller.
@Action(semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(named = "Create Supplier")
public IncomingDocViewModel createSeller(final OrganisationNameNumberViewModel candidate, final Country country, @Parameter(optionality = Optionality.OPTIONAL) final String ibanNumber) {
Organisation organisation = organisationRepository.newOrganisation(null, true, candidate.getOrganisationName(), country);
if (candidate.getChamberOfCommerceCode() != null)
organisation.setChamberOfCommerceCode(candidate.getChamberOfCommerceCode());
setSeller(organisation);
if (ibanNumber != null) {
bankAccountRepository.newBankAccount(organisation, ibanNumber, null);
}
onCreateSeller(organisation);
return this;
}
Aggregations