1 /**
2 * Copyright 2005-2015 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.krad.dao.impl;
17
18 import org.apache.ojb.broker.Identity;
19 import org.apache.ojb.broker.core.IdentityFactoryImpl;
20 import org.apache.ojb.broker.core.proxy.IndirectionHandlerCGLIBImpl;
21 import org.apache.ojb.broker.core.proxy.ProxyHelper;
22 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
23 import org.kuali.rice.krad.dao.PersistenceDao;
24
25 public class PersistenceDaoOjb extends PlatformAwareDaoBaseOjb implements PersistenceDao {
26
27 /**
28 * @see org.kuali.rice.krad.dao.PersistenceDao#clearCache()
29 */
30 public void clearCache() {
31 getPersistenceBroker(true).clearCache();
32 }
33
34 /**
35 * @see org.kuali.rice.krad.dao.PersistenceDao#resolveProxy(java.lang.Object)
36 */
37 public Object resolveProxy(Object o) {
38 Identity ident = new IdentityFactoryImpl(getPersistenceBroker(true)).buildIdentity(o);
39 IndirectionHandlerCGLIBImpl ih = new IndirectionHandlerCGLIBImpl(getPersistenceBroker(true).getPBKey(), ident);
40 return ih.getRealSubject();
41 }
42
43 /**
44 * @see org.kuali.rice.krad.dao.PersistenceDao#retrieveAllReferences(java.lang.Object)
45 */
46 public void retrieveAllReferences(Object o) {
47 getPersistenceBroker(true).retrieveAllReferences(o);
48 }
49
50 /**
51 * @see org.kuali.rice.krad.dao.PersistenceDao#retrieveReference(java.lang.Object, java.lang.String)
52 */
53 public void retrieveReference(Object o, String referenceName) {
54 getPersistenceBroker(true).retrieveReference(o, referenceName);
55 }
56
57 /**
58 * Asks ProxyHelper if the object is proxied
59 *
60 * @see org.kuali.rice.krad.dao.PersistenceDao#isProxied(java.lang.Object)
61 */
62 public boolean isProxied(Object object) {
63 return ProxyHelper.isProxy(object);
64 }
65
66 }