Search in sources :

Example 46 with Action

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

the class FixedAssetRole method delete.

@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
public FixedAsset delete() {
    FixedAsset fa = getAsset();
    remove(this);
    return fa;
}
Also used : FixedAsset(org.estatio.module.asset.dom.FixedAsset) Action(org.apache.isis.applib.annotation.Action)

Example 47 with Action

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

the class EstatioFixtureScripts method createRetroInvoicesForProperty.

@Action(restrictTo = RestrictTo.PROTOTYPING)
@MemberOrder(sequence = "2")
public List<FixtureResult> createRetroInvoicesForProperty(final Property property, @ParameterLayout(named = "Start due date") final LocalDate startDueDate, @Parameter(optionality = Optionality.OPTIONAL) @ParameterLayout(named = "Nextdue date") final LocalDate nextDueDate) {
    final CreateRetroInvoices creator = container.newTransientInstance(CreateRetroInvoices.class);
    final FixtureScript.ExecutionContext executionContext = fixtureScripts.newExecutionContext(null);
    creator.createProperty(property, startDueDate, nextDueDate, executionContext);
    return executionContext.getResults();
}
Also used : CreateRetroInvoices(org.estatio.module.lease.migrations.CreateRetroInvoices) FixtureScript(org.apache.isis.applib.fixturescripts.FixtureScript) Action(org.apache.isis.applib.annotation.Action) MemberOrder(org.apache.isis.applib.annotation.MemberOrder)

Example 48 with Action

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

the class IndexValuesMaintenanceMenu method uploadIndexValues.

// //////////////////////////////////////
@Action(publishing = Publishing.DISABLED, semantics = SemanticsOf.IDEMPOTENT)
@MemberOrder(sequence = "2")
public List<IndexValueMaintLineItem> uploadIndexValues(@Parameter(fileAccept = ".xlsx") @ParameterLayout(named = "Excel spreadsheet") final Blob spreadsheet, final Country country) {
    final ApplicationTenancy applicationTenancy = estatioApplicationTenancyRepository.findOrCreateTenancyFor(country);
    List<IndexValueMaintLineItem> lineItems = excelService.fromExcel(spreadsheet, IndexValueMaintLineItem.class, IndexValueMaintLineItem.class.getSimpleName());
    for (IndexValueMaintLineItem lineItem : lineItems) {
        lineItem.setAtPath(applicationTenancy.getPath());
    }
    return lineItems;
}
Also used : ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) Action(org.apache.isis.applib.annotation.Action) MemberOrder(org.apache.isis.applib.annotation.MemberOrder)

Example 49 with Action

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

the class Guarantee method remove.

@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
public void remove(final String reason) {
    remove(this);
    final FinancialAccount financialAccount = getFinancialAccount();
    this.setFinancialAccount(null);
    if (financialAccount != null) {
        financialAccount.remove(reason);
    }
}
Also used : FinancialAccount(org.estatio.module.financial.dom.FinancialAccount) Action(org.apache.isis.applib.annotation.Action)

Example 50 with Action

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

the class Communication method sendByEmail.

// so can invoke via BackgroundService
@Action(hidden = Where.EVERYWHERE)
public Communication sendByEmail() {
    // body...
    final Document coverNoteDoc = findDocument(DocumentConstants.PAPERCLIP_ROLE_COVER);
    final String emailBody = coverNoteDoc.asChars();
    // (email) attachments..
    // this corresponds to the primary document and any attachments
    final List<DataSource> attachments = Lists.newArrayList();
    final Document primaryDocument = getPrimaryDocument();
    if (primaryDocument != null) {
        // should be the case
        attachments.add(primaryDocument.asDataSource());
    }
    attachments.addAll(findDocumentsInRoleAsStream(DocumentConstants.PAPERCLIP_ROLE_ATTACHMENT).map(DocumentAbstract::asDataSource).collect(Collectors.toList()));
    // cc..
    final List<String> toList = findCorrespondents(CommChannelRoleType.TO);
    final List<String> ccList = findCorrespondents(CommChannelRoleType.CC);
    final List<String> bccList = findCorrespondents(CommChannelRoleType.BCC);
    // subject ...
    final String subject = getSubject();
    // finally, we send
    final boolean send = emailService.send(toList, ccList, bccList, subject, emailBody, attachments.toArray(new DataSource[] {}));
    if (!send) {
        throw new ApplicationException("Failed to send email; see system logs for details.");
    }
    // mark this comm as having been sent.
    sent();
    return this;
}
Also used : DocumentAbstract(org.incode.module.document.dom.impl.docs.DocumentAbstract) ApplicationException(org.apache.isis.applib.ApplicationException) Document(org.incode.module.document.dom.impl.docs.Document) DataSource(javax.activation.DataSource) Action(org.apache.isis.applib.annotation.Action)

Aggregations

Action (org.apache.isis.applib.annotation.Action)117 ActionLayout (org.apache.isis.applib.annotation.ActionLayout)63 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)31 Document (org.incode.module.document.dom.impl.docs.Document)23 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)12 ArrayList (java.util.ArrayList)11 Blob (org.apache.isis.applib.value.Blob)10 WorksheetSpec (org.isisaddons.module.excel.dom.WorksheetSpec)10 LocalDate (org.joda.time.LocalDate)9 WorksheetContent (org.isisaddons.module.excel.dom.WorksheetContent)8 DomainObject (org.apache.isis.applib.annotation.DomainObject)6 DateTime (org.joda.time.DateTime)6 List (java.util.List)5 SemanticsOf (org.apache.isis.applib.annotation.SemanticsOf)5 PaymentBatch (org.estatio.module.capex.dom.payment.PaymentBatch)5 BankAccount (org.estatio.module.financial.dom.BankAccount)5 Lease (org.estatio.module.lease.dom.Lease)5 Organisation (org.estatio.module.party.dom.Organisation)5 BigDecimal (java.math.BigDecimal)4 Collectors (java.util.stream.Collectors)4