Search in sources :

Example 11 with MemberOrder

use of org.apache.isis.applib.annotation.MemberOrder 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 12 with MemberOrder

use of org.apache.isis.applib.annotation.MemberOrder 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 13 with MemberOrder

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

the class IndexValueMaintLineItem method apply.

// //////////////////////////////////////
@MemberOrder(sequence = "2")
@ActionSemantics(Of.IDEMPOTENT)
@Bulk
public void apply() {
    if (bulkInteractionContext.isFirst()) {
        String error = check();
        if (error != null) {
            getContainer().raiseError(error);
            return;
        }
    }
    // only null on first pass, then populated
    ApplicationTenancy applicationTenancy = (ApplicationTenancy) scratchpad.get("applicationTenancy");
    if (applicationTenancy == null) {
        final String atPath = getAtPath();
        applicationTenancy = applicationTenancies.findTenancyByPath(atPath);
        scratchpad.put("applicationTenancy", applicationTenancy);
    }
    // only null on first pass, then populated
    Index index = (Index) scratchpad.get("index");
    if (index == null) {
        final String reference = getReference();
        index = indexRepository.newIndex(reference, reference, applicationTenancy);
        scratchpad.put("index", index);
        setIndex(index);
    }
    // only null on first pass, then populated, and only if !existingIndex
    IndexBase previousBase = (IndexBase) scratchpad.get("previousBase");
    final LocalDate baseStartDate = getBaseStartDate();
    final BigDecimal baseFactor = getBaseFactor();
    IndexBase indexBase = indexBaseRepository.findByIndexAndDate(index, baseStartDate);
    if (indexBase == null) {
        indexBase = indexBaseRepository.newIndexBase(index, previousBase, baseStartDate, baseFactor);
    }
    setIndexBase(indexBase);
    // for next time need to create
    scratchpad.put("previousBase", indexBase);
    final LocalDate valueStartDate = getValueStartDate();
    final BigDecimal value = getValue();
    IndexValue indexValue = indexValueRepository.findByIndexAndStartDate(index, valueStartDate);
    if (indexValue == null) {
        indexValue = indexValueRepository.findOrCreate(index, valueStartDate, value);
    } else {
        indexValue.setValue(value);
    }
    setIndexValue(indexValue);
    // belt-n-braces so that subsequent queries succeed...
    getContainer().flush();
}
Also used : Index(org.estatio.module.index.dom.Index) IndexBase(org.estatio.module.index.dom.IndexBase) IndexValue(org.estatio.module.index.dom.IndexValue) LocalDate(org.joda.time.LocalDate) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) BigDecimal(java.math.BigDecimal) ActionSemantics(org.apache.isis.applib.annotation.ActionSemantics) MemberOrder(org.apache.isis.applib.annotation.MemberOrder) Bulk(org.apache.isis.applib.annotation.Bulk)

Example 14 with MemberOrder

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

the class EstatioSecurityModuleFixturesMenu method installFixturesAndReturnFirstRole.

// //////////////////////////////////////
@Action(semantics = SemanticsOf.NON_IDEMPOTENT, restrictTo = RestrictTo.PROTOTYPING)
@ActionLayout(cssClassFa = "fa-bolt")
@MemberOrder(sequence = "20")
public Object installFixturesAndReturnFirstRole() {
    final List<FixtureResult> fixtureResultList = fixtureScripts.findFixtureScriptFor(EstatioSecurityModuleSeedFixture.class).run(null);
    for (FixtureResult fixtureResult : fixtureResultList) {
        final Object object = fixtureResult.getObject();
        if (object instanceof ApplicationRole) {
            return object;
        }
    }
    container.warnUser("No rules found in fixture; returning all results");
    return fixtureResultList;
}
Also used : FixtureResult(org.apache.isis.applib.fixturescripts.FixtureResult) ApplicationRole(org.isisaddons.module.security.dom.role.ApplicationRole) EstatioSecurityModuleSeedFixture(org.estatio.module.base.seed.EstatioSecurityModuleSeedFixture) Action(org.apache.isis.applib.annotation.Action) MemberOrder(org.apache.isis.applib.annotation.MemberOrder) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 15 with MemberOrder

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

the class Property_newBudgetContribution method newBudget.

@Action(semantics = SemanticsOf.NON_IDEMPOTENT)
@MemberOrder(name = "budgets", sequence = "1")
public Budget newBudget(final Property property, final int year) {
    Budget budget = budgetRepository.newBudget(property, new LocalDate(year, 01, 01), new LocalDate(year, 12, 31));
    budget.findOrCreatePartitioningForBudgeting();
    return budget;
}
Also used : Budget(org.estatio.module.budget.dom.budget.Budget) LocalDate(org.joda.time.LocalDate) Action(org.apache.isis.applib.annotation.Action) MemberOrder(org.apache.isis.applib.annotation.MemberOrder)

Aggregations

MemberOrder (org.apache.isis.applib.annotation.MemberOrder)34 Action (org.apache.isis.applib.annotation.Action)29 ActionLayout (org.apache.isis.applib.annotation.ActionLayout)15 Document (org.incode.module.document.dom.impl.docs.Document)5 WorksheetSpec (org.isisaddons.module.excel.dom.WorksheetSpec)4 ArrayList (java.util.ArrayList)3 WorksheetContent (org.isisaddons.module.excel.dom.WorksheetContent)3 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)3 Period (org.joda.time.Period)3 FixtureScript (org.apache.isis.applib.fixturescripts.FixtureScript)2 Order (org.estatio.module.capex.dom.order.Order)2 OrderItem (org.estatio.module.capex.dom.order.OrderItem)2 Lease (org.estatio.module.lease.dom.Lease)2 CreateRetroInvoices (org.estatio.module.lease.migrations.CreateRetroInvoices)2 LocalDateInterval (org.incode.module.base.dom.valuetypes.LocalDateInterval)2 DocumentType (org.incode.module.document.dom.impl.types.DocumentType)2 DateTime (org.joda.time.DateTime)2 LocalDate (org.joda.time.LocalDate)2 BigDecimal (java.math.BigDecimal)1 List (java.util.List)1