001 /* 002 * Copyright 2010 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.osedu.org/licenses/ECL-2.0 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.student.contract.model.impl; 017 018 import java.util.List; 019 020 import org.kuali.student.contract.model.MessageStructure; 021 import org.kuali.student.contract.model.Service; 022 import org.kuali.student.contract.model.ServiceContractModel; 023 import org.kuali.student.contract.model.ServiceMethod; 024 import org.kuali.student.contract.model.XmlType; 025 026 /** 027 * This reads the supplied spreadsheet but then caches it so it doesn't have to 028 * re-read it again. 029 * @author nwright 030 */ 031 public class ServiceContractModelCache implements ServiceContractModel { 032 033 private ServiceContractModel model; 034 035 public ServiceContractModelCache(ServiceContractModel model) { 036 this.model = model; 037 } 038 private List<ServiceMethod> serviceMethods = null; 039 040 @Override 041 public List<ServiceMethod> getServiceMethods() { 042 if (serviceMethods == null) { 043 serviceMethods = model.getServiceMethods(); 044 } 045 return serviceMethods; 046 } 047 private List<XmlType> xmlTypes; 048 049 @Override 050 public List<XmlType> getXmlTypes() { 051 if (xmlTypes == null) { 052 xmlTypes = model.getXmlTypes(); 053 } 054 return xmlTypes; 055 } 056 private List<MessageStructure> messageStructures = null; 057 058 @Override 059 public List<MessageStructure> getMessageStructures() { 060 if (messageStructures == null) { 061 messageStructures = model.getMessageStructures(); 062 } 063 return messageStructures; 064 } 065 private List<Service> services = null; 066 067 @Override 068 public List<Service> getServices() { 069 if (services == null) { 070 services = model.getServices(); 071 } 072 return services; 073 } 074 075 @Override 076 public List<String> getSourceNames() { 077 return model.getSourceNames(); 078 } 079 }