1010package org .openmrs .module .reporting .report .service .db ;
1111
1212import org .hibernate .HibernateException ;
13- import org .hibernate .engine .spi .SharedSessionContractImplementor ;
1413import org .hibernate .usertype .UserType ;
1514
1615import java .io .IOException ;
3029 */
3130public class PropertiesType implements UserType {
3231
33- /**
32+ /**
3433 * @see UserType#assemble(Serializable, Object)
3534 */
3635 public Object assemble (Serializable cached , Object owner ) throws HibernateException {
37- if (cached == null ) {
38- return null ;
39- }
36+ if (cached == null ) {
37+ return null ;
38+ }
4039 try {
41- String s = (String ) cached ;
42- Properties p = new Properties ();
43- p .load (new StringReader (s ));
44- return p ;
45- }
46- catch (IOException e ) {
47- throw new IllegalArgumentException ("Unable to load properties from string" , e );
48- }
40+ String s = (String ) cached ;
41+ Properties p = new Properties ();
42+ p .load (new StringReader (s ));
43+ return p ;
44+ }
45+ catch (IOException e ) {
46+ throw new IllegalArgumentException ("Unable to load properties from string" , e );
47+ }
4948 }
5049
51- /**
50+ /**
5251 * @see UserType#deepCopy(Object)
5352 */
5453 public Object deepCopy (Object value ) throws HibernateException {
@@ -64,77 +63,77 @@ public Object deepCopy(Object value) throws HibernateException {
6463 }
6564 }
6665
67- /**
66+ /**
6867 * @see UserType#disassemble(Object)
6968 */
7069 public Serializable disassemble (Object value ) throws HibernateException {
71- if (value == null ) {
72- return null ;
73- }
74- try {
75- Properties props = (Properties ) value ;
76- StringWriter sw = new StringWriter ();
77- props .store (sw , null );
78- return sw .toString ();
79- }
80- catch (IOException e ) {
81- throw new IllegalArgumentException ("Unable to store properties as string" , e );
82- }
83- }
70+ if (value == null ) {
71+ return null ;
72+ }
73+ try {
74+ Properties props = (Properties ) value ;
75+ StringWriter sw = new StringWriter ();
76+ props .store (sw , null );
77+ return sw .toString ();
78+ }
79+ catch (IOException e ) {
80+ throw new IllegalArgumentException ("Unable to store properties as string" , e );
81+ }
82+ }
8483
85- /**
84+ /**
8685 * @see UserType#equals(Object, Object)
8786 */
8887 public boolean equals (Object x , Object y ) throws HibernateException {
8988 return x != null && x .equals (y );
9089 }
9190
92- /**
91+ /**
9392 * @see UserType#hashCode(Object)
9493 */
9594 public int hashCode (Object x ) throws HibernateException {
9695 return x .hashCode ();
9796 }
9897
99- /**
98+ /**
10099 * @see UserType#isMutable()
101100 */
102101 public boolean isMutable () {
103102 return true ;
104103 }
105104
106- /**
107- * @see UserType#nullSafeGet(ResultSet, String[], SharedSessionContractImplementor, Object)
105+ /**
106+ * @see UserType#nullSafeGet(ResultSet, String[], Object)
108107 */
109- public Object nullSafeGet (ResultSet rs , String [] names , SharedSessionContractImplementor session , Object owner ) throws HibernateException , SQLException {
108+ public Object nullSafeGet (ResultSet rs , String [] names , Object owner ) throws HibernateException , SQLException {
110109 String s = rs .getString (names [0 ]);
111- return assemble (s , null );
110+ return assemble (s , null );
112111 }
113112
114- /**
115- * @see UserType#nullSafeSet(PreparedStatement, Object, int, SharedSessionContractImplementor )
113+ /**
114+ * @see UserType#nullSafeSet(PreparedStatement, Object, int)
116115 */
117- public void nullSafeSet (PreparedStatement st , Object value , int index , SharedSessionContractImplementor session ) throws HibernateException , SQLException {
116+ public void nullSafeSet (PreparedStatement st , Object value , int index ) throws HibernateException , SQLException {
118117 String val = (String ) disassemble (value );
119118 st .setString (index , val );
120119 }
121120
122- /**
121+ /**
123122 * @see UserType#replace(Object, Object, Object)
124123 */
125124 public Object replace (Object original , Object target , Object owner ) throws HibernateException {
126125 return original ;
127126 }
128127
129- /**
128+ /**
130129 * @see UserType#returnedClass()
131130 */
132131 @ SuppressWarnings ("unchecked" )
133132 public Class returnedClass () {
134133 return Properties .class ;
135134 }
136135
137- /**
136+ /**
138137 * @see UserType#sqlTypes()
139138 */
140139 public int [] sqlTypes () {
0 commit comments