Search in sources :

Example 31 with ActionLayout

use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.

the class InvoiceMenu method newInvoiceForLease.

@ActionLayout(contributed = Contributed.AS_NEITHER)
@Action(semantics = SemanticsOf.NON_IDEMPOTENT)
@MemberOrder(sequence = "1")
public Invoice newInvoiceForLease(final Lease lease, final LocalDate dueDate, @Parameter(optionality = Optionality.OPTIONAL) final PaymentMethod paymentMethod, final Currency currency) {
    final Property propertyIfAny = lease.getProperty();
    final Party seller = lease.getPrimaryParty();
    final Party buyer = lease.getSecondaryParty();
    final ApplicationTenancy propertySellerTenancy = estatioApplicationTenancyRepositoryForLease.findOrCreateTenancyFor(propertyIfAny, seller);
    return invoiceForLeaseRepository.newInvoice(propertySellerTenancy, seller, buyer, paymentMethod == null ? lease.defaultPaymentMethod() : paymentMethod, currency, dueDate, lease, null);
}
Also used : Party(org.estatio.module.party.dom.Party) Property(org.estatio.module.asset.dom.Property) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) Action(org.apache.isis.applib.annotation.Action) MemberOrder(org.apache.isis.applib.annotation.MemberOrder) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 32 with ActionLayout

use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.

the class InvoiceForLease_sendByEmailPrelimLetterOrInvoiceDocAbstract method $$.

@Action(semantics = SemanticsOf.NON_IDEMPOTENT, domainEvent = DomainEvent.class)
@ActionLayout(cssClassFa = "at", contributed = Contributed.AS_ACTION)
public Invoice $$(@ParameterLayout(named = "to:") final EmailAddress toChannel, @Parameter(optionality = Optionality.OPTIONAL, maxLength = CommunicationChannel.EmailType.Meta.MAX_LEN, regexPattern = CommunicationChannel.EmailType.Meta.REGEX, regexPatternReplacement = CommunicationChannel.EmailType.Meta.REGEX_DESC) @ParameterLayout(named = "cc:") final String cc, @Parameter(optionality = Optionality.OPTIONAL, maxLength = CommunicationChannel.EmailType.Meta.MAX_LEN, regexPattern = CommunicationChannel.EmailType.Meta.REGEX, regexPatternReplacement = CommunicationChannel.EmailType.Meta.REGEX_DESC) @ParameterLayout(named = "cc (2):") final String cc2, @Parameter(optionality = Optionality.OPTIONAL, maxLength = CommunicationChannel.EmailType.Meta.MAX_LEN, regexPattern = CommunicationChannel.EmailType.Meta.REGEX, regexPatternReplacement = CommunicationChannel.EmailType.Meta.REGEX_DESC) @ParameterLayout(named = "cc (3):") final String cc3, @Parameter(optionality = Optionality.OPTIONAL, maxLength = CommunicationChannel.EmailType.Meta.MAX_LEN, regexPattern = CommunicationChannel.EmailType.Meta.REGEX, regexPatternReplacement = CommunicationChannel.EmailType.Meta.REGEX_DESC) @ParameterLayout(named = "bcc:") final String bcc, @Parameter(optionality = Optionality.OPTIONAL, maxLength = CommunicationChannel.EmailType.Meta.MAX_LEN, regexPattern = CommunicationChannel.EmailType.Meta.REGEX, regexPatternReplacement = CommunicationChannel.EmailType.Meta.REGEX_DESC) @ParameterLayout(named = "bcc (2):") final String bcc2) throws IOException {
    final Document document = findDocument();
    createEmailCommunication(document, toChannel, cc, cc2, cc3, bcc, bcc2);
    return invoice;
}
Also used : Document(org.incode.module.document.dom.impl.docs.Document) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 33 with ActionLayout

use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.

the class Budget_DownloadCalculations method downloadCalculations.

@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa = "fa-download")
public Blob downloadCalculations() {
    final String fileName = budget.title() + ".xlsx";
    WorksheetSpec spec = new WorksheetSpec(CalculationResultViewModel.class, "values");
    WorksheetContent worksheetContent = new WorksheetContent(budgetAssignmentService.getCalculationResults(budget), spec);
    return excelService.toExcelPivot(worksheetContent, fileName);
}
Also used : WorksheetSpec(org.isisaddons.module.excel.dom.WorksheetSpec) WorksheetContent(org.isisaddons.module.excel.dom.WorksheetContent) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 34 with ActionLayout

use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.

the class Budget_Remove method removeBudget.

