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 package org.apache.openoffice.comp.sdbc.dbtools.sdbcx; 23 24 import org.apache.openoffice.comp.sdbc.dbtools.comphelper.PropertySet; 25 import org.apache.openoffice.comp.sdbc.dbtools.comphelper.PropertySetAdapter.PropertyGetter; 26 import org.apache.openoffice.comp.sdbc.dbtools.comphelper.PropertySetAdapter.PropertySetter; 27 import org.apache.openoffice.comp.sdbc.dbtools.util.PropertyIds; 28 29 import com.sun.star.beans.PropertyAttribute; 30 import com.sun.star.uno.Type; 31 32 public class ODescriptor extends PropertySet { 33 private String name; 34 private final boolean isCaseSensitive; 35 ODescriptor(String name, boolean isCaseSensitive, boolean isReadOnly)36 public ODescriptor(String name, boolean isCaseSensitive, boolean isReadOnly) { 37 this.name = name; 38 this.isCaseSensitive = isCaseSensitive; 39 registerProperties(isReadOnly); 40 } 41 ODescriptor(String name, boolean isCaseSensitive)42 public ODescriptor(String name, boolean isCaseSensitive) { 43 this(name, isCaseSensitive, true); 44 } 45 registerProperties(boolean isReadOnly)46 private void registerProperties(boolean isReadOnly) { 47 registerProperty(PropertyIds.NAME.name, PropertyIds.NAME.id, Type.STRING, isReadOnly ? PropertyAttribute.READONLY : 0, 48 new PropertyGetter() { 49 @Override 50 public Object getValue() { 51 return name; 52 53 } 54 }, 55 isReadOnly ? null : new PropertySetter() { 56 @Override 57 public void setValue(Object value) { 58 name = (String) value; 59 } 60 }); 61 } 62 getName()63 public String getName() { 64 return name; 65 } 66 setName(String name)67 public void setName(String name) { 68 this.name = name; 69 } 70 isCaseSensitive()71 public boolean isCaseSensitive() { 72 return isCaseSensitive; 73 } 74 } 75