@Test( expected = NullPointerException.class ) public void testGetReferencedResourcesWithoutExpression() { preProcessor.getReferencedResources( metaData, null, null, null, null ); }
public ResourceReference[] getReferencedResources( final ExpressionPropertyMetaData metaData, final Expression expression, final Object attributeValue, final Element reportElement, final ResourceManager resourceManager ) { if ( expression == null ) { throw new NullPointerException(); } if ( reportElement == null ) { throw new NullPointerException(); } if ( resourceManager == null ) { throw new NullPointerException(); } final String propertyRole = metaData.getPropertyRole(); if ( "Content".equals( propertyRole ) ) { final ResourceKey contentBase = reportElement.getContentBase(); final ResourceKey elementSource = reportElement.getDefinitionSource(); if ( attributeValue instanceof ResourceKey ) { final ResourceKey path = (ResourceKey) attributeValue; final boolean linked = BundleUtilities.isSameBundle( elementSource, path ); return new ResourceReference[] { new ResourceReference( path, linked ) }; } else if ( attributeValue instanceof String && contentBase != null ) { try { final ResourceKey path = resourceManager.deriveKey( contentBase, String.valueOf( attributeValue ) ); final boolean linked = BundleUtilities.isSameBundle( elementSource, path ) == false; return new ResourceReference[] { new ResourceReference( path, linked ) }; } catch ( ResourceKeyCreationException rce ) { } } else if ( attributeValue != null ) { try { final ResourceKey path = resourceManager.createKey( attributeValue ); final boolean linked = BundleUtilities.isSameBundle( elementSource, path ) == false; return new ResourceReference[] { new ResourceReference( path, linked ) }; } catch ( ResourceKeyCreationException rce ) { } } } return EMPTY_RESOURCES; }
DefaultExpressionPropertyCore implements ExpressionPropertyCore { public ResourceReference[] getReferencedResources( final ExpressionPropertyMetaData metaData, final Expression expression, final Object attributeValue, final Element reportElement, final ResourceManager resourceManager ) { if ( expression == null ) { throw new NullPointerException(); } if ( reportElement == null ) { throw new NullPointerException(); } if ( resourceManager == null ) { throw new NullPointerException(); } final String propertyRole = metaData.getPropertyRole(); if ( "Content".equals( propertyRole ) ) { final ResourceKey contentBase = reportElement.getContentBase(); final ResourceKey elementSource = reportElement.getDefinitionSource(); if ( attributeValue instanceof ResourceKey ) { final ResourceKey path = (ResourceKey) attributeValue; final boolean linked = BundleUtilities.isSameBundle( elementSource, path ); return new ResourceReference[] { new ResourceReference( path, linked ) }; } else if ( attributeValue instanceof String && contentBase != null ) { try { final ResourceKey path = resourceManager.deriveKey( contentBase, String.valueOf( attributeValue ) ); final boolean linked = BundleUtilities.isSameBundle( elementSource, path ) == false; return new ResourceReference[] { new ResourceReference( path, linked ) }; } catch ( ResourceKeyCreationException rce ) { } } else if ( attributeValue != null ) { try { final ResourceKey path = resourceManager.createKey( attributeValue ); final boolean linked = BundleUtilities.isSameBundle( elementSource, path ) == false; return new ResourceReference[] { new ResourceReference( path, linked ) }; } catch ( ResourceKeyCreationException rce ) { } } } return EMPTY_RESOURCES; } }
DefaultExpressionPropertyCore implements ExpressionPropertyCore { public ResourceReference[] getReferencedResources( final ExpressionPropertyMetaData metaData, final Expression expression, final Object attributeValue, final Element reportElement, final ResourceManager resourceManager ) { if ( expression == null ) { throw new NullPointerException(); } if ( reportElement == null ) { throw new NullPointerException(); } if ( resourceManager == null ) { throw new NullPointerException(); } final String propertyRole = metaData.getPropertyRole(); if ( "Content".equals( propertyRole ) ) { final ResourceKey contentBase = reportElement.getContentBase(); final ResourceKey elementSource = reportElement.getDefinitionSource(); if ( attributeValue instanceof ResourceKey ) { final ResourceKey path = (ResourceKey) attributeValue; final boolean linked = BundleUtilities.isSameBundle( elementSource, path ); return new ResourceReference[] { new ResourceReference( path, linked ) }; } else if ( attributeValue instanceof String && contentBase != null ) { try { final ResourceKey path = resourceManager.deriveKey( contentBase, String.valueOf( attributeValue ) ); final boolean linked = BundleUtilities.isSameBundle( elementSource, path ) == false; return new ResourceReference[] { new ResourceReference( path, linked ) }; } catch ( ResourceKeyCreationException rce ) { } } else if ( attributeValue != null ) { try { final ResourceKey path = resourceManager.createKey( attributeValue ); final boolean linked = BundleUtilities.isSameBundle( elementSource, path ) == false; return new ResourceReference[] { new ResourceReference( path, linked ) }; } catch ( ResourceKeyCreationException rce ) { } } } return EMPTY_RESOURCES; } DefaultExpressionPropertyCore(); }
DefaultExpressionPropertyCore implements ExpressionPropertyCore { public ResourceReference[] getReferencedResources( final ExpressionPropertyMetaData metaData, final Expression expression, final Object attributeValue, final Element reportElement, final ResourceManager resourceManager ) { if ( expression == null ) { throw new NullPointerException(); } if ( reportElement == null ) { throw new NullPointerException(); } if ( resourceManager == null ) { throw new NullPointerException(); } final String propertyRole = metaData.getPropertyRole(); if ( "Content".equals( propertyRole ) ) { final ResourceKey contentBase = reportElement.getContentBase(); final ResourceKey elementSource = reportElement.getDefinitionSource(); if ( attributeValue instanceof ResourceKey ) { final ResourceKey path = (ResourceKey) attributeValue; final boolean linked = BundleUtilities.isSameBundle( elementSource, path ); return new ResourceReference[] { new ResourceReference( path, linked ) }; } else if ( attributeValue instanceof String && contentBase != null ) { try { final ResourceKey path = resourceManager.deriveKey( contentBase, String.valueOf( attributeValue ) ); final boolean linked = BundleUtilities.isSameBundle( elementSource, path ) == false; return new ResourceReference[] { new ResourceReference( path, linked ) }; } catch ( ResourceKeyCreationException rce ) { } } else if ( attributeValue != null ) { try { final ResourceKey path = resourceManager.createKey( attributeValue ); final boolean linked = BundleUtilities.isSameBundle( elementSource, path ) == false; return new ResourceReference[] { new ResourceReference( path, linked ) }; } catch ( ResourceKeyCreationException rce ) { } } } return EMPTY_RESOURCES; } DefaultExpressionPropertyCore(); String[] getReferencedFields( final ExpressionPropertyMetaData metaData, final Expression expression,
      final Object attributeValue ); String[] getReferencedGroups( final ExpressionPropertyMetaData metaData, final Expression expression,
      final Object attributeValue ); String[] getReferencedElements( final ExpressionPropertyMetaData metaData, final Expression expression,
      final Object attributeValue ); ResourceReference[] getReferencedResources( final ExpressionPropertyMetaData metaData,
      final Expression expression, final Object attributeValue, final Element reportElement,
      final ResourceManager resourceManager ); String[] getExtraCalculationFields( final ExpressionPropertyMetaData metaData ); }
