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