View Javadoc

1   /**
2    * Copyright 2004-2013 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.kpme.core.service.module;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  import org.apache.commons.collections.CollectionUtils;
22  import org.kuali.kpme.core.accrualcategory.AccrualCategory;
23  import org.kuali.kpme.core.bo.HrBusinessObject;
24  import org.kuali.kpme.core.cache.CacheUtils;
25  import org.kuali.kpme.core.calendar.Calendar;
26  import org.kuali.kpme.core.department.Department;
27  import org.kuali.kpme.core.earncode.EarnCode;
28  import org.kuali.kpme.core.earncode.group.EarnCodeGroup;
29  import org.kuali.kpme.core.institution.Institution;
30  import org.kuali.kpme.core.job.Job;
31  import org.kuali.kpme.core.leaveplan.LeavePlan;
32  import org.kuali.kpme.core.location.Location;
33  import org.kuali.kpme.core.paygrade.PayGrade;
34  import org.kuali.kpme.core.paytype.PayType;
35  import org.kuali.kpme.core.position.PositionBase;
36  import org.kuali.kpme.core.principal.PrincipalHRAttributes;
37  import org.kuali.kpme.core.salarygroup.SalaryGroup;
38  import org.kuali.kpme.core.task.Task;
39  import org.kuali.kpme.core.util.HrConstants;
40  import org.kuali.kpme.core.workarea.WorkArea;
41  import org.kuali.rice.krad.service.impl.ModuleServiceBase;
42  
43  
44  public class KpmeModuleService extends ModuleServiceBase {
45  
46      @Override
47      public List<List<String>> listAlternatePrimaryKeyFieldNames(Class businessObjectInterfaceClass) {
48          List<List<String>> retList = new ArrayList<List<String>>();
49          List<String> keyList = new ArrayList<String>();
50          try {
51              keyList.addAll((java.util.List<String>) businessObjectInterfaceClass.getDeclaredField("EQUAL_TO_FIELDS").get(businessObjectInterfaceClass));
52          } catch (NoSuchFieldException e) {
53              LOG.warn(businessObjectInterfaceClass.getClass().getName() + " does not contain a EQUAL_TO_FIELDS list");
54          } catch (IllegalAccessException e) {
55              LOG.warn(businessObjectInterfaceClass.getClass().getName() + " does not contain a EQUAL_TO_FIELDS list");
56          }
57  
58          if (HrBusinessObject.class.isAssignableFrom(businessObjectInterfaceClass)) {
59              keyList.add(HrConstants.EFFECTIVE_DATE_FIELD);
60          }
61          if (CollectionUtils.isNotEmpty(keyList)) {
62              retList.add(keyList);
63              return retList;
64          }
65          return super.listAlternatePrimaryKeyFieldNames(businessObjectInterfaceClass);
66      }
67  }