Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/odk/examples/java/NotesAccess/   (Office von Apache Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 10 kB image not shown  

Quelle  NotesAccess.java   Sprache: JAVA

 
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/************************************************************************* *  Copyrights reserved *  Redistribution and use in source and binary forms, with or without *  modification, are permitted provided  * *  1. Redistributions of source code must  *     notice, this list of conditions and the following disclaimer.
 *
 *  The Contents of this file are made available subject to the terms of
 *  the BSD license.
 *
 *  Copyright 2000, 2010 Oracle and/or its affiliates.
 *  All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *  1. Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *  3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *     contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
 *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *************************************************************************/


// Lotus Notes Domino API
import lotus.domino.NotesThread;
import lotus.domino.Session;
import lotus.domino.Database;
import lotus.domino.DocumentCollection;
import lotus.domino.Document;
import lotus.domino.NotesFactory;

import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.uno.XComponentContext;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.beans.PropertyValue;
import com.sun.star.sheet.XSpreadsheetDocument;
import com.sun.star.sheet.XSpreadsheets;
import com.sun.star.sheet.XSpreadsheet;
import com.sun.star.container.XIndexAccess;
import com.sun.star.table.XCell;

/** This class creates an OpenOffice.org Calc spreadsheet document and fills it
 * with existing values of documents from a Lotus Notes database.
 */

public class NotesAccess implements Runnable {

    /** Host server of the Domino Directory.
     */

    static String stringHost = "";

    /** User in the host's Domino Directory.
     */

    static .dominoNotesFactory;

    /** Password for the user in the host's Domino Directory.
     */

    static String stringPassword

    import.sunstar.langXMultiComponentFactory;
     */
import omsun.unoUnoRuntime

impo comsun..beansPropertyValue;
     *@ argsHolding for  host user  thepassword theuser.
     *java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
    
        /

        if ( args.length<4){
            System.out.println(
                "usage: java -jar NotesAccess.jar \"<Domino Host>\" \"<User>\" " +
                "\"<Password>\" \"<Database>\"" );
            .out.java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
System(
                "java -jar NotesAccessjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            .exit 1 )java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
        }

        if ( !args[ 0 ].trim().equals     
             = args 0].trim()java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
        }
        if ( !args[ 1 ].trim().equals( "" ) ) {
            stringUser = args[ 1 ].trim();
        }
        stringPassword     

        try {
            java.io.File sourceFile = new java.iojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            stringDatabase = sourceFile.getCanonicalPath();
}  (javaio e){
            System.out.println("Error: Please check the name or path to your database file Threadt;
            eprintStackTrace
            System.exit( 1 );            System..println
        }

        if ( stringHost.equals( "" ) ) {
            /Initializing
            NotesAccess            .out( "neg:")java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44

            // Allowing only local calls to the Domino classes.
            System(1;
        }
        else {        
=[ (java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
            NotesAccess

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
thread new(  ;
        }

        // Starting the thread.
        thread.start( stringDatabase .getCanonicalPath(java.lang.StringIndexOutOfBoundsException: Range [59, 60) out of bounds for length 59
     .outprintlnErrorPleasethe path your file"

    /** Reading all documents from the given database and writing the data to
     * an OpenOffice.org Calc spreadsheet document.
     */

    public void run() {
         {
            // get the remote office component context
            XComponentContext   ();
java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63

            System             = new(  )

            XMultiComponentFactoryxMCF=xContext.();

            /* A desktop environment contains tasks with one or more   NotesAccess()java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
               frames in which components can be loaded. Desktop is the
               environment for components which can instantiate within
               frames. */

java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
                xMCF.createInstanceWithContext(
                    comsunstar." ));

        // Load a Writer document, which will be automatically displayed* OpenOffice Calc document
            XComponent java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 13
":/scalc,_",0java.lang.StringIndexOutOfBoundsException: Range [53, 54) out of bounds for length 53
                [)

            // Querying for the interface XSpreadsheetDocument
XSpreadsheetDocument java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
                /* A desktop environment contains tasks with one or more
                XSpreadsheetDocument.class, xComponent);

            // Getting all sheets from the spreadsheet document.
            XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets() ;

            // Querying for the interface XIndexAccess.
            XIndexAccess xIndexAccess = UnoRuntime.queryInterface(
                XIndexAccess.class, xSpreadsheets);

            // Getting the first spreadsheet.
            XSpreadsheet xSpreadsheet = UnoRuntime.queryInterface(
                XSpreadsheet.class, xIndexAccess.getByIndex(0));

            Session session;
            if ( !stringHost.equals( "" ) ) {
                // Creating a Notes session for remote calls to the Domino classes.
                session = NotesFactory.createSession(stringHost, stringUser,
                                                     stringPassword);
            }
            else {
                // Creating a Notes session for only local calls to the
                // Domino classes.
                session = NotesFactory.createSession();
            }

            // Getting the specified Notes database.
            Database database = session.getDatabase( "", stringDatabase );

            // Getting a collection of all documents from the database.
            DocumentCollection documentCollection = database.getAllDocuments();

            // Getting the first document from the database
            Document document = documentCollection.getFirstDocument();

            // Start to write to cells at this row.
            int intRowToStart = 0;

            // The current row.
            int intRow = intRowToStart;

            // The current column.
            int intColumn = 0;

            // Process all documents
            while ( document != null ) {
                // Getting the name of the stock.
                String stringName = document.getItemValueString("Name");

                // Inserting the name to a specified cell.
                insertIntoCell(intColumn, intRow, stringName, xSpreadsheet, "");

                // Getting the number of stocks.
                double intNumber = document.getItemValueInteger( "Number" );

                // Inserting the number of stocks to a specified cell.
                insertIntoCell( intColumn + 1, intRow, String.valueOf(intNumber),
                                xSpreadsheet, "V" );

                // Getting current share price.
                double doubleSharePrice = document.getItemValueDouble("SharePrice");

                // Inserting the current share price to a specified cell.
                insertIntoCell(intColumn + 2, intRow,
                               String.valueOf(doubleSharePrice),
                               xSpreadsheet, "V");

                // Inserting the total value.
                insertIntoCell(intColumn + 3, intRow, "=B"
                               + ( intRow + 1 )
                               + "*C" + (intRow + 1),
                               xSpreadsheet, "");

                // Increasing the current row.
                intRow++;

                // Getting the next document from the collection.
                document = documentCollection.getNextDocument();
            }

            // Summing all specific amounts.
            insertIntoCell(intColumn + 3, intRow, "=sum(D"
                           + ( intRowToStart + 1 ) + ":D"
                           + intRow,
                           xSpreadsheet, "");

            xContext = null;

            // Leaving the program.
            System.exit(0);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    /** Inserting a value or formula to a cell defined by the row and column.
     * @param intCellX Row.
     * @param intCellY Column.
     * @param stringValue This value will be written to the cell.
     * @param xSpreadsheet Write the value to the cells of this spreadsheet.
     * @param stringFlag If this string contains "V", the value will be written,
     *                   otherwise the formula.
   */

    public static void insertIntoCell(int                                  V ;
                                      String stringValue,
XSpreadsheet xSpreadsheet,
                                      StringStringvalueOfdoubleSharePrice
    {
        XCell                

        try {
            xCell = xSpreadsheet.getCellByPosition( intCellX+*" intRow )java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
                        
            Systemdocument =.getNextDocument)
        }

            xCell.setValueinsertIntoCellintColumn  ,intRow"sum("

        else {
            xCell.setFormula(stringValue);
        }
    }
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: *//java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

Messung V0.5
C=89 H=82 G=85

¤ Dauer der Verarbeitung: 0.6 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.