wizards/com/sun/star/wizards/db/CommandMetaData.java | 2 wizards/com/sun/star/wizards/db/RecordParser.java | 9 +- wizards/com/sun/star/wizards/db/SQLQueryComposer.java | 6 - wizards/com/sun/star/wizards/query/QuerySummary.java | 2 wizards/com/sun/star/wizards/query/QueryWizard.java | 4 - wizards/com/sun/star/wizards/report/GroupFieldHandler.java | 4 - wizards/com/sun/star/wizards/report/ReportTextDocument.java | 38 +++++----- wizards/com/sun/star/wizards/report/ReportTextImplementation.java | 10 +- wizards/com/sun/star/wizards/report/ReportWizard.java | 4 - wizards/com/sun/star/wizards/ui/AggregateComponent.java | 2 10 files changed, 43 insertions(+), 38 deletions(-)
New commits: commit 45eb7e7cf2e29fed5e5bdce7197871cd115e1cb6 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Sep 20 09:16:40 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Sep 20 17:05:38 2024 +0200 cid#1608090 PA: Public Attribute Change-Id: I9bd34262523a7eaa430824749adee6f3e326c59e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173718 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java index 6bd83b0af180..abe9e29d2acc 100644 --- a/wizards/com/sun/star/wizards/db/RecordParser.java +++ b/wizards/com/sun/star/wizards/db/RecordParser.java @@ -40,7 +40,7 @@ public class RecordParser extends QueryMetaData private XNameAccess xColumns; private com.sun.star.sdbc.XRow xResultSetRow; - public XResultSet ResultSet; + private XResultSet ResultSet; private XInterface xRowSet; private XCompletedExecution xExecute; private XComponent xRowSetComponent; @@ -232,6 +232,11 @@ public class RecordParser extends QueryMetaData return true; } + public XResultSet getResultSet() + { + return ResultSet; + } + @Override public void dispose() { diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index a70d4eee4b2b..29d3d25c64b0 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -338,7 +338,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme XTextCursor xTextCursor = ReportTextDocument.createTextCursor(getDoc().xTextDocument.getText()); xTextDocument.lockControllers(); - if (getRecordParser().ResultSet.next()) + if (getRecordParser().getResultSet().next()) { replaceUserFields(); Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page"); @@ -354,7 +354,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme if (getRecordParser().getcurrentRecordData(DataVector)) { m_bStopProcess = false; - while ((getRecordParser().ResultSet.next()) && (!m_bStopProcess)) + while ((getRecordParser().getResultSet().next()) && (!m_bStopProcess)) { breset = false; for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++) commit c9ce398635c7712d493a1d7112b7afdb442fb2d7 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Sep 20 09:12:55 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Sep 20 17:05:28 2024 +0200 cid#1608290 PA: Public Attribute Change-Id: Ifb9bedaaaf152c6c43454811b63bdf55a157cf2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173717 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index 28180382f2b1..08b527f3ee10 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -42,7 +42,7 @@ public class CommandMetaData extends DBMetaData public FieldColumn[] FieldColumns = new FieldColumn[] { }; - public String[] GroupFieldNames = new String[] + private String[] GroupFieldNames = new String[] { }; private String[][] SortFieldNames = new String[][] diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java index e4295e473424..6bd83b0af180 100644 --- a/wizards/com/sun/star/wizards/db/RecordParser.java +++ b/wizards/com/sun/star/wizards/db/RecordParser.java @@ -193,7 +193,7 @@ public class RecordParser extends QueryMetaData throw new InvalidQueryException(xMSF, Command); } } - GroupFieldColumns = getFieldColumnList(GroupFieldNames); + GroupFieldColumns = getFieldColumnList(getGroupFieldNames()); RecordFieldColumns = getFieldColumnList(getRecordFieldNames()); return true; } diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 9ab58f2861dd..84a6cd97012b 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -63,7 +63,7 @@ public class SQLQueryComposer private boolean addtoSelectClause(String DisplayFieldName) throws SQLException { - return !(bincludeGrouping && CurDBMetaData.xDBMetaData.supportsGroupByUnrelated() && CurDBMetaData.GroupFieldNames != null && JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, DisplayFieldName) > -1); + return !(bincludeGrouping && CurDBMetaData.xDBMetaData.supportsGroupByUnrelated() && CurDBMetaData.getGroupFieldNames() != null && JavaTools.FieldInList(CurDBMetaData.getGroupFieldNames(), DisplayFieldName) > -1); } public String getSelectClause(boolean _baddAliasFieldNames) throws SQLException @@ -199,9 +199,9 @@ public class SQLQueryComposer private void appendGroupByColumns(boolean _baddAliasFieldNames) throws SQLException { - for (int i = 0; i < CurDBMetaData.GroupFieldNames.length; i++) + for (int i = 0; i < CurDBMetaData.getGroupFieldNames().length; i++) { - XPropertySet xColumn = CurDBMetaData.getColumnObjectByFieldName(CurDBMetaData.GroupFieldNames[i], _baddAliasFieldNames); + XPropertySet xColumn = CurDBMetaData.getColumnObjectByFieldName(CurDBMetaData.getGroupFieldNames()[i], _baddAliasFieldNames); m_queryComposer.appendGroupByColumn(xColumn); } } diff --git a/wizards/com/sun/star/wizards/query/QuerySummary.java b/wizards/com/sun/star/wizards/query/QuerySummary.java index 443c96453525..369e269698cf 100644 --- a/wizards/com/sun/star/wizards/query/QuerySummary.java +++ b/wizards/com/sun/star/wizards/query/QuerySummary.java @@ -64,7 +64,7 @@ public class QuerySummary extends QueryMetaData sFilterFraction = combineFilterNameFraction(this.getFilterConditions(), "RID_QUERY_53", "RID_QUERY_54") + sReturnChar; if (xDBMetaData.supportsGroupBy()) { - sGroupByFraction = combinePartString("RID_QUERY_57", GroupFieldNames, "RID_QUERY_58") + sReturnChar; + sGroupByFraction = combinePartString("RID_QUERY_57", getGroupFieldNames(), "RID_QUERY_58") + sReturnChar; sHavingFraction = combineFilterNameFraction(getGroupByFilterConditions(), "RID_QUERY_59", "RID_QUERY_60"); } // TODO: remove the last return from the string diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index 8f460e55ef07..16a7e4cdef06 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -280,8 +280,8 @@ public class QueryWizard extends DatabaseObjectWizard if (m_DBMetaData.xDBMetaData.supportsGroupBy()) { m_DBMetaData.setGroupFieldNames(m_groupFieldSelection.getSelectedFieldNames()); - m_DBMetaData.GroupFieldNames = JavaTools.removeOutdatedFields(m_DBMetaData.GroupFieldNames, m_DBMetaData.NonAggregateFieldNames); - m_DBMetaData.GroupByFilterConditions = JavaTools.removeOutdatedFields(m_DBMetaData.GroupByFilterConditions, m_DBMetaData.GroupFieldNames); + m_DBMetaData.setGroupFieldNames(JavaTools.removeOutdatedFields(m_DBMetaData.getGroupFieldNames(), m_DBMetaData.NonAggregateFieldNames)); + m_DBMetaData.GroupByFilterConditions = JavaTools.removeOutdatedFields(m_DBMetaData.GroupByFilterConditions, m_DBMetaData.getGroupFieldNames()); } } switch (nNewStep) diff --git a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java index 26543bb46218..3cb9bed91e97 100644 --- a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java +++ b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java @@ -67,7 +67,7 @@ public class GroupFieldHandler extends FieldSelection private boolean isGroupField(String _FieldName) { - return (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, _FieldName) != -1); + return (JavaTools.FieldInList(CurDBMetaData.getGroupFieldNames(), _FieldName) != -1); } public void initialize() @@ -112,7 +112,7 @@ public class GroupFieldHandler extends FieldSelection { String[] GroupFieldNames = new String[GroupFieldVector.size()]; GroupFieldVector.toArray(GroupFieldNames); - CurDBMetaData.GroupFieldNames = GroupFieldNames; + CurDBMetaData.setGroupFieldNames(GroupFieldNames); } // @Override @Override diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java index 1c109c0b1f52..a8880d53a015 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -149,7 +149,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.COMMAND, CurDBMetaData.Command); } - oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "GroupFieldNames", JavaTools.ArraytoString(CurDBMetaData.GroupFieldNames)); + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "GroupFieldNames", JavaTools.ArraytoString(CurDBMetaData.getGroupFieldNames())); oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "FieldNames", JavaTools.ArraytoString(CurDBMetaData.getFieldNames())); String[][] sortFieldNames = CurDBMetaData.getSortFieldNames(); if (sortFieldNames != null && sortFieldNames.length > 0) @@ -223,7 +223,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { int i; DBColumn CurDBColumn; - int GroupCount = CurDBMetaData.GroupFieldNames.length; + int GroupCount = CurDBMetaData.getGroupFieldNames().length; CurRecordTable = null; for (i = 0; i < GroupCount; i++) { @@ -232,7 +232,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen oTextSectionHandler.linkSectiontoTemplate(sTemplateUrl, SectionName); oTextTableHandler.renameTextTable("MyTextTable", "Tbl_" + SectionName); } - if (oTextSectionHandler.xTextSectionsSupplier.getTextSections().getElementNames().length > CurDBMetaData.GroupFieldNames.length) + if (oTextSectionHandler.xTextSectionsSupplier.getTextSections().getElementNames().length > CurDBMetaData.getGroupFieldNames().length) { oTextSectionHandler.linkSectiontoTemplate(sTemplateUrl, RECORDSECTION); CurRecordTable = new RecordTable(oTextTableHandler); @@ -240,7 +240,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } for (i = 0; i < GroupCount; i++) { - CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], TBLGROUPSECTION + (i + 1)); + CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.getGroupFieldNames()[i], TBLGROUPSECTION + (i + 1)); CurDBColumn.formatValueCell(); DBColumnsVector.set(i, CurDBColumn); replaceFieldValueInGroupTable(CurDBColumn, i); @@ -260,9 +260,9 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen if (CurDBMetaData.getRecordFieldNames().length > 0) { boolean bAddParagraph = true; - if (CurDBMetaData.GroupFieldNames != null) + if (CurDBMetaData.getGroupFieldNames() != null) { - bAddParagraph = (CurDBMetaData.GroupFieldNames.length == 0); + bAddParagraph = (CurDBMetaData.getGroupFieldNames().length == 0); } oTextSectionHandler.insertTextSection(RECORDSECTION, TemplateName, bAddParagraph); CurRecordTable = new RecordTable(oTextTableHandler); @@ -326,7 +326,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen private void insertColumnstoRecordTable() { - int GroupCount = CurDBMetaData.GroupFieldNames.length; + int GroupCount = CurDBMetaData.getGroupFieldNames().length; DBColumn CurDBColumn; // Note for some reason the table might lose its name and has to be renamed therefore String OldTableName = CurRecordTable.xTableName.getName(); @@ -436,9 +436,9 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen DBColumn CurDBColumn; for (int i = 0; i < CurDBMetaData.FieldColumns.length; i++) { - if (i < CurDBMetaData.GroupFieldNames.length) + if (i < CurDBMetaData.getGroupFieldNames().length) { - CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], COPYOFTBLGROUPSECTION + (i + 1)); + CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.getGroupFieldNames()[i], COPYOFTBLGROUPSECTION + (i + 1)); } else { @@ -446,7 +446,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { CurRecordTable = new RecordTable(oTextTableHandler); } - CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i - CurDBMetaData.GroupFieldNames.length); + CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i - CurDBMetaData.getGroupFieldNames().length); } if (CurDBColumn.xNameCell != null) { @@ -455,18 +455,18 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen else { String DelFieldName; - if (i < CurDBMetaData.GroupFieldNames.length) + if (i < CurDBMetaData.getGroupFieldNames().length) { - DelFieldName = CurDBMetaData.GroupFieldNames[i]; - CurDBMetaData.GroupFieldNames = JavaTools.removefromList(CurDBMetaData.GroupFieldNames, new String[] + DelFieldName = CurDBMetaData.getGroupFieldNames()[i]; + CurDBMetaData.setGroupFieldNames(JavaTools.removefromList(CurDBMetaData.getGroupFieldNames(), new String[] { DelFieldName - }); + })); CurDBMetaData.GroupFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.GroupFieldColumns); } else { - DelFieldName = CurDBMetaData.getRecordFieldName(i - CurDBMetaData.GroupFieldNames.length); + DelFieldName = CurDBMetaData.getRecordFieldName(i - CurDBMetaData.getGroupFieldNames().length); String[] aNewList = JavaTools.removefromList(CurDBMetaData.getRecordFieldNames(), new String[] { DelFieldName @@ -544,7 +544,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen public void removeAllVisibleTextSections() { - int GroupCount = CurDBMetaData.GroupFieldNames.length; + int GroupCount = CurDBMetaData.getGroupFieldNames().length; String[] sInvisibleSectionNames = new String[GroupCount + 1]; sInvisibleSectionNames[0] = RECORDSECTION; for (int i = 1; i <= GroupCount; i++) @@ -565,7 +565,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen private String[] getLayoutTextTableNames() { - int GroupCount = CurDBMetaData.GroupFieldNames.length; + int GroupCount = CurDBMetaData.getGroupFieldNames().length; String[] sLayoutTableNames = new String[GroupCount + 1]; for (int i = 0; i < GroupCount; i++) { @@ -629,7 +629,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { XNameAccess xTextSections = oTextSectionHandler.xTextSectionsSupplier.getTextSections(); Object oTextSection; - int GroupFieldCount = CurDBMetaData.GroupFieldNames.length; + int GroupFieldCount = CurDBMetaData.getGroupFieldNames().length; for (int i = 0; i < GroupFieldCount; i++) { oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(i + 1)); @@ -649,7 +649,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen public void removeCopiedTextSections() { - int GroupCount = CurDBMetaData.GroupFieldNames.length; + int GroupCount = CurDBMetaData.getGroupFieldNames().length; String[] sCopyTextSections = new String[GroupCount + 1]; String[] sCopyTextTables = new String[GroupCount + 1]; sCopyTextSections[0] = COPYOFRECORDSECTION; diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index 6d81e99fc87b..a70d4eee4b2b 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -143,7 +143,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme m_aDoc.setLayoutSectionsVisible(false); XTextCursor xTextCursor = ReportTextDocument.createTextCursor(m_aDoc.xTextDocument.getText()); xTextCursor.gotoStart(false); - for (int i = 0; i < getRecordParser().GroupFieldNames.length; i++) + for (int i = 0; i < getRecordParser().getGroupFieldNames().length; i++) { XNamed xNamedTextSection = addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(i + 1), null, null); xNamedTextSection.setName(ReportTextDocument.COPYOFGROUPSECTION + (i + 1)); @@ -237,7 +237,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme getRecordParser().setSortFieldNames(sortFieldNames); } getRecordParser().setRecordFieldNames(sNewList); - getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, PropertyNames.SEMI_COLON); + getRecordParser().setGroupFieldNames(JavaTools.ArrayoutofString(sGroupFieldNames, PropertyNames.SEMI_COLON)); int nOrigCommandType = Integer.parseInt(sCommandType); getRecordParser().setCommandType(nOrigCommandType); @@ -330,7 +330,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme getDoc().removeNonLayoutTextTables(); addTextSectionCopies(); getDoc().getallDBColumns(); - int GroupFieldCount = getRecordParser().GroupFieldNames.length; + int GroupFieldCount = getRecordParser().getGroupFieldNames().length; int FieldCount = getRecordParser().FieldColumns.length; Object[] OldGroupFieldValues = new Object[GroupFieldCount]; int RecordFieldCount = FieldCount - GroupFieldCount; diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index 8ad2c611292d..e643eb7fce3a 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -141,7 +141,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener String[] aFieldNames2 = m_reportDocument.getRecordParser().getFieldNames(); String[][] aSortFieldNames = m_reportDocument.getRecordParser().getSortFieldNames(); CurSortingComponent.initialize(aFieldNames2, aSortFieldNames); - int nLength = m_reportDocument.getRecordParser().GroupFieldNames.length; + int nLength = m_reportDocument.getRecordParser().getGroupFieldNames().length; CurSortingComponent.setReadOnlyUntil(nLength); break; @@ -190,7 +190,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener case SOGROUPPAGE: // TODO: DESIGN!!! a getter should return a value!!! CurGroupFieldHandler.getGroupFieldNames(m_reportDocument.getRecordParser()); - String[] aGroupFieldNames = m_reportDocument.getRecordParser().GroupFieldNames; + String[] aGroupFieldNames = m_reportDocument.getRecordParser().getGroupFieldNames(); // CurReportDocument.getRecordParser().prependSortFieldNames(aGroupFieldNames); m_reportDocument.setGrouping(aGroupFieldNames); break; diff --git a/wizards/com/sun/star/wizards/ui/AggregateComponent.java b/wizards/com/sun/star/wizards/ui/AggregateComponent.java index a4bb1fa9b5bf..6bc51b943115 100644 --- a/wizards/com/sun/star/wizards/ui/AggregateComponent.java +++ b/wizards/com/sun/star/wizards/ui/AggregateComponent.java @@ -318,7 +318,7 @@ public class AggregateComponent extends ControlScroller boolean benabletherest = true; boolean benableGroupPage = isGroupingpossible(); CurUnoDialog.setStepEnabled(UIConsts.SOGROUPSELECTIONPAGE, benableGroupPage); - CurUnoDialog.setStepEnabled(UIConsts.SOGROUPFILTERPAGE, benableGroupPage && CurDBMetaData.GroupFieldNames.length > 0); + CurUnoDialog.setStepEnabled(UIConsts.SOGROUPFILTERPAGE, benableGroupPage && CurDBMetaData.getGroupFieldNames().length > 0); if (isAggregateComponentEnabled()) { benabletherest = hasonlycompletefunctions();