001    /*
002     * Copyright 2007-2009 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.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/ecl2.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.rice.kns.service.impl;
017    
018    import java.util.List;
019    import java.util.Map;
020    
021    import org.kuali.rice.kns.bo.ExternalizableBusinessObject;
022    import org.kuali.rice.kns.util.ExternalizableBusinessObjectUtils;
023    
024    /**
025     * This is a description of what this class does - jjhanso don't forget to fill this in.
026     *
027     * @author Kuali Rice Team (rice.collab@kuali.org)
028     *
029     */
030    public class KNSModuleService extends ModuleServiceBase {
031    
032        protected List<String> businessObjects;
033    
034        @Override
035        public boolean isResponsibleFor(Class businessObjectClass) {
036            if (businessObjects != null) {
037                if (businessObjects.contains(businessObjectClass.getName())) {
038                    return true;
039                }
040            }
041            if (ExternalizableBusinessObject.class.isAssignableFrom(businessObjectClass)) {
042                Class externalizableBusinessObjectInterface = ExternalizableBusinessObjectUtils.determineExternalizableBusinessObjectSubInterface(businessObjectClass);
043                if (externalizableBusinessObjectInterface != null) {
044                    Map<Class, Class> validEBOs = getModuleConfiguration().getExternalizableBusinessObjectImplementations();
045                    if (validEBOs != null) {
046                        if (validEBOs.get(externalizableBusinessObjectInterface) != null) {
047                            return true;
048                        }
049                    }
050                }
051            }
052            return false;
053        }
054    
055        public List<String> getBusinessObjects() {
056            return this.businessObjects;
057        }
058    
059        public void setBusinessObjects(List<String> businessObjects) {
060            this.businessObjects = businessObjects;
061        }
062    }