Skip to content

Commit 2ab70fc

Browse files
committed
Update UserType sub classes
1 parent f26b04f commit 2ab70fc

File tree

9 files changed

+69
-72
lines changed

9 files changed

+69
-72
lines changed

api-1.9/src/main/java/org/openmrs/module/reporting/report/service/db/MappedDefinitionType.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import org.apache.commons.lang.StringUtils;
2121
import org.hibernate.HibernateException;
22-
import org.hibernate.engine.spi.SessionImplementor;
2322
import org.hibernate.engine.spi.SharedSessionContractImplementor;
2423
import org.hibernate.type.Type;
2524
import org.hibernate.usertype.CompositeUserType;
@@ -83,15 +82,15 @@ public boolean isMutable() {
8382
}
8483

8584
/**
86-
* @see CompositeUserType#getPropertyValue(Object, int)
85+
* @see CompositeUserType#getPropertyValue(java.lang.Object, int)
8786
*/
8887
public Object getPropertyValue(Object component, int property) throws HibernateException {
8988
Mapped m = (Mapped) component;
9089
return (property == 0 ? m.getParameterizable() : m.getParameterMappings());
9190
}
9291

9392
/**
94-
* @see CompositeUserType#setPropertyValue(Object, int, Object)
93+
* @see CompositeUserType#setPropertyValue(java.lang.Object, int, java.lang.Object)
9594
*/
9695
public void setPropertyValue(Object component, int property, Object value) throws HibernateException {
9796
Mapped m = (Mapped) component;
@@ -104,7 +103,7 @@ public void setPropertyValue(Object component, int property, Object value) throw
104103
}
105104

106105
/**
107-
* @see CompositeUserType#deepCopy(Object)
106+
* @see CompositeUserType#deepCopy(java.lang.Object)
108107
*/
109108
public Object deepCopy(Object value) throws HibernateException {
110109
if (value == null) return null;
@@ -116,7 +115,7 @@ public Object deepCopy(Object value) throws HibernateException {
116115
}
117116

118117
/**
119-
* @see CompositeUserType#nullSafeGet(ResultSet, String[], SessionImplementor, Object)
118+
* @see CompositeUserType#nullSafeGet(ResultSet, String[], SharedSessionContractImplementor, Object)
120119
*/
121120
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
122121
String parameterizableUuid = (String) HibernateUtil.standardType("STRING").nullSafeGet(rs, names[0], session, owner);
@@ -136,7 +135,7 @@ public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImp
136135
}
137136

138137
/**
139-
* @see CompositeUserType#nullSafeSet(PreparedStatement, Object, int, SessionImplementor)
138+
* @see CompositeUserType#nullSafeSet(PreparedStatement, Object, int, SharedSessionContractImplementor)
140139
*/
141140
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
142141
String definitionUuid = null;
@@ -160,7 +159,7 @@ public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSes
160159
}
161160

