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
018import java.util.List;
019
020
021import org.kuali.rice.krms.api.repository.proposition.PropositionDefinition;
022import org.kuali.rice.krms.api.repository.proposition.PropositionParameter;
023import org.kuali.rice.krms.api.repository.rule.RuleDefinition;
024import org.springframework.cache.annotation.CacheEvict;
025import org.springframework.cache.annotation.Cacheable;
026
027/**
028 * This is the interface for accessing KRMS repository Proposition related
029 * business objects.
030 *
031 * @author Kuali Rice Team (rice.collab@kuali.org)
032 *
033 */
034public interface PropositionBoService {
035
036    /**
037     * This will create a {@link PropositionDefinition} exactly like the parameter passed in.
038     *
039     * @param prop the proposition to create
040     * @throws IllegalArgumentException if the proposition is null
041     * @throws IllegalStateException if the proposition already exists in the system
042     */
043    @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
044    PropositionDefinition createProposition(PropositionDefinition prop);
045
046    /**
047     * This will update an existing {@link PropositionDefinition}.
048     *
049     * @param prop the proposition to update
050     * @throws IllegalArgumentException if the proposition is null
051     * @throws IllegalStateException if the proposition does not exist in the system
052     */
053    @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
054    void updateProposition(PropositionDefinition prop);
055
056    /**
057     * Lookup the proposition based on the given proposition id.
058     *
059     * @param propId the given proposition id
060     * @return a proposition associated with the given proposition id.  A null reference is returned if an invalid or
061     *         non-existent id is supplied.
062     */
063    @Cacheable(value= PropositionDefinition.Cache.NAME, key="'propId=' + #p0")
064    PropositionDefinition getPropositionById(String propId);
065
066
067
068    /**
069     * This will create a {@link PropositionParameter} exactly like the parameter passed in.
070     *
071     * @param parameter the proposition parameter to create
072     * @throws IllegalArgumentException if the proposition parameter is null
073     * @throws IllegalStateException if the proposition parameter is already existing in the system
074     */
075    @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
076    void createParameter(PropositionParameter parameter);
077
078    /**
079     * This will update a {@link PropositionParameter}.
080     *
081     *
082     * @param parameter the proposition parameter to update
083     * @throws IllegalArgumentException if the proposition parameter is null
084     * @throws IllegalStateException if the proposition parameter does not exist in the system
085     */
086    @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
087    void updateParameter(PropositionParameter parameter);
088
089    /**
090     * Lookup the proposition parameters based on the given proposition id.
091     *
092     * @param propId the given proposition id
093     * @return a list of PropositionParameters associated with the given proposition id.  A null reference is returned if an invalid or
094     *         non-existant id is supplied.
095     */
096    List<PropositionParameter> getParameters(String propId);
097
098    /**
099     * Lookup the proposition parameter based on the id.
100     *
101     * @param id the given proposition id
102     * @return an immutable PropositionParameters associated with the given id.  A null reference is returned if an invalid or
103     *         non-existant id is supplied.
104     */
105    PropositionParameter getParameterById(String id);
106
107    /**
108     * Lookup the proposition parameter based on the proposition id and sequence number.
109     *
110     * @param id the given proposition id
111     * @return an immutable PropositionParameters associated with the given proposition id and sequence number.  A null reference is returned if an invalid or
112     *         non-existant.
113     */
114    PropositionParameter getParameterByPropIdAndSequenceNumber(String propId, Integer sequenceNumber);
115
116
117}