@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
@ActionLayout(contributed = Contributed.AS_ACTION)
public void removeBudget(@ParameterLayout(named = "This will delete the budget and all associated data including keytables, calculations, runs, results and lease terms. (You may consider downloading the budget and the keytables beforehand.) Are you sure?") final boolean areYouSure) {
    // delete results and runs
    for (BudgetCalculationRun run : budgetCalculationRunRepository.allBudgetCalculationRuns().stream().filter(x -> x.getBudget().equals(budget)).collect(Collectors.toList())) {
        for (BudgetCalculationResult result : run.getBudgetCalculationResults()) {
            // delete links and lease terms
            for (BudgetCalculationResultLink link : budgetCalculationResultLinkRepository.findByCalculationResult(result)) {
                LeaseTermForServiceCharge leaseTermToRemove = null;
                if (link.getLeaseTermForServiceCharge() != null) {
                    leaseTermToRemove = link.getLeaseTermForServiceCharge();
                }
                link.remove();
                if (leaseTermToRemove != null) {
                    leaseTermToRemove.remove();
                }
            }
        }
        run.remove();
    }
    // delete overrides and values
    for (Lease lease : leaseRepository.findByAssetAndActiveOnDate(budget.getProperty(), budget.getStartDate())) {
        for (BudgetOverride override : budgetOverrideRepository.findByLease(lease)) {
            override.remove();
        }
    }
    // delete partition items
    for (BudgetItem budgetItem : budget.getItems()) {
        for (PartitionItem item : partitionItemRepository.findByBudgetItem(budgetItem)) {
            item.remove();
        }
    }
    budget.remove();
}
Also used : BudgetOverrideRepository(org.estatio.module.budgetassignment.dom.override.BudgetOverrideRepository) BudgetCalculationRepository(org.estatio.module.budget.dom.budgetcalculation.BudgetCalculationRepository) EstatioRole(org.estatio.module.base.dom.EstatioRole) Lease(org.estatio.module.lease.dom.Lease) Inject(javax.inject.Inject) ActionLayout(org.apache.isis.applib.annotation.ActionLayout) BudgetCalculationRun(org.estatio.module.budgetassignment.dom.calculationresult.BudgetCalculationRun) Budget(org.estatio.module.budget.dom.budget.Budget) UserService(org.apache.isis.applib.services.user.UserService) Action(org.apache.isis.applib.annotation.Action) LeaseTermForServiceCharge(org.estatio.module.lease.dom.LeaseTermForServiceCharge) BudgetOverride(org.estatio.module.budgetassignment.dom.override.BudgetOverride) PartitionItem(org.estatio.module.budget.dom.partioning.PartitionItem) BudgetCalculationType(org.estatio.module.budget.dom.budgetcalculation.BudgetCalculationType) BudgetCalculationResultLinkRepository(org.estatio.module.budgetassignment.dom.calculationresult.BudgetCalculationResultLinkRepository) BudgetCalculationResult(org.estatio.module.budgetassignment.dom.calculationresult.BudgetCalculationResult) BudgetCalculationResultLink(org.estatio.module.budgetassignment.dom.calculationresult.BudgetCalculationResultLink) Collectors(java.util.stream.Collectors) PartitionItemRepository(org.estatio.module.budget.dom.partioning.PartitionItemRepository) LeaseRepository(org.estatio.module.lease.dom.LeaseRepository) Mixin(org.apache.isis.applib.annotation.Mixin) SemanticsOf(org.apache.isis.applib.annotation.SemanticsOf) ParameterLayout(org.apache.isis.applib.annotation.ParameterLayout) Contributed(org.apache.isis.applib.annotation.Contributed) BudgetCalculationRunRepository(org.estatio.module.budgetassignment.dom.calculationresult.BudgetCalculationRunRepository) BudgetItem(org.estatio.module.budget.dom.budgetitem.BudgetItem) BudgetCalculationResultLink(org.estatio.module.budgetassignment.dom.calculationresult.BudgetCalculationResultLink) Lease(org.estatio.module.lease.dom.Lease) BudgetOverride(org.estatio.module.budgetassignment.dom.override.BudgetOverride) BudgetItem(org.estatio.module.budget.dom.budgetitem.BudgetItem) LeaseTermForServiceCharge(org.estatio.module.lease.dom.LeaseTermForServiceCharge) BudgetCalculationRun(org.estatio.module.budgetassignment.dom.calculationresult.BudgetCalculationRun) PartitionItem(org.estatio.module.budget.dom.partioning.PartitionItem) BudgetCalculationResult(org.estatio.module.budgetassignment.dom.calculationresult.BudgetCalculationResult) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 35 with ActionLayout

use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.

the class Budget method removeAllBudgetItems.

@Action(restrictTo = RestrictTo.PROTOTYPING, semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
@ActionLayout()
public Budget removeAllBudgetItems() {
    for (BudgetItem budgetItem : this.getItems()) {
        for (PartitionItem pItem : budgetItem.getPartitionItems()) {
            pItem.remove();
        }
        getContainer().remove(budgetItem);
        getContainer().flush();
    }
    return this;
}
Also used : BudgetItem(org.estatio.module.budget.dom.budgetitem.BudgetItem) PartitionItem(org.estatio.module.budget.dom.partioning.PartitionItem) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Aggregations

ActionLayout (org.apache.isis.applib.annotation.ActionLayout)62 Action (org.apache.isis.applib.annotation.Action)61 Document (org.incode.module.document.dom.impl.docs.Document)22 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)14 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)9 WorksheetSpec (org.isisaddons.module.excel.dom.WorksheetSpec)7 Blob (org.apache.isis.applib.value.Blob)6 ArrayList (java.util.ArrayList)5 WorksheetContent (org.isisaddons.module.excel.dom.WorksheetContent)5 DocumentTemplate (org.incode.module.document.dom.impl.docs.DocumentTemplate)3 DomainObject (org.apache.isis.applib.annotation.DomainObject)2 BudgetItem (org.estatio.module.budget.dom.budgetitem.BudgetItem)2 PartitionItem (org.estatio.module.budget.dom.partioning.PartitionItem)2 IncomingDocViewModel (org.estatio.module.capex.app.document.IncomingDocViewModel)2 Invoice (org.estatio.module.invoice.dom.Invoice)2 Lease (org.estatio.module.lease.dom.Lease)2 Organisation (org.estatio.module.party.dom.Organisation)2 DocumentType (org.incode.module.document.dom.impl.types.DocumentType)2 LocalDate (org.joda.time.LocalDate)2 LocalDateTime (org.joda.time.LocalDateTime)2