162161
/**
163-
* @see CompositeUserType#replace(Object, Object, SessionImplementor, Object)
162+
* @see CompositeUserType#replace(Object, Object, SharedSessionContractImplementor, Object)
164163
*/
165164
public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException {
166165
return original;
@@ -181,14 +180,14 @@ public int hashCode(Object x) throws HibernateException {
181180
}
182181

183182
/**
184-
* @see CompositeUserType#disassemble(Object, SessionImplementor)
183+
* @see CompositeUserType#disassemble(Object, SharedSessionContractImplementor)
185184
*/
186185
public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException {
187186
return (Serializable) deepCopy(value);
188187
}
189188

190189
/**
191-
* @see CompositeUserType#assemble(Serializable, SessionImplementor, Object)
190+
* @see CompositeUserType#assemble(Serializable, SharedSessionContractImplementor, Object)
192191
*/
193192
public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException {
194193
return deepCopy(cached);

api-1.9/src/main/java/org/openmrs/module/reporting/report/service/db/PropertiesType.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
*/
1010
package org.openmrs.module.reporting.report.service.db;
1111

12-
import static java.sql.Types.VARCHAR;
12+
import org.hibernate.HibernateException;
13+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
14+
import org.hibernate.usertype.UserType;
1315

1416
import java.io.IOException;
1517
import java.io.Serializable;
@@ -21,10 +23,7 @@
2123
import java.util.Map;
2224
import java.util.Properties;
2325

24-
import org.hibernate.HibernateException;
25-
import org.hibernate.engine.spi.SessionImplementor;
26-
import org.hibernate.engine.spi.SharedSessionContractImplementor;
27-
import org.hibernate.usertype.UserType;
26+
import static java.sql.Types.VARCHAR;
2827

2928
/**
3029
* A report definition type
@@ -105,15 +104,15 @@ public boolean isMutable() {
105104
}
106105

107106
/**
108-
* @see UserType#nullSafeGet(ResultSet, String[], Object)
107+
* @see UserType#nullSafeGet(ResultSet, String[], SharedSessionContractImplementor, Object)
109108
*/
110109
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
111110
String s = rs.getString(names[0]);
112111
return assemble(s, null);
113112
}
114113

115114
/**
116-
* @see UserType#nullSafeSet(PreparedStatement, Object, int)
115+
* @see UserType#nullSafeSet(PreparedStatement, Object, int, SharedSessionContractImplementor)
117116
*/
118117
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
119118
String val = (String) disassemble(value);

api-1.9/src/main/java/org/openmrs/module/reporting/report/service/db/RenderingModeType.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import java.sql.SQLException;
1616

1717
import org.hibernate.HibernateException;
18-
import org.hibernate.engine.spi.SessionImplementor;
1918
import org.hibernate.engine.spi.SharedSessionContractImplementor;
2019
import org.hibernate.type.Type;
2120
import org.hibernate.usertype.CompositeUserType;
@@ -66,15 +65,15 @@ public boolean isMutable() {
6665
}
6766

6867
/**
69-
* @see CompositeUserType#getPropertyValue(Object, int)
68+
* @see CompositeUserType#getPropertyValue(java.lang.Object, int)
7069
*/
7170
public Object getPropertyValue(Object component, int property) throws HibernateException {
7271
RenderingMode m = (RenderingMode) component;
7372
return (property == 0 ? m.getRenderer().getClass() : m.getArgument());
7473
}
7574

7675
/**
77-
* @see CompositeUserType#setPropertyValue(Object, int, Object)
76+
* @see CompositeUserType#setPropertyValue(java.lang.Object, int, java.lang.Object)
7877
*/
7978
public void setPropertyValue(Object component, int property, Object value) throws HibernateException {
8079
RenderingMode m = (RenderingMode) component;
@@ -96,7 +95,7 @@ public void setPropertyValue(Object component, int property, Object value) throw
9695
}
9796

9897
/**
99-
* @see CompositeUserType#deepCopy(Object)
98+
* @see CompositeUserType#deepCopy(java.lang.Object)
10099
*/
101100
public Object deepCopy(Object value) throws HibernateException {
102101
if (value == null) return null;
@@ -105,7 +104,7 @@ public Object deepCopy(Object value) throws HibernateException {
105104
}
106105

107106
/**
108-
* @see CompositeUserType#nullSafeGet(ResultSet, String[], SessionImplementor, Object)
107+
* @see CompositeUserType#nullSafeGet(ResultSet, String[], SharedSessionContractImplementor, Object)
109108
*/
110109
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
111110
Class rendererClass = (Class) HibernateUtil.standardType("CLASS").nullSafeGet(rs, names[0], session, owner);
@@ -122,7 +121,7 @@ public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImp
122121
}
123122

124123
/**
125-
* @see CompositeUserType#nullSafeSet(PreparedStatement, Object, int, SessionImplementor)
124+
* @see CompositeUserType#nullSafeSet(PreparedStatement, Object, int, SharedSessionContractImplementor)
126125
*/
127126
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
128127
RenderingMode mode = (RenderingMode) value;
@@ -131,7 +130,7 @@ public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSes
131130
}
132131

