View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krms.impl.repository;
17  
18  
19  import org.kuali.rice.krms.api.repository.context.ContextDefinition;
20  import org.springframework.cache.annotation.CacheEvict;
21  import org.springframework.cache.annotation.Cacheable;
22  
23  /**
24   * This is the interface for accessing KRMS repository Context related bos 
25   * 
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   *
28   */
29  public interface ContextBoService {
30  
31      /**
32       * This will create a {@link ContextDefinition} exactly like the parameter passed in.
33       *
34       * @param context  The Context to create
35       * @throws IllegalArgumentException if the context is null
36       * @throws IllegalStateException if the context already exists in the system
37       */
38      @CacheEvict(value={ContextDefinition.Cache.NAME}, allEntries = true)
39  	public ContextDefinition createContext(ContextDefinition context);
40  
41      /**
42       * This will update an existing {@link ContextDefinition}.
43       *
44       * @param context  The Context to update
45       * @throws IllegalArgumentException if the Context is null
46       * @throws IllegalStateException if the Context does not exists in the system
47       */
48      @CacheEvict(value={ContextDefinition.Cache.NAME}, allEntries = true)
49  	public void updateContext(ContextDefinition context);
50  	
51  //	public void createContextAttribute(ContextAttribute contextAttribute);
52  //	public void updateContextAttribute(ContextAttribute contextAttribute);
53  	
54      /**
55       * Retrieves an Context from the repository based on the given context id.
56       *
57       * @param contextId the id of the Context to retrieve
58       * @return an {@link ContextDefinition} identified by the given contextId.  
59       * A null reference is returned if an invalid or non-existent id is supplied.
60       * @throws IllegalArgumentException if the contextId is null or blank.
61       */
62      @Cacheable(value= ContextDefinition.Cache.NAME, key="'actionId=' + #p0")
63  	public ContextDefinition getContextByContextId( String contextId );
64  	
65      /**
66       * Retrieves an Context from the repository based on the provided context name
67       * and namespace.
68       *
69       * @param name the name of the Context to retrieve.
70       * @param namespace the namespace that the context is under.
71       * @return an {@link ContextDefinition} identified by the given name and namespace.  
72       * A null reference is returned if an invalid or non-existent name and
73       * namespace combination is supplied.
74       * @throws IllegalArgumentException if the either the name or the namespace
75       * is null or blank.
76       */
77      @Cacheable(value= ContextDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'namespace=' + #p1")
78  	public ContextDefinition getContextByNameAndNamespace( String name, String namespace );
79  
80  	/**
81  	* Converts a mutable bo to it's immutable counterpart
82  	* @param bo the mutable business object
83  	* @return the immutable object
84  	*/
85  //	public ContextDefinition to( ContextBo bo);
86  
87     /**
88  	* Converts a immutable object to it's mutable bo counterpart
89  	* @param im immutable object
90  	* @return the mutable bo
91  	*/
92  //	public ContextBo from( ContextDefinition im );
93  }