1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 package com.sun.star.wizards.db; 24 25 import com.sun.star.lang.XMultiServiceFactory; 26 import com.sun.star.sdbc.SQLException; 27 import com.sun.star.sdbcx.KeyType; 28 import com.sun.star.sdbcx.XColumnsSupplier; 29 import com.sun.star.sdbcx.XKeysSupplier; 30 import com.sun.star.uno.AnyConverter; 31 import com.sun.star.awt.VclWindowPeerAttribute; 32 import com.sun.star.uno.UnoRuntime; 33 import com.sun.star.lang.Locale; 34 import com.sun.star.beans.XPropertySet; 35 import com.sun.star.container.XIndexAccess; 36 import com.sun.star.container.XNameAccess; 37 import com.sun.star.wizards.common.Helper; 38 import com.sun.star.wizards.common.JavaTools; 39 import com.sun.star.wizards.common.NumberFormatter; 40 import com.sun.star.wizards.common.PropertyNames; 41 import com.sun.star.wizards.common.Resource; 42 import java.util.ArrayList; 43 import java.util.HashMap; 44 import java.util.Map; 45 46 public class CommandMetaData extends DBMetaData 47 { 48 49 public Map FieldTitleSet = new HashMap(); 50 public String[] m_aAllFieldNames = new String[] 51 { 52 }; 53 public FieldColumn[] FieldColumns = new FieldColumn[] 54 { 55 }; 56 public String[] GroupFieldNames = new String[] 57 { 58 }; 59 private String[][] SortFieldNames = new String[][] 60 { 61 }; 62 private String[] RecordFieldNames = new String[] 63 { 64 }; 65 public String[][] AggregateFieldNames = new String[][] 66 { 67 }; 68 public String[] NumericFieldNames = new String[] 69 { 70 }; 71 public String[] NonAggregateFieldNames; 72 private int CommandType; 73 private String Command; 74 boolean bCatalogAtStart = true; 75 String sCatalogSep = PropertyNames.EMPTY_STRING; 76 String sIdentifierQuote = PropertyNames.EMPTY_STRING; 77 boolean bCommandComposerAttributesalreadyRetrieved = false; 78 private XIndexAccess xIndexKeys; 79 CommandMetaData(XMultiServiceFactory xMSF, Locale _aLocale, NumberFormatter oNumberFormatter)80 public CommandMetaData(XMultiServiceFactory xMSF, Locale _aLocale, NumberFormatter oNumberFormatter) 81 { 82 super(xMSF, _aLocale, oNumberFormatter); 83 } 84 CommandMetaData(XMultiServiceFactory xMSF)85 public CommandMetaData(XMultiServiceFactory xMSF) 86 { 87 super(xMSF); 88 } 89 initializeFieldColumns(boolean _bgetDefaultValue, String _CommandName, String[] _FieldNames)90 public void initializeFieldColumns(boolean _bgetDefaultValue, String _CommandName, String[] _FieldNames) 91 { 92 this.setCommandName(_CommandName); 93 FieldColumns = new FieldColumn[_FieldNames.length]; 94 for (int i = 0; i < _FieldNames.length; i++) 95 { 96 FieldColumns[i] = new FieldColumn(this, _FieldNames[i], this.getCommandName(), false); 97 // if (_bgetDefaultValue) 98 // { 99 // FieldColumns[i].getDefaultValue(); 100 // } 101 } 102 } 103 initializeFieldColumns(String[] _FieldNames, XNameAccess _xColumns)104 public void initializeFieldColumns(String[] _FieldNames, XNameAccess _xColumns) 105 { 106 FieldColumns = new FieldColumn[_FieldNames.length]; 107 for (int i = 0; i < _FieldNames.length; i++) 108 { 109 FieldColumns[i] = new FieldColumn(this, _xColumns, _FieldNames[i]); 110 } 111 } 112 initializeFieldColumns(String[] _FieldNames, String _CommandName)113 public void initializeFieldColumns(String[] _FieldNames, String _CommandName) 114 { 115 this.setCommandName(_CommandName); 116 FieldColumns = new FieldColumn[_FieldNames.length]; 117 for (int i = 0; i < _FieldNames.length; i++) 118 { 119 FieldColumns[i] = new FieldColumn(this, _FieldNames[i], _CommandName, false); 120 if (FieldTitleSet != null && FieldTitleSet.containsKey(_FieldNames[i])) 121 { 122 FieldColumns[i].setFieldTitle((String) FieldTitleSet.get(_FieldNames[i])); 123 if (FieldColumns[i].getFieldTitle() == null) 124 { 125 FieldColumns[i].setFieldTitle(_FieldNames[i]); 126 FieldTitleSet.put(_FieldNames[i], _FieldNames[i]); 127 } 128 } 129 } 130 } 131 getFieldTitleSet()132 public Map getFieldTitleSet() 133 { 134 return FieldTitleSet; 135 } 136 getColumnObjectByFieldName(String _FieldName, boolean _bgetByDisplayName)137 public XPropertySet getColumnObjectByFieldName(String _FieldName, boolean _bgetByDisplayName) 138 { 139 try 140 { 141 FieldColumn CurFieldColumn = null; 142 if (_bgetByDisplayName) 143 { 144 CurFieldColumn = this.getFieldColumnByDisplayName(_FieldName); 145 } 146 else 147 { 148 CurFieldColumn = this.getFieldColumnByFieldName(_FieldName); 149 } 150 String CurCommandName = CurFieldColumn.getCommandName(); 151 CommandObject oCommand = getTableByName(CurCommandName); 152 Object oColumn = oCommand.getColumns().getByName(CurFieldColumn.getFieldName()); 153 return UnoRuntime.queryInterface(XPropertySet.class, oColumn); 154 } 155 catch (Exception exception) 156 { 157 exception.printStackTrace(System.out); 158 return null; 159 } 160 } 161 162 // @SuppressWarnings("unchecked") prependSortFieldNames(String[] _fieldnames)163 public void prependSortFieldNames(String[] _fieldnames) 164 { 165 ArrayList aSortFields = new ArrayList(); 166 for (int i = 0; i < _fieldnames.length; i++) 167 { 168 String[] sSortFieldName = new String[2]; 169 sSortFieldName[0] = _fieldnames[i]; 170 int index = JavaTools.FieldInTable(SortFieldNames, _fieldnames[i]); 171 if (index > -1) 172 { 173 sSortFieldName[1] = SortFieldNames[index][1]; 174 } 175 else 176 { 177 sSortFieldName[1] = PropertyNames.ASC; 178 } 179 aSortFields.add(sSortFieldName); 180 } 181 for (int i = 0; i < SortFieldNames.length; i++) 182 { 183 if (JavaTools.FieldInList(_fieldnames, SortFieldNames[i][0]) == -1) 184 { 185 aSortFields.add(SortFieldNames[i]); 186 } 187 } 188 SortFieldNames = new String[aSortFields.size()][2]; 189 aSortFields.toArray(SortFieldNames); 190 } 191 getSortFieldNames()192 public String[][] getSortFieldNames() 193 { 194 return SortFieldNames; 195 } 196 setSortFieldNames(String[][] aNewListList)197 public void setSortFieldNames(String[][] aNewListList) 198 { 199 SortFieldNames = aNewListList; 200 } 201 getFieldColumn(String _FieldName, String _CommandName)202 public FieldColumn getFieldColumn(String _FieldName, String _CommandName) 203 { 204 for (int i = 0; i < FieldColumns.length; i++) 205 { 206 if (FieldColumns[i].getFieldName().equals(_FieldName) && FieldColumns[i].getCommandName().equals(_CommandName)) 207 { 208 return FieldColumns[i]; 209 } 210 } 211 return null; 212 } 213 getFieldColumnByFieldName(String _FieldName)214 public FieldColumn getFieldColumnByFieldName(String _FieldName) 215 { 216 for (int i = 0; i < FieldColumns.length; i++) 217 { 218 String sFieldName = FieldColumns[i].getFieldName(); 219 if (sFieldName.equals(_FieldName)) 220 { 221 return FieldColumns[i]; 222 } 223 if (_FieldName.indexOf('.') == -1) 224 { 225 String sCompound = Command + "." + _FieldName; 226 if (sFieldName.equals(sCompound)) 227 { 228 return FieldColumns[i]; 229 } 230 } 231 } 232 throw new com.sun.star.uno.RuntimeException(); 233 } 234 getFieldColumnByDisplayName(String _DisplayName)235 public FieldColumn getFieldColumnByDisplayName(String _DisplayName) 236 { 237 String identifierQuote = getIdentifierQuote(); 238 for (int i = 0; i < FieldColumns.length; i++) 239 { 240 String sDisplayName = FieldColumns[i].getDisplayFieldName(); 241 if (sDisplayName.equals(_DisplayName)) 242 { 243 return FieldColumns[i]; 244 } 245 if (_DisplayName.indexOf('.') == -1) 246 { 247 String sCompound = Command + "." + _DisplayName; 248 if (sDisplayName.equals(sCompound)) 249 { 250 return FieldColumns[i]; 251 } 252 } 253 String quotedName = new StringBuilder(CommandName.quoteName(FieldColumns[i].getCommandName(), identifierQuote)).append('.').append(CommandName.quoteName(FieldColumns[i].getFieldName(), identifierQuote)).toString(); 254 if (quotedName.equals(_DisplayName)) 255 { 256 return FieldColumns[i]; 257 } 258 } 259 throw new com.sun.star.uno.RuntimeException(); 260 } 261 getFieldColumnByTitle(String _FieldTitle)262 public FieldColumn getFieldColumnByTitle(String _FieldTitle) 263 { 264 for (int i = 0; i < FieldColumns.length; i++) 265 { 266 if (FieldColumns[i].getFieldTitle().equals(_FieldTitle)) 267 { 268 return FieldColumns[i]; 269 } 270 } 271 // throw new com.sun.star.uno.RuntimeException(); 272 // LLA: Group works with fields direct 273 for (int i = 0; i < FieldColumns.length; i++) 274 { 275 if (FieldColumns[i].getFieldName().equals(_FieldTitle)) 276 { 277 return FieldColumns[i]; 278 } 279 } 280 throw new com.sun.star.uno.RuntimeException(); 281 } 282 getFieldNamesOfCommand(String _commandname, int _commandtype, boolean _bAppendMode)283 public boolean getFieldNamesOfCommand(String _commandname, int _commandtype, boolean _bAppendMode) 284 { 285 try 286 { 287 // Object oField; 288 java.util.ArrayList<String> ResultFieldNames = new java.util.ArrayList<String>(10); 289 String[] FieldNames; 290 CommandObject oCommand = this.getCommandByName(_commandname, _commandtype); 291 FieldNames = oCommand.getColumns().getElementNames(); 292 if (FieldNames.length > 0) 293 { 294 for (int n = 0; n < FieldNames.length; n++) 295 { 296 final String sFieldName = FieldNames[n]; 297 Object oField = oCommand.getColumns().getByName(sFieldName); 298 int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type")); 299 // BinaryFieldTypes are not included in the WidthList 300 if (JavaTools.FieldInIntTable(WidthList, iType) >= 0) 301 { 302 // if (_bAppendMode) 303 // ResultFieldNames.addElement(_commandname + "." + FieldNames[n]); 304 // else 305 ResultFieldNames.add(sFieldName); 306 } 307 else if (JavaTools.FieldInIntTable(BinaryTypes, iType) >= 0) 308 { 309 ResultFieldNames.add(sFieldName); 310 } 311 } 312 // FieldNames = new String[FieldNames.length]; 313 // FieldTypes = new int[FieldNames.length]; 314 m_aAllFieldNames = new String[ResultFieldNames.size()]; 315 m_aAllFieldNames = ResultFieldNames.toArray(m_aAllFieldNames); 316 return true; 317 } 318 } 319 catch (Exception exception) 320 { 321 exception.printStackTrace(System.out); 322 } 323 Resource oResource = new Resource(xMSF, "Database", "dbw"); 324 String sMsgNoFieldsFromCommand = oResource.getResText(RID_DB_COMMON + 45); 325 sMsgNoFieldsFromCommand = JavaTools.replaceSubString(sMsgNoFieldsFromCommand, _commandname, "%NAME"); 326 showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgNoFieldsFromCommand); 327 return false; 328 } 329 getOrderableColumns(String[] _fieldnames)330 public String[] getOrderableColumns(String[] _fieldnames) 331 { 332 ArrayList<String> aOrderableColumns = new ArrayList<String>(); 333 for (int i = 0; i < _fieldnames.length; i++) 334 { 335 FieldColumn ofieldcolumn = getFieldColumnByFieldName(_fieldnames[i]); 336 if (getDBDataTypeInspector().isColumnOrderable(ofieldcolumn.getXColumnPropertySet())) 337 { 338 aOrderableColumns.add(_fieldnames[i]); 339 } 340 } 341 String[] sretfieldnames = new String[aOrderableColumns.size()]; 342 return aOrderableColumns.toArray(sretfieldnames); 343 } 344 345 /** 346 * @return Returns the command. 347 */ getCommandName()348 public String getCommandName() 349 { 350 return Command; 351 } 352 353 /** 354 * @param _command The command to set. 355 */ setCommandName(String _command)356 public void setCommandName(String _command) 357 { 358 Command = _command; 359 } 360 361 /** 362 * @return Returns the commandType. 363 */ getCommandType()364 public int getCommandType() 365 { 366 return CommandType; 367 } 368 369 /** 370 * @param _commandType The commandType to set. 371 */ setCommandType(int _commandType)372 public void setCommandType(int _commandType) 373 { 374 CommandType = _commandType; 375 } 376 isnumeric(FieldColumn _oFieldColumn)377 public boolean isnumeric(FieldColumn _oFieldColumn) 378 { 379 try 380 { 381 CommandObject oTable = super.getTableByName(_oFieldColumn.getCommandName()); 382 Object oField = oTable.getColumns().getByName(_oFieldColumn.getFieldName()); 383 int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type")); 384 int ifound = java.util.Arrays.binarySearch(NumericTypes, iType); 385 if ((ifound < NumericTypes.length) && (ifound > 0)) 386 { 387 return (NumericTypes[ifound] == iType); 388 } 389 else 390 { 391 return false; 392 } 393 } 394 catch (Exception exception) 395 { 396 exception.printStackTrace(System.out); 397 return false; 398 } 399 } 400 setNumericFields()401 public String[] setNumericFields() 402 { 403 try 404 { 405 ArrayList<String> numericfieldsvector = new java.util.ArrayList<String>(); 406 for (int i = 0; i < FieldColumns.length; i++) 407 { 408 if (isnumeric(FieldColumns[i])) 409 { 410 numericfieldsvector.add(FieldColumns[i].getDisplayFieldName()); 411 } 412 } 413 NumericFieldNames = new String[numericfieldsvector.size()]; 414 numericfieldsvector.toArray(NumericFieldNames); 415 return NumericFieldNames; 416 } 417 catch (Exception exception) 418 { 419 exception.printStackTrace(System.out); 420 return new String[] 421 { 422 }; 423 } 424 } 425 getFieldNames(String[] _sDisplayFieldNames, String _sCommandName)426 public String[] getFieldNames(String[] _sDisplayFieldNames, String _sCommandName) 427 { 428 ArrayList<String> sFieldNamesVector = new java.util.ArrayList<String>(); 429 for (int i = 0; i < FieldColumns.length; i++) 430 { 431 if (_sCommandName.equals(FieldColumns[i].getCommandName()) && JavaTools.FieldInList(_sDisplayFieldNames, FieldColumns[i].getDisplayFieldName()) > -1) 432 { 433 sFieldNamesVector.add(FieldColumns[i].getFieldName()); 434 } 435 } 436 String[] sFieldNames = new String[sFieldNamesVector.size()]; 437 sFieldNamesVector.toArray(sFieldNames); 438 return sFieldNames; 439 } 440 getFieldNames()441 public String[] getFieldNames() 442 { 443 String[] sFieldNames = new String[FieldColumns.length]; 444 for (int i = 0; i < FieldColumns.length; i++) 445 { 446 sFieldNames[i] = FieldColumns[i].getFieldName(); 447 } 448 return sFieldNames; 449 } 450 getDisplayFieldNames()451 public String[] getDisplayFieldNames() 452 { 453 String[] sDisplayFieldNames = new String[FieldColumns.length]; 454 for (int i = 0; i < FieldColumns.length; i++) 455 { 456 sDisplayFieldNames[i] = FieldColumns[i].getDisplayFieldName(); 457 } 458 return sDisplayFieldNames; 459 } 460 setNonAggregateFieldNames()461 public String[] setNonAggregateFieldNames() 462 { 463 try 464 { 465 ArrayList<String> nonaggregatefieldsvector = new java.util.ArrayList<String>(); 466 for (int i = 0; i < FieldColumns.length; i++) 467 { 468 if (JavaTools.FieldInTable(AggregateFieldNames, FieldColumns[i].getDisplayFieldName()) == -1) 469 { 470 nonaggregatefieldsvector.add(FieldColumns[i].getDisplayFieldName()); 471 } 472 } 473 NonAggregateFieldNames = new String[nonaggregatefieldsvector.size()]; 474 nonaggregatefieldsvector.toArray(NonAggregateFieldNames); 475 return NonAggregateFieldNames; 476 } 477 catch (Exception exception) 478 { 479 exception.printStackTrace(System.out); 480 return new String[] 481 { 482 }; 483 } 484 } 485 486 /** 487 * the fieldnames passed over are not necessarily the ones that are defined in the class 488 * @param _DisplayFieldNames 489 * @return 490 */ hasNumericalFields(String[] _DisplayFieldNames)491 public boolean hasNumericalFields(String[] _DisplayFieldNames) 492 { 493 if (_DisplayFieldNames != null && _DisplayFieldNames.length > 0) 494 { 495 for (int i = 0; i < _DisplayFieldNames.length; i++) 496 { 497 if (isnumeric(getFieldColumnByDisplayName(_DisplayFieldNames[i]))) 498 { 499 return true; 500 } 501 } 502 } 503 return false; 504 } 505 getFieldTitle(String FieldName)506 public String getFieldTitle(String FieldName) 507 { 508 String FieldTitle = FieldName; 509 if (this.FieldTitleSet != null) 510 { 511 FieldTitle = (String) this.FieldTitleSet.get(FieldName); //FieldTitles[TitleIndex]; 512 if (FieldTitle == null) 513 { 514 return FieldName; 515 } 516 } 517 return FieldTitle; 518 } 519 setFieldTitles(String[] sFieldTitles)520 public void setFieldTitles(String[] sFieldTitles) 521 { 522 int nFieldColLength = FieldColumns.length; 523 for (int i = 0; i < sFieldTitles.length; i++) 524 { 525 if (i < nFieldColLength) 526 { 527 FieldColumns[i].setFieldTitle(sFieldTitles[i]); 528 } 529 530 } 531 } 532 getFieldTitles()533 public String[] getFieldTitles() 534 { 535 String[] sFieldTitles = new String[FieldColumns.length]; 536 for (int i = 0; i < FieldColumns.length; i++) 537 { 538 sFieldTitles[i] = FieldColumns[i].getFieldTitle(); 539 } 540 return sFieldTitles; 541 } 542 setGroupFieldNames(String[] GroupFieldNames)543 public void setGroupFieldNames(String[] GroupFieldNames) 544 { 545 this.GroupFieldNames = GroupFieldNames; 546 } 547 getGroupFieldNames()548 public String[] getGroupFieldNames() 549 { 550 return GroupFieldNames; 551 } 552 createRecordFieldNames()553 public void createRecordFieldNames() 554 { 555 String CurFieldName; 556 int GroupFieldCount; 557 int TotFieldCount = FieldColumns.length; 558 // int SortFieldCount = SortFieldNames[0].length; 559 GroupFieldCount = JavaTools.getArraylength(GroupFieldNames); 560 RecordFieldNames = new String[TotFieldCount - GroupFieldCount]; 561 562 int a = 0; 563 for (int i = 0; i < TotFieldCount; i++) 564 { 565 CurFieldName = FieldColumns[i].getFieldName(); 566 if (JavaTools.FieldInList(GroupFieldNames, CurFieldName) < 0) 567 { 568 RecordFieldNames[a] = CurFieldName; 569 // a += 1; 570 ++a; 571 } 572 } 573 } 574 setRecordFieldNames(String[] _aNewList)575 public void setRecordFieldNames(String[] _aNewList) 576 { 577 RecordFieldNames = _aNewList; 578 } 579 getRecordFieldNames()580 public String[] getRecordFieldNames() 581 { 582 return RecordFieldNames; 583 } 584 getRecordFieldName(int i)585 public String getRecordFieldName(int i) 586 { 587 return RecordFieldNames[i]; 588 } 589 590 /**@deprecated use 'RelationController' class instead 591 * 592 * @param _stablename 593 * @param _ncommandtype 594 * @return 595 */ getReferencedTables(String _stablename, int _ncommandtype)596 public String[] getReferencedTables(String _stablename, int _ncommandtype) 597 { 598 String[] sTotReferencedTables = new String[] 599 { 600 }; 601 try 602 { 603 if (_ncommandtype == com.sun.star.sdb.CommandType.TABLE && xDBMetaData.supportsIntegrityEnhancementFacility()) 604 { 605 java.util.ArrayList<String> TableVector = new java.util.ArrayList<String>(); 606 Object oTable = getTableNamesAsNameAccess().getByName(_stablename); 607 XKeysSupplier xKeysSupplier = UnoRuntime.queryInterface(XKeysSupplier.class, oTable); 608 xIndexKeys = xKeysSupplier.getKeys(); 609 for (int i = 0; i < xIndexKeys.getCount(); i++) 610 { 611 XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i)); 612 int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); 613 if (curtype == KeyType.FOREIGN) 614 { 615 // getImportedKeys (RelationController.cxx /source/ui/relationdesign) /Zeile 475 616 String sreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); 617 if (getTableNamesAsNameAccess().hasByName(sreftablename)) 618 { 619 TableVector.add(sreftablename); 620 } 621 } 622 } 623 if (TableVector.size() > 0) 624 { 625 sTotReferencedTables = new String[TableVector.size()]; 626 TableVector.toArray(sTotReferencedTables); 627 } 628 } 629 } 630 catch (Exception e) 631 { 632 e.printStackTrace(System.out); 633 } 634 return sTotReferencedTables; 635 } 636 637 /**@deprecated use 'RelationController' class instead 638 * 639 * @param _sreferencedtablename 640 * @return 641 */ getKeyColumns(String _sreferencedtablename)642 public String[][] getKeyColumns(String _sreferencedtablename) 643 { 644 String[][] skeycolumnnames = null; 645 try 646 { 647 for (int i = 0; i < xIndexKeys.getCount(); i++) 648 { 649 XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i)); 650 int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); 651 if (curtype == KeyType.FOREIGN) 652 { 653 String scurreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); 654 if (getTableNamesAsNameAccess().hasByName(scurreftablename)) 655 { 656 if (scurreftablename.equals(_sreferencedtablename)) 657 { 658 XColumnsSupplier xColumnsSupplier = UnoRuntime.queryInterface(XColumnsSupplier.class, xPropertySet); 659 String[] smastercolnames = xColumnsSupplier.getColumns().getElementNames(); 660 skeycolumnnames = new String[2][smastercolnames.length]; 661 skeycolumnnames[0] = smastercolnames; 662 skeycolumnnames[1] = new String[smastercolnames.length]; 663 for (int n = 0; n < smastercolnames.length; n++) 664 { 665 XPropertySet xcolPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xColumnsSupplier.getColumns().getByName(smastercolnames[n])); 666 skeycolumnnames[1][n] = AnyConverter.toString(xcolPropertySet.getPropertyValue("RelatedColumn")); 667 } 668 return skeycolumnnames; 669 } 670 } 671 } 672 } 673 } 674 catch (Exception e) 675 { 676 e.printStackTrace(); 677 } 678 return skeycolumnnames; 679 } 680 openFormDocument(boolean _bReadOnly)681 public void openFormDocument(boolean _bReadOnly) 682 { 683 } 684 setCommandComposingAttributes()685 public void setCommandComposingAttributes() 686 { 687 try 688 { 689 sCatalogSep = xDBMetaData.getCatalogSeparator(); 690 sIdentifierQuote = xDBMetaData.getIdentifierQuoteString(); 691 bCommandComposerAttributesalreadyRetrieved = true; 692 } 693 catch (SQLException e) 694 { 695 e.printStackTrace(System.out); 696 } 697 } 698 699 /** 700 * @return Returns the bCatalogAtStart. 701 */ isCatalogAtStart()702 public boolean isCatalogAtStart() 703 { 704 if (!bCommandComposerAttributesalreadyRetrieved) 705 { 706 setCommandComposingAttributes(); 707 } 708 return bCatalogAtStart; 709 } 710 711 /** 712 * @return Returns the sCatalogSep. 713 */ getCatalogSeparator()714 public String getCatalogSeparator() 715 { 716 if (!bCommandComposerAttributesalreadyRetrieved) 717 { 718 setCommandComposingAttributes(); 719 } 720 return sCatalogSep; 721 } 722 723 /** 724 * @return Returns the sIdentifierQuote. 725 */ getIdentifierQuote()726 public String getIdentifierQuote() 727 { 728 if (!bCommandComposerAttributesalreadyRetrieved) 729 { 730 setCommandComposingAttributes(); 731 } 732 return sIdentifierQuote; 733 } 734 } 735