if (context instanceof ReportFormulaContext == false)
{
throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
}
final ReportFormulaContext rfc = (ReportFormulaContext) context;
final DocumentMetaData data = rfc.getProcessingContext().getDocumentMetaData();
if (parameterCount == 1)
{
final String metaName = context.getTypeRegistry().convertToText(parameters.getType(0), parameters.getValue(0));
final String[] namespaces = data.getMetaDataNamespaces();
for (int i = 0; i < namespaces.length; i++)
{
final String namespace = namespaces[i];
final Object attribute = data.getBundleAttribute(namespace, metaName);
if (attribute != null)
{
return new TypeValuePair(AnyType.TYPE, attribute);
}
}
}
else
{
final String metaNamespace = context.getTypeRegistry().convertToText(parameters.getType(0), parameters.getValue(0));
final String metaName = context.getTypeRegistry().convertToText(parameters.getType(1), parameters.getValue(1));
{
final Object o = data.getBundleAttribute(metaNamespace, metaName);
return new TypeValuePair(AnyType.TYPE, o);
}
}
throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);