Package com.sun.star.beans

Examples of com.sun.star.beans.XPropertySet


                {
                    commandType = CommandType.COMMAND;
                }
            }
            final XRowSet rowSet = createRowSet(command, commandType, parameters);
            final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);

            final XConnectionTools tools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, connection);
            fillOrderStatement(command, commandType, parameters, tools, rowSetProp);

            if ( command.length() != 0 )
View Full Code Here


                            out[0] = (XComponent) UnoRuntime.queryInterface(XComponent.class, xStatement);

                            // set the "MaxRows" to 0. This is just in case our attempt to append a 0=1 filter
                            // failed - in this case, the MaxRows restriction should at least ensure that there
                            // is no data returned (which would be potentially expensive)
                            final XPropertySet xStatementProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xStatement);
                            try
                            {
                                if ( xStatementProps != null )
                                {
                                    xStatementProps.setPropertyValue("MaxRows", new Integer(0));
                                }
                            } catch ( com.sun.star.uno.Exception ex )
                            {
                                // oh damn. Not much of a chance to recover, we will no retrieve the complete
                                // full blown result set
View Full Code Here

                    {
                        final XQueriesSupplier xSupplyQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, connection);
                        final XNameAccess queries = xSupplyQueries.getQueries();
                        if ( queries.hasByName(command) )
                        {
                            final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, queries.getByName(command));
                            final Boolean escape = (Boolean) prop.getPropertyValue("EscapeProcessing");
                            if (escape.booleanValue())
                            {
                                statement = (String) prop.getPropertyValue(UNO_COMMAND);
                                final XSingleSelectQueryComposer composer = getComposer(tools, statement, CommandType.COMMAND);
                                if (composer != null)
                                {
                                    final String order = (String) prop.getPropertyValue(UNO_ORDER);
                                    if (order != null && order.length() != 0)
                                    {
                                        composer.setOrder(order);
                                    }
                                    final Boolean applyFilter = (Boolean) prop.getPropertyValue(UNO_APPLY_FILTER);
                                    if (applyFilter.booleanValue())
                                    {
                                        final String filter = (String) prop.getPropertyValue(UNO_FILTER);
                                        if (filter != null && filter.length() != 0)
                                        {
                                            composer.setFilter(filter);
                                        }
                                    }
View Full Code Here

        int oldParameterCount = 0;

        final XSingleSelectQueryComposer composer = getComposer(tools, command, commandType);
        if ( composer != null )
        {
          final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);
            if ( ((Boolean)rowSetProp.getPropertyValue(APPLY_FILTER)).booleanValue() )
            {
                composer.setFilter((String)rowSetProp.getPropertyValue("Filter"));
            }
            // get old parameter count
            final XParametersSupplier paraSup = (XParametersSupplier) UnoRuntime.queryInterface(XParametersSupplier.class, composer);
            if ( paraSup != null )
            {
                final XIndexAccess params = paraSup.getParameters();
                if ( params != null )
                {
                    oldParameterCount = params.getCount();
                }
            }
            final ArrayList masterValues = (ArrayList) parameters.get(MASTER_VALUES);
            if ( masterValues != null && !masterValues.isEmpty() )
            {
                // Vector masterColumns = (Vector) parameters.get("master-columns");
                final ArrayList detailColumns = (ArrayList) parameters.get(DETAIL_COLUMNS);
                if ( oldParameterCount < detailColumns.size() )
                {
                    // create the new filter
                    final String quote = connection.getMetaData().getIdentifierQuoteString();
                    final StringBuffer oldFilter = new StringBuffer();
                    oldFilter.append(composer.getFilter());
                    if ( oldFilter.length() != 0 )
                    {
                        oldFilter.append(" AND ");
                    }
                    int newParamterCounter = 1;
                    for (final Iterator it = detailColumns.iterator(); it.hasNext();
                            ++newParamterCounter)
                    {
                        final String detail = (String) it.next();
                        //String master = (String) masterIt.next();
                        oldFilter.append(quote);
                        oldFilter.append(detail);
                        oldFilter.append(quote);
                        oldFilter.append(" = :link_");
                        oldFilter.append(newParamterCounter);
                        if ( it.hasNext() )
                        {
                            oldFilter.append(" AND ");
                        }
                    }

                    composer.setFilter(oldFilter.toString());
                }
                else
                    oldParameterCount = 0;

                final String sQuery = composer.getQuery();
                rowSetProp.setPropertyValue(UNO_COMMAND, sQuery);
                rowSetProp.setPropertyValue(UNO_COMMAND_TYPE,
                                            new Integer(CommandType.COMMAND));

                final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, rowSet);

                for (int i = 0;
View Full Code Here

    private final XRowSet createRowSet(final String command,
            final int commandType, final Map parameters)
            throws Exception
    {
        final XRowSet rowSet = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.sdb.RowSet", m_cmpCtx));
        final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);

        rowSetProp.setPropertyValue("ActiveConnection", connection);
        final Boolean escapeProcessing = (Boolean)parameters.get(ESCAPE_PROCESSING);
        rowSetProp.setPropertyValue("EscapeProcessing", escapeProcessing);
        rowSetProp.setPropertyValue(UNO_COMMAND_TYPE, new Integer(commandType));
        rowSetProp.setPropertyValue(UNO_COMMAND, command);

        final String filter = (String) parameters.get(UNO_FILTER);
        if ( filter != null )
        {
            rowSetProp.setPropertyValue("Filter", filter);
            rowSetProp.setPropertyValue(APPLY_FILTER, Boolean.valueOf(filter.length() != 0));
        }
        else
        {
            rowSetProp.setPropertyValue(APPLY_FILTER, Boolean.FALSE);
        }
        return rowSet;
    }
View Full Code Here

                {
                    final XQueriesSupplier xSupplyQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, connection);
                    final XNameAccess queries = xSupplyQueries.getQueries();
                    if ( queries.hasByName(command) )
                    {
                        final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, queries.getByName(command));
                        final Boolean escape = (Boolean) prop.getPropertyValue("EscapeProcessing");
                        rowSetProp.setPropertyValue("EscapeProcessing", escape);
                        final String queryCommand = (String) prop.getPropertyValue(UNO_COMMAND);
                        statement = "SELECT * FROM (" + queryCommand + ")";
                    }

                }
                else
View Full Code Here

            final PropertyValue[] value = new PropertyValue[]{new PropertyValue()};
            // value[0] = new PropertyValue();
            value[0].Name = "InputStream";
            value[0].Value = image;

            final XPropertySet xImage = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
                    m_xGraphicProvider.queryGraphic(value));

            if (xImage != null)
            {
                final XPropertySetInfo xInfo = xImage.getPropertySetInfo();
                if (xInfo.hasPropertyByName("Size100thMM"))
                {
                    Size imageSize = (Size) xImage.getPropertyValue("Size100thMM");
                    dim.setSize(imageSize.Width, imageSize.Height);
                    if (dim.height == 0 && dim.width == 0)
                    {
                        imageSize = (Size) xImage.getPropertyValue("SizePixel");
                        final int dpi = java.awt.Toolkit.getDefaultToolkit().getScreenResolution();
                        final double fac = 2540 / dpi;
                        dim.setSize(imageSize.Width * fac, imageSize.Height * fac);
                    }
                }
                else if (xInfo.hasPropertyByName("SizePixel"))
                {
                    final Size imageSize = (Size) xImage.getPropertyValue("SizePixel");
                    final int dpi = java.awt.Toolkit.getDefaultToolkit().getScreenResolution();
                    final double fac = 2540 / dpi;
                    dim.setSize(imageSize.Width * fac, imageSize.Height * fac);
                }
            }
