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 
24 package connectivity.tools;
25 
26 import com.sun.star.beans.PropertyVetoException;
27 import com.sun.star.beans.UnknownPropertyException;
28 import com.sun.star.beans.XPropertySet;
29 import com.sun.star.lang.WrappedTargetException;
30 import com.sun.star.lang.IllegalArgumentException;
31 
32 public class QueryDefinition
33 {
34     XPropertySet    m_queryDef;
35 
QueryDefinition( XPropertySet _queryDef )36     public QueryDefinition( XPropertySet _queryDef )
37     {
38         m_queryDef = _queryDef;
39     }
40 
41     /** retrieves the command underlying the query definition
42      *
43      * This method is a mere wrapped around the <code>getPropertyValue( "Command" )</code> call
44      */
getCommand()45     public final String getCommand() throws WrappedTargetException
46     {
47         String command = null;
48         try {
49             command = (String)m_queryDef.getPropertyValue( "Command" );
50         }
51         catch (UnknownPropertyException e) { }
52 
53         return command;
54     }
55 
56     /** retrieves the command underlying the query definition
57      *
58      * This method is a mere wrapped around the <code>getPropertyValue( "Command" )</code> call
59      */
setCommand( String _command )60     public void setCommand( String _command ) throws WrappedTargetException
61     {
62         try
63         {
64             m_queryDef.setPropertyValue( "Command", _command );
65         }
66         catch (UnknownPropertyException e) { }
67         catch (PropertyVetoException e) { }
68         catch (IllegalArgumentException e) { }
69     }
70 }
71