Search in sources :

Example 1 with FixtureResult

use of org.apache.isis.applib.fixturescripts.FixtureResult in project estatio by estatio.

the class OrderInvoiceImportForDemoXlsxFixture method execute.

@Override
protected void execute(final ExecutionContext executionContext) {
    setExcelResource(Resources.getResource(getClass(), "OrderInvoiceImportForDemo.xlsx"));
    setMatcher(sheetName -> {
        if (sheetName.startsWith("OXFORD")) {
            return new WorksheetSpec(rowFactoryFor(OrderInvoiceImportHandler.class, executionContext), sheetName, Mode.RELAXED);
        } else {
            return null;
        }
    });
    super.execute(executionContext);
    for (FixtureResult result : executionContext.getResults()) {
        if (result.getClassName().equals(OrderInvoiceLine.class.getName())) {
            OrderInvoiceLine line = (OrderInvoiceLine) result.getObject();
            OrderInvoiceLine._apply applyMixin = factoryService.mixin(OrderInvoiceLine._apply.class, line);
            if (applyMixin.disableAct() == null) {
                applyMixin.act();
            }
        }
    }
}
Also used : WorksheetSpec(org.isisaddons.module.excel.dom.WorksheetSpec) OrderInvoiceImportHandler(org.estatio.module.capex.imports.OrderInvoiceImportHandler) FixtureResult(org.apache.isis.applib.fixturescripts.FixtureResult) OrderInvoiceLine(org.estatio.module.capex.imports.OrderInvoiceLine)

Example 2 with FixtureResult

use of org.apache.isis.applib.fixturescripts.FixtureResult 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)

Aggregations

FixtureResult (org.apache.isis.applib.fixturescripts.FixtureResult)2 Action (org.apache.isis.applib.annotation.Action)1 ActionLayout (org.apache.isis.applib.annotation.ActionLayout)1 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)1 EstatioSecurityModuleSeedFixture (org.estatio.module.base.seed.EstatioSecurityModuleSeedFixture)1 OrderInvoiceImportHandler (org.estatio.module.capex.imports.OrderInvoiceImportHandler)1 OrderInvoiceLine (org.estatio.module.capex.imports.OrderInvoiceLine)1 WorksheetSpec (org.isisaddons.module.excel.dom.WorksheetSpec)1 ApplicationRole (org.isisaddons.module.security.dom.role.ApplicationRole)1