001/**
002 * Copyright 2005-2018 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.dao.impl;
017
018import org.apache.ojb.broker.Identity;
019import org.apache.ojb.broker.core.IdentityFactoryImpl;
020import org.apache.ojb.broker.core.proxy.IndirectionHandlerCGLIBImpl;
021import org.apache.ojb.broker.core.proxy.ProxyHelper;
022import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
023import org.kuali.rice.krad.dao.PersistenceDao;
024import org.kuali.rice.krad.util.LegacyDataFramework;
025
026@Deprecated
027@LegacyDataFramework
028public class PersistenceDaoOjb extends PlatformAwareDaoBaseOjb implements PersistenceDao {
029
030    /**
031     * @see org.kuali.rice.krad.dao.PersistenceDao#clearCache()
032     */
033    @Override
034        public void clearCache() {
035        getPersistenceBroker(true).clearCache();
036    }
037
038    /**
039     * @see org.kuali.rice.krad.dao.PersistenceDao#resolveProxy(java.lang.Object)
040     */
041    @Override
042        public Object resolveProxy(Object o) {
043        Identity ident = new IdentityFactoryImpl(getPersistenceBroker(true)).buildIdentity(o);
044        IndirectionHandlerCGLIBImpl ih = new IndirectionHandlerCGLIBImpl(getPersistenceBroker(true).getPBKey(), ident);
045        return ih.getRealSubject();
046    }
047
048    /**
049     * @see org.kuali.rice.krad.dao.PersistenceDao#retrieveAllReferences(java.lang.Object)
050     */
051    @Override
052        public void retrieveAllReferences(Object o) {
053        getPersistenceBroker(true).retrieveAllReferences(o);
054    }
055
056    /**
057     * @see org.kuali.rice.krad.dao.PersistenceDao#retrieveReference(java.lang.Object, java.lang.String)
058     */
059    @Override
060        public void retrieveReference(Object o, String referenceName) {
061        getPersistenceBroker(true).retrieveReference(o, referenceName);
062    }
063
064        /**
065         * Asks ProxyHelper if the object is proxied
066         *
067         * @see org.kuali.rice.krad.dao.PersistenceDao#isProxied(java.lang.Object)
068         */
069        @Override
070        public boolean isProxied(Object object) {
071                return ProxyHelper.isProxy(object);
072        }
073
074}