133132
/**
134-
* @see CompositeUserType#replace(Object, Object, org.hibernate.engine.SessionImplementor, Object)
133+
* @see CompositeUserType#replace(java.lang.Object, java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
135134
*/
136135
public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException {
137136
return original;
@@ -152,14 +151,14 @@ public int hashCode(Object x) throws HibernateException {
152151
}
153152

154153
/**
155-
* @see CompositeUserType#disassemble(Object, SessionImplementor)
154+
* @see CompositeUserType#disassemble(Object, SharedSessionContractImplementor)
156155
*/
157156
public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException {
158157
return (Serializable) deepCopy(value);
159158
}
160159

161160
/**
162-
* @see CompositeUserType#assemble(Serializable, SessionImplementor, Object)
161+
* @see CompositeUserType#assemble(Serializable, SharedSessionContractImplementor, Object)
163162
*/
164163
public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException {
165164
return deepCopy(cached);

api-1.9/src/main/java/org/openmrs/module/reporting/report/service/db/ReportDefinitionType.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import java.sql.Types;
1717

1818
import org.hibernate.HibernateException;
19-
import org.hibernate.engine.spi.SessionImplementor;
2019
import org.hibernate.engine.spi.SharedSessionContractImplementor;
2120
import org.hibernate.usertype.UserType;
2221
import org.openmrs.api.context.Context;
@@ -77,7 +76,7 @@ public boolean isMutable() {
7776
}
7877

7978
/**
80-
* @see UserType#nullSafeGet(ResultSet, String[], Object)
79+
* @see UserType#nullSafeGet(ResultSet, String[], SharedSessionContractImplementor, Object)
8180
*/
8281
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
8382
String uuid = rs.getString(names[0]);
@@ -88,7 +87,7 @@ public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImp
8887
}
8988

9089
/**
91-
* @see UserType#nullSafeSet(PreparedStatement, Object, int, SessionImplementor)
90+
* @see UserType#nullSafeSet(PreparedStatement, Object, int, SharedSessionContractImplementor)
9291
*/
9392
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
9493
ReportDefinition d = (ReportDefinition) value;

api-2.0/src/main/java/org/openmrs/module/reporting/report/service/db/MappedDefinitionType.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
*/
1010
package org.openmrs.module.reporting.report.service.db;
1111

12+
import java.io.Serializable;
13+
import java.sql.PreparedStatement;
14+
import java.sql.ResultSet;
15+
import java.sql.SQLException;
16+
import java.util.HashMap;
17+
import java.util.Map;
18+
import java.util.Properties;
19+
1220
import org.apache.commons.lang.StringUtils;
1321
import org.hibernate.HibernateException;
1422
import org.hibernate.engine.spi.SessionImplementor;
@@ -25,14 +33,6 @@
2533
import org.openmrs.module.reporting.evaluation.parameter.Parameterizable;
2634
import org.openmrs.module.reporting.serializer.ReportingSerializer;
2735

28-
import java.io.Serializable;
29-
import java.sql.PreparedStatement;
30-
import java.sql.ResultSet;
31-
import java.sql.SQLException;
32-
import java.util.HashMap;
33-
import java.util.Map;
34-
import java.util.Properties;
35-
3636
/**
3737
* Custom User-Type for storing Mapped objects in a single table within 2 columns
3838
* This type takes in 2 properties and 1 parameter in the form:
@@ -83,15 +83,15 @@ public boolean isMutable() {
8383
}
8484

8585
/**
86-
* @see CompositeUserType#getPropertyValue(Object, int)
86+
* @see CompositeUserType#getPropertyValue(java.lang.Object, int)
8787
*/
8888
public Object getPropertyValue(Object component, int property) throws HibernateException {
8989
Mapped m = (Mapped) component;
9090
return (property == 0 ? m.getParameterizable() : m.getParameterMappings());
9191
}
9292

9393
/**
94-
* @see CompositeUserType#setPropertyValue(Object, int, Object)
94+
* @see CompositeUserType#setPropertyValue(java.lang.Object, int, java.lang.Object)
9595
*/
9696
public void setPropertyValue(Object component, int property, Object value) throws HibernateException {
9797
Mapped m = (Mapped) component;
@@ -104,7 +104,7 @@ public void setPropertyValue(Object component, int property, Object value) throw
104104
}
105105

106106
/**
107-
* @see CompositeUserType#deepCopy(Object)
107+
* @see CompositeUserType#deepCopy(java.lang.Object)
108108
*/
109109
public Object deepCopy(Object value) throws HibernateException {
110110
if (value == null) return null;
@@ -116,7 +116,7 @@ public Object deepCopy(Object value) throws HibernateException {
116116
}
117117

118118
/**
119-
* @see CompositeUserType#nullSafeGet(ResultSet, String[], SessionImplementor, Object)
119+
* @see CompositeUserType#nullSafeGet(ResultSet, String[], SharedSessionContractImplementor, Object)
120120
*/
121121
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
122122
String parameterizableUuid = (String) HibernateUtil.standardType("STRING").nullSafeGet(rs, names[0], session, owner);
@@ -136,7 +136,7 @@ public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImp
136136
}
137137

138138
/**
139-
* @see CompositeUserType#nullSafeSet(PreparedStatement, Object, int, SessionImplementor)
139+
* @see CompositeUserType#nullSafeSet(PreparedStatement, Object, int, SharedSessionContractImplementor)
140140
*/
141141
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
142142
String definitionUuid = null;
@@ -160,7 +160,7 @@ public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSes
160160
}
161161

