01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * Created on Jan 22, 2004
17: */
18: package org.geotools.validation.attributes;
19:
20: import java.beans.IntrospectionException;
21: import java.beans.PropertyDescriptor;
22: import java.util.ResourceBundle;
23:
24: import org.geotools.validation.DefaultFeatureValidationBeanInfo;
25:
26: /**
27: * SQLValidationBeanInfo purpose.
28: *
29: * <p>
30: * Description of SQLValidationBeanInfo ...
31: * </p>
32: *
33: * @author dzwiers, Refractions Research, Inc.
34: * @author $Author: dmzwiers $ (last modification)
35: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/validation/src/main/java/org/geotools/validation/attributes/UniquityValidationBeanInfo.java $
36: * @version $Id: UniquityValidationBeanInfo.java 22266 2006-10-19 11:30:55Z acuster $
37: */
38: public class UniquityValidationBeanInfo extends
39: DefaultFeatureValidationBeanInfo {
40: /**
41: * GazetteerNameValidationBeanInfo constructor.
42: *
43: * <p>
44: * Description
45: * </p>
46: */
47: public UniquityValidationBeanInfo() {
48: super ();
49: }
50:
51: /**
52: * Implementation of getPropertyDescriptors.
53: *
54: *
55: * @see java.beans.BeanInfo#getPropertyDescriptors()
56: */
57: public PropertyDescriptor[] getPropertyDescriptors() {
58: PropertyDescriptor[] pd2 = super .getPropertyDescriptors();
59: ResourceBundle resourceBundle = getResourceBundle(UniquityValidation.class);
60:
61: if (pd2 == null) {
62: pd2 = new PropertyDescriptor[0];
63: }
64:
65: PropertyDescriptor[] pd = new PropertyDescriptor[pd2.length + 1];
66: int i = 0;
67:
68: for (; i < pd2.length; i++)
69: pd[i] = pd2[i];
70:
71: try {
72: pd[i] = createPropertyDescriptor("attributeName",
73: UniquityValidation.class, resourceBundle);
74: pd[i].setExpert(false);
75: } catch (IntrospectionException e) {
76: pd = pd2;
77:
78: // TODO error, log here
79: e.printStackTrace();
80: }
81:
82: return pd;
83: }
84: }
|