View Javadoc

1   /*
2    * Licensed to the University Corporation for Advanced Internet Development, 
3    * Inc. (UCAID) under one or more contributor license agreements.  See the 
4    * NOTICE file distributed with this work for additional information regarding
5    * copyright ownership. The UCAID licenses this file to You under the Apache 
6    * License, Version 2.0 (the "License"); you may not use this file except in 
7    * compliance with the License.  You may obtain a copy of the License at
8    *
9    *    http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.dataConnector;
19  
20  import edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.dataConnector.RDBMSDataConnector.DATA_TYPES;
21  
22  /**
23   * Describes how to express a given result set column as an attribute and value.
24   */
25  public class RDBMSColumnDescriptor {
26  
27      /** Name of the database column. */
28      private String columnName;
29  
30      /** Name of the attribute to map the column to. */
31      private String attributeName;
32  
33      /** Java data type to express the database value as. */
34      private DATA_TYPES dataType;
35  
36      /**
37       * Constructor.
38       * 
39       * @param column name of the database column
40       * @param attribute name of the attribute to map the column to
41       * @param type Java data type to express the database value as
42       */
43      public RDBMSColumnDescriptor(String column, String attribute, DATA_TYPES type) {
44          columnName = column;
45          attributeName = attribute;
46          dataType = type;
47      }
48  
49      /**
50       * Gets the name of the database column.
51       * 
52       * @return name of the database column
53       */
54      public String getColumnName() {
55          return columnName;
56      }
57  
58      /**
59       * Gets the name of the attribute to map the column to.
60       * 
61       * @return name of the attribute to map the column to
62       */
63      public String getAttributeID() {
64          return attributeName;
65      }
66  
67      /**
68       * Gets the Java data type to express the database value as.
69       * 
70       * @return Java data type to express the database value as
71       */
72      public DATA_TYPES getDataType() {
73          return dataType;
74      }
75  
76      /** {@inheritDoc} */
77      public String toString() {
78          return "RBDMSColumnDescriptor{columnName=" + columnName + ", attributeId=" + attributeName + ", dataType="
79                  + dataType + "}";
80      }
81  }