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   package it.imolinfo.jbi4cics.messageformat.jdbc;
9   
10  import it.imolinfo.jbi4cics.exception.FormatException;
11  import it.imolinfo.jbi4cics.jbi.Messages;
12  import it.imolinfo.jbi4cics.messageformat.FieldDescriptor;
13  import it.imolinfo.jbi4cics.messageformat.MappingDescriptor;
14  
15  import java.util.Map;
16  
17  import org.apache.commons.collections.map.ListOrderedMap;
18  
19  public class ResultSetMappingDescriptor implements MappingDescriptor{
20    
21    /**
22     * The responsible to translate localized messages.
23     */
24  private static final Messages MESSAGES
25  	          = Messages.getMessages(ResultSetMappingDescriptor.class);
26  	
27    private Map<String, String> columnNamePropertyNameMap=new ListOrderedMap();
28    private Class beanClass;
29    
30    public ResultSetMappingDescriptor() {
31      super();
32      // TODO Auto-generated constructor stub
33    }
34    
35    /**
36     * @return Returns the columnNamePropertyNameMap.
37     */
38    public Map<String, String> getColumnNamePropertyNameMap() {
39      return columnNamePropertyNameMap;
40    }  
41  
42    /**
43     * Il field descriptor non e' usato in questo caso.
44     * @param propertyName    The property name
45     * @param fieldName    The field name
46     * @param fieldDescriptor    The field descriptor
47     * @throws FormatException    The format exception
48     */
49    public void addFieldMapping(String propertyName, String fieldName, FieldDescriptor fieldDescriptor) throws FormatException {
50      columnNamePropertyNameMap.put(fieldName,propertyName);    
51    }
52    
53    /**
54     * Non implementato.
55     * @param propertyName    The property name
56     * @param fieldIndex    The field idex
57     * @param fieldDescriptor    The field descriptor
58     * @throws FormatException    The format exception
59     */
60    public void addFieldMapping(String propertyName, Integer fieldIndex, FieldDescriptor fieldDescriptor) throws FormatException {
61      throw new FormatException(MESSAGES.getString("CIC001800_Not_implemented"));    
62    }
63  
64    /**
65     * @throws FormatException The format exception
66     * @return   A map with string and field descriptor
67     */
68    public Map<String, FieldDescriptor> getFieldMap() throws FormatException {
69  //  TODO gestire questo metodo
70      throw new FormatException(MESSAGES.getString("CIC001800_Not_implemented"));
71    }
72  
73    /**
74     * @return Returns the beanClass.
75     */
76    public Class getBeanClass() {
77      return beanClass;
78    }
79  
80    /**
81     * @param beanClass The beanClass to set.
82     */
83    public void setBeanClass(Class beanClass) {
84      this.beanClass = beanClass;
85    }
86  
87    /**
88     * @param codePage The code page
89     */
90    public void setCodePage(String codePage) {
91      // TODO Auto-generated method stub
92      
93    }  
94  
95  }