View Full Code Here

        {
            final PropertyValue[] value = new PropertyValue[]{new PropertyValue()};
            value[0].Name = "InputStream";
            value[0].Value = image;

            final XPropertySet xImage = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
                    m_xGraphicProvider.queryGraphic(value));

            if (xImage != null)
            {
                final XPropertySetInfo xInfo = xImage.getPropertySetInfo();
                if (xInfo.hasPropertyByName("MimeType"))
                {
                    return (String) xImage.getPropertyValue("MimeType");
                }
            }
        }
        catch (UnknownPropertyException ex)
        {
View Full Code Here

        {
            final XStream stream = output.openStreamElement(name, ElementModes.WRITE | ElementModes.TRUNCATE);
            stream.getInputStream().closeInput();
            if (mimeType != null)
            {
                final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, stream);
                prop.setPropertyValue("MediaType", mimeType);
            }
            return new BufferedOutputStream(new XOutputStreamToOutputStreamAdapter(stream.getOutputStream()), 204800);
        }
        catch (com.sun.star.uno.Exception e)
        {
View Full Code Here

        {
            final String temp = shortenName(name);
            final XStorage storage = (XStorage) UnoRuntime.queryInterface(XStorage.class, output.openStorageElement(temp, ElementModes.WRITE));
            if (mimeType != null)
            {
                final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, storage);
                prop.setPropertyValue("MediaType", mimeType);
            }
            return new StorageRepository(storage, true);
        }
        catch (UnknownPropertyException ex)
        {
View Full Code Here

TOP

Related Classes of com.sun.star.beans.XPropertySet

Copyright © 2018 www.massapicom. 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.