@Test( expected = FatalTransformerException.class ) public void getDhisResourceScriptExecution() { Mockito.doReturn( true ).when( scriptExecutionContext ).hasScriptExecution(); final TrackedEntityInstance resource = new TrackedEntityInstance(); final WritableScriptedLazyDhisResource scriptedResource = new WritableScriptedLazyDhisResource( resource, scriptExecutionContext ); Assert.assertSame( resource, scriptedResource.getDhisResource() ); }
@ScriptExecutionForbidden @Nullable public DhisResource getDhisResource() { if ( scriptExecutionContext.hasScriptExecution() ) { throw new FatalTransformerException( "Resource instance cannot be accessed within script execution." ); } return resource; }
WritableScriptedLazyDhisResource extends AbstractWritableScriptedDhisResource implements AccessibleWritableScriptedLazyDhisResource { @ScriptExecutionForbidden @Nullable public DhisResource getDhisResource() { if ( scriptExecutionContext.hasScriptExecution() ) { throw new FatalTransformerException( "Resource instance cannot be accessed within script execution." ); } return resource; } }
WritableScriptedLazyDhisResource extends AbstractWritableScriptedDhisResource implements AccessibleWritableScriptedLazyDhisResource { @ScriptExecutionForbidden @Nullable public DhisResource getDhisResource() { if ( scriptExecutionContext.hasScriptExecution() ) { throw new FatalTransformerException( "Resource instance cannot be accessed within script execution." ); } return resource; } WritableScriptedLazyDhisResource( @Nonnull DhisResource resource, @Nonnull ScriptExecutionContext scriptExecutionContext );  WritableScriptedLazyDhisResource( @Nonnull DhisResourceType resourceType, @Nonnull String resourceId, @Nonnull ScriptExecutionContext scriptExecutionContext ); }
WritableScriptedLazyDhisResource extends AbstractWritableScriptedDhisResource implements AccessibleWritableScriptedLazyDhisResource { @ScriptExecutionForbidden @Nullable public DhisResource getDhisResource() { if ( scriptExecutionContext.hasScriptExecution() ) { throw new FatalTransformerException( "Resource instance cannot be accessed within script execution." ); } return resource; } WritableScriptedLazyDhisResource( @Nonnull DhisResource resource, @Nonnull ScriptExecutionContext scriptExecutionContext );  WritableScriptedLazyDhisResource( @Nonnull DhisResourceType resourceType, @Nonnull String resourceId, @Nonnull ScriptExecutionContext scriptExecutionContext ); @ScriptExecutionForbidden @Nullable DhisResource getDhisResource(); }
WritableScriptedLazyDhisResource extends AbstractWritableScriptedDhisResource implements AccessibleWritableScriptedLazyDhisResource { @ScriptExecutionForbidden @Nullable public DhisResource getDhisResource() { if ( scriptExecutionContext.hasScriptExecution() ) { throw new FatalTransformerException( "Resource instance cannot be accessed within script execution." ); } return resource; } WritableScriptedLazyDhisResource( @Nonnull DhisResource resource, @Nonnull ScriptExecutionContext scriptExecutionContext );  WritableScriptedLazyDhisResource( @Nonnull DhisResourceType resourceType, @Nonnull String resourceId, @Nonnull ScriptExecutionContext scriptExecutionContext ); @ScriptExecutionForbidden @Nullable DhisResource getDhisResource();  }