View Javadoc

1   /**
2    * Copyright 2004-2012 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.hr.time.roles.dao;
17  
18  import java.util.List;
19  
20  import org.apache.ojb.broker.query.Criteria;
21  import org.apache.ojb.broker.query.QueryFactory;
22  import org.kuali.hr.time.roles.TkRoleGroup;
23  import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
24  
25  public class TkRoleGroupDaoSpringOjbImpl extends PlatformAwareDaoBaseOjb implements TkRoleGroupDao {
26   
27  	@Override
28  	public void saveOrUpdateRoleGroup(TkRoleGroup roleGroup) {
29  		this.getPersistenceBrokerTemplate().store(roleGroup);
30  	}
31  
32  	@Override
33  	public void saveOrUpdateRoleGroups(List<TkRoleGroup> roleGroups) {
34  		if (roleGroups != null) {
35  			for (TkRoleGroup role : roleGroups) {
36  				saveOrUpdateRoleGroup(role);
37  			}
38  		}
39  	}
40  
41  	@Override
42  	public TkRoleGroup getRoleGroup(String principalId) {
43  		Criteria currentRecordCriteria = new Criteria();
44  		currentRecordCriteria.addEqualTo("principalId", principalId);
45  
46  		return (TkRoleGroup) this.getPersistenceBrokerTemplate().getObjectByQuery(QueryFactory.newQuery(TkRoleGroup.class, currentRecordCriteria));
47  	}
48   
49  
50  }