View Javadoc

1   /*******************************************************************************
2    *  Copyright (c) 2005, 2006 Imola Informatica.
3    *  All rights reserved. This program and the accompanying materials
4    *  are made available under the terms of the LGPL License v2.1
5    *  which accompanies this distribution, and is available at
6    *  http://www.gnu.org/licenses/lgpl.html
7    *******************************************************************************/
8   /**
9    * 
10   */
11  package it.imolinfo.jbi4cics.messageformat.jdbc;
12  
13  import it.imolinfo.jbi4cics.exception.FormatException;
14  import it.imolinfo.jbi4cics.jbi.Messages;
15  import it.imolinfo.jbi4cics.messageformat.FieldDescriptor;
16  import it.imolinfo.jbi4cics.messageformat.MappingDescriptor;
17  
18  import java.util.Map;
19  
20  /**
21   * @author raffaele
22   *
23   */
24  public class JdbcBeanMappingDescriptor implements MappingDescriptor{
25    
26   /**
27    * The responsible to translate localized messages.
28    */
29    private static final Messages MESSAGES
30  	          = Messages.getMessages(JdbcBeanMappingDescriptor.class);
31    
32    private JdbcStatementDescriptor jdbcStatementDescriptor;
33    private ResultSetMappingDescriptor resultSetMappingDescriptor;  
34    private String resultSetPropertyName;
35    private Class beanClass;
36    
37    /**
38     * 
39     */
40    public JdbcBeanMappingDescriptor() {
41    }
42    
43    /**
44     * @return Returns the resultSetPropertyName.
45     */
46    public String getResultSetPropertyName() {
47      return resultSetPropertyName;
48    }
49    
50    /**
51     * @param resultSetPropertyName The resultSetPropertyName to set.
52     */
53    public void setResultSetPropertyName(String resultSetPropertyName) {
54      this.resultSetPropertyName = resultSetPropertyName;
55    }
56  
57     
58  
59    /**
60     * @return Returns the jdbcStatementDescriptor.
61     */
62    public JdbcStatementDescriptor getJdbcStatementDescriptor() {
63      return jdbcStatementDescriptor;
64    }
65  
66    /**
67     * @param jdbcStatementDescriptor The jdbcStatementDescriptor to set.
68     */
69    public void setJdbcStatementDescriptor(JdbcStatementDescriptor jdbcStatementDescriptor) {
70      this.jdbcStatementDescriptor = jdbcStatementDescriptor;
71    }
72  
73    /**
74     * Non implementato.
75     * @param propertyName    The property name
76     * @param fieldName    The field name
77     * @param fieldDescriptor    The filed descriptor
78     * @throws FormatException    The format exception
79     */
80    public void addFieldMapping(String propertyName, String fieldName, FieldDescriptor fieldDescriptor) throws FormatException {
81      throw new FormatException(MESSAGES.getString("CIC001800_Not_implemented"));    
82    }
83  
84    /**
85     * Non implementato.
86     * @param propertyName    The property name
87     * @param fieldIndex    The field index
88     * @param fieldDescriptor    The filed descriptor
89     * @throws FormatException    The format exception
90     */
91    public void addFieldMapping(String propertyName, Integer fieldIndex, FieldDescriptor fieldDescriptor) throws FormatException {
92      throw new FormatException(MESSAGES.getString("CIC001800_Not_implemented"));    
93    }
94  
95    /**
96     * @return Returns the resultSetMappingDescriptor.
97     */
98    public ResultSetMappingDescriptor getResultSetMappingDescriptor() {
99      return resultSetMappingDescriptor;
100   }
101 
102   /**
103    * @param resultSetMappingDescriptor The resultSetMappingDescriptor to set.
104    */
105   public void setResultSetMappingDescriptor(ResultSetMappingDescriptor resultSetMappingDescriptor) {
106     this.resultSetMappingDescriptor = resultSetMappingDescriptor;
107   }
108 
109   /**
110    * @throws FormatException The format exception
111    * @return A map with string and field descriptor
112    */
113   public Map<String, FieldDescriptor> getFieldMap() throws FormatException{
114 //  TODO gestire questo metodo
115     throw new FormatException(MESSAGES.getString("CIC001800_Not_implemented"));
116   }
117 
118   /**
119    * @return Returns the beanClass.
120    */
121   public Class getBeanClass() {
122     return beanClass;
123   }
124 
125   /**
126    * @param beanClass The beanClass to set.
127    */
128   public void setBeanClass(Class beanClass) {
129     this.beanClass = beanClass;
130   }
131 
132   /**
133    * @param codePage The code Page
134    */
135   public void setCodePage(String codePage) {
136     jdbcStatementDescriptor.setCodePage(codePage);
137     resultSetMappingDescriptor.setCodePage(codePage); 
138     
139   }
140 
141 
142 
143 }