001/** 002 * Copyright 2005-2016 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 */ 016package org.kuali.rice.krms.impl.repository; 017 018 019import org.kuali.rice.krms.api.repository.context.ContextDefinition; 020import org.springframework.cache.annotation.CacheEvict; 021import org.springframework.cache.annotation.Cacheable; 022 023/** 024 * This is the interface for accessing KRMS repository Context related bos 025 * 026 * @author Kuali Rice Team (rice.collab@kuali.org) 027 * 028 */ 029public interface ContextBoService { 030 031 /** 032 * This will create a {@link ContextDefinition} exactly like the parameter passed in. 033 * 034 * @param context The Context to create 035 * @throws IllegalArgumentException if the context is null 036 * @throws IllegalStateException if the context already exists in the system 037 */ 038 @CacheEvict(value={ContextDefinition.Cache.NAME}, allEntries = true) 039 public ContextDefinition createContext(ContextDefinition context); 040 041 /** 042 * This will update an existing {@link ContextDefinition}. 043 * 044 * @param context The Context to update 045 * @throws IllegalArgumentException if the Context is null 046 * @throws IllegalStateException if the Context does not exists in the system 047 */ 048 @CacheEvict(value={ContextDefinition.Cache.NAME}, allEntries = true) 049 public void updateContext(ContextDefinition context); 050 051// public void createContextAttribute(ContextAttribute contextAttribute); 052// public void updateContextAttribute(ContextAttribute contextAttribute); 053 054 /** 055 * Retrieves an Context from the repository based on the given context id. 056 * 057 * @param contextId the id of the Context to retrieve 058 * @return an {@link ContextDefinition} identified by the given contextId. 059 * A null reference is returned if an invalid or non-existent id is supplied. 060 * @throws IllegalArgumentException if the contextId is null or blank. 061 */ 062 @Cacheable(value= ContextDefinition.Cache.NAME, key="'actionId=' + #p0") 063 public ContextDefinition getContextByContextId( String contextId ); 064 065 /** 066 * Retrieves an Context from the repository based on the provided context name 067 * and namespace. 068 * 069 * @param name the name of the Context to retrieve. 070 * @param namespace the namespace that the context is under. 071 * @return an {@link ContextDefinition} identified by the given name and namespace. 072 * A null reference is returned if an invalid or non-existent name and 073 * namespace combination is supplied. 074 * @throws IllegalArgumentException if the either the name or the namespace 075 * is null or blank. 076 */ 077 @Cacheable(value= ContextDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'namespace=' + #p1") 078 public ContextDefinition getContextByNameAndNamespace( String name, String namespace ); 079 080 /** 081 * Converts a mutable bo to it's immutable counterpart 082 * @param bo the mutable business object 083 * @return the immutable object 084 */ 085// public ContextDefinition to( ContextBo bo); 086 087 /** 088 * Converts a immutable object to it's mutable bo counterpart 089 * @param im immutable object 090 * @return the mutable bo 091 */ 092// public ContextBo from( ContextDefinition im ); 093}