162162
/**
163-
* @see CompositeUserType#replace(Object, Object, SessionImplementor, Object)
163+
* @see CompositeUserType#replace(Object, Object, SharedSessionContractImplementor, Object)
164164
*/
165165
public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException {
166166
return original;
@@ -181,14 +181,14 @@ public int hashCode(Object x) throws HibernateException {
181181
}
182182

183183
/**
184-
* @see CompositeUserType#disassemble(Object, SessionImplementor)
184+
* @see CompositeUserType#disassemble(Object, SharedSessionContractImplementor)
185185
*/
186186
public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException {
187187
return (Serializable) deepCopy(value);
188188
}
189189

190190
/**
191-
* @see CompositeUserType#assemble(Serializable, SessionImplementor, Object)
191+
* @see CompositeUserType#assemble(Serializable, SharedSessionContractImplementor, Object)
192192
*/
193193
public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException {
194194
return deepCopy(cached);

api-2.0/src/main/java/org/openmrs/module/reporting/report/service/db/PropertiesType.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
*/
1010
package org.openmrs.module.reporting.report.service.db;
1111

12-
import org.hibernate.HibernateException;
13-
import org.hibernate.engine.spi.SharedSessionContractImplementor;
14-
import org.hibernate.usertype.UserType;
12+
import static java.sql.Types.VARCHAR;
1513

1614
import java.io.IOException;
1715
import java.io.Serializable;
@@ -23,7 +21,10 @@
2321
import java.util.Map;
2422
import java.util.Properties;
2523

26-
import static java.sql.Types.VARCHAR;
24+
import org.hibernate.HibernateException;
25+
import org.hibernate.engine.spi.SessionImplementor;
26+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
27+
import org.hibernate.usertype.UserType;
2728

2829
/**
2930
* A report definition type
@@ -104,15 +105,15 @@ public boolean isMutable() {
104105
}
105106

106107
/**
107-
* @see UserType#nullSafeGet(ResultSet, String[], Object)
108+
* @see UserType#nullSafeGet(ResultSet, String[], SharedSessionContractImplementor, Object)
108109
*/
109110
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
110111
String s = rs.getString(names[0]);
111112
return assemble(s, null);
112113
}
113114

114115
/**
115-
* @see UserType#nullSafeSet(PreparedStatement, Object, int)
116+
* @see UserType#nullSafeSet(PreparedStatement, Object, int, SharedSessionContractImplementor)
116117
*/
117118
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
118119
String val = (String) disassemble(value);

0 commit comments

Comments
 (0)