DefaultExpressionPropertyCore implements ExpressionPropertyCore { public ResourceReference[] getReferencedResources( final ExpressionPropertyMetaData metaData, final Expression expression, final Object attributeValue, final Element reportElement, final ResourceManager resourceManager ) { if ( expression == null ) { throw new NullPointerException(); } if ( reportElement == null ) { throw new NullPointerException(); } if ( resourceManager == null ) { throw new NullPointerException(); } final String propertyRole = metaData.getPropertyRole(); if ( "Content".equals( propertyRole ) ) { final ResourceKey contentBase = reportElement.getContentBase(); final ResourceKey elementSource = reportElement.getDefinitionSource(); if ( attributeValue instanceof ResourceKey ) { final ResourceKey path = (ResourceKey) attributeValue; final boolean linked = BundleUtilities.isSameBundle( elementSource, path ); return new ResourceReference[] { new ResourceReference( path, linked ) }; } else if ( attributeValue instanceof String && contentBase != null ) { try { final ResourceKey path = resourceManager.deriveKey( contentBase, String.valueOf( attributeValue ) ); final boolean linked = BundleUtilities.isSameBundle( elementSource, path ) == false; return new ResourceReference[] { new ResourceReference( path, linked ) }; } catch ( ResourceKeyCreationException rce ) { } } else if ( attributeValue != null ) { try { final ResourceKey path = resourceManager.createKey( attributeValue ); final boolean linked = BundleUtilities.isSameBundle( elementSource, path ) == false; return new ResourceReference[] { new ResourceReference( path, linked ) }; } catch ( ResourceKeyCreationException rce ) { } } } return EMPTY_RESOURCES; } DefaultExpressionPropertyCore(); String[] getReferencedFields( final ExpressionPropertyMetaData metaData, final Expression expression,
      final Object attributeValue ); String[] getReferencedGroups( final ExpressionPropertyMetaData metaData, final Expression expression,
      final Object attributeValue ); String[] getReferencedElements( final ExpressionPropertyMetaData metaData, final Expression expression,
      final Object attributeValue ); ResourceReference[] getReferencedResources( final ExpressionPropertyMetaData metaData,
      final Expression expression, final Object attributeValue, final Element reportElement,
      final ResourceManager resourceManager ); String[] getExtraCalculationFields( final ExpressionPropertyMetaData metaData );  }