001: /*
002: * Copyright 2006-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.core.service.impl;
017:
018: import java.util.Collections;
019: import java.util.List;
020:
021: import org.kuali.RiceConstants;
022: import org.kuali.core.KualiModule;
023: import org.kuali.core.bo.user.KualiModuleUser;
024: import org.kuali.core.bo.user.UniversalUser;
025: import org.kuali.core.bo.user.UserId;
026: import org.kuali.core.dao.KualiModuleUserDao;
027: import org.kuali.core.exceptions.UserNotFoundException;
028: import org.kuali.core.service.KualiConfigurationService;
029: import org.kuali.core.service.KualiModuleUserService;
030: import org.kuali.core.service.UniversalUserService;
031:
032: public abstract class KualiModuleUserServiceBaseImpl<T extends KualiModuleUser>
033: implements KualiModuleUserService<T> {
034:
035: protected UniversalUserService universalUserService;
036: protected List<String> propertyList = Collections.EMPTY_LIST;
037: protected Class moduleUserClass;
038: protected KualiConfigurationService configService;
039: protected KualiModule module;
040: protected KualiModuleUserDao kualiModuleUserDao;
041:
042: public T getModuleUser(String moduleID,
043: String personUniversalIdentifier) {
044: try {
045: return (T) universalUserService.getUniversalUser(
046: personUniversalIdentifier).getModuleUser(moduleID);
047: } catch (UserNotFoundException ex) {
048: return null;
049: }
050: }
051:
052: public T getModuleUser(String moduleID, UserId userId)
053: throws UserNotFoundException {
054: try {
055: return (T) universalUserService.getUniversalUser(userId)
056: .getModuleUser(moduleID);
057: } catch (UserNotFoundException ex) {
058: return null;
059: }
060: }
061:
062: public T getModuleUser(String moduleID, UniversalUser universalUser) {
063: return (T) universalUser.getModuleUser(moduleID);
064: }
065:
066: public List<String> getPropertyList() {
067: return propertyList;
068: }
069:
070: public void setPropertyList(List<String> propertyList) {
071: this .propertyList = propertyList;
072: }
073:
074: public UniversalUserService getUniversalUserService() {
075: return universalUserService;
076: }
077:
078: public void setUniversalUserService(
079: UniversalUserService universalUserService) {
080: this .universalUserService = universalUserService;
081: }
082:
083: public Class getModuleUserClass() {
084: return moduleUserClass;
085: }
086:
087: public void setModuleUserClass(Class moduleUserClass) {
088: this .moduleUserClass = moduleUserClass;
089: }
090:
091: public KualiConfigurationService getConfigService() {
092: return configService;
093: }
094:
095: public void setConfigService(KualiConfigurationService configService) {
096: this .configService = configService;
097: }
098:
099: public KualiModule getModule() {
100: return module;
101: }
102:
103: public void setModule(KualiModule module) {
104: this .module = module;
105: }
106:
107: public KualiModuleUserDao getKualiModuleUserDao() {
108: return kualiModuleUserDao;
109: }
110:
111: public void setKualiModuleUserDao(
112: KualiModuleUserDao kualiModuleUserDao) {
113: this .kualiModuleUserDao = kualiModuleUserDao;
114: }
115:
116: public Object getUserActiveCriteria() {
117: return kualiModuleUserDao.getActiveUserQueryCriteria(module
118: .getModuleId());
119: }
120:
121: public Object getActiveFacultyStaffAffiliateCriteria() {
122: String[] allowedEmployeeStatusValues = getConfigService()
123: .getParameterValues(
124: RiceConstants.KNS_NAMESPACE,
125: RiceConstants.DetailTypes.UNIVERSAL_USER_DETAIL_TYPE,
126: RiceConstants.ALLOWED_EMPLOYEE_STATUS_RULE)
127: .toArray(new String[] {});
128: return kualiModuleUserDao
129: .getActiveFacultyStaffAffiliateCriteria(allowedEmployeeStatusValues);
130: }
131: }
|