01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.purap.fixtures;
17:
18: import org.kuali.core.bo.user.UniversalUser;
19: import org.kuali.module.chart.bo.ChartUser;
20: import org.kuali.module.purap.bo.PurapUser;
21:
22: public enum UniversalUsersFixture {
23: NON_KFS_NON_PA("6666666666", null, null), NON_KFS_PA("7777777777",
24: null, getMathPurapUser()), KFS_NO_CHART_ORG_NO_PA_CHART_ORG(
25: "8888888888", getActiveChartUser(), null), KFS_CHART_ORG_NO_PA_CHART_ORG(
26: "9999999999", getActiveSociologyChartUser(), null), KFS_NO_CHART_ORG_PA_CHART_ORG(
27: "5555555555", getActiveChartUser(), getMathPurapUser()), KFS_CHART_ORG_PA_CHART_ORG(
28: "5555555555", getActiveSociologyChartUser(),
29: getMathPurapUser()), ;
30:
31: private String fakeId;
32: private ChartUser chartUser;
33: private PurapUser purapUser;
34:
35: private UniversalUsersFixture(String fakeId, ChartUser chartUser,
36: PurapUser purapUser) {
37: this .fakeId = fakeId;
38: this .chartUser = chartUser;
39: this .purapUser = purapUser;
40: }
41:
42: private static ChartUser getActiveChartUser() {
43: ChartUser chartUser = new ChartUser();
44: chartUser.setActive(true);
45: return chartUser;
46: }
47:
48: private static ChartUser getActiveSociologyChartUser() {
49: ChartUser chartUser = getActiveChartUser();
50: chartUser.setUserChartOfAccountsCode("IN");
51: chartUser.setUserOrganizationCode("SOC");
52: return chartUser;
53: }
54:
55: private static PurapUser getMathPurapUser() {
56: PurapUser purapUser = new PurapUser();
57: purapUser.setUserChartOfAccountsCode("EA");
58: purapUser.setUserOrganizationCode("MATH");
59: return purapUser;
60: }
61:
62: public UniversalUser createUser() {
63: UniversalUser user = new UniversalUser();
64: user.setPersonUniversalIdentifier(fakeId);
65: user.setPersonUserIdentifier(fakeId.substring(0, 7));
66: user.setPersonPayrollIdentifier(fakeId);
67: user.setPersonTaxIdentifier(fakeId.substring(0, 8));
68: user.setPersonTaxIdentifierTypeCode("S");
69: user.setPersonFirstName("unit");
70: user.setPersonLastName("test");
71: user.setPrimaryDepartmentCode("BL-PSY");
72: user.setEmployeeStatusCode("A");
73: user.setEmployeeTypeCode("P");
74: if (chartUser != null) {
75: user.getModuleUsers().put(ChartUser.MODULE_ID, chartUser);
76: } else {
77: user.getModuleUsers().put(ChartUser.MODULE_ID,
78: new ChartUser());
79: }
80: if (purapUser != null) {
81: user.getModuleUsers().put(PurapUser.MODULE_ID, purapUser);
82: } else {
83: user.getModuleUsers().put(PurapUser.MODULE_ID,
84: new PurapUser());
85: }
86: return user;
87: }
88: }
|