Examples of XEnumeration


Examples of com.sun.star.container.XEnumeration

        // The idea for this code came from:
        // http://www.oooforum.org/forum/viewtopic.phtml?t=60451
        XTextRange textRange = null;
        XEnumerationAccess xParaAccess = (XEnumerationAccess) UnoRuntime.queryInterface(
                XEnumerationAccess.class, table.getAnchor().getText());
        XEnumeration xParaEnum = xParaAccess.createEnumeration();
        while (retval == null && xParaEnum.hasMoreElements()){
            Object elt = xParaEnum.nextElement();
            XServiceInfo xInfo = (XServiceInfo) UnoRuntime.queryInterface(
                    XServiceInfo.class, elt);
            if (xInfo.supportsService("com.sun.star.text.TextTable")) {
                XTextTable xTable = (XTextTable) UnoRuntime.queryInterface(
                        XTextTable.class, elt);
View Full Code Here

Examples of com.sun.star.container.XEnumeration

        XTextFieldsSupplier xTFS = (XTextFieldsSupplier)
                 UnoRuntime.queryInterface(XTextFieldsSupplier.class,xTextDocument);
         List docFieldMasterNames =
                 Arrays.asList((xTFS.getTextFieldMasters()).getElementNames());
         /* Create either OOOREsult or OOOError and add to list of OOOElements */
         XEnumeration xEnum = xTFS.getTextFields().createEnumeration();
         while (xEnum.hasMoreElements()){
             XDependentTextField xTF = (XDependentTextField)xEnum.nextElement();
             String name = (String) xTF.getTextFieldMaster().getPropertyValue("Name");


             /* NEED TO INDEX BY THE OOO Object */

 
View Full Code Here

Examples of com.sun.star.container.XEnumeration

    private ArrayList<XDependentTextField> getTextFields () throws java.lang.Exception {
        XTextFieldsSupplier xTFS = (XTextFieldsSupplier)
                 UnoRuntime.queryInterface(XTextFieldsSupplier.class,xTextDocument);
        ArrayList<XDependentTextField> xDTF=new ArrayList();
         /* Create either OOOREsult or OOOError and add to list of OOOElements */
        XEnumeration xEnum = xTFS.getTextFields().createEnumeration();
        XTextField xTF;
        while (xEnum.hasMoreElements()){
//            xDTF.add( (XDependentTextField) xEnum.nextElement())) ;
//            Logger.getLogger("com.CompPad").log(Level.FINE,"nextelement: "+((XTextField)((Any)xEnum.nextElement()).getObject()).getPresentation(true));
           
            xTF= (XTextField)((Any)xEnum.nextElement()).getObject();

            xDTF.add((XDependentTextField)UnoRuntime.queryInterface(
                    XDependentTextField.class,xTF));
        }
        return xDTF;
View Full Code Here

Examples of com.sun.star.container.XEnumeration

    {
        copyProperties(_xFromSection, _xToSection);

        try
        {
            XEnumeration xEnum = _xFromSection.createEnumeration();
            while (xEnum.hasMoreElements())
            {
                Object aEnumObj = xEnum.nextElement();
                XReportComponent aComponent = (XReportComponent) UnoRuntime.queryInterface(XReportComponent.class, aEnumObj);

                // XCloneable aClone = (XCloneable)UnoRuntime.queryInterface(XCloneable.class, aEnumObj);
                if (aComponent != null)
                {
View Full Code Here

Examples of com.sun.star.container.XEnumeration

            XCellRangesQuery xCellQuery = (XCellRangesQuery)
                UnoRuntime.queryInterface(XCellRangesQuery.class, sheet);
            XSheetCellRanges xFormulaCells = xCellQuery.queryContentCells(
                (short)com.sun.star.sheet.CellFlags.FORMULA);
            XEnumerationAccess xFormulas = xFormulaCells.getCells();
            XEnumeration xFormulaEnum = xFormulas.createEnumeration();
            while (xFormulaEnum.hasMoreElements()) {
                Object formulaCell = xFormulaEnum.nextElement();
                xCell = (XCell)UnoRuntime.queryInterface(XCell.class, formulaCell);
                XCellAddressable xCellAddress = (XCellAddressable)
                    UnoRuntime.queryInterface(XCellAddressable.class, xCell);
                System.out.println("Formula cell in column " +
                                   xCellAddress.getCellAddress().Column
View Full Code Here

Examples of com.sun.star.container.XEnumeration

        final Pair< ?, ? >[] paired = new Pair< ?, ? >[ keys.length ];
        for ( int i=0; i<keys.length; ++i )
            paired[i] = new Pair< Object, Object >( keys[i], values[i] );

        // create non-isolated enumerators, and check their content
        XEnumeration enumerateKeys = map.createKeyEnumeration( false );
        XEnumeration enumerateValues = map.createValueEnumeration( false );
        XEnumeration enumerateAll = map.createElementEnumeration( false );
        impl_verifyEnumerationContent( enumerateKeys, keys, "key enumeration" );
        impl_verifyEnumerationContent( enumerateValues, values, "value enumeration" );
        impl_verifyEnumerationContent( enumerateAll, paired, "content enumeration" );

        // all enumerators above have been created as non-isolated iterators, so they're expected to die when
View Full Code Here

Examples of com.sun.star.container.XEnumeration

            // Here, we access this interface
            XEnumerationAccess xParaAccess = (XEnumerationAccess)
                UnoRuntime.queryInterface(XEnumerationAccess.class, mxDocText );
            // Call the XEnumerationAccess's only method to access the actual
            // Enumeration
            XEnumeration xParaEnum = xParaAccess.createEnumeration();

            // While there are paragraphs, do things to them
            while ( xParaEnum.hasMoreElements() )
            {
                // Get a reference to the next paragraphs XServiceInfo interface.
                // TextTables are also part of this enumeration access, so we ask
                // the element if it is a TextTable, if it doesn't support the
                // com.sun.star.text.TextTable service, then it is safe to assume
                // that it really is a paragraph
                XServiceInfo xInfo = (XServiceInfo) UnoRuntime.queryInterface(
                    XServiceInfo.class, xParaEnum.nextElement() );
                if ( !xInfo.supportsService ( "com.sun.star.text.TextTable" ) )
                {
                    // Access the paragraph's property set...the properties in this
                    // property set are listed in:
                    // com.sun.star.style.ParagraphProperties
View Full Code Here

Examples of com.sun.star.container.XEnumeration

    public void check()
    {
        XComponent xComp = null;
        XComponent xComp2 = null;
        try {
            XEnumeration xStmtsEnum;
            XNamedGraph xManifest;

            log.println("Creating document with Repository...");

            // we cannot create a XDMA directly, we must create
            // a document and get it from there :(
            // create document
            PropertyValue[] loadProps = new PropertyValue[1];
            loadProps[0] = new PropertyValue();
            loadProps[0].Name = "Hidden";
            loadProps[0].Value = new Boolean(true);
            xComp = util.DesktopTools.openNewDoc(xMSF, "swriter", loadProps);
            XTextDocument xText = (XTextDocument) UnoRuntime.queryInterface(
                        XTextDocument.class, xComp);

            XRepositorySupplier xRS = (XRepositorySupplier)
                UnoRuntime.queryInterface(XRepositorySupplier.class, xComp);
            assure("xRS null", null != xRS);
            XDocumentMetadataAccess xDMA = (XDocumentMetadataAccess)
                UnoRuntime.queryInterface(XDocumentMetadataAccess.class, xRS);
            assure("xDMA null", null != xDMA);
            xRep = xRS.getRDFRepository();
            assure("xRep null", null != xRep);

            log.println("...done");

            log.println("Checking that new repository is initialized...");

            XURI xBaseURI = (XURI) xDMA;
            String baseURI = xBaseURI.getStringValue();
            assure("new: baseURI",
                null != xBaseURI && !xBaseURI.getStringValue().equals(""));

            assure("new: # graphs", 1 == xRep.getGraphNames().length);
            XURI manifest = URI.createNS(xContext, xBaseURI.getStringValue(),
                manifestPath);
            xManifest = xRep.getGraph(manifest);
            assure("new: manifest graph", null != xManifest);

            Statement[] manifestStmts = getManifestStmts(xBaseURI);
            xStmtsEnum = xRep.getStatements(null, null, null);
            assure("new: manifest graph", eq(xStmtsEnum, manifestStmts));

            log.println("...done");

            log.println("Checking some invalid args...");

            String content = "behold, for i am the content.";
            XTextRange xTR = new TestRange(content);
            XMetadatable xM = (XMetadatable) xTR;

            try {
                xDMA.getElementByURI(null);
                assure("getElementByURI: null allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.getMetadataGraphsWithType(null);
                assure("getMetadataGraphsWithType: null URI allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addMetadataFile("", new XURI[0]);
                assure("addMetadataFile: empty filename allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addMetadataFile("/foo", new XURI[0]);
                assure("addMetadataFile: absolute filename allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addMetadataFile("fo\"o", new XURI[0]);
                assure("addMetadataFile: invalid filename allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addMetadataFile("../foo", new XURI[0]);
                assure("addMetadataFile: filename with .. allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addMetadataFile("foo/../../bar", new XURI[0]);
                assure("addMetadataFile: filename with nest .. allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addMetadataFile("foo/././bar", new XURI[0]);
                assure("addMetadataFile: filename with nest . allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addMetadataFile("content.xml", new XURI[0]);
                assure("addMetadataFile: content.xml allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addMetadataFile("styles.xml", new XURI[0]);
                assure("addMetadataFile: styles.xml allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addMetadataFile("meta.xml", new XURI[0]);
                assure("addMetadataFile: meta.xml allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addMetadataFile("settings.xml", new XURI[0]);
                assure("addMetadataFile: settings.xml allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.importMetadataFile(FileFormat.RDF_XML, null, "foo",
                    foo, new XURI[0]);
                assure("importMetadataFile: null stream allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                XInputStream xFooIn =
                    new StreamSimulator(tempDir + "empty.rdf", true, param);
                xDMA.importMetadataFile(FileFormat.RDF_XML, xFooIn, "",
                    foo, new XURI[0]);
                assure("importMetadataFile: empty filename allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                XInputStream xFooIn =
                    new StreamSimulator(tempDir + "empty.rdf", true, param);
                xDMA.importMetadataFile(FileFormat.RDF_XML, xFooIn, "meta.xml",
                    foo, new XURI[0]);
                assure("importMetadataFile: meta.xml filename allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                XInputStream xFooIn =
                    new StreamSimulator(tempDir + "empty.rdf", true, param);
                xDMA.importMetadataFile(FileFormat.RDF_XML,
                    xFooIn, "foo", null, new XURI[0]);
                assure("importMetadataFile: null base URI allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                XInputStream xFooIn =
                    new StreamSimulator(tempDir + "empty.rdf", true, param);
                xDMA.importMetadataFile(FileFormat.RDF_XML,
                    xFooIn, "foo", rdf_type, new XURI[0]);
                assure("importMetadataFile: non-absolute base URI allowed",
                    false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.removeMetadataFile(null);
                assure("removeMetadataFile: null URI allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addContentOrStylesFile("");
                assure("addContentOrStylesFile: empty filename allowed",
                    false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addContentOrStylesFile("/content.xml");
                assure("addContentOrStylesFile: absolute filename allowed",
                    false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.addContentOrStylesFile("foo.rdf");
                assure("addContentOrStylesFile: invalid filename allowed",
                    false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.removeContentOrStylesFile("");
                assure("removeContentOrStylesFile: empty filename allowed",
                    false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.loadMetadataFromStorage(null, foo, null);
                assure("loadMetadataFromStorage: null storage allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.storeMetadataToStorage(null/*, base*/);
                assure("storeMetadataToStorage: null storage allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.loadMetadataFromMedium(new PropertyValue[0]);
                assure("loadMetadataFromMedium: empty medium allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }
            try {
                xDMA.storeMetadataToMedium(new PropertyValue[0]);
                assure("storeMetadataToMedium: empty medium allowed", false);
            } catch (IllegalArgumentException e) {
                // ignore
            }

            log.println("...done");

            log.println("Checking file addition/removal...");

            xDMA.removeContentOrStylesFile(contentPath);
            xStmtsEnum = xManifest.getStatements(null, null, null);
            assure("removeContentOrStylesFile (content)",
                eq(xStmtsEnum, new Statement[] {
                        manifestStmts[0], manifestStmts[2], manifestStmts[4]
                    }));

            xDMA.addContentOrStylesFile(contentPath);
            xStmtsEnum = xManifest.getStatements(null, null, null);
            assure("addContentOrStylesFile (content)",
                eq(xStmtsEnum, manifestStmts));

            xDMA.removeContentOrStylesFile(stylesPath);
            xStmtsEnum = xManifest.getStatements(null, null, null);
            assure("removeContentOrStylesFile (styles)",
                eq(xStmtsEnum, new Statement[] {
                        manifestStmts[0], manifestStmts[1], manifestStmts[3]
                    }));

            xDMA.addContentOrStylesFile(stylesPath);
            xStmtsEnum = xManifest.getStatements(null, null, null);
            assure("addContentOrStylesFile (styles)",
                eq(xStmtsEnum, manifestStmts));

            XURI xFoo = URI.createNS(xContext, xBaseURI.getStringValue(),
                fooPath);
            Statement xM_BaseHaspartFoo =
                new Statement(xBaseURI, pkg_hasPart, xFoo, manifest);
            Statement xM_FooTypeMetadata =
                new Statement(xFoo, rdf_type, pkg_MetadataFile, manifest);
            Statement xM_FooTypeBar =
                new Statement(xFoo, rdf_type, bar, manifest);
            xDMA.addMetadataFile(fooPath, new XURI[] { bar });
            xStmtsEnum = xManifest.getStatements(null, null, null);
            assure("addMetadataFile",
                eq(xStmtsEnum, merge(manifestStmts, new Statement[] {
                        xM_BaseHaspartFoo, xM_FooTypeMetadata, xM_FooTypeBar
                    })));

            XURI[] graphsBar = xDMA.getMetadataGraphsWithType(bar);
            assure("getMetadataGraphsWithType",
                graphsBar.length == 1 && eq(graphsBar[0], xFoo));


            xDMA.removeMetadataFile(xFoo);
            xStmtsEnum = xManifest.getStatements(null, null, null);
            assure("removeMetadataFile",
                eq(xStmtsEnum, manifestStmts));

            log.println("...done");

            log.println("Checking mapping...");

            XEnumerationAccess xTextEnum = (XEnumerationAccess)
                UnoRuntime.queryInterface(XEnumerationAccess.class,
                    xText.getText());
            Object o = xTextEnum.createEnumeration().nextElement();
            XMetadatable xMeta1 = (XMetadatable) UnoRuntime.queryInterface(
                        XMetadatable.class, o);

            XURI uri;
            XMetadatable xMeta;
            xMeta = xDMA.getElementByURI(xMeta1);
            assure("getElementByURI: null", null != xMeta);
            String XmlId = xMeta.getMetadataReference().Second;
            String XmlId1 = xMeta1.getMetadataReference().Second;
            assure("getElementByURI: no xml id", !XmlId.equals(""));
            assure("getElementByURI: different xml id", XmlId.equals(XmlId1));

            log.println("...done");

            log.println("Checking storing and loading...");

            XURI xFoobar = URI.createNS(xContext, xBaseURI.getStringValue(),
                fooBarPath);
            Statement[] metadataStmts = getMetadataFileStmts(xBaseURI,
                fooBarPath);
            xDMA.addMetadataFile(fooBarPath, new XURI[0]);
            xStmtsEnum = xRep.getStatements(null, null, null);
            assure("addMetadataFile",
                eq(xStmtsEnum, merge(manifestStmts, metadataStmts )));

            Statement xFoobar_FooBarFoo =
                new Statement(foo, bar, foo, xFoobar);
            xRep.getGraph(xFoobar).addStatement(foo, bar, foo);
            xStmtsEnum = xRep.getStatements(null, null, null);
            assure("addStatement",
                eq(xStmtsEnum, merge(manifestStmts, merge(metadataStmts,
                    new Statement[] { xFoobar_FooBarFoo }))));

            PropertyValue noMDNoContentFile = new PropertyValue();
            noMDNoContentFile.Name = "URL";
            noMDNoContentFile.Value = util.utils.getFullTestURL("CUSTOM.odt");
            PropertyValue noMDFile = new PropertyValue();
            noMDFile.Name = "URL";
            noMDFile.Value = util.utils.getFullTestURL("TEST.odt");
            PropertyValue file = new PropertyValue();
            file.Name = "URL";
            file.Value = tempDir + "TESTDMA.odt";
            /*
            PropertyValue baseURL = new PropertyValue();
            baseURL.Name = "DocumentBaseURL";
            baseURL.Value = tempDir + "TMP.odt";
            */
            PropertyValue mimetype = new PropertyValue();
            mimetype.Name = "MediaType";
            mimetype.Value = "application/vnd.oasis.opendocument.text";
            PropertyValue[] argsEmptyNoContent = { mimetype, noMDNoContentFile};
            PropertyValue[] argsEmpty = { mimetype, noMDFile };
            PropertyValue[] args = { mimetype, file };

            xStmtsEnum = xRep.getStatements(null, null, null);
            XURI[] graphs = xRep.getGraphNames();

            xDMA.storeMetadataToMedium(args);

            // this should re-init
            xDMA.loadMetadataFromMedium(argsEmptyNoContent);
            xRep = xRS.getRDFRepository();
            assure("xRep null", null != xRep);
            assure("baseURI still tdoc?",
                !baseURI.equals(xDMA.getStringValue()));
            Statement[] manifestStmts2 = getManifestStmts((XURI) xDMA);
            xStmtsEnum = xRep.getStatements(null, null, null);
            // there is no content or styles file in here, so we have just
            // the package stmt
            assure("loadMetadataFromMedium (no metadata, no content)",
                eq(xStmtsEnum, new Statement[] { manifestStmts2[0] }));

            // this should re-init
            xDMA.loadMetadataFromMedium(argsEmpty);
            xRep = xRS.getRDFRepository();
            assure("xRep null", null != xRep);
            assure("baseURI still tdoc?",
                !baseURI.equals(xDMA.getStringValue()));
            Statement[] manifestStmts3 = getManifestStmts((XURI) xDMA);

            xStmtsEnum = xRep.getStatements(null, null, null);
            assure("loadMetadataFromMedium (no metadata)",
                eq(xStmtsEnum, manifestStmts3));

            xDMA.loadMetadataFromMedium(args);
            xRep = xRS.getRDFRepository();
            assure("xRep null", null != xRep);
            Statement[] manifestStmts4 = getManifestStmts((XURI) xDMA);
            Statement[] metadataStmts4 = getMetadataFileStmts((XURI) xDMA,
                fooBarPath);

            xStmtsEnum = xRep.getStatements(null, null, null);
            assure("some graph(s) not reloaded",
                graphs.length == xRep.getGraphNames().length);

            XURI xFoobar4 = URI.createNS(xContext, xDMA.getStringValue(),
                fooBarPath);
            Statement xFoobar_FooBarFoo4 =
                new Statement(foo, bar, foo, xFoobar4);
            assure("loadMetadataFromMedium (re-load)",
                eq(xStmtsEnum, merge(manifestStmts4, merge(metadataStmts4,
                        new Statement[] { xFoobar_FooBarFoo4 }))));

            log.println("...done");

            log.println("Checking storing and loading via model...");

            String f = tempDir + "TESTPARA.odt";

            XStorable xStor = (XStorable) UnoRuntime.queryInterface(
                        XStorable.class, xRS);

            xStor.storeToURL(f, new PropertyValue[0]);

            xComp2 = util.DesktopTools.loadDoc(xMSF, f, loadProps);

            XDocumentMetadataAccess xDMA2 = (XDocumentMetadataAccess)
                UnoRuntime.queryInterface(XDocumentMetadataAccess.class,
                xComp2);
            assure("xDMA2 null", null != xDMA2);

            XRepositorySupplier xRS2 = (XRepositorySupplier)
                UnoRuntime.queryInterface(XRepositorySupplier.class, xComp2);
            assure("xRS2 null", null != xRS2);

            XRepository xRep2 = xRS2.getRDFRepository();
            assure("xRep2 null", null != xRep2);

            Statement[] manifestStmts5 = getManifestStmts((XURI) xDMA2);
            Statement[] metadataStmts5 = getMetadataFileStmts((XURI) xDMA2,
                fooBarPath);
            XURI xFoobar5 = URI.createNS(xContext, xDMA2.getStringValue(),
                fooBarPath);
            Statement xFoobar_FooBarFoo5 =
                new Statement(foo, bar, foo, xFoobar5);
            xStmtsEnum = xRep.getStatements(null, null, null);
            XEnumeration xStmtsEnum2 = xRep2.getStatements(null, null, null);
            assure("load: repository differs",
                eq(xStmtsEnum2, merge(manifestStmts5, merge(metadataStmts5,
                        new Statement[] { xFoobar_FooBarFoo5 }))));

            log.println("...done");
View Full Code Here

Examples of com.sun.star.container.XEnumeration

            XText xText = xTextDoc.getText();

            XEnumerationAccess xEA = (XEnumerationAccess)
                UnoRuntime.queryInterface(XEnumerationAccess.class, xText);
            XEnumeration xEnum = xEA.createEnumeration();

            log.println("...done");

            log.println("Checking RDFa in loaded test document...");

            XMetadatable xPara;
            Statement[] stmts;

            Statement x_FooBarLit1 = new Statement(foo, bar, mkLit("1"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 1",
                eq(stmts, new Statement[] {
                        x_FooBarLit1
                    }));

            Statement x_FooBarLit2 = new Statement(foo, bar, mkLit("2"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 2",
                eq(stmts, new Statement[] {
                        x_FooBarLit2
                    }));

            Statement x_BlankBarLit3 =
                new Statement(blank1, bar, mkLit("3"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 3",
                eq(stmts, new Statement[] {
                        x_BlankBarLit3
                    }));
            XBlankNode b3 = (XBlankNode) UnoRuntime.queryInterface(
                XBlankNode.class, stmts[0].Subject);

            Statement x_BlankBarLit4 =
                new Statement(blank2, bar, mkLit("4"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 4",
                eq(stmts, new Statement[] {
                        x_BlankBarLit4
                    }));
            XBlankNode b4 = (XBlankNode) UnoRuntime.queryInterface(
                XBlankNode.class, stmts[0].Subject);

            Statement x_BlankBarLit5 =
                new Statement(blank1, bar, mkLit("5"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 5",
                eq(stmts, new Statement[] {
                        x_BlankBarLit5
                    }));
            XBlankNode b5 = (XBlankNode) UnoRuntime.queryInterface(
                XBlankNode.class, stmts[0].Subject);

            assure("RDFa: 3 != 4",
                !b3.getStringValue().equals(b4.getStringValue()));
            assure("RDFa: 3 == 5",
                 b3.getStringValue().equals(b5.getStringValue()));

            Statement x_FooBarLit6 = new Statement(foo, bar, mkLit("6"), null);
            Statement x_FooBazLit6 = new Statement(foo, baz, mkLit("6"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 6",
                eq(stmts, new Statement[] {
                        x_FooBarLit6, x_FooBazLit6
                    }));

            Statement x_FooBarLit7 = new Statement(foo, bar, mkLit("7"), null);
            Statement x_FooBazLit7 = new Statement(foo, baz, mkLit("7"), null);
            Statement x_FooFooLit7 = new Statement(foo, foo, mkLit("7"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 7",
                eq(stmts, new Statement[] {
                        x_FooBarLit7, x_FooBazLit7, x_FooFooLit7
                    }));

            XNode lit = mkLit("a fooish bar");
            XNode lit_type= mkLit("a fooish bar", bar);
            Statement x_FooBarLit = new Statement(foo, bar, lit, null);
            Statement x_FooBarLittype = new Statement(foo, bar, lit_type, null);

            Statement x_FooLabelLit8 =
                new Statement(foo, rdfs_label, mkLit("8"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 8",
                eq(stmts, new Statement[] {
                        x_FooBarLit, x_FooLabelLit8
                    }));

            Statement x_FooLabelLit9 =
                new Statement(foo, rdfs_label, mkLit("9"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 9",
                eq(stmts, new Statement[] {
                        x_FooBarLit, x_FooLabelLit9
                    }));

            Statement x_FooLabelLit10 =
                new Statement(foo, rdfs_label, mkLit("10"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 10",
                eq(stmts, new Statement[] {
                        x_FooBarLittype, x_FooLabelLit10
                    }));

            Statement x_FooBarLit11
                = new Statement(foo, bar, mkLit("11", bar), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 11",
                eq(stmts, new Statement[] {
                        x_FooBarLit11
                    }));

            XURI xFile = URI.createNS(xContext, file, "/" + contentPath);
            Statement x_FileBarLit12 =
                new Statement(xFile, bar, mkLit("12"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 12",
                eq(stmts, new Statement[] {
                        x_FileBarLit12
                    }));

            Statement x_FooLabelLit13 =
                new Statement(foo, rdfs_label, mkLit("13"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 13",
                eq(stmts, new Statement[] {
                        x_FooBarLit, x_FooLabelLit13
                    }));

            Statement x_FooLabelLit14 =
                new Statement(foo, rdfs_label, mkLit("14"), null);
            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 14",
                eq(stmts, new Statement[] {
                        x_FooBarLit, x_FooLabelLit14
                    }));

            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 15", eq(stmts, new Statement[] { } ));

            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 16", eq(stmts, new Statement[] { } ));

            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 17", eq(stmts, new Statement[] { } ));

            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 18", eq(stmts, new Statement[] { } ));

            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 19", eq(stmts, new Statement[] { } ));

            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 20", eq(stmts, new Statement[] { } ));

            xPara = (XMetadatable) UnoRuntime.queryInterface(
                XMetadatable.class, xEnum.nextElement());
            stmts = xRep.getStatementRDFa(xPara);
            assure("RDFa: 21", eq(stmts, new Statement[] { } ));

            log.println("...done");
View Full Code Here

Examples of com.sun.star.container.XEnumeration

    static boolean eq(XQuerySelectResult i_Result,
            String[] i_Vars, XNode[][] i_Bindings) throws Exception
    {
        String[] vars = (String[]) i_Result.getBindingNames();
        XEnumeration iter = (XEnumeration) i_Result;
        XNode[][] bindings = toSeqs(iter);
        if (vars.length != i_Vars.length) {
            log.println("var lengths differ");
            return false;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.