@Test( expected = NullPointerException.class ) public void testGetReferencedFieldsWithoutExpression() { preProcessor.getReferencedFields( metaData, null, null ); }
public String[] getReferencedFields( final ExpressionPropertyMetaData metaData, final Expression expression, final Object attributeValue ) { if ( expression == null ) { throw new NullPointerException(); } final String propertyRole = metaData.getPropertyRole(); if ( attributeValue == null ) { return EMPTY; } if ( "Field".equals( propertyRole ) ) { if ( attributeValue instanceof String[] ) { final String[] vals = (String[]) attributeValue; return (String[]) vals.clone(); } return new String[] { String.valueOf( attributeValue ) }; } else if ( "Message".equals( propertyRole ) ) { final String message = String.valueOf( attributeValue ); final MessageFormatSupport messageFormatSupport = new MessageFormatSupport(); messageFormatSupport.setFormatString( message ); return messageFormatSupport.getFields(); } else if ( "Formula".equals( propertyRole ) ) { final String formula = String.valueOf( attributeValue ); try { final Object[] objects = FormulaUtil.getReferences( formula ); final ArrayList list = new ArrayList(); for ( int i = 0; i < objects.length; i++ ) { final Object object = objects[i]; if ( object instanceof String ) { list.add( object ); } } return (String[]) list.toArray( new String[list.size()] ); } catch ( ParseException e ) { return EMPTY; } } return EMPTY; }
DefaultExpressionPropertyCore implements ExpressionPropertyCore { public String[] getReferencedFields( final ExpressionPropertyMetaData metaData, final Expression expression, final Object attributeValue ) { if ( expression == null ) { throw new NullPointerException(); } final String propertyRole = metaData.getPropertyRole(); if ( attributeValue == null ) { return EMPTY; } if ( "Field".equals( propertyRole ) ) { if ( attributeValue instanceof String[] ) { final String[] vals = (String[]) attributeValue; return (String[]) vals.clone(); } return new String[] { String.valueOf( attributeValue ) }; } else if ( "Message".equals( propertyRole ) ) { final String message = String.valueOf( attributeValue ); final MessageFormatSupport messageFormatSupport = new MessageFormatSupport(); messageFormatSupport.setFormatString( message ); return messageFormatSupport.getFields(); } else if ( "Formula".equals( propertyRole ) ) { final String formula = String.valueOf( attributeValue ); try { final Object[] objects = FormulaUtil.getReferences( formula ); final ArrayList list = new ArrayList(); for ( int i = 0; i < objects.length; i++ ) { final Object object = objects[i]; if ( object instanceof String ) { list.add( object ); } } return (String[]) list.toArray( new String[list.size()] ); } catch ( ParseException e ) { return EMPTY; } } return EMPTY; } }
DefaultExpressionPropertyCore implements ExpressionPropertyCore { public String[] getReferencedFields( final ExpressionPropertyMetaData metaData, final Expression expression, final Object attributeValue ) { if ( expression == null ) { throw new NullPointerException(); } final String propertyRole = metaData.getPropertyRole(); if ( attributeValue == null ) { return EMPTY; } if ( "Field".equals( propertyRole ) ) { if ( attributeValue instanceof String[] ) { final String[] vals = (String[]) attributeValue; return (String[]) vals.clone(); } return new String[] { String.valueOf( attributeValue ) }; } else if ( "Message".equals( propertyRole ) ) { final String message = String.valueOf( attributeValue ); final MessageFormatSupport messageFormatSupport = new MessageFormatSupport(); messageFormatSupport.setFormatString( message ); return messageFormatSupport.getFields(); } else if ( "Formula".equals( propertyRole ) ) { final String formula = String.valueOf( attributeValue ); try { final Object[] objects = FormulaUtil.getReferences( formula ); final ArrayList list = new ArrayList(); for ( int i = 0; i < objects.length; i++ ) { final Object object = objects[i]; if ( object instanceof String ) { list.add( object ); } } return (String[]) list.toArray( new String[list.size()] ); } catch ( ParseException e ) { return EMPTY; } } return EMPTY; } DefaultExpressionPropertyCore(); }
DefaultExpressionPropertyCore implements ExpressionPropertyCore { public String[] getReferencedFields( final ExpressionPropertyMetaData metaData, final Expression expression, final Object attributeValue ) { if ( expression == null ) { throw new NullPointerException(); } final String propertyRole = metaData.getPropertyRole(); if ( attributeValue == null ) { return EMPTY; } if ( "Field".equals( propertyRole ) ) { if ( attributeValue instanceof String[] ) { final String[] vals = (String[]) attributeValue; return (String[]) vals.clone(); } return new String[] { String.valueOf( attributeValue ) }; } else if ( "Message".equals( propertyRole ) ) { final String message = String.valueOf( attributeValue ); final MessageFormatSupport messageFormatSupport = new MessageFormatSupport(); messageFormatSupport.setFormatString( message ); return messageFormatSupport.getFields(); } else if ( "Formula".equals( propertyRole ) ) { final String formula = String.valueOf( attributeValue ); try { final Object[] objects = FormulaUtil.getReferences( formula ); final ArrayList list = new ArrayList(); for ( int i = 0; i < objects.length; i++ ) { final Object object = objects[i]; if ( object instanceof String ) { list.add( object ); } } return (String[]) list.toArray( new String[list.size()] ); } catch ( ParseException e ) { return EMPTY; } } return EMPTY; } 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 String[] getReferencedFields( final ExpressionPropertyMetaData metaData, final Expression expression, final Object attributeValue ) { if ( expression == null ) { throw new NullPointerException(); } final String propertyRole = metaData.getPropertyRole(); if ( attributeValue == null ) { return EMPTY; } if ( "Field".equals( propertyRole ) ) { if ( attributeValue instanceof String[] ) { final String[] vals = (String[]) attributeValue; return (String[]) vals.clone(); } return new String[] { String.valueOf( attributeValue ) }; } else if ( "Message".equals( propertyRole ) ) { final String message = String.valueOf( attributeValue ); final MessageFormatSupport messageFormatSupport = new MessageFormatSupport(); messageFormatSupport.setFormatString( message ); return messageFormatSupport.getFields(); } else if ( "Formula".equals( propertyRole ) ) { final String formula = String.valueOf( attributeValue ); try { final Object[] objects = FormulaUtil.getReferences( formula ); final ArrayList list = new ArrayList(); for ( int i = 0; i < objects.length; i++ ) { final Object object = objects[i]; if ( object instanceof String ) { list.add( object ); } } return (String[]) list.toArray( new String[list.size()] ); } catch ( ParseException e ) { return EMPTY; } } return EMPTY; } 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 );  }