@@ -0,0 +1,3655 @@
+/*%0A * The Gemma project.%0A * %0A * Copyright (c) 2005 Columbia University%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *       http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A *%0A */%0Apackage edu.columbia.gemma.expression.experiment;%0A%0Aimport org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0Aimport org.hibernate.Criteria;%0Aimport org.hibernate.criterion.Restrictions;%0A%0A/**%0A * %3Chr%3E%0A * %3Cp%3E%0A * Copyright (c) 2004-2005 Columbia University%0A * %0A * @author pavlidis%0A * @version $Id$%0A * @see edu.columbia.gemma.expression.experiment.ExpressionExperiment%0A */%0Apublic class ExpressionExperimentDaoImpl extends edu.columbia.gemma.expression.experiment.ExpressionExperimentDaoBase %7B%0A%0A    private static Log log = LogFactory.getLog( ExpressionExperimentDaoImpl.class.getName() );%0A%0A    /*%0A     * (non-Javadoc)%0A     * %0A     * @see edu.columbia.gemma.expression.experiment.ExpressionExperimentDaoBase#find(edu.columbia.gemma.expression.experiment.ExpressionExperiment)%0A     */%0A    @Override%0A    public ExpressionExperiment find( ExpressionExperiment expressionExperiment ) %7B%0A        try %7B%0A            Criteria queryObject = super.getSession( false ).createCriteria( ExpressionExperiment.class );%0A%0A            if ( expressionExperiment.getAccession() != null ) %7B%0A                queryObject.add( Restrictions.eq( %22accession%22, expressionExperiment.getAccession() ) );%0A            %7D else %7B%0A                queryObject.add( Restrictions.eq( %22name%22, expressionExperiment.getName() ) );%0A            %7D%0A%0A            java.util.List results = queryObject.list();%0A            Object result = null;%0A            if ( results != null ) %7B%0A                if ( results.size() %3E 1 ) %7B%0A                    throw new org.springframework.dao.InvalidDataAccessResourceUsageException(%0A                            %22More than one instance of '%22 + ExpressionExperiment.class.getName()%0A                                    + %22' was found when executing query%22 );%0A%0A                %7D else if ( results.size() == 1 ) %7B%0A                    result = ( ExpressionExperiment ) results.iterator().next();%0A                %7D%0A            %7D%0A            return ( ExpressionExperiment ) result;%0A        %7D catch ( org.hibernate.HibernateException ex ) %7B%0A            throw super.convertHibernateAccessException( ex );%0A        %7D%0A    %7D%0A%0A    /*%0A     * (non-Javadoc)%0A     * %0A     * @see edu.columbia.gemma.expression.experiment.ExpressionExperimentDaoBase#findOrCreate(edu.columbia.gemma.expression.experiment.ExpressionExperiment)%0A     */%0A    @Override%0A    public ExpressionExperiment findOrCreate( ExpressionExperiment expressionExperiment ) %7B%0A        if ( expressionExperiment.getName() == null && expressionExperiment.getAccession() == null ) %7B%0A            log.debug( %22ExpressionExperiment must have name or external accession.%22 );%0A            return null;%0A        %7D%0A        ExpressionExperiment newExpressionExperiment = this.find( expressionExperiment );%0A        if ( newExpressionExperiment != null ) %7B%0A            return newExpressionExperiment;%0A        %7D%0A        log.debug( %22Creating new expressionExperiment: %22 + expressionExperiment.getName() );%0A        return ( ExpressionExperiment ) create( expressionExperiment );%0A    %7D%0A%7D

implement find, findOrCreate