1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.synchronoss.cpo;
22
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25 import org.synchronoss.cpo.meta.domain.CpoAttribute;
26
27
28
29
30
31 public abstract class AbstractCpoData implements CpoData{
32
33 private static final Logger logger = LoggerFactory.getLogger(AbstractCpoData.class);
34 private CpoAttribute cpoAttribute = null;
35
36 public AbstractCpoData(CpoAttribute cpoAttribute) {
37 this.cpoAttribute = cpoAttribute;
38 }
39
40 public CpoAttribute getCpoAttribute() {
41 return cpoAttribute;
42 }
43
44 public void setCpoAttribute(CpoAttribute cpoAttribute) {
45 this.cpoAttribute = cpoAttribute;
46 }
47
48 @Override
49 public Object transformIn(Object datasourceObject) throws CpoException {
50 Object retObj = datasourceObject;
51
52 if (cpoAttribute.getCpoTransform() != null) {
53 retObj = cpoAttribute.getCpoTransform().transformIn(datasourceObject);
54 }
55 return retObj;
56 }
57
58 @Override
59 public Object transformOut(Object attributeObject) throws CpoException {
60 Object retObj = attributeObject;
61
62 if (cpoAttribute.getCpoTransform() != null) {
63 retObj = cpoAttribute.getCpoTransform().transformOut(attributeObject);
64 }
65 return retObj;
66 }
67
68 @Override
69 public Object invokeGetter() throws CpoException {
70 throw new UnsupportedOperationException("Not supported yet.");
71 }
72
73 @Override
74 public void invokeSetter(Object instanceObject) throws CpoException {
75 throw new UnsupportedOperationException("Not supported yet.");
76 }
77
78 public Class getDataGetterReturnType() {
79 Class returnClass = cpoAttribute.getSetterParamType();
80 if (cpoAttribute.getCpoTransform()!=null){
81 returnClass=cpoAttribute.getTransformInMethod().getParameterTypes()[0];
82 }
83 return returnClass;
84 }
85
86 public Class getDataSetterParamType() {
87 Class returnClass = cpoAttribute.getGetterReturnType();
88 if (cpoAttribute.getCpoTransform()!=null){
89 returnClass=cpoAttribute.getTransformOutMethod().getReturnType();
90 }
91 return returnClass;
92 }
93
94 }