1 package de.fhdw.wtf.persistence.utils;
2
3 import java.sql.CallableStatement;
4 import java.sql.SQLException;
5
6 import de.fhdw.wtf.persistence.exception.NotValidInputException;
7 import de.fhdw.wtf.persistence.meta.Object;
8 import de.fhdw.wtf.persistence.meta.UserObject;
9
10
11
12
13 public class DBConnectionUserObjectHandler implements DBConnectionObjectHandler {
14
15 private final UserObject userObject;
16
17 @Override
18 public String getObjectTypeString() {
19 return "UO";
20 }
21
22 @Override
23 public void handleCall(final CallableStatement call, final int parameterIndex) throws SQLException {
24 call.setLong(parameterIndex, this.userObject.getId());
25 }
26
27 @Override
28 public Object getObject() {
29 return this.userObject;
30 }
31
32
33
34
35
36
37
38
39
40 public DBConnectionUserObjectHandler(final UserObject userObject) throws NotValidInputException {
41 super();
42
43 if (userObject == null) {
44 throw new NotValidInputException("userObject");
45 }
46
47 this.userObject = userObject;
48 }
49 }