View Javadoc
1   /**
2    * Copyright 2005-2014 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.coreservice.impl.component;
17  
18  import org.eclipse.persistence.exceptions.OptimisticLockException;
19  import org.kuali.rice.core.framework.persistence.ojb.DataAccessUtils;
20  import org.kuali.rice.krad.data.DataObjectService;
21  import org.springframework.beans.factory.annotation.Required;
22  
23  
24  /**
25   * JDBC-based implementation of the {@code ComponentSetDao}.
26   *
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class ComponentSetDaoJpa implements ComponentSetDao {
30      private DataObjectService dataObjectService;
31  
32      @Override
33      public boolean saveIgnoreLockingFailure(ComponentSetBo componentSetBo) {
34          try{
35              getDataObjectService().save(componentSetBo);
36          } catch (RuntimeException e) {
37              if (e.getClass().isAssignableFrom(OptimisticLockException.class)) {
38                  return false;
39              }
40              throw e;
41          }
42          return true;
43      }
44      public DataObjectService getDataObjectService() {
45          return dataObjectService;
46      }
47  
48      @Required
49      public void setDataObjectService(DataObjectService dataObjectService) {
50          this.dataObjectService = dataObjectService;
51      }
52  
53  
54  }