001 /**
002 * Copyright 2005-2012 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.krad.service.impl;
017
018 import java.util.List;
019 import java.util.Map;
020
021 import org.kuali.rice.krad.bo.ExternalizableBusinessObject;
022 import org.kuali.rice.krad.util.ExternalizableBusinessObjectUtils;
023
024 /**
025 * Module service implementation for the Rice KRAD module
026 *
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 */
029 public class KRADModuleService extends ModuleServiceBase {
030 protected List<String> businessObjects;
031
032 @Override
033 public boolean isResponsibleFor(Class businessObjectClass) {
034 if (businessObjects != null) {
035 if (businessObjects.contains(businessObjectClass.getName())) {
036 return true;
037 }
038 }
039
040 if (ExternalizableBusinessObject.class.isAssignableFrom(businessObjectClass)) {
041 Class externalizableBusinessObjectInterface =
042 ExternalizableBusinessObjectUtils.determineExternalizableBusinessObjectSubInterface(
043 businessObjectClass);
044 if (externalizableBusinessObjectInterface != null) {
045 Map<Class, Class> validEBOs = getModuleConfiguration().getExternalizableBusinessObjectImplementations();
046 if (validEBOs != null) {
047 if (validEBOs.get(externalizableBusinessObjectInterface) != null) {
048 return true;
049 }
050 }
051 }
052 }
053
054 return false;
055 }
056
057 public List<String> getBusinessObjects() {
058 return this.businessObjects;
059 }
060
061 public void setBusinessObjects(List<String> businessObjects) {
062 this.businessObjects = businessObjects;
063 }
064 }