diff options
Diffstat (limited to 'reportbuilder/java/org/libreoffice/report/function/metadata')
11 files changed, 369 insertions, 0 deletions
diff --git a/reportbuilder/java/org/libreoffice/report/function/metadata/Author-Function.properties b/reportbuilder/java/org/libreoffice/report/function/metadata/Author-Function.properties new file mode 100644 index 000000000..a05ce8dad --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/function/metadata/Author-Function.properties @@ -0,0 +1,21 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# +# x-no-translate + +display-name=AUTHOR +description=Returns the author of the report. diff --git a/reportbuilder/java/org/libreoffice/report/function/metadata/Author-Function_en_US.properties b/reportbuilder/java/org/libreoffice/report/function/metadata/Author-Function_en_US.properties new file mode 100644 index 000000000..a05ce8dad --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/function/metadata/Author-Function_en_US.properties @@ -0,0 +1,21 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# +# x-no-translate + +display-name=AUTHOR +description=Returns the author of the report. diff --git a/reportbuilder/java/org/libreoffice/report/function/metadata/AuthorFunction.java b/reportbuilder/java/org/libreoffice/report/function/metadata/AuthorFunction.java new file mode 100644 index 000000000..dcd30e5f0 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/function/metadata/AuthorFunction.java @@ -0,0 +1,48 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package org.libreoffice.report.function.metadata; + +import org.libreoffice.report.ReportEngineParameterNames; + +import org.pentaho.reporting.libraries.formula.EvaluationException; +import org.pentaho.reporting.libraries.formula.FormulaContext; +import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; +import org.pentaho.reporting.libraries.formula.function.Function; +import org.pentaho.reporting.libraries.formula.function.ParameterCallback; +import org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair; +import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType; + +public class AuthorFunction implements Function +{ + + public String getCanonicalName() + { + return "AUTHOR"; + } + + public TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters) + throws EvaluationException + { + if (parameters.getParameterCount() != 0) + { + throw new EvaluationException(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE); + } + + return new TypeValuePair(TextType.TYPE, context.getConfiguration().getConfigProperty(ReportEngineParameterNames.AUTHOR)); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/function/metadata/AuthorFunctionDescription.java b/reportbuilder/java/org/libreoffice/report/function/metadata/AuthorFunctionDescription.java new file mode 100644 index 000000000..b4cf6e22f --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/function/metadata/AuthorFunctionDescription.java @@ -0,0 +1,57 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package org.libreoffice.report.function.metadata; + +import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription; +import org.pentaho.reporting.libraries.formula.function.FunctionCategory; +import org.pentaho.reporting.libraries.formula.typing.Type; +import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType; + +public class AuthorFunctionDescription extends AbstractFunctionDescription +{ + + public AuthorFunctionDescription() + { + super("AUTHOR", "org.libreoffice.report.function.metadata.Author-Function"); + } + + public FunctionCategory getCategory() + { + return MetaDataFunctionCategory.CATEGORY; + } + + public int getParameterCount() + { + return 0; + } + + public Type getParameterType(final int position) + { + return null; + } + + public Type getValueType() + { + return TextType.TYPE; + } + + public boolean isParameterMandatory(final int position) + { + return false; + } +} diff --git a/reportbuilder/java/org/libreoffice/report/function/metadata/MetaDataFunctionCategory.java b/reportbuilder/java/org/libreoffice/report/function/metadata/MetaDataFunctionCategory.java new file mode 100644 index 000000000..3b6ac8a29 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/function/metadata/MetaDataFunctionCategory.java @@ -0,0 +1,33 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package org.libreoffice.report.function.metadata; + +import org.pentaho.reporting.libraries.formula.function.AbstractFunctionCategory; +import org.pentaho.reporting.libraries.formula.function.FunctionCategory; + +public class MetaDataFunctionCategory extends AbstractFunctionCategory +{ + + public static final FunctionCategory CATEGORY = new MetaDataFunctionCategory(); + + private MetaDataFunctionCategory() + { + super("org.libreoffice.report.function.metadata.category"); + } +} + diff --git a/reportbuilder/java/org/libreoffice/report/function/metadata/Title-Function.properties b/reportbuilder/java/org/libreoffice/report/function/metadata/Title-Function.properties new file mode 100644 index 000000000..3c0039f6c --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/function/metadata/Title-Function.properties @@ -0,0 +1,21 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# +# x-no-translate + +display-name=TITLE +description=Returns the title of the report. diff --git a/reportbuilder/java/org/libreoffice/report/function/metadata/Title-Function_en_US.properties b/reportbuilder/java/org/libreoffice/report/function/metadata/Title-Function_en_US.properties new file mode 100644 index 000000000..3c0039f6c --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/function/metadata/Title-Function_en_US.properties @@ -0,0 +1,21 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# +# x-no-translate + +display-name=TITLE +description=Returns the title of the report. diff --git a/reportbuilder/java/org/libreoffice/report/function/metadata/TitleFunction.java b/reportbuilder/java/org/libreoffice/report/function/metadata/TitleFunction.java new file mode 100644 index 000000000..c4cd953ba --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/function/metadata/TitleFunction.java @@ -0,0 +1,48 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package org.libreoffice.report.function.metadata; + +import org.libreoffice.report.ReportEngineParameterNames; + +import org.pentaho.reporting.libraries.formula.EvaluationException; +import org.pentaho.reporting.libraries.formula.FormulaContext; +import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; +import org.pentaho.reporting.libraries.formula.function.Function; +import org.pentaho.reporting.libraries.formula.function.ParameterCallback; +import org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair; +import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType; + +public class TitleFunction implements Function +{ + + public String getCanonicalName() + { + return "TITLE"; + } + + public TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters) + throws EvaluationException + { + if (parameters.getParameterCount() != 0) + { + throw new EvaluationException(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE); + } + + return new TypeValuePair(TextType.TYPE, context.getConfiguration().getConfigProperty(ReportEngineParameterNames.TITLE)); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/function/metadata/TitleFunctionDescription.java b/reportbuilder/java/org/libreoffice/report/function/metadata/TitleFunctionDescription.java new file mode 100644 index 000000000..30d3d337b --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/function/metadata/TitleFunctionDescription.java @@ -0,0 +1,57 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package org.libreoffice.report.function.metadata; + +import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription; +import org.pentaho.reporting.libraries.formula.function.FunctionCategory; +import org.pentaho.reporting.libraries.formula.typing.Type; +import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType; + +public class TitleFunctionDescription extends AbstractFunctionDescription +{ + + public TitleFunctionDescription() + { + super("TITLE", "org.libreoffice.report.function.metadata.Title-Function"); + } + + public FunctionCategory getCategory() + { + return MetaDataFunctionCategory.CATEGORY; + } + + public int getParameterCount() + { + return 0; + } + + public Type getParameterType(final int position) + { + return null; + } + + public Type getValueType() + { + return TextType.TYPE; + } + + public boolean isParameterMandatory(final int position) + { + return false; + } +} diff --git a/reportbuilder/java/org/libreoffice/report/function/metadata/category.properties b/reportbuilder/java/org/libreoffice/report/function/metadata/category.properties new file mode 100644 index 000000000..39f24f271 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/function/metadata/category.properties @@ -0,0 +1,21 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# +# x-no-translate + +display-name=Document Information +description=Contains functions to access document information. diff --git a/reportbuilder/java/org/libreoffice/report/function/metadata/category_en_US.properties b/reportbuilder/java/org/libreoffice/report/function/metadata/category_en_US.properties new file mode 100644 index 000000000..76ea0bb4d --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/function/metadata/category_en_US.properties @@ -0,0 +1,21 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# +# x-no-translate + +display-name=MetaData +description=Contains functions about meta data |