You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Dan Haywood (JIRA)" <ji...@apache.org> on 2016/11/30 12:05:58 UTC
[jira] [Updated] (ISIS-1230) How use SudoService with fixture
scripts that themselves are nested?
[ https://issues.apache.org/jira/browse/ISIS-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Haywood updated ISIS-1230:
------------------------------
Summary: How use SudoService with fixture scripts that themselves are nested? (was: [DUPLICATE] How use SudoService with fixture scripts that themselves are nested?)
> How use SudoService with fixture scripts that themselves are nested?
> --------------------------------------------------------------------
>
> Key: ISIS-1230
> URL: https://issues.apache.org/jira/browse/ISIS-1230
> Project: Isis
> Issue Type: Improvement
> Components: Core
> Affects Versions: core-1.8.0
> Reporter: Dan Haywood
> Priority: Minor
> Fix For: 1.13.2
>
>
> As raised by Oscar:
> I’m not sure how to use the SudoService inside a FixtureScript.
> I have the following:
> public class DemoWithAllRecordsFixture extends FixtureScript {
> public DemoWithAllRecordsFixture() {
> this.withDiscoverability(Discoverability.DISCOVERABLE);
> }
> @Override
> protected void execute(
> final ExecutionContext executionContext) {
> executionContext.executeChild(this, new ExcelInheritedConditionsSNPGenotypeFixture());
> executionContext.executeChild(this, new ExcelDrugsSNPGenotypeFixture());
> executionContext.executeChild(this, new ExcelTraitsSNPGenotypeFixture());
> }
> The ExcelInheritedConditionsSNPGenotypeFixture contains many wrapped action invocations, so the following exception is thrown:
> Caused by: org.apache.isis.applib.services.wrapper.HiddenException: Reason: Could not locate application user for initialisation. Identifier: com.tellmegen.domain.model.inheritedconditions.InheritedCondition#upsertSNPGenotype(java.lang.Integer,com.tellmegen.domain.model.AppliesToSex,java.lang.String,java.lang.String,com.tellmegen.domain.model.inheritedconditions.InheritedConditionHeredity,com.tellmegen.domain.model.inheritedconditions.InheritedConditionPhenotype,com.tellmegen.domain.model.inheritedconditions.InheritedConditionStatus,java.lang.String,java.lang.String)
> at org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.toException(DomainObjectInvocationHandler.java:732)
> at org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.notifyListenersAndVetoIfRequired(DomainObjectInvocationHandler.java:700)
> at org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.checkVisibility(DomainObjectInvocationHandler.java:682)
> at org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.handleActionMethod(DomainObjectInvocationHandler.java:607)
> at org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.invoke(DomainObjectInvocationHandler.java:263)
> at org.apache.isis.core.wrapper.proxy.ProxyInstantiatorForJavassist$1.invoke(ProxyInstantiatorForJavassist.java:72)
> at com.tellmegen.domain.model.inheritedconditions.InheritedCondition_$$_jvstcc_7.upsertSNPGenotype(InheritedCondition_$$_jvstcc_7.java)
> at com.tellmegen.domain.model.importing.ImportInheritedConditionSNPGenotype.saveToDatabase(ImportInheritedConditionSNPGenotype.java:244)
> at com.tellmegen.domain.model.importing.ImportInheritedConditionsSNPGenotypeService.importInheritedConditionsSNPGenotypes(ImportInheritedConditionsSNPGenotypeService.java:38)
> at com.tellmegen.fixture.model.inheritedconditionsnpgenotype.ExcelInheritedConditionsSNPGenotypeFixture.execute(ExcelInheritedConditionsSNPGenotypeFixture.java:24)
> at org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext.executeChildIfNotAlready(FixtureScript.java:549)
> at org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext.executeChildT(FixtureScript.java:528)
> at org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext.executeChildT(FixtureScript.java:498)
> at org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext.executeChild(FixtureScript.java:487)
> at com.tellmegen.fixture.TellMeGenDemoWithAllRecordsFixture.execute(TellMeGenDemoWithAllRecordsFixture.java:34)
> If try to use them inside a SudoService.sudo(…) call I don’t have access to the “executionContext” (it’s private).
> So basically, I would need to make the “executionContext” field of FixtureScript “public”, or being able to use SudoService to override the User globally, without needing to use a “Callable